Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Kucera2008-02-14 22:31:55 +0000
committerMike Kucera2008-02-14 22:31:55 +0000
commit30fa8e597b35db5e992061b9ef222f79f29fddd6 (patch)
tree384ca80efbc192641194595dcce32a38a0e4851d /lrparser/org.eclipse.cdt.core.lrparser.tests
parent743d1d04ee3f9f6bfabe651daa18dcee09d36fae (diff)
downloadorg.eclipse.cdt-30fa8e597b35db5e992061b9ef222f79f29fddd6.tar.gz
org.eclipse.cdt-30fa8e597b35db5e992061b9ef222f79f29fddd6.tar.xz
org.eclipse.cdt-30fa8e597b35db5e992061b9ef222f79f29fddd6.zip
secondary parser to solve cast ambiguity in C++
Diffstat (limited to 'lrparser/org.eclipse.cdt.core.lrparser.tests')
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser.tests/src/org/eclipse/cdt/core/lrparser/tests/c99/C99Tests.java17
1 files changed, 11 insertions, 6 deletions
diff --git a/lrparser/org.eclipse.cdt.core.lrparser.tests/src/org/eclipse/cdt/core/lrparser/tests/c99/C99Tests.java b/lrparser/org.eclipse.cdt.core.lrparser.tests/src/org/eclipse/cdt/core/lrparser/tests/c99/C99Tests.java
index 399ba88e1ab..0ed58333fa0 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser.tests/src/org/eclipse/cdt/core/lrparser/tests/c99/C99Tests.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser.tests/src/org/eclipse/cdt/core/lrparser/tests/c99/C99Tests.java
@@ -18,6 +18,8 @@ import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier;
import org.eclipse.cdt.core.dom.lrparser.BaseExtensibleLanguage;
import org.eclipse.cdt.core.dom.lrparser.c99.C99Language;
+import org.eclipse.cdt.core.dom.lrparser.cpp.ISOCPPLanguage;
+import org.eclipse.cdt.core.model.ILanguage;
import org.eclipse.cdt.core.parser.ParserLanguage;
import org.eclipse.cdt.core.parser.tests.ast2.AST2Tests;
import org.eclipse.cdt.internal.core.parser.ParserException;
@@ -39,18 +41,21 @@ public class C99Tests extends AST2Tests {
}
- protected IASTTranslationUnit parse( String code, ParserLanguage lang, boolean useGNUExtensions, boolean expectNoProblems ) throws ParserException {
- if(lang != ParserLanguage.C)
- return super.parse(code, lang, useGNUExtensions, expectNoProblems);
-
- return ParseHelper.parse(code, getLanguage(), expectNoProblems);
+ @Override
+ protected IASTTranslationUnit parse( String code, ParserLanguage lang, boolean useGNUExtensions, boolean expectNoProblems ) throws ParserException {
+ ILanguage language = lang.isCPP() ? getCPPLanguage() : getC99Language();
+ return ParseHelper.parse(code, language, expectNoProblems);
}
- protected BaseExtensibleLanguage getLanguage() {
+ protected ILanguage getC99Language() {
return C99Language.getDefault();
}
+ protected ILanguage getCPPLanguage() {
+ return ISOCPPLanguage.getDefault();
+ }
+
public void testMultipleHashHash() throws Exception {
String code = "#define TWICE(a) int a##tera; int a##ther; \n TWICE(pan)";

Back to the top