add: Variable declarations test.

This commit is contained in:
2024-08-17 15:44:58 +08:00
parent eedbd5e7e5
commit c7077bd0fd
3 changed files with 95 additions and 2 deletions

View File

@@ -9,7 +9,9 @@ namespace CanonSharp.Pascal.Parser;
public abstract class GrammarParserBuilder
{
protected static IParser<LexicalToken, LexicalToken> Keyword(string value)
=> Satisfy<LexicalToken>(token => token.TokenType == LexicalTokenType.Keyword && token.LiteralValue == value);
=> Satisfy<LexicalToken>(token =>
token.TokenType == LexicalTokenType.Keyword &&
token.LiteralValue.Equals(value, StringComparison.OrdinalIgnoreCase));
protected static IParser<LexicalToken, LexicalToken> Operator(string value)
=> Satisfy<LexicalToken>(token => token.TokenType == LexicalTokenType.Operator && token.LiteralValue == value);