Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
DeleteParser.cs
1using System;
3
5{
9 public class DeleteParser : IKeyWord
10 {
14 public DeleteParser()
15 {
16 }
17
21 public string KeyWord => "DELETE";
22
26 public string[] Aliases => null;
27
31 public string[] InternalKeywords => new string[]
32 {
33 "LAZY",
34 "FROM",
35 "WHERE"
36 };
37
44 public bool TryParse(ScriptParser Parser, out ScriptNode Result)
45 {
46 Result = null;
47
48 string s = Parser.NextToken().ToUpper();
49 bool Lazy = s == "LAZY";
50
51 if (Lazy)
52 s = Parser.NextToken().ToUpper();
53
54 if (s != "FROM")
55 return false;
56
57 if (!SelectParser.TryParseSources(Parser, out SourceDefinition Source))
58 return false;
59
60 ScriptNode Where = null;
61
62 s = Parser.PeekNextToken().ToUpper();
63 if (s == "WHERE")
64 {
65 Parser.NextToken();
66 Where = Parser.ParseOrs();
67 }
68
69 Result = new Delete(Source, Where, Lazy, Parser.Start, Parser.Length, Parser.Expression);
70
71 return true;
72 }
73
74 }
75}
Base class for all nodes in a parsed script tree.
Definition: ScriptNode.cs:69
Script parser, for custom parsers.
Definition: ScriptParser.cs:10
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
Definition: ScriptParser.cs:33
ScriptNode ParseOrs()
Parses ORs.
int Start
Start position in expression
Definition: ScriptParser.cs:28
Expression Expression
Expression being parsed.
Definition: ScriptParser.cs:43
Executes a DELETE statement against the object database.
Definition: Delete.cs:13
bool TryParse(ScriptParser Parser, out ScriptNode Result)
Tries to parse a script node.
Definition: DeleteParser.cs:44
string KeyWord
Keyword associated with custom parser.
Definition: DeleteParser.cs:21
string[] Aliases
Keyword aliases, if available, null if none.
Definition: DeleteParser.cs:26
string[] InternalKeywords
Any keywords used internally by the custom parser.
Definition: DeleteParser.cs:31
Abstract base class for source definitions
Interface for keywords with custom parsing.
Definition: IKeyWord.cs:9