diff options
author | Ryo Nihei <nihei.dev@gmail.com> | 2022-04-16 01:44:33 +0900 |
---|---|---|
committer | Ryo Nihei <nihei.dev@gmail.com> | 2022-04-16 01:45:10 +0900 |
commit | 9a9444bdc00e2a738fb0aa7cac4afa8a123d679b (patch) | |
tree | 409797eff699062b8aa5d9df2d1ab9beaf356552 /grammar/grammar_test.go | |
parent | Prohibit specifying associativity and precedence multiple times for a symbol (diff) | |
download | urubu-9a9444bdc00e2a738fb0aa7cac4afa8a123d679b.tar.gz urubu-9a9444bdc00e2a738fb0aa7cac4afa8a123d679b.tar.xz |
Prohibit using the same element multiple times in the #ast directive
Diffstat (limited to 'grammar/grammar_test.go')
-rw-r--r-- | grammar/grammar_test.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/grammar/grammar_test.go b/grammar/grammar_test.go index a90ee8b..2bb2358 100644 --- a/grammar/grammar_test.go +++ b/grammar/grammar_test.go @@ -772,6 +772,34 @@ bar errs: []*SemanticError{semErrDirInvalidParam}, }, { + caption: "a symbol can appear in the `#ast` directive only once", + specSrc: ` +%name test + +s + : foo #ast foo foo + ; + +foo + : 'foo'; +`, + errs: []*SemanticError{semErrDuplicateElem}, + }, + { + caption: "a symbol can appear in the `#ast` directive only once, even if the symbol has a label", + specSrc: ` +%name test + +s + : foo@x #ast foo x + ; + +foo + : 'foo'; +`, + errs: []*SemanticError{semErrDuplicateElem}, + }, + { caption: "the expansion operator cannot be applied to a terminal symbol", specSrc: ` %name test |