aboutsummaryrefslogtreecommitdiff
path: root/spec/grammar/syntax_error.go
diff options
context:
space:
mode:
authorRyo Nihei <nihei.dev@gmail.com>2022-06-12 00:40:28 +0900
committerRyo Nihei <nihei.dev@gmail.com>2022-06-12 09:44:00 +0900
commit2dd098d1e16bd0b8786ca97ccc7d3b06fa6bc3d1 (patch)
tree2e5a9ffa712ffe553d5ecafb35e27a7a3cd1fa11 /spec/grammar/syntax_error.go
parentSupport the underscore symbol matching any symbols in vartan-test command (diff)
downloadcotia-2dd098d1e16bd0b8786ca97ccc7d3b06fa6bc3d1.tar.gz
cotia-2dd098d1e16bd0b8786ca97ccc7d3b06fa6bc3d1.tar.xz
Prohibit using a pattern in an alternative
When a syntax error occurs, the parser must provide a user with the names of expected tokens. However, if a pattern appears directly in an alternative, Vartan cannot assign an appropriate name to the pattern. Therefore, this commit prohibits alternatives from containing patterns.
Diffstat (limited to 'spec/grammar/syntax_error.go')
-rw-r--r--spec/grammar/syntax_error.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/spec/grammar/syntax_error.go b/spec/grammar/syntax_error.go
index 1fec801..1f9664b 100644
--- a/spec/grammar/syntax_error.go
+++ b/spec/grammar/syntax_error.go
@@ -37,6 +37,7 @@ var (
synErrNoDirectiveName = newSyntaxError("a directive needs a name")
synErrNoOrderedSymbolName = newSyntaxError("an ordered symbol name is missing")
synErrUnclosedDirGroup = newSyntaxError("a directive group must be closed by )")
+ synErrPatternInAlt = newSyntaxError("a pattern literal cannot appear directly in an alternative. instead, please define a terminal symbol with the pattern literal")
synErrStrayExpOp = newSyntaxError("an expansion operator ... must be preceded by an identifier")
synErrInvalidExpOperand = newSyntaxError("an expansion operator ... can be applied to only an identifier")
synErrSemicolonNoNewline = newSyntaxError("a semicolon must be followed by a newline")