bison-patches
[Top][All Lists]
Advanced

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

examples: style changes in lexcalc


From: Akim Demaille
Subject: examples: style changes in lexcalc
Date: Sat, 16 Feb 2019 15:57:01 +0100

commit a29ea1e5a431957024c3d6a889b556e8a8897434
Author: Akim Demaille <address@hidden>
Date:   Sat Feb 16 13:18:31 2019 +0100

    examples: style changes in lexcalc
    
    * examples/c/lexcalc/parse.y: Formatting/comment changes.

diff --git a/examples/c/lexcalc/parse.y b/examples/c/lexcalc/parse.y
index f2f29df1..5d1be5d6 100644
--- a/examples/c/lexcalc/parse.y
+++ b/examples/c/lexcalc/parse.y
@@ -15,8 +15,8 @@
 // Emitted on top of the implementation file.
 %code top
 {
-#include <stdio.h>  /* printf. */
-#include <stdlib.h> /* getenv. */
+#include <stdio.h>  // printf.
+#include <stdlib.h> // getenv.
 }
 
 %define api.pure full
@@ -55,13 +55,13 @@ input:
 
 line:
   exp EOL   { $$ = $1; }
-| error EOL { yyerrok; }
+| error EOL { $$ = 0; yyerrok; }
 ;
 
 exp:
-  exp "+" exp   { $$ = $1 + $3;  }
-| exp "-" exp   { $$ = $1 - $3;  }
-| exp "*" exp   { $$ = $1 * $3;  }
+  exp "+" exp   { $$ = $1 + $3; }
+| exp "-" exp   { $$ = $1 - $3; }
+| exp "*" exp   { $$ = $1 * $3; }
 | exp "/" exp
   {
     if ($3 == 0)
@@ -72,7 +72,7 @@ exp:
     else
       $$ = $1 / $3;
   }
-| "(" exp ")"   { $$ = $2;       }
+| "(" exp ")"   { $$ = $2; }
 | NUM           { $$ = $1; }
 ;
 %%




reply via email to

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