diff options
Diffstat (limited to 'grammar/grammar_test.go')
-rw-r--r-- | grammar/grammar_test.go | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/grammar/grammar_test.go b/grammar/grammar_test.go index 5a8bb4a..aeeffac 100644 --- a/grammar/grammar_test.go +++ b/grammar/grammar_test.go @@ -1714,6 +1714,25 @@ foo errs: []*SemanticError{semErrDirInvalidParam}, }, { + caption: "the `#left` directive cannot be applied to an error symbol", + specSrc: ` +#name test; + +#prec ( + #left error +); + +s + : foo ';' + | error ';' + ; + +foo + : 'foo'; +`, + errs: []*SemanticError{semErrDirInvalidParam}, + }, + { caption: "the `#left` directive cannot take an undefined symbol", specSrc: ` #name test; @@ -1937,6 +1956,25 @@ foo errs: []*SemanticError{semErrDirInvalidParam}, }, { + caption: "the `#right` directive cannot be applied to an error symbol", + specSrc: ` +#name test; + +#prec ( + #right error +); + +s + : foo ';' + | error ';' + ; + +foo + : 'foo'; +`, + errs: []*SemanticError{semErrDirInvalidParam}, + }, + { caption: "the `#right` directive cannot take an undefined symbol", specSrc: ` #name test; @@ -2160,6 +2198,25 @@ foo errs: []*SemanticError{semErrDirInvalidParam}, }, { + caption: "the `#assign` directive cannot be applied to an error symbol", + specSrc: ` +#name test; + +#prec ( + #assign error +); + +s + : foo ';' + | error ';' + ; + +foo + : 'foo'; +`, + errs: []*SemanticError{semErrDirInvalidParam}, + }, + { caption: "the `#assign` directive cannot take an undefined symbol", specSrc: ` #name test; @@ -2669,6 +2726,20 @@ foo errs: []*SemanticError{semErrDirInvalidParam}, }, { + caption: "the `#prec` directive cannot be applied to an error symbol", + specSrc: ` +#name test; + +s + : foo #prec error + ; + +foo + : 'foo'; +`, + errs: []*SemanticError{semErrDirInvalidParam}, + }, + { caption: "the `#prec` directive cannot take an undefined symbol", specSrc: ` #name test; |