From dbd2e20de97cdef56da0de07adff4251de94ef43 Mon Sep 17 00:00:00 2001 From: Ryo Nihei Date: Tue, 29 Mar 2022 19:10:23 +0900 Subject: Change syntax of production directives The position of directives given to productions has moved from before a left-hand side value to after a left-hand side value. This change aims to simplify the syntax. However, there is no change in positions of directives given to alternatives. --- spec/parser.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'spec/parser.go') diff --git a/spec/parser.go b/spec/parser.go index e092f59..be20e7d 100644 --- a/spec/parser.go +++ b/spec/parser.go @@ -306,19 +306,14 @@ func (p *parser) parseProduction() *ProductionNode { return nil } - dir := p.parseDirective() - if dir != nil { - if !p.consume(tokenKindNewline) { - raiseSyntaxError(p.pos.Row, synErrProdDirNoNewline) - } - } - if !p.consume(tokenKindID) { raiseSyntaxError(p.pos.Row, synErrNoProductionName) } lhs := p.lastTok.text lhsPos := p.lastTok.pos + dir := p.parseDirective() + p.consume(tokenKindNewline) if !p.consume(tokenKindColon) { -- cgit v1.2.3