From 936b600ce23cce4350a730817a067a8926384baf Mon Sep 17 00:00:00 2001 From: Ryo Nihei Date: Sat, 28 Aug 2021 11:03:09 +0900 Subject: Use a pattern string defined by a string literal as its alias --- spec/parser.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'spec/parser.go') diff --git a/spec/parser.go b/spec/parser.go index 9778521..71ee50b 100644 --- a/spec/parser.go +++ b/spec/parser.go @@ -36,9 +36,10 @@ type AlternativeNode struct { } type ElementNode struct { - ID string - Pattern string - Pos Position + ID string + Pattern string + Literally bool + Pos Position } type DirectiveNode struct { @@ -407,8 +408,9 @@ func (p *parser) parseElement() *ElementNode { } case p.consume(tokenKindStringLiteral): return &ElementNode{ - Pattern: mlspec.EscapePattern(p.lastTok.text), - Pos: p.lastTok.pos, + Pattern: p.lastTok.text, + Literally: true, + Pos: p.lastTok.pos, } } return nil -- cgit v1.2.3