summary refs log tree commit diff
path: root/bin
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-01-01 14:19:26 -0500
committerJune McEnroe <june@causal.agency>2021-01-01 14:19:26 -0500
commit86891cd638ad3481e58d79952e1b3131d14ac44a (patch)
tree0cd76a6ead8eb9040bdda4bb2bcc351e415058f2 /bin
parentIncrement license header templates (diff)
downloadsrc-86891cd638ad3481e58d79952e1b3131d14ac44a.tar.gz
src-86891cd638ad3481e58d79952e1b3131d14ac44a.zip
Remove empty comma statement from bit
Diffstat (limited to '')
-rw-r--r--bin/bit.y15
1 files changed, 7 insertions, 8 deletions
diff --git a/bin/bit.y b/bin/bit.y
index 7a7d37ed..ec3892fd 100644
--- a/bin/bit.y
+++ b/bin/bit.y
@@ -28,14 +28,16 @@
 
 #define YYSTYPE uint64_t
 
-static void yyerror(const char *str);
 static int yylex(void);
+static void yyerror(const char *str);
 static void print(uint64_t val);
 
 static uint64_t vars[128];
 
 %}
 
+%token Int Var
+
 %left '$'
 %right '='
 %left '|'
@@ -47,15 +49,12 @@ static uint64_t vars[128];
 %right '~'
 %left 'K' 'M' 'G' 'T'
 
-%token Int Var
-
 %%
 
 stmt:
 	| stmt expr '\n' { print(vars['_'] = $2); printf("\n"); }
 	| stmt expr ',' { print(vars['_'] = $2); }
 	| stmt '\n'
-	| stmt ','
 	;
 
 expr:
@@ -87,10 +86,6 @@ expr:
 
 %%
 
-static void yyerror(const char *str) {
-	warnx("%s", str);
-}
-
 static int lexInt(uint64_t base) {
 	yylval = 0;
 	for (char ch; EOF != (ch = getchar());) {
@@ -159,6 +154,10 @@ static int yylex(void) {
 	}
 }
 
+static void yyerror(const char *str) {
+	warnx("%s", str);
+}
+
 static const char *Codes[128] = {
 	"NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL",
 	"BS",  "HT",  "NL",  "VT",  "NP",  "CR",  "SO",  "SI",