use strtol to parse constants
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@9784 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
%{
|
%{
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997 - 2000 Kungliga Tekniska H<>gskolan
|
* Copyright (c) 1997 - 2001 Kungliga Tekniska H<>gskolan
|
||||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
@@ -80,7 +80,10 @@ EXTERNAL { return EXTERNAL; }
|
|||||||
"]" { return *yytext; }
|
"]" { return *yytext; }
|
||||||
::= { return EEQUAL; }
|
::= { return EEQUAL; }
|
||||||
--[^\n]*\n { ++lineno; }
|
--[^\n]*\n { ++lineno; }
|
||||||
-?[0-9]+ { yylval.constant = atoi(yytext); return CONSTANT; }
|
-?(0x)?[0-9]+ { char *e; yylval.constant = strtol(yytext, &e, 0);
|
||||||
|
if(e == yytext)
|
||||||
|
error_message("malformed constant (%s)", yytext);
|
||||||
|
else return CONSTANT; }
|
||||||
[A-Za-z][-A-Za-z0-9_]* { yylval.name = strdup (yytext); return IDENTIFIER; }
|
[A-Za-z][-A-Za-z0-9_]* { yylval.name = strdup (yytext); return IDENTIFIER; }
|
||||||
[ \t] ;
|
[ \t] ;
|
||||||
\n { ++lineno; }
|
\n { ++lineno; }
|
||||||
|
Reference in New Issue
Block a user