Allow identifiers to start with an underscore
This commit is contained in:
parent
8f6d2591f3
commit
2f8c295675
|
@ -95,7 +95,7 @@ namespace Upsilon.Parser
|
||||||
}
|
}
|
||||||
return new SyntaxToken(SyntaxKind.Tilde, _position, "~", null);
|
return new SyntaxToken(SyntaxKind.Tilde, _position, "~", null);
|
||||||
default:
|
default:
|
||||||
if (char.IsLetter(Current))
|
if (char.IsLetter(Current) || Current == '_')
|
||||||
return LexIdentifierOrKeyword();
|
return LexIdentifierOrKeyword();
|
||||||
_diagnostics.LogBadCharacter(new TextSpan(_position, 1), SyntaxKind.Identifier);
|
_diagnostics.LogBadCharacter(new TextSpan(_position, 1), SyntaxKind.Identifier);
|
||||||
return new SyntaxToken(SyntaxKind.BadToken, _position, "", null);
|
return new SyntaxToken(SyntaxKind.BadToken, _position, "", null);
|
||||||
|
|
Loading…
Reference in New Issue