27 namespace Ntp.Analyzer.Config.Compiler
41 public int LineNumber => reader.Line;
43 public int ColumnNumber => reader.Position;
53 char c = reader.Peek();
71 if (reader.Peek() ==
'\n')
89 while (reader.Peek() ==
' ' || reader.Peek() ==
'\t')
92 if (reader.Peek() ==
'#')
101 Token = GetNextToken();
107 if (reader.Peek() ==
'\0')
110 switch (reader.Peek())
125 if (reader.Peek() !=
'#')
129 while (reader.Peek() !=
'\r' && reader.Peek() !=
'\n' && reader.Peek() !=
'\0')
132 switch (reader.Peek())
141 if (reader.Peek() ==
'\n')
152 while (reader.Peek() !=
'\0')
154 switch (reader.Peek())
162 if (reader.Peek() ==
'\n')
169 while (
char.IsWhiteSpace(reader.Peek()))
175 if (reader.Peek() ==
'\0')
180 var
c = reader.Peek();
191 var token = ParseQuotedIdent() ?? ParseLiteral();
200 switch (text.ToLower())
222 if (
int.TryParse(text, out value))
235 if (text.ToCharArray().Count(
c =>
"0123456789.".Contains(
c)) != text.Length)
238 if (text.ToCharArray().Count(
c =>
c ==
'.') > 1)
242 return double.TryParse(text, out dvalue) ?
new NumericToken(dvalue) : null;
247 var text =
new StringBuilder();
248 while (!
char.IsWhiteSpace(reader.Peek()) && reader.Peek() !=
'\r' && reader.Peek() !=
'\n' &&
249 reader.Peek() !=
'\0')
250 text.Append(reader.Read());
252 string tokenText = text.ToString();
254 var token = ParseBoolean(tokenText) ?? ParseDigitValue(tokenText);
258 string search = tokenText.ToLower();
259 var keyword =
Keyword.
Keywords.FirstOrDefault(k => k.LowerText == search);
261 return keyword != null
268 if (reader.Peek() !=
'"')
273 var text =
new StringBuilder();
274 while (reader.Peek() !=
'\0' && reader.Peek() !=
'"')
275 text.Append(reader.Read());
277 if (reader.Peek() ==
'"')
283 #region IDisposable Support 297 disposedValue =
true;
308 GC.SuppressFinalize(
this);
static Token ParseDigitValue(string text)
readonly ConfigFileReader reader
void ConsumeWhiteSpaces()
Consume white spaces and comments.
void Consume()
Consume white spaces, line breaks and comments.
static IEnumerable< Keyword > Keywords
static Token ParseBoolean(string text)
void Dispose(bool disposing)