2using System.Collections.Generic;
45 Result = this.ParseDocument(Parser);
46 return !(Result is
null);
51 List<XmlScriptProcessingInstruction> ProcessingInstructions =
null;
52 int Start = Parser.
Start;
61 while ((ch = Parser.
NextChar()) !=
'?' && ch != 0)
67 if (ProcessingInstructions is
null)
68 ProcessingInstructions =
new List<XmlScriptProcessingInstruction>();
100 List<XmlScriptAttribute> Attributes =
null;
105 string ElementName = ParseName(Parser);
145 if (ParseName(Parser) != ElementName)
146 throw Parser.
SyntaxError(
"Expected end of element " + ElementName);
176 throw Parser.
SyntaxError(
"Unterminated CDATA construct.");
185 throw Parser.
SyntaxError(
"Expected <!-- or <![CDATA[");
219 Element.Add(this.ParseElement(Parser));
233 else if (
char.IsLetter(ch) || ch ==
'_' || ch ==
':')
235 int AttributeStart = Parser.
Position;
236 string AttributeName = ParseName(Parser);
243 Parser.CanSkipWhitespace =
false;
245 Parser.CanSkipWhitespace = Bak;
249 ElementValue = Constant.Constant;
261 if (AttributeName ==
"xmlns")
265 if (Attributes is
null)
266 Attributes =
new List<XmlScriptAttribute>();
268 Attributes.Add(Attribute);
271 else if (
char.IsWhiteSpace(ch))
285 if (!(
char.IsLetter(ch) || ch ==
'_' || ch ==
':'))
292 if (
char.IsLetterOrDigit(ch) ||
char.IsDigit(ch) ||
293 ch ==
'.' || ch ==
'-' || ch ==
'_' || ch ==
':')
Base class for all types of elements.
string Script
Original script string.
Represents a constant element value.
Base class for all nodes in a parsed script tree.
int Length
Length of expression covered by node.
Expression Expression
Expression of which the node is a part.
int Start
Start position in script expression.
Script parser, for custom parsers.
SyntaxException SyntaxError(string Message)
Returns a Syntax Error Exception object.
ScriptNode ParsePowers()
Parses powers.
bool IsNextChars(string Token)
If the next characters to be parsed is a given token.
int Start
Start position in expression
int Position
Current parsing position.
Expression Expression
Expression being parsed.
void UndoChar()
Undoes a character in the parsing of an expression.
string PeekNextChars(int NrChars)
Returns the next given number of characters to be parsed, without moving the position forward one cha...
void SkipChars(int NrChars)
Skips a predefined number of characters.
char PeekNextChar()
Returns the next character to be parsed, without moving the position forward one character....
bool CanSkipWhitespace
If whitespace can be skipped (true), or if it has semantic meaning to the custom parser (false).
void SkipWhiteSpace()
If current position is whitespace, moves the current position forward to the first non-whitespace cha...
char NextChar()
Returns the next character to be parsed, and moves the position forward one character....
ScriptNode ParseSequence()
Parses a sequence of statements.
Abstract base class for XML Script attribute nodes.
XML Script attribute node, whose value is defined by script.
XML Script attribute node, whose value is defined by script.
Represents an script-based XML document.
Base class for all XML Script nodes in a parsed script tree.
static string EvaluateString(ScriptNode Node, Variables Variables)
Evaluates a script node to a string.
XML Script processing instruction node.
bool TryParse(ScriptParser Parser, out ScriptNode Result)
Tries to parse a script node.
string[] Aliases
Keyword aliases, if available, null if none.
string KeyWord
Keyword associated with custom parser.
string[] InternalKeywords
Any keywords used internally by the custom parser.
XmlParser()
Parses an XML document
Basic interface for all types of elements.
Interface for keywords with custom parsing.