alec

Abstraction Layer for Escape Codes
git clone git://git.dimitrijedobrota.com/alec.git
Log | Files | Refs | README | LICENSE

commit 8dca0ea8e3f13e1e0ed157b7110ab072df348c41
parent ac20e7fbf62edf24a087d738b8a6c313b85c5c1b
Author: Dimitrije Dobrota <mail@dimitrijedobrota.com>
Date:   Tue, 27 Feb 2024 16:29:41 +0000

Treat lines with only whitespace as empty

Diffstat:
Msrc/lexer.l | 7++++---
Msrc/rules | 14++++++++------
2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/src/lexer.l b/src/lexer.l @@ -10,9 +10,10 @@ LINE_END (\n|\r|\r\n) %% -{LINE_END} { return EOL; } -, { return COMMA; } -[^,\n]* { +{LINE_END} { return EOL; } +^[\t ]*{LINE_END} { return EOL; } +, { return COMMA; } +[^,\n]* { while(*yytext && isspace(*yytext)) yytext++; yylval.n = strdup(yytext); return LITERAL; } diff --git a/src/rules b/src/rules @@ -1,22 +1,22 @@ - + foreground int idx limit_256 32, ';', 5, ';', idx, 'm' - + background int idx limit_256 42, ';', 5, ';', idx, 'm' - + foreground int R, int G, int B limit_256 38, ';', 5, ';', R, ';', G, ';', B, 'm' - + background int R, int G, int B @@ -26,7 +26,7 @@ limit_256 foreground COLOR color - + (int)color + 30, 'm' @@ -36,4 +36,6 @@ COLOR color (int)color + 40, 'm' - + + +