From a443f0a1a4b79faa0b0271b72ea4a8e5f3d03ffd Mon Sep 17 00:00:00 2001 From: Ryo Nihei Date: Sat, 14 May 2022 14:42:00 +0900 Subject: Prohibit applying the expansion operator to anything other than identifiers --- spec/parser.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'spec/parser.go') diff --git a/spec/parser.go b/spec/parser.go index 9c66bfb..efbd072 100644 --- a/spec/parser.go +++ b/spec/parser.go @@ -494,10 +494,14 @@ func (p *parser) parseParameter() *ParameterNode { Group: g, Pos: pos, } - default: - return nil } if p.consume(tokenKindExpantion) { + switch { + case param == nil: + raiseSyntaxError(p.pos.Row, synErrStrayExpOp) + case param.ID == "": + raiseSyntaxError(p.pos.Row, synErrInvalidExpOperand) + } param.Expansion = true } return param -- cgit v1.2.3