From 86891cd638ad3481e58d79952e1b3131d14ac44a Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Fri, 1 Jan 2021 14:19:26 -0500 Subject: Remove empty comma statement from bit --- bin/bit.y | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'bin') 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", -- cgit 1.4.1