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