private void ReadIdentifierOrKeyword()
{
var start = _charReader.Position;
// Skip first letter
NextChar();
// The following characters can be letters, digits the underscore and the dollar sign.
while (char.IsLetterOrDigit(_charReader.Current) ||
_charReader.Current == '_' ||
_charReader.Current == '$')
{
NextChar();
}
var end = _charReader.Position;
var span = TextSpan.FromBounds(Text, start, end);
var text = Text.GetText(span);
_kind = SyntaxFacts.GetKeywordKind(text);
_contextualKind = (_mode == LexerMode.Directive)
? SyntaxFacts.GetPreprocessorKeywordKind(text)
: SyntaxFacts.GetContextualKeywordKind(text);
switch (_kind)
{
case SyntaxKind.TrueKeyword:
_value = true;
break;
case SyntaxKind.FalseKeyword:
_value = false;
break;
default:
_value = text;
break;
}
}
}