aboutsummaryrefslogtreecommitdiff
path: root/spec/parser.go
diff options
context:
space:
mode:
authorRyo Nihei <nihei.dev@gmail.com>2022-05-14 14:42:00 +0900
committerRyo Nihei <nihei.dev@gmail.com>2022-05-15 20:42:28 +0900
commita443f0a1a4b79faa0b0271b72ea4a8e5f3d03ffd (patch)
tree10ba6c9806ec2bd831fe62d34e1da22daaf5e0e0 /spec/parser.go
parentProhibit using escape sequences in string literals (diff)
downloadcotia-a443f0a1a4b79faa0b0271b72ea4a8e5f3d03ffd.tar.gz
cotia-a443f0a1a4b79faa0b0271b72ea4a8e5f3d03ffd.tar.xz
Prohibit applying the expansion operator to anything other than identifiers
Diffstat (limited to 'spec/parser.go')
-rw-r--r--spec/parser.go8
1 files changed, 6 insertions, 2 deletions
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