diff options
author | June McEnroe <june@causal.agency> | 2021-01-01 14:19:26 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2021-01-01 14:19:26 -0500 |
commit | 035e7cd54826e16dea2186ea18a44d3e308f96d5 (patch) | |
tree | 5ea9224b0cbe22e56bfe66c5345ef38807aa3470 /bin | |
parent | Increment license header templates (diff) | |
download | src-035e7cd54826e16dea2186ea18a44d3e308f96d5.tar.gz src-035e7cd54826e16dea2186ea18a44d3e308f96d5.zip |
Remove empty comma statement from bit
Diffstat (limited to '')
-rw-r--r-- | bin/bit.y | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/bin/bit.y b/bin/bit.y index 6ef8ade1..9d977a34 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", |