bcalc

cli bitcoin unit calculator
git clone git://jb55.com/bcalc
Log | Files | Refs | README | LICENSE

commit aa860210b3a3c9b66a94607fcbdad036bde569a7
parent ee1bd29c26018c9f2737fcca26217be3534d4abb
Author: William Casarin <jb55@jb55.com>
Date:   Thu, 14 Nov 2019 17:53:59 -0800

lexer: dont support spaces between digits

Something weird was going on

Reported-by: james@coxj.com
Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
Mlexer.l | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lexer.l b/lexer.l @@ -14,7 +14,7 @@ static char * copy_num(char *in, int len) { for (int i = 0; i < len; i++) { char c = in[i]; - if (c != ',' && c != '_' && c != ' ') + if (c != ',' && c != '_') buf[j++] = c; } buf[j] = 0; @@ -71,7 +71,7 @@ fiat|FIAT|alt|ALT|usd|USD|cur|CUR|other|OTHER { return T_FLOAT; } -[0-9_, ]+ { +[0-9_,]+ { yylval.intval = strtoll(copy_num(yytext, yyleng), NULL, 10); return T_INT; }