From 3eb0e88f911386a4e6eca991c1471070596c5554 Mon Sep 17 00:00:00 2001 From: Ryo Nihei Date: Sat, 7 May 2022 20:41:33 +0900 Subject: Change syntax for top-level directives %name changes to: #name example; %left and %right change to: #prec ( #left a b #right c d ); --- spec/lexer.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'spec/lexer.go') diff --git a/spec/lexer.go b/spec/lexer.go index f9ad871..2459c40 100644 --- a/spec/lexer.go +++ b/spec/lexer.go @@ -25,7 +25,8 @@ const ( tokenKindLabelMarker = tokenKind("@") tokenKindDirectiveMarker = tokenKind("#") tokenKindExpantion = tokenKind("...") - tokenKindMetaDataMarker = tokenKind("%") + tokenKindLParen = tokenKind("(") + tokenKindRParen = tokenKind(")") tokenKindNewline = tokenKind("newline") tokenKindEOF = tokenKind("eof") tokenKindInvalid = tokenKind("invalid") @@ -265,8 +266,10 @@ func (l *lexer) lexAndSkipWSs() (*token, error) { return newSymbolToken(tokenKindDirectiveMarker, newPosition(tok.Row+1, tok.Col+1)), nil case KindIDExpansion: return newSymbolToken(tokenKindExpantion, newPosition(tok.Row+1, tok.Col+1)), nil - case KindIDMetadataMarker: - return newSymbolToken(tokenKindMetaDataMarker, newPosition(tok.Row+1, tok.Col+1)), nil + case KindIDLParen: + return newSymbolToken(tokenKindLParen, newPosition(tok.Row+1, tok.Col+1)), nil + case KindIDRParen: + return newSymbolToken(tokenKindRParen, newPosition(tok.Row+1, tok.Col+1)), nil default: return newInvalidToken(string(tok.Lexeme), newPosition(tok.Row+1, tok.Col+1)), nil } -- cgit v1.2.3