parent
a0720885bd
commit
23d83cd9c1
5 changed files with 68 additions and 0 deletions
|
|
@ -7,6 +7,9 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
|
||||||
Version 4.0.0 (in progress)
|
Version 4.0.0 (in progress)
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
|
2019-02-10: ZackerySpytz
|
||||||
|
#1464 Add support for C++14 binary integer literals.
|
||||||
|
|
||||||
2019-02-10: ZackerySpytz
|
2019-02-10: ZackerySpytz
|
||||||
#1450 Add support for C++11 UCS-2 and UCS-4 character literals. Also add support for
|
#1450 Add support for C++11 UCS-2 and UCS-4 character literals. Also add support for
|
||||||
C++17 UTF8 character literals.
|
C++17 UTF8 character literals.
|
||||||
|
|
|
||||||
|
|
@ -162,6 +162,7 @@ CPP_TEST_CASES += \
|
||||||
cpp_nodefault \
|
cpp_nodefault \
|
||||||
cpp_static \
|
cpp_static \
|
||||||
cpp_typedef \
|
cpp_typedef \
|
||||||
|
cpp14_binary_integer_literals \
|
||||||
cpp17_nested_namespaces \
|
cpp17_nested_namespaces \
|
||||||
cpp17_nspace_nested_namespaces \
|
cpp17_nspace_nested_namespaces \
|
||||||
cpp17_u8_char_literals \
|
cpp17_u8_char_literals \
|
||||||
|
|
|
||||||
31
Examples/test-suite/cpp14_binary_integer_literals.i
Normal file
31
Examples/test-suite/cpp14_binary_integer_literals.i
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
%module cpp14_binary_integer_literals
|
||||||
|
|
||||||
|
// Tests are designed so that code compiles with C++98 compilers
|
||||||
|
|
||||||
|
%{
|
||||||
|
#if __cplusplus >= 201402L
|
||||||
|
#define CPP14 1
|
||||||
|
#endif
|
||||||
|
%}
|
||||||
|
|
||||||
|
int b1 = 0b1;
|
||||||
|
int b2 = 0b10;
|
||||||
|
long b3 = 0b11l;
|
||||||
|
unsigned long b4 = 0b100ul;
|
||||||
|
unsigned long b5 = 0B101UL;
|
||||||
|
|
||||||
|
%{
|
||||||
|
#if defined(CPP14)
|
||||||
|
int b1 = 0b1;
|
||||||
|
int b2 = 0b10;
|
||||||
|
long b3 = 0b11l;
|
||||||
|
unsigned long b4 = 0b100ul;
|
||||||
|
unsigned long b5 = 0B101UL;
|
||||||
|
#else
|
||||||
|
int b1 = 1;
|
||||||
|
int b2 = 2;
|
||||||
|
long b3 = 3;
|
||||||
|
unsigned long b4 = 4;
|
||||||
|
unsigned long b5 = 5;
|
||||||
|
#endif
|
||||||
|
%}
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
from cpp14_binary_integer_literals import *
|
||||||
|
|
||||||
|
if cvar.b1 != 1:
|
||||||
|
raise RuntimeError
|
||||||
|
|
||||||
|
if cvar.b2 != 2:
|
||||||
|
raise RuntimeError
|
||||||
|
|
||||||
|
if cvar.b3 != 3:
|
||||||
|
raise RuntimeError
|
||||||
|
|
||||||
|
if cvar.b4 != 4:
|
||||||
|
raise RuntimeError
|
||||||
|
|
||||||
|
if cvar.b5 != 5:
|
||||||
|
raise RuntimeError
|
||||||
|
|
@ -1162,6 +1162,8 @@ static int look(Scanner *s) {
|
||||||
state = 84;
|
state = 84;
|
||||||
else if ((c == 'x') || (c == 'X'))
|
else if ((c == 'x') || (c == 'X'))
|
||||||
state = 85;
|
state = 85;
|
||||||
|
else if ((c == 'b') || (c == 'B'))
|
||||||
|
state = 850;
|
||||||
else if (c == '.')
|
else if (c == '.')
|
||||||
state = 81;
|
state = 81;
|
||||||
else if ((c == 'l') || (c == 'L')) {
|
else if ((c == 'l') || (c == 'L')) {
|
||||||
|
|
@ -1203,6 +1205,21 @@ static int look(Scanner *s) {
|
||||||
return SWIG_TOKEN_INT;
|
return SWIG_TOKEN_INT;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 850:
|
||||||
|
/* This is a binary number */
|
||||||
|
if ((c = nextchar(s)) == 0)
|
||||||
|
return SWIG_TOKEN_INT;
|
||||||
|
if ((c == '0') || (c == '1'))
|
||||||
|
state = 850;
|
||||||
|
else if ((c == 'l') || (c == 'L')) {
|
||||||
|
state = 87;
|
||||||
|
} else if ((c == 'u') || (c == 'U')) {
|
||||||
|
state = 88;
|
||||||
|
} else {
|
||||||
|
retract(s, 1);
|
||||||
|
return SWIG_TOKEN_INT;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case 86:
|
case 86:
|
||||||
/* Rest of floating point number */
|
/* Rest of floating point number */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue