projects
/
emu8051.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
7c267c5
)
Allow hex numbers to begin with 0x or $ prefix in scanner
author
Hugo Villeneuve
<hugo@hugovil.com>
Fri, 7 Feb 2014 04:00:10 +0000
(23:00 -0500)
committer
Hugo Villeneuve
<hugo@hugovil.com>
Thu, 13 Feb 2014 05:25:18 +0000
(
00:25
-0500)
src/cli/scanner.l
patch
|
blob
|
history
diff --git
a/src/cli/scanner.l
b/src/cli/scanner.l
index
2839f83
..
6abaa30
100644
(file)
--- a/
src/cli/scanner.l
+++ b/
src/cli/scanner.l
@@
-5,8
+5,17
@@
#include "parser.h"
#include "hexfile.h"
%}
#include "parser.h"
#include "hexfile.h"
%}
+
+digit [0-9]
+alpha [a-fA-F]
+hextail ({digit}|{alpha}){1,8}
+hex1 0[xX]{hextail}
+hex2 ${hextail}
+
%%
%%
-[0-9]+ { yylval.number = asciihex2int(yytext); return NUMBER; }
+{hex1} { yylval.number = asciihex2int(yytext); return NUMBER; }
+{hex2} { yylval.number = asciihex2int(&yytext[1]); return NUMBER; }
+[0-9]+ { yylval.number = atoi(yytext); return NUMBER; }
[h?] return TOK_HELP;
sb return TOK_SB;
rb return TOK_RB;
[h?] return TOK_HELP;
sb return TOK_SB;
rb return TOK_RB;