diff options
author | Vlad Ivanov | 2018-04-19 10:36:26 +0000 |
---|---|---|
committer | Nathan Ridge | 2018-04-26 02:06:39 +0000 |
commit | 7d9e0b0ddd7e515966b01c3c7d222ecb71580ff1 (patch) | |
tree | 216b4c7a187cccfe986f67eb5a16f502d50ce356 /core/org.eclipse.cdt.core.tests/parser | |
parent | b9bac6912eda89d6b9a6f482818fb63c90dcf5fb (diff) | |
download | org.eclipse.cdt-7d9e0b0ddd7e515966b01c3c7d222ecb71580ff1.tar.gz org.eclipse.cdt-7d9e0b0ddd7e515966b01c3c7d222ecb71580ff1.tar.xz org.eclipse.cdt-7d9e0b0ddd7e515966b01c3c7d222ecb71580ff1.zip |
Bug 519062: add support for digit separators
Change-Id: I6fa990c76395dcc6f9b0e5e05707cff03a34b8db
Signed-off-by: Vlad Ivanov <vlad@ivanov.email>
Diffstat (limited to 'core/org.eclipse.cdt.core.tests/parser')
2 files changed, 29 insertions, 1 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java index 98a18631337..0f6998b7483 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java @@ -12653,4 +12653,23 @@ public class AST2CPPTests extends AST2CPPTestBase { public void testNestedNamespaceDefinition_490359() throws Exception { parseAndCheckBindings(); } + + // constexpr auto l_a = 0b01'100'100'100; + // constexpr auto l_b = 1'123'456; + // constexpr auto l_c = 0x1000'1000; + // constexpr auto l_d = 0111'1000; + // auto v_a = 1'123'456ul; + // auto v_b = 1'123'456ull; + // auto v_c = 0xAABB'CCDDll; + public void testLiteralDecimalSeparators_519062() throws Exception { + BindingAssertionHelper helper = getAssertionHelper(); + helper.assertVariableValue("l_a", 804); + helper.assertVariableValue("l_b", 1123456); + helper.assertVariableValue("l_c", 268439552); + helper.assertVariableValue("l_d", 299520); + + helper.assertVariableType("v_a", CPPBasicType.UNSIGNED_LONG); + helper.assertVariableType("v_b", CPPBasicType.UNSIGNED_LONG_LONG); + helper.assertVariableType("v_c", CPPBasicType.LONG_LONG); + } } diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/LexerTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/LexerTests.java index ee83ac3d8b8..1e0b056dd9b 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/LexerTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/LexerTests.java @@ -34,6 +34,7 @@ public class LexerTests extends BaseTestCase { NO_MINMAX.fSupportMinAndMax= false; SLASH_PERCENT.fSupportSlashPercentComments= true; CPP_OPTIONS.fSupportRawStringLiterals= true; + CPP_OPTIONS.fSupportDigitSeparators= true; } static String TRIGRAPH_REPLACES_CHARS= "#^[]|{}~\\"; @@ -452,7 +453,15 @@ public class LexerTests extends BaseTestCase { eof(); } } - + + public void testNumberSeparator() throws Exception { + String n = "123'456"; + + init(n, CPP_OPTIONS); + integer(n); + eof(); + } + public void testCharLiteral() throws Exception { String lit= "'abc0123\\'\".:; \\\\'"; init(lit); |