Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Schorn2009-01-16 11:11:16 -0500
committerMarkus Schorn2009-01-16 11:11:16 -0500
commit46a72bfdbfbd81f02f1b6f12d52d2379df107dc9 (patch)
tree7cb1701d5d0e4f39f684f84675649123146962aa /lrparser/org.eclipse.cdt.core.lrparser
parenteb5caf452eaa7b30f3985347c8cf13ee06ee3550 (diff)
downloadorg.eclipse.cdt-46a72bfdbfbd81f02f1b6f12d52d2379df107dc9.tar.gz
org.eclipse.cdt-46a72bfdbfbd81f02f1b6f12d52d2379df107dc9.tar.xz
org.eclipse.cdt-46a72bfdbfbd81f02f1b6f12d52d2379df107dc9.zip
Make ambiguity resolution part of ASTTranslationUnit, bug 259373.
Diffstat (limited to 'lrparser/org.eclipse.cdt.core.lrparser')
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/BuildASTParserAction.java8
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/c99/C99BuildASTParserAction.java16
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/cpp/CPPBuildASTParserAction.java53
3 files changed, 49 insertions, 28 deletions
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/BuildASTParserAction.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/BuildASTParserAction.java
index 94df5f9774..401388ec4d 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/BuildASTParserAction.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/BuildASTParserAction.java
@@ -18,7 +18,6 @@ import java.util.List;
import lpg.lpgjavaruntime.IToken;
-import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTASMDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
@@ -160,16 +159,11 @@ public abstract class BuildASTParserAction extends AbstractParserAction {
* @see AbstractGNUSourceCodeParser#resolveAmbiguities()
*/
private void resolveAmbiguityNodes() {
- tu.accept(createAmbiguityNodeVisitor());
if (tu instanceof ASTTranslationUnit) {
- ((ASTTranslationUnit)tu).cleanupAfterAmbiguityResolution();
+ ((ASTTranslationUnit)tu).resolveAmbiguities();
}
}
-
- protected abstract ASTVisitor createAmbiguityNodeVisitor();
-
-
/**
* Consumes a single identifier token.
*/
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/c99/C99BuildASTParserAction.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/c99/C99BuildASTParserAction.java
index cdb81619f8..825794313e 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/c99/C99BuildASTParserAction.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/c99/C99BuildASTParserAction.java
@@ -11,18 +11,17 @@
package org.eclipse.cdt.core.dom.lrparser.action.c99;
-import static org.eclipse.cdt.internal.core.dom.lrparser.c99.C99Parsersym.*;
import static org.eclipse.cdt.core.dom.lrparser.action.ParserUtil.endOffset;
import static org.eclipse.cdt.core.dom.lrparser.action.ParserUtil.length;
-import static org.eclipse.cdt.core.dom.lrparser.action.ParserUtil.offset;
import static org.eclipse.cdt.core.dom.lrparser.action.ParserUtil.matchTokens;
+import static org.eclipse.cdt.core.dom.lrparser.action.ParserUtil.offset;
+import static org.eclipse.cdt.internal.core.dom.lrparser.c99.C99Parsersym.*;
import java.util.Collections;
import java.util.List;
import lpg.lpgjavaruntime.IToken;
-import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
@@ -50,7 +49,6 @@ import org.eclipse.cdt.core.dom.ast.IASTSwitchStatement;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
import org.eclipse.cdt.core.dom.ast.IASTWhileStatement;
-import org.eclipse.cdt.core.dom.ast.c.ICNodeFactory;
import org.eclipse.cdt.core.dom.ast.c.ICASTArrayDesignator;
import org.eclipse.cdt.core.dom.ast.c.ICASTArrayModifier;
import org.eclipse.cdt.core.dom.ast.c.ICASTCompositeTypeSpecifier;
@@ -62,6 +60,7 @@ import org.eclipse.cdt.core.dom.ast.c.ICASTPointer;
import org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.c.ICASTTypeIdInitializerExpression;
import org.eclipse.cdt.core.dom.ast.c.ICASTTypedefNameSpecifier;
+import org.eclipse.cdt.core.dom.ast.c.ICNodeFactory;
import org.eclipse.cdt.core.dom.ast.gnu.c.ICASTKnRFunctionDeclarator;
import org.eclipse.cdt.core.dom.lrparser.IParser;
import org.eclipse.cdt.core.dom.lrparser.IParserActionTokenProvider;
@@ -75,11 +74,9 @@ import org.eclipse.cdt.internal.core.dom.lrparser.c99.C99ExpressionParser;
import org.eclipse.cdt.internal.core.dom.lrparser.c99.C99NoCastExpressionParser;
import org.eclipse.cdt.internal.core.dom.lrparser.c99.C99Parsersym;
import org.eclipse.cdt.internal.core.dom.lrparser.c99.C99SizeofExpressionParser;
-import org.eclipse.cdt.internal.core.dom.parser.ASTAmbiguousNode;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguousExpression;
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguousStatement;
-import org.eclipse.cdt.internal.core.dom.parser.c.CASTAmbiguityResolver;
import org.eclipse.cdt.internal.core.dom.parser.c.CASTAmbiguousExpression;
import org.eclipse.cdt.internal.core.dom.parser.c.CASTAmbiguousStatement;
@@ -740,11 +737,4 @@ public class C99BuildASTParserAction extends BuildASTParserAction {
protected IASTAmbiguousStatement createAmbiguousStatement(IASTStatement... statements) {
return new CASTAmbiguousStatement(statements);
}
-
- @Override
- protected ASTVisitor createAmbiguityNodeVisitor() {
- return new CASTAmbiguityResolver();
- }
-
-
} \ No newline at end of file
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/cpp/CPPBuildASTParserAction.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/cpp/CPPBuildASTParserAction.java
index aa5d43d261..a80fead2b3 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/cpp/CPPBuildASTParserAction.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/cpp/CPPBuildASTParserAction.java
@@ -16,7 +16,51 @@ import static org.eclipse.cdt.core.dom.lrparser.action.ParserUtil.matchTokens;
import static org.eclipse.cdt.core.dom.lrparser.action.ParserUtil.offset;
import static org.eclipse.cdt.core.parser.util.CollectionUtils.findFirstAndRemove;
import static org.eclipse.cdt.core.parser.util.CollectionUtils.reverseIterable;
-import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.*;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_ColonColon;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_Completion;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_EndOfCompletion;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_GT;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_LT;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_LeftBracket;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_LeftParen;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_RightBracket;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_RightParen;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_Tilde;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_auto;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_bool;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_char;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_class;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_const;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_delete;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_double;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_enum;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_explicit;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_extern;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_float;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_for;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_friend;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_identifier;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_inline;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_int;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_long;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_mutable;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_new;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_private;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_protected;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_public;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_register;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_short;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_signed;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_static;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_struct;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_typedef;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_typename;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_union;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_unsigned;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_virtual;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_void;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_volatile;
+import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.TK_wchar_t;
import java.util.Arrays;
import java.util.Collections;
@@ -25,7 +69,6 @@ import java.util.List;
import lpg.lpgjavaruntime.IToken;
-import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
@@ -111,7 +154,6 @@ import org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPTemplateTypeParameterPa
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguousExpression;
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguousStatement;
-import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTAmbiguityResolver;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTAmbiguousDeclarator;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTAmbiguousExpression;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTAmbiguousStatement;
@@ -1792,9 +1834,4 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
protected IASTAmbiguousStatement createAmbiguousStatement(IASTStatement... statements) {
return new CPPASTAmbiguousStatement(statements);
}
-
- @Override
- protected ASTVisitor createAmbiguityNodeVisitor() {
- return new CPPASTAmbiguityResolver();
- }
} \ No newline at end of file

Back to the top