Add support for C++17 hexadecimal floating literals

This commit is contained in:
Zackery Spytz 2019-02-13 15:16:40 -07:00
commit cf83adfcd1
7 changed files with 111 additions and 1 deletions

View file

@ -1196,6 +1196,10 @@ static int look(Scanner *s) {
return SWIG_TOKEN_INT;
if (isxdigit(c))
state = 85;
else if (c == '.') /* hexadecimal float */
state = 860;
else if ((c == 'p') || (c == 'P')) /* hexadecimal float */
state = 820;
else if ((c == 'l') || (c == 'L')) {
state = 87;
} else if ((c == 'u') || (c == 'U')) {
@ -1220,7 +1224,22 @@ static int look(Scanner *s) {
return SWIG_TOKEN_INT;
}
break;
case 860:
/* hexadecimal float */
if ((c = nextchar(s)) == 0) {
Swig_error(cparse_file, cparse_start_line, "Hexadecimal floating literals require an exponent\n");
return SWIG_TOKEN_ERROR;
}
if (isxdigit(c))
state = 860;
else if ((c == 'p') || (c == 'P'))
state = 820;
else {
retract(s, 2);
Swig_error(cparse_file, cparse_start_line, "Hexadecimal floating literals require an exponent\n");
return SWIG_TOKEN_ERROR;
}
break;
case 86:
/* Rest of floating point number */