aboutsummaryrefslogtreecommitdiff
path: root/spec/lexer.go
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lexer.go')
-rw-r--r--spec/lexer.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/spec/lexer.go b/spec/lexer.go
index 258faae..d513d7d 100644
--- a/spec/lexer.go
+++ b/spec/lexer.go
@@ -21,11 +21,12 @@ const (
tokenKindKWFragment = tokenKind("fragment")
tokenKindID = tokenKind("id")
tokenKindTerminalPattern = tokenKind("terminal pattern")
+ tokenKindStringLiteral = tokenKind("string")
tokenKindColon = tokenKind(":")
tokenKindOr = tokenKind("|")
tokenKindSemicolon = tokenKind(";")
tokenKindDirectiveMarker = tokenKind("#")
- tokenKindTreeNodeOpen = tokenKind("'(")
+ tokenKindTreeNodeOpen = tokenKind("#(")
tokenKindTreeNodeClose = tokenKind(")")
tokenKindPosition = tokenKind("$")
tokenKindExpantion = tokenKind("...")
@@ -77,6 +78,14 @@ func newTerminalPatternToken(text string, pos Position) *token {
}
}
+func newStringLiteralToken(text string, pos Position) *token {
+ return &token{
+ kind: tokenKindStringLiteral,
+ text: text,
+ pos: pos,
+ }
+}
+
func newPositionToken(num int, pos Position) *token {
return &token{
kind: tokenKindPosition,
@@ -234,7 +243,7 @@ func (l *lexer) lexAndSkipWSs() (*token, error) {
Col: tok.Col + 1,
}
}
- return newTerminalPatternToken(mlspec.EscapePattern(pat), newPosition(tok.Row+1, tok.Col+1)), nil
+ return newStringLiteralToken(pat, newPosition(tok.Row+1, tok.Col+1)), nil
case "colon":
return newSymbolToken(tokenKindColon, newPosition(tok.Row+1, tok.Col+1)), nil
case "or":