alecAbstraction Layer for Escape Codes |
git clone git://git.dimitrijedobrota.com/alec.git |
Log | Files | Refs | README | LICENSE | HACKING | CONTRIBUTING | CODE_OF_CONDUCT | BUILDING | |
commit | ac20e7fbf62edf24a087d738b8a6c313b85c5c1b |
parent | 58f5b24c1c58f2fa5a2c06d758735150261483df |
author | Dimitrije Dobrota <mail@dimitrijedobrota.com> |
date | Tue, 27 Feb 2024 16:16:26 +0000 |
Fix empty line issue with bison
Diffstat:M | src/parser.y | | | +++++++-- |
M | src/rules | | | ++++++++++ |
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/src/parser.y b/src/parser.y
@@ -27,16 +27,21 @@
%%
document: record { records = list_new((char *)$1, records); }
| record EOL document { records = list_new((char *)$1, records); }
document: %empty
| EOL document
| record document { records = list_new((char *)$1, records); }
;
record: name list list list { $$ = record_new($1, $2, $3, $4); }
;
name: LITERAL EOL { $$ = $1; }
;
list: EOL { $$ = NULL; }
| LITERAL EOL { $$ = list_new($1, NULL); }
| LITERAL COMMA list { $$ = list_new($1, $3); }
;
%%
diff --git a/src/rules b/src/rules
@@ -1,8 +1,11 @@
foreground
int idx
limit_256
32, ';', 5, ';', idx, 'm'
background
int idx
limit_256
@@ -13,17 +16,24 @@ int R, int G, int B
limit_256
38, ';', 5, ';', R, ';', G, ';', B, 'm'
background
int R, int G, int B
limit_256
38, ';', 5, ';', R, ';', G, ';', B, 'm'
foreground
COLOR color
(int)color + 30, 'm'
background
COLOR color
(int)color + 40, 'm'