Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Kucera2008-05-02 19:21:21 +0000
committerMike Kucera2008-05-02 19:21:21 +0000
commit82df35cc3e164aa18d8f2290c484ae2b60ba53a2 (patch)
tree1124d338043671c82c982d3f5ea4122b31830365 /lrparser/org.eclipse.cdt.core.lrparser/src
parent8a4f9177cd0d32b8d4b12447b5e186e4318bc746 (diff)
downloadorg.eclipse.cdt-82df35cc3e164aa18d8f2290c484ae2b60ba53a2.tar.gz
org.eclipse.cdt-82df35cc3e164aa18d8f2290c484ae2b60ba53a2.tar.xz
org.eclipse.cdt-82df35cc3e164aa18d8f2290c484ae2b60ba53a2.zip
Template rebind tests now pass
Diffstat (limited to 'lrparser/org.eclipse.cdt.core.lrparser/src')
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/cpp/CPPBuildASTParserAction.java56
1 files changed, 24 insertions, 32 deletions
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 85c0b9c2084..3fbead3866f 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
@@ -700,29 +700,22 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
/**
* The template keyword is optional but must be the leftmost token.
+ *
+ * This just throws away the template keyword.
*/
- @Deprecated public void consumeNameWithTemplateKeyword() {
- if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
+ public void consumeNameWithTemplateKeyword() {
+ if(TRACE_ACTIONS)
+ DebugUtil.printMethodTrace();
IASTName name = (IASTName) astStack.pop();
- boolean hasTemplateKeyword = astStack.pop() == PLACE_HOLDER;
-
- if(hasTemplateKeyword)
- name = addTemplateKeyword(parser.getLeftIToken(), name);
+ astStack.pop(); // pop the template keyword
+
astStack.push(name);
if(TRACE_AST_STACK) System.out.println(astStack);
}
-
-
- @Deprecated private IASTName addTemplateKeyword(final IToken templateKeyword, final IASTName name) {
- IASTName replacement = nodeFactory.newName((templateKeyword + " " + name).toCharArray()); //$NON-NLS-1$
- int offset = offset(templateKeyword);
- int length = length(name) + (offset(name) - offset);
- setOffsetAndLength(replacement, offset, length);
- return replacement;
- }
+
@@ -1257,24 +1250,23 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
public void consumeInitDeclaratorComplete() {
if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
+
+ IASTDeclarator declarator = (IASTDeclarator) astStack.peek();
+ if(!(declarator instanceof IASTFunctionDeclarator))
+ return;
+
+ IParser secondaryParser = new CPPNoFunctionDeclaratorParser(parser.getOrderedTerminalSymbols());
+ IASTNode alternateDeclarator = runSecondaryParser(secondaryParser);
+
+ if(alternateDeclarator == null || alternateDeclarator instanceof IASTProblemDeclaration)
+ return;
+
+ astStack.pop();
+ IASTNode ambiguityNode = new CPPASTAmbiguousDeclarator(declarator, (IASTDeclarator)alternateDeclarator);
+
+ setOffsetAndLength(ambiguityNode);
+ astStack.push(ambiguityNode);
-// System.out.println(parser.getRuleTokens());
-// IASTDeclarator declarator = (IASTDeclarator) astStack.peek();
-// if(!(declarator instanceof IASTFunctionDeclarator))
-// return;
-//
-// IParser secondaryParser = new CPPNoFunctionDeclaratorParser(parser.getOrderedTerminalSymbols());
-// IASTNode alternateDeclarator = runSecondaryParser(secondaryParser);
-//
-// if(alternateDeclarator == null || alternateDeclarator instanceof IASTProblemDeclaration)
-// return;
-//
-// astStack.pop();
-// IASTNode ambiguityNode = new CPPASTAmbiguousDeclarator(declarator, (IASTDeclarator)alternateDeclarator);
-//
-// setOffsetAndLength(ambiguityNode);
-// astStack.push(ambiguityNode);
-//
if(TRACE_AST_STACK) System.out.println(astStack);
}

Back to the top