X-Git-Url: https://git.gag.com/?a=blobdiff_plain;ds=sidebyside;f=src%2FSDCC.lex;h=0fc43d00445ed1bd3f5881bb047b091f04423282;hb=5a1d5e778e85664f4e6657019348b4756b16eacb;hp=91f8bf319fe1566b56b659e3a41b4774686e552f;hpb=96e24452be2eb01070b96ac7a887d568c84a0afb;p=fw%2Fsdcc diff --git a/src/SDCC.lex b/src/SDCC.lex index 91f8bf31..0fc43d00 100644 --- a/src/SDCC.lex +++ b/src/SDCC.lex @@ -22,6 +22,7 @@ what you give them. Help stamp out software-hoarding! -------------------------------------------------------------------------*/ +B [0-1] D [0-9] L [a-zA-Z_$] H [a-fA-F0-9] @@ -199,6 +200,15 @@ _?"_asm" { count(); return(check_type()); } +0[bB]{B}+{IS}? { + if (!options.std_sdcc) + { + yyerror("binary (0b) constants are not allowed in ISO C"); + } + count(); + yylval.val = constVal(yytext); + return(CONSTANT); +} 0[xX]{H}+{IS}? { count(); yylval.val = constVal(yytext); return(CONSTANT); } 0[0-7]*{IS}? { count(); yylval.val = constVal(yytext); return(CONSTANT); } [1-9]{D}*{IS}? { count(); yylval.val = constVal(yytext); return(CONSTANT); } @@ -383,7 +393,7 @@ static int check_type(void) /* check if it is in the table as a typedef */ if (!ignoreTypedefType && sym && IS_SPEC (sym->etype) - && SPEC_TYPEDEF (sym->etype)) + && SPEC_TYPEDEF (sym->etype) && findSym(TypedefTab, NULL, yytext)) return (TYPE_NAME); else return(IDENTIFIER); @@ -501,8 +511,10 @@ static const char *stringLiteral(void) dbuf_destroy(&linebuf); } else - unput(ch); - break; + { + unput(ch); + goto out; + } default: count_char(ch);