76 bool Distinct =
false;
80 if (
string.IsNullOrEmpty(s))
83 while (s ==
"TOP" || s ==
"DISTINCT" || s ==
"GENERIC")
89 Top = Parser.ParseNoWhiteSpace();
104 if (
string.IsNullOrEmpty(s))
114 if (Top is
null && !Generic)
132 if (!(Top is
null) || Generic)
154 if (s ==
"/" || s ==
"." || s ==
"@")
155 Node = ParseXPath(Parser,
true);
158 Node = Parser.ParseNoWhiteSpace();
161 XPath.ExtractValue =
true;
168 if (!
string.IsNullOrEmpty(s) && s !=
"," && s !=
"FROM")
173 Name = Parser.ParseNoWhiteSpace();
182 ColumnNames.
Add(Name);
207 if (s ==
"/" || s ==
"." || s ==
"@")
208 Where = ParseXPath(Parser,
false);
222 if (
string.Compare(Parser.
NextToken(),
"BY",
true) != 0)
236 if (!
string.IsNullOrEmpty(s) && s !=
"," && s !=
";" && s !=
")" && s !=
"]" && s !=
"}" && s !=
"HAVING" && s !=
"ORDER" && s !=
"OFFSET")
241 Name = Parser.ParseNoWhiteSpace();
256 GroupByNames.
Add(Name);
271 else if (!(Columns is
null))
273 bool ImplicitGrouping =
false;
277 if (this.ContainsVectorFunction(Column))
279 ImplicitGrouping =
true;
284 if (ImplicitGrouping)
296 if (
string.Compare(Parser.
NextToken(),
"BY",
true) != 0)
309 OrderBy.
Add(
new KeyValuePair<ScriptNode, bool>(Node,
true));
312 else if (s ==
"DESC")
315 OrderBy.
Add(
new KeyValuePair<ScriptNode, bool>(Node,
false));
319 OrderBy.
Add(
new KeyValuePair<ScriptNode, bool>(Node,
true));
333 Offset = Parser.ParseNoWhiteSpace();
336 Result =
new Select(Columns?.ToArray(), ColumnNames?.ToArray(), Source, Where,
337 GroupBy?.ToArray(), GroupByNames?.ToArray(), Having, OrderBy?.ToArray(),
347 StringBuilder sb =
new StringBuilder();
351 while ((ch = Parser.
PeekNextChar()) > 32 && ch != 160 && ch !=
',' && ch !=
';')
359 if (!TryParseSource(Parser, out Source))
382 if (
string.Compare(Parser.
NextToken(),
"JOIN",
true) != 0)
386 if (!TryParseSource(Parser, out Source2))
389 ScriptNode Conditions = ParseJoinConditions(Parser);
402 if (
string.Compare(Parser.
NextToken(),
"JOIN",
true) != 0)
410 if (!TryParseSource(Parser, out Source2))
413 Conditions = ParseJoinConditions(Parser);
426 if (
string.Compare(Parser.
NextToken(),
"JOIN",
true) != 0)
434 if (!TryParseSource(Parser, out Source2))
437 Conditions = ParseJoinConditions(Parser);
450 if (
string.Compare(Parser.
NextToken(),
"JOIN",
true) != 0)
458 if (!TryParseSource(Parser, out Source2))
461 Conditions = ParseJoinConditions(Parser);
468 if (
string.Compare(Parser.
NextToken(),
"JOIN",
true) != 0)
471 if (!TryParseSource(Parser, out Source2))
474 Conditions = ParseJoinConditions(Parser);
506 if (!
string.IsNullOrEmpty(s) &&
531 Name = Parser.ParseNoWhiteSpace();
541 internal static bool IsAlias(
string s)
543 foreach (
char ch
in s)
545 if (!
char.IsLetterOrDigit(ch) && ch !=
'_')
552 private bool ContainsVectorFunction(
ScriptNode Node)
554 if (!this.SearchForVectorFunction(Node, out
_,
null))
A chunked list is a linked list of chunks of objects of type T .
void Add(T Item)
Adds an item to the collection.
Represents a constant element value.
Base class for all funcions.
Base class for funcions of one vector variable.
Base class for all nodes in a parsed script tree.
bool ForAllChildNodes(ScriptNodeEventHandler Callback, object State, bool DepthFirst)
Calls the callback method for all child nodes.
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.
string PeekNextToken()
Returns the next token to be parsed, without moving the position forward. If at the end of the expres...
string NextToken()
Returns the next token to be parsed, and moves the position forward correspondingly....
int Length
Length of script parsed
ScriptNode ParseOrs()
Parses ORs.
int Start
Start position in expression
int Position
Current parsing position.
Expression Expression
Expression being parsed.
char PeekNextChar()
Returns the next character to be parsed, without moving the position forward one character....
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....
Represents a variable reference.
string Name
Name of method.
Node repesenting an XPath expression
Parses a SPARQL statement
bool TryParse(ScriptParser Parser, out ScriptNode Result)
Tries to parse a script node.
Parses a SELECT statement
string[] InternalKeywords
Any keywords used internally by the custom parser.
string[] Aliases
Keyword aliases, if available, null if none.
string KeyWord
Keyword associated with custom parser.
SelectParser()
Parses a SELECT statement
bool TryParse(ScriptParser Parser, out ScriptNode Result)
Tries to parse a script node.
Executes a SELECT statement against the object database.
Abstract base class for source definitions
CROSS JOIN of two source definitions.
FULL [OUTER] JOIN of two source definitions.
[INNER] JOIN of two source definitions.
LEFT [OUTER] JOIN of two source definitions.
RIGHT [OUTER] JOIN of two source definitions.
Direct reference to a data source.
Interface for keywords with custom parsing.
SearchMethod
Method to traverse the expression structure