X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fnasal%2Flex.c;h=89c3c407b28c578181f07c4e460c684ea8fe591d;hb=bcb320b537b6f7e5e3724e8a30d309322171eb43;hp=d3d525c316c52bfcf095b3a06a91d603871a9ef8;hpb=818359bfd09e493c8d74b7ace8b91f4d229eab67;p=simgear.git diff --git a/simgear/nasal/lex.c b/simgear/nasal/lex.c index d3d525c3..89c3c407 100644 --- a/simgear/nasal/lex.c +++ b/simgear/nasal/lex.c @@ -257,27 +257,26 @@ static int lexHexLiteral(struct Parser* p, int index) } #define ISNUM(c) ((c) >= '0' && (c) <= '9') - +#define ISHEX(c) (ISNUM(c) || ((c)>='a' && (c)<='f') || ((c)>='A' && (c)<='F')) +#define NUMSTART(c) (ISNUM(c) || (c) == '+' || (c) == '-') static int lexNumLiteral(struct Parser* p, int index) { int len = p->len, i = index; unsigned char* buf = (unsigned char*)p->buf; double d; - if(buf[0] == '0' && i+1= '0' && buf[i] <= '9') i++; + while(i= '0' && buf[i] <= '9') i++; + while(i= '0' && buf[i+1] <= '9')) i++; - while(i= '0' && buf[i] <= '9') i++; + if(buf[i] == '-' || buf[i] == '+') i++; + while(ibuf + index, i - index, &d); newToken(p, index, TOK_LITERAL, 0, 0, d);