bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 5/5] symbols: check more invalid declarations


From: Akim Demaille
Subject: [PATCH 5/5] symbols: check more invalid declarations
Date: Sun, 16 Dec 2018 10:45:40 +0100

* tests/input.at (Invalid %nterm uses): Rename as...
(Invalid symbol declarations): this.
Extend.
---
 tests/input.at | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/tests/input.at b/tests/input.at
index 70afa473..ddfead8e 100644
--- a/tests/input.at
+++ b/tests/input.at
@@ -195,11 +195,11 @@ input.y:7.4-9: warning: POSIX Yacc does not support 
%empty [-Wyacc]
 AT_CLEANUP
 
 
-## --------------------- ##
-## Invalid %nterm uses.  ##
-## --------------------- ##
+## ----------------------------- ##
+## Invalid symbol declarations.  ##
+## ----------------------------- ##
 
-AT_SETUP([Invalid %nterm uses])
+AT_SETUP([Invalid symbol declarations])
 
 AT_DATA([input.y],
 [[%nterm expr "expression";
@@ -207,6 +207,9 @@ AT_DATA([input.y],
 %nterm fact 124 "factor";
 %nterm '+' '*';
 %nterm "number";
+%token "tok1" 1;
+%left "tok2" 2;
+%type "tok3" 3;
 %%
 expr: expr '+' term | term;
 term: term '*' fact | fact;
@@ -232,6 +235,15 @@ input.y:4.8-10: error: character literals cannot be 
nonterminals
 input.y:5.8-15: error: syntax error, unexpected string, expecting char or 
identifier or <tag>
  %nterm "number";
         ^^^^^^^^
+input.y:6.8-13: error: syntax error, unexpected string, expecting char or 
identifier or <tag>
+ %token "tok1" 1;
+        ^^^^^^
+input.y:7.14: error: syntax error, unexpected integer
+ %left "tok2" 2;
+              ^
+input.y:8.14: error: syntax error, unexpected integer
+ %type "tok3" 3;
+              ^
 ]])
 
 AT_CLEANUP
-- 
2.19.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]