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
|
|
@ -1,6 +1,10 @@
|
|||
Version 1.3.32 (in progress)
|
||||
============================
|
||||
|
||||
04/21/2007: olly
|
||||
Fix parsing of float constants with an exponent (e.g. 1e-02f)
|
||||
(bug #1699646).
|
||||
|
||||
04/20/2007: olly
|
||||
[Python] Fix lack of generation of docstrings when -O is used.
|
||||
Also, fix generation of docstrings containing a double quote
|
||||
|
|
|
|||
|
|
@ -598,6 +598,12 @@ macro(size_t, pfx, sizet)
|
|||
return x + y;
|
||||
}
|
||||
|
||||
// Regression test for bug1699646 - we weren't handling
|
||||
// + or - after e for float constants.
|
||||
float regression_test_for_bug1699646(float f = 1e-02f) {
|
||||
return f;
|
||||
}
|
||||
|
||||
float val_float(float x) {
|
||||
return x;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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