|
string | Dialect [get] |
|
string | Dialect [get] |
| Gets the string identifying the SQL dialect used to parse More...
|
|
|
static void | BuildErrors (ParseTree tree, ICollection< SqlParseError > errors, LogMessageList logMessages) |
|
static string | FormInfoMessage (ParseTree tree, int line, int column) |
|
static IList< Irony.Parsing.Token > | FindTokensFrom (ParseTree tree, int line, int column) |
|
static IList< Irony.Parsing.Token > | FindTokensTo (ParseTree tree, int line, int column) |
|
Definition at line 28 of file SqlDefaultParser.cs.
Deveel.Data.Sql.Parser.SqlDefaultParser.SqlDefaultParser |
( |
SqlGrammarBase |
grammar | ) |
|
|
inline |
Definition at line 32 of file SqlDefaultParser.cs.
37 throw new InvalidOperationException();
LanguageData languageData
Irony.Parsing.Parser parser
static void Deveel.Data.Sql.Parser.SqlDefaultParser.BuildErrors |
( |
ParseTree |
tree, |
|
|
ICollection< SqlParseError > |
errors, |
|
|
LogMessageList |
logMessages |
|
) |
| |
|
inlinestaticprivate |
Definition at line 101 of file SqlDefaultParser.cs.
102 foreach (var logMessage
in logMessages) {
104 var line = logMessage.Location.Line;
105 var column = logMessage.Location.Column;
107 var expected = logMessage.ParserState.ReportedExpectedSet.ToArray();
108 var infoMessage =
String.Format(
"A parse error occurred near '{0}' in the source", locationMessage);
109 if (expected.Length > 0)
110 infoMessage =
String.Format(
"{0}. Expected {1}", infoMessage,
String.Join(
", ", expected));
112 errors.Add(
new SqlParseError(infoMessage, line, column));
A long string in the system.
static string FormInfoMessage(ParseTree tree, int line, int column)
ErrorLevel
In case of error messages, this enumerates the level of severity of the error.
void Deveel.Data.Sql.Parser.SqlDefaultParser.Dispose |
( |
bool |
disposing | ) |
|
|
inlineprivate |
void Deveel.Data.Sql.Parser.SqlDefaultParser.Dispose |
( |
| ) |
|
|
inline |
static IList<Irony.Parsing.Token> Deveel.Data.Sql.Parser.SqlDefaultParser.FindTokensFrom |
( |
ParseTree |
tree, |
|
|
int |
line, |
|
|
int |
column |
|
) |
| |
|
inlinestaticprivate |
Definition at line 144 of file SqlDefaultParser.cs.
145 var tokens = tree.Tokens;
146 bool startCollect =
false;
148 var result =
new List<
Irony.Parsing.Token>();
149 foreach (var token
in tokens) {
150 if (token.Location.Line == line &&
151 token.Location.Column == column) {
159 return result.ToList();
static IList<Irony.Parsing.Token> Deveel.Data.Sql.Parser.SqlDefaultParser.FindTokensTo |
( |
ParseTree |
tree, |
|
|
int |
line, |
|
|
int |
column |
|
) |
| |
|
inlinestaticprivate |
Definition at line 162 of file SqlDefaultParser.cs.
163 var tokens = tree.Tokens;
165 var result =
new List<
Irony.Parsing.Token>();
166 foreach (var token
in tokens) {
167 if (token.Location.Line == line &&
168 token.Location.Column == column)
174 return result.ToList();
static string Deveel.Data.Sql.Parser.SqlDefaultParser.FormInfoMessage |
( |
ParseTree |
tree, |
|
|
int |
line, |
|
|
int |
column |
|
) |
| |
|
inlinestaticprivate |
Definition at line 117 of file SqlDefaultParser.cs.
118 const int tokensBeforeCount = 10;
119 const int tokensAfterCount = 10;
121 var tokensBefore =
FindTokensTo(tree, line, column).Reverse().ToList();
124 var countTokensBefore =
System.Math.Min(tokensBefore.Count, tokensBeforeCount);
125 var countTokensAfter =
System.Math.Min(tokensAfterCount, tokensAfter.Count);
127 var takeTokensBefore = tokensBefore.Take(countTokensBefore).Reverse();
128 var takeTokensAfter = tokensAfter.Take(countTokensAfter);
130 var sb =
new StringBuilder();
131 foreach (var token
in takeTokensBefore) {
132 sb.Append(token.Text);
136 foreach (var token
in takeTokensAfter) {
137 sb.Append(token.Text);
141 return sb.ToString();
static IList< Irony.Parsing.Token > FindTokensFrom(ParseTree tree, int line, int column)
static IList< Irony.Parsing.Token > FindTokensTo(ParseTree tree, int line, int column)
SqlParseResult Deveel.Data.Sql.Parser.SqlDefaultParser.Parse |
( |
string |
input | ) |
|
|
inline |
Analyzes and parses the input and results an object that describes the parsed nodes in a tree that can be used to construct objects for interacting with the system.
- Parameters
-
input | The input string to be parsed. |
- Returns
- Returns an instance of SqlParseResult that includes information about the analyzed input.
- Exceptions
-
ArgumentNullException | If the provided input is null or empty. |
- See also
- SqlParseResult
Implements Deveel.Data.Sql.Parser.ISqlParser.
Definition at line 54 of file SqlDefaultParser.cs.
55 var result =
new SqlParseResult(
Dialect);
57 var timer =
new Timer();
61 var node =
ParseNode(input, result.Errors, out time);
62 result.RootNode = node;
63 }
catch (Exception ex) {
65 result.Errors.Add(
new SqlParseError(ex.Message, 0, 0));
68 result.ParseTime = timer.Elapsed;
ISqlNode ParseNode(string sqlSource, ICollection< SqlParseError > errors, out long parseTime)
ISqlNode Deveel.Data.Sql.Parser.SqlDefaultParser.ParseNode |
( |
string |
sqlSource, |
|
|
ICollection< SqlParseError > |
errors, |
|
|
out long |
parseTime |
|
) |
| |
|
inlineprivate |
Definition at line 74 of file SqlDefaultParser.cs.
75 var tree =
parser.Parse(sqlSource);
76 parseTime = tree.ParseTimeMilliseconds;
78 if (tree.Status == ParseTreeStatus.Error) {
84 DefaultNodeType = typeof (SqlNode),
85 DefaultIdentifierNodeType = typeof (IdentifierNode)
88 var astCompiler =
new AstBuilder(astContext);
89 astCompiler.BuildAst(tree);
94 var node = (ISqlNode) tree.Root.AstNode;
95 if (node.NodeName ==
"root")
96 node = node.ChildNodes.FirstOrDefault();
static void BuildErrors(ParseTree tree, ICollection< SqlParseError > errors, LogMessageList logMessages)
LanguageData languageData
Irony.Parsing.Parser parser
LanguageData Deveel.Data.Sql.Parser.SqlDefaultParser.languageData |
|
private |
Irony.Parsing.Parser Deveel.Data.Sql.Parser.SqlDefaultParser.parser |
|
private |
string Deveel.Data.Sql.Parser.SqlDefaultParser.Dialect |
|
get |
The documentation for this class was generated from the following file:
- /var/calculate/remote/distfiles/egit-src/deveeldb.git/src/deveeldb/Deveel.Data.Sql.Parser/SqlDefaultParser.cs