bison-patches
[Top][All Lists]
Advanced

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

[PATCH 2/6] glr.c: example: use the exact same display as in the C++ exa


From: Akim Demaille
Subject: [PATCH 2/6] glr.c: example: use the exact same display as in the C++ example
Date: Sat, 2 Jan 2021 16:30:27 +0100

* examples/c/glr/c++-types.y: Add a space after the commas.
* examples/c/glr/c++-types.test: Adjust expectations.
---
 examples/c/glr/c++-types.test | 16 ++++++++--------
 examples/c/glr/c++-types.y    | 12 ++++++------
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/examples/c/glr/c++-types.test b/examples/c/glr/c++-types.test
index 46e10483..079538c3 100644
--- a/examples/c/glr/c++-types.test
+++ b/examples/c/glr/c++-types.test
@@ -35,13 +35,13 @@ T (y y) = z + q;
 z + q;
 EOF
 run 0 "\
-1.0-4: +(z,q)
-3.0-2: <declare>(T,x)
-5.0-6: <init-declare>(T,x,y)
-7.0-4: =(x,y)
-9.0-8: +(<cast>(x,T),y)
-11.0-4: <OR>(<declare>(T,x),<cast>(x,T))
-13.0-12: <OR>(<init-declare>(T,y,+(z,q)),=(<cast>(y,T),+(z,q)))
+1.0-4: +(z, q)
+3.0-2: <declare>(T, x)
+5.0-6: <init-declare>(T, x, y)
+7.0-4: =(x, y)
+9.0-8: +(<cast>(x, T), y)
+11.0-4: <OR>(<declare>(T, x), <cast>(x, T))
+13.0-12: <OR>(<init-declare>(T, y, +(z, q)), =(<cast>(y, T), +(z, q)))
 15.0-14: <error>
-17.0-4: +(z,q)
+17.0-4: +(z, q)
 err: 15.5: syntax error, unexpected identifier, expecting '=' or '+' or ')'"
diff --git a/examples/c/glr/c++-types.y b/examples/c/glr/c++-types.y
index b44bd6ad..2d52b2b1 100644
--- a/examples/c/glr/c++-types.y
+++ b/examples/c/glr/c++-types.y
@@ -106,15 +106,15 @@ stmt : expr ';'  %merge <stmtMerge>     { $$ = $1; }
 
 expr : ID
      | TYPENAME '(' expr ')'
-                        { $$ = new_nterm ("<cast>(%s,%s)", $3, $1, NULL); }
-     | expr '+' expr    { $$ = new_nterm ("+(%s,%s)", $1, $3, NULL); }
-     | expr '=' expr    { $$ = new_nterm ("=(%s,%s)", $1, $3, NULL); }
+                        { $$ = new_nterm ("<cast>(%s, %s)", $3, $1, NULL); }
+     | expr '+' expr    { $$ = new_nterm ("+(%s, %s)", $1, $3, NULL); }
+     | expr '=' expr    { $$ = new_nterm ("=(%s, %s)", $1, $3, NULL); }
      ;
 
 decl : TYPENAME declarator ';'
-                        { $$ = new_nterm ("<declare>(%s,%s)", $1, $2, NULL); }
+                        { $$ = new_nterm ("<declare>(%s, %s)", $1, $2, NULL); }
      | TYPENAME declarator '=' expr ';'
-                        { $$ = new_nterm ("<init-declare>(%s,%s,%s)", $1,
+                        { $$ = new_nterm ("<init-declare>(%s, %s, %s)", $1,
                                           $2, $4); }
      ;
 
@@ -291,7 +291,7 @@ static void node_print (FILE *out, Node *n)
 static Node*
 stmtMerge (YYSTYPE x0, YYSTYPE x1)
 {
-  return new_nterm ("<OR>(%s,%s)", x0.stmt, x1.stmt, NULL);
+  return new_nterm ("<OR>(%s, %s)", x0.stmt, x1.stmt, NULL);
 }
 
 static int
-- 
2.29.2




reply via email to

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