summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAkim Demaille <akim.demaille@gmail.com>2021-01-02 07:33:08 +0100
committerAkim Demaille <akim.demaille@gmail.com>2021-01-02 07:37:00 +0100
commitf67c1ce937736ff243430a288bba55867a5e563d (patch)
treea709bc5f1e157008bb8e2adc3ec8698bb5260d73 /examples
parent5a4e6062751043e43e260961336d8dafb83ae63e (diff)
downloadbison-f67c1ce937736ff243430a288bba55867a5e563d.tar.gz
glr.c: example: use the exact same display as in the C++ example
* examples/c/glr/c++-types.y: Add a space after the commas. * examples/c/glr/c++-types.test: Adjust expectations.
Diffstat (limited to 'examples')
-rw-r--r--examples/c/glr/c++-types.test16
-rw-r--r--examples/c/glr/c++-types.y12
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