Fix parsing of float constants with an exponent (e.g. 1e-02f) (bug #1699646).
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9688 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
4beedd3f04
commit
660d1c8a55
3 changed files with 29 additions and 3 deletions
|
|
@ -749,7 +749,7 @@ static int look(Scanner * s) {
|
|||
if (c == '.') {
|
||||
state = 81;
|
||||
} else if ((c == 'e') || (c == 'E')) {
|
||||
state = 86;
|
||||
state = 82;
|
||||
} else if ((c == 'f') || (c == 'F')) {
|
||||
Delitem(s->text, DOH_END);
|
||||
return SWIG_TOKEN_FLOAT;
|
||||
|
|
@ -770,10 +770,13 @@ static int look(Scanner * s) {
|
|||
if (isdigit(c))
|
||||
state = 81;
|
||||
else if ((c == 'e') || (c == 'E'))
|
||||
state = 82;
|
||||
else if ((c == 'f') || (c == 'F') || (c == 'l') || (c == 'L')) {
|
||||
state = 820;
|
||||
else if ((c == 'f') || (c == 'F')) {
|
||||
Delitem(s->text, DOH_END);
|
||||
return SWIG_TOKEN_FLOAT;
|
||||
} else if ((c == 'l') || (c == 'L')) {
|
||||
Delitem(s->text, DOH_END);
|
||||
return SWIG_TOKEN_DOUBLE;
|
||||
} else {
|
||||
retract(s, 1);
|
||||
return (SWIG_TOKEN_DOUBLE);
|
||||
|
|
@ -791,6 +794,19 @@ static int look(Scanner * s) {
|
|||
return (SWIG_TOKEN_INT);
|
||||
}
|
||||
break;
|
||||
case 820:
|
||||
/* Like case 82, but we've seen a decimal point. */
|
||||
if ((c = nextchar(s)) == 0) {
|
||||
retract(s, 1);
|
||||
return SWIG_TOKEN_DOUBLE;
|
||||
}
|
||||
if ((isdigit(c)) || (c == '-') || (c == '+'))
|
||||
state = 86;
|
||||
else {
|
||||
retract(s, 2);
|
||||
return (SWIG_TOKEN_DOUBLE);
|
||||
}
|
||||
break;
|
||||
case 83:
|
||||
/* Might be a hexadecimal or octal number */
|
||||
if ((c = nextchar(s)) == 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue