Array init support
This commit is contained in:
@@ -89,52 +89,37 @@ public class Lexer
|
||||
ConsumeWhitespace();
|
||||
var startIndex = _index;
|
||||
|
||||
string? documentation = null;
|
||||
while (Peek() is { Value: '/' } && Peek(1) is { Value: '/' })
|
||||
{
|
||||
Next();
|
||||
Next();
|
||||
|
||||
if (Peek() is { Value: '/' })
|
||||
{
|
||||
Next();
|
||||
|
||||
while (Peek().TryGetValue(out var character))
|
||||
{
|
||||
Next();
|
||||
documentation += character;
|
||||
if (character == '\n')
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (Peek().TryGetValue(out var character))
|
||||
{
|
||||
Next();
|
||||
if (character == '\n')
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (documentation != null)
|
||||
{
|
||||
return new DocumentationToken(_sourceText, startIndex, _index, documentation);
|
||||
}
|
||||
|
||||
ConsumeWhitespace();
|
||||
startIndex = _index;
|
||||
|
||||
if (!Peek().TryGetValue(out var current))
|
||||
{
|
||||
return Optional<Token>.Empty();
|
||||
}
|
||||
|
||||
if (current == '/' && Peek(1).TryGetValue(out var nextChar) && nextChar == '/')
|
||||
{
|
||||
Next();
|
||||
Next();
|
||||
|
||||
if (Peek().TryGetValue(out var thirdChar) && thirdChar == '/')
|
||||
{
|
||||
Next();
|
||||
var buffer = string.Empty;
|
||||
while (Peek().TryGetValue(out var character) && character != '\n')
|
||||
{
|
||||
buffer += character;
|
||||
Next();
|
||||
}
|
||||
Next();
|
||||
return new DocumentationToken(_sourceText, startIndex, _index, buffer);
|
||||
}
|
||||
|
||||
while (Peek().TryGetValue(out var character) && character != '\n')
|
||||
{
|
||||
Next();
|
||||
}
|
||||
Next();
|
||||
return ParseToken();
|
||||
}
|
||||
|
||||
if (char.IsLetter(current) || current == '_')
|
||||
{
|
||||
var buffer = string.Empty;
|
||||
|
||||
Reference in New Issue
Block a user