mirror of
http://git.hugovil.com/git/emu8051.git
synced 2025-10-14 02:48:29 +08:00
Allow hex numbers to begin with 0x or $ prefix in scanner
This commit is contained in:
@@ -5,8 +5,17 @@
|
||||
#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;
|
||||
|
Reference in New Issue
Block a user