mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
fixed problems with auto_ptr tests and overloadable operators
This commit is contained in:
parent
8342cee582
commit
230652a572
13 changed files with 5656 additions and 5762 deletions
|
@ -306,18 +306,6 @@ $Rules
|
|||
::= $empty
|
||||
/.$Action $Builder openASTScope(); $EndBuilder $EndAction./
|
||||
|
||||
<openscope-symbol>
|
||||
::= $empty
|
||||
-- /.$Action $Resolve openSymbolScope(); $EndResolve $EndAction./
|
||||
|
||||
<openscope-declaration>
|
||||
::= $empty
|
||||
-- /.$Action $Resolve openDeclarationScope(); $EndResolve $EndAction./
|
||||
|
||||
<placeholder>
|
||||
::= $empty
|
||||
/.$Action $Builder consumePlaceHolder(); $EndBuilder $EndAction./
|
||||
|
||||
<empty>
|
||||
::= $empty
|
||||
/.$Action $Builder consumeEmpty(); $EndBuilder $EndAction./
|
||||
|
@ -371,11 +359,6 @@ external_declaration
|
|||
/. $Build consumeDeclarationProblem(); $EndBuild ./
|
||||
|
||||
|
||||
--expression_as_translation_unit
|
||||
-- ::= expression
|
||||
-- /. $Build consumeExpressionAsTranslationUnit(); $EndBuild ./
|
||||
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
-- Expressions
|
||||
------------------------------------------------------------------------------------------
|
||||
|
@ -996,7 +979,7 @@ simple_declaration_specifiers
|
|||
| no_type_declaration_specifiers simple_type_specifier
|
||||
| simple_declaration_specifiers simple_type_specifier
|
||||
| simple_declaration_specifiers no_type_declaration_specifier
|
||||
| $empty
|
||||
| no_type_declaration_specifiers
|
||||
|
||||
|
||||
-- struct, union or class!
|
||||
|
@ -1724,7 +1707,7 @@ template_id_name
|
|||
/. $Build consumeTemplateId(); $EndBuild ./
|
||||
|
||||
template_identifier
|
||||
::= 'identifier'
|
||||
::= identifier_name
|
||||
|
||||
|
||||
template_argument_list
|
||||
|
|
|
@ -23,7 +23,7 @@ import lpg.lpgjavaruntime.PrsStream;
|
|||
*
|
||||
* @author Mike Kucera
|
||||
*/
|
||||
class LPGTokenAdapter implements lpg.lpgjavaruntime.IToken {
|
||||
public class LPGTokenAdapter implements lpg.lpgjavaruntime.IToken {
|
||||
|
||||
/** The token object that is being wrapped */
|
||||
private final org.eclipse.cdt.core.parser.IToken token;
|
||||
|
@ -39,6 +39,10 @@ class LPGTokenAdapter implements lpg.lpgjavaruntime.IToken {
|
|||
this.kind = parserKind;
|
||||
}
|
||||
|
||||
public org.eclipse.cdt.core.parser.IToken getWrappedToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
public int getAdjunctIndex() {
|
||||
return adjunctIndex;
|
||||
}
|
||||
|
|
|
@ -850,8 +850,10 @@ public abstract class BuildASTParserAction {
|
|||
IASTDeclarator declarator;
|
||||
if(hasDeclarator)
|
||||
declarator = (IASTDeclarator) astStack.pop();
|
||||
else
|
||||
else {
|
||||
declarator = nodeFactory.newDeclarator(nodeFactory.newName());
|
||||
setOffsetAndLength(declarator, parser.getRightIToken().getEndOffset(), 0);
|
||||
}
|
||||
|
||||
IASTDeclSpecifier declSpecifier = (IASTDeclSpecifier) astStack.pop();
|
||||
IASTTypeId typeId = nodeFactory.newTypeId(declSpecifier, declarator);
|
||||
|
|
|
@ -181,6 +181,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTUsingDeclaration;
|
|||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTUsingDirective;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTVisibilityLabel;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTWhileStatement;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.OverloadableOperator;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -206,8 +207,8 @@ public class CPPASTNodeFactory implements ICPPASTNodeFactory {
|
|||
return new CPPASTName();
|
||||
}
|
||||
|
||||
public ICPPASTOperatorName newCPPOperatorName(char[] name) {
|
||||
return new CPPASTOperatorName(name);
|
||||
public ICPPASTOperatorName newCPPOperatorName(OverloadableOperator op) {
|
||||
return new CPPASTOperatorName(op);
|
||||
}
|
||||
|
||||
public IASTProblem newProblem(int id, char[] arg, boolean error) {
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.dom.lrparser.action.cpp;
|
||||
|
||||
import static org.eclipse.cdt.core.dom.lrparser.util.CollectionUtils.findFirstAndRemove;
|
||||
import static org.eclipse.cdt.core.dom.lrparser.util.CollectionUtils.reverseIterable;
|
||||
import static org.eclipse.cdt.core.dom.lrparser.util.CollectionUtils.*;
|
||||
|
||||
import static org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym.*;
|
||||
|
||||
import java.util.Collections;
|
||||
|
@ -36,6 +36,7 @@ import org.eclipse.cdt.core.dom.ast.IASTInitializer;
|
|||
import org.eclipse.cdt.core.dom.ast.IASTInitializerExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTLiteralExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTPointer;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTPointerOperator;
|
||||
|
@ -84,7 +85,9 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisiblityLabel;
|
|||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
|
||||
import org.eclipse.cdt.core.dom.lrparser.IParser;
|
||||
import org.eclipse.cdt.core.dom.lrparser.IParserActionTokenProvider;
|
||||
import org.eclipse.cdt.core.dom.lrparser.LPGTokenAdapter;
|
||||
import org.eclipse.cdt.core.dom.lrparser.action.BuildASTParserAction;
|
||||
import org.eclipse.cdt.core.dom.lrparser.util.CollectionUtils;
|
||||
import org.eclipse.cdt.core.dom.lrparser.util.DebugUtil;
|
||||
import org.eclipse.cdt.internal.core.dom.lrparser.c99.C99ExpressionStatementParser;
|
||||
import org.eclipse.cdt.internal.core.dom.lrparser.c99.C99Parsersym;
|
||||
|
@ -92,6 +95,7 @@ import org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPExpressionStatementPars
|
|||
import org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPNoCastExpressionParser;
|
||||
import org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTFunctionDeclarator;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.OverloadableOperator;
|
||||
|
||||
/**
|
||||
* Semantic actions that build the AST during the parse.
|
||||
|
@ -134,36 +138,6 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
|
|||
}
|
||||
|
||||
|
||||
// /**
|
||||
// * Used only for debugging purposes.
|
||||
// *
|
||||
// * Use this to make expression the start symbol for the grammar,
|
||||
// * it will be inserted into the translation unit inside a function.
|
||||
// */
|
||||
// @Deprecated public void consumeExpressionAsTranslationUnit() {
|
||||
// if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
|
||||
//
|
||||
// IASTExpression expression = (IASTExpression) astStack.pop();
|
||||
//
|
||||
// ICPPASTSimpleDeclSpecifier declSpec = nodeFactory.newCPPSimpleDeclSpecifier();
|
||||
// declSpec.setType(IASTSimpleDeclSpecifier.t_int);
|
||||
//
|
||||
// IASTFunctionDeclarator declarator = nodeFactory.newFunctionDeclarator(nodeFactory.newName("main".toCharArray())); //$NON-NLS-1$
|
||||
//
|
||||
// IASTCompoundStatement body = nodeFactory.newCompoundStatement();
|
||||
// body.addStatement(nodeFactory.newExpressionStatement(expression));
|
||||
//
|
||||
//
|
||||
// IASTFunctionDefinition funcDef =
|
||||
// nodeFactory.newFunctionDefinition(declSpec, declarator, body);
|
||||
//
|
||||
// tu.addDeclaration(funcDef);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* new_expression
|
||||
* ::= dcolon_opt 'new' new_placement_opt new_type_id <openscope-ast> new_array_expressions_op new_initializer_opt
|
||||
|
@ -407,9 +381,10 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
|
|||
if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
|
||||
|
||||
List<IToken> tokens = parser.getRuleTokens();
|
||||
char[] operatorName = concatenateTokens(tokens.subList(1, tokens.size()));
|
||||
tokens = tokens.subList(1, tokens.size());
|
||||
OverloadableOperator operator = getOverloadableOperator(tokens);
|
||||
|
||||
ICPPASTOperatorName name = nodeFactory.newCPPOperatorName(operatorName);
|
||||
ICPPASTOperatorName name = nodeFactory.newCPPOperatorName(operator);
|
||||
setOffsetAndLength(name);
|
||||
astStack.push(name);
|
||||
|
||||
|
@ -417,15 +392,20 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
|
|||
}
|
||||
|
||||
|
||||
private static char[] concatenateTokens(List<IToken> tokens) {
|
||||
StringBuilder sb = new StringBuilder(20); // longest operator name: operator delete[]
|
||||
private static OverloadableOperator getOverloadableOperator(List<IToken> tokens) {
|
||||
if(tokens.size() == 1) {
|
||||
// TODO this is a hack that I did to save time
|
||||
LPGTokenAdapter coreToken = (LPGTokenAdapter) tokens.get(0);
|
||||
return OverloadableOperator.valueOf(coreToken.getWrappedToken());
|
||||
}
|
||||
else if(matchTokens(tokens, TK_new, TK_LeftBracket, TK_RightBracket)) {
|
||||
return OverloadableOperator.NEW_ARRAY;
|
||||
}
|
||||
else if(matchTokens(tokens, TK_delete, TK_LeftBracket, TK_RightBracket)) {
|
||||
return OverloadableOperator.DELETE_ARRAY;
|
||||
}
|
||||
|
||||
for(IToken t : tokens)
|
||||
sb.append(t);
|
||||
|
||||
char[] cs = new char[sb.length()];
|
||||
sb.getChars(0, sb.length(), cs, 0);
|
||||
return cs;
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
@ -448,6 +428,17 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
|
|||
}
|
||||
|
||||
|
||||
private static char[] concatenateTokens(List<IToken> tokens) {
|
||||
StringBuilder sb = new StringBuilder(20); // longest operator name: operator delete[]
|
||||
|
||||
for(IToken t : tokens)
|
||||
sb.append(t);
|
||||
|
||||
char[] cs = new char[sb.length()];
|
||||
sb.getChars(0, sb.length(), cs, 0);
|
||||
return cs;
|
||||
}
|
||||
|
||||
/**
|
||||
* unqualified_id
|
||||
* ::= '~' class_name
|
||||
|
@ -1367,6 +1358,11 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
|
|||
ICPPASTFunctionDeclarator declarator = (ICPPASTFunctionDeclarator) astStack.pop();
|
||||
IASTDeclSpecifier declSpec = (IASTDeclSpecifier) astStack.pop(); // may be null
|
||||
|
||||
if(declSpec == null) { // can happen if implicit int is used
|
||||
declSpec = nodeFactory.newSimpleDeclSpecifier();
|
||||
setOffsetAndLength(declSpec, parser.getLeftIToken().getStartOffset(), 0);
|
||||
}
|
||||
|
||||
if(isTryBlockDeclarator) {
|
||||
// perform a shallow copy
|
||||
ICPPASTFunctionTryBlockDeclarator tryBlockDeclarator = nodeFactory.newFunctionTryBlockDeclarator(declarator.getName());
|
||||
|
@ -1380,7 +1376,6 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
|
|||
for(IASTTypeId exception : declarator.getExceptionSpecification()) {
|
||||
tryBlockDeclarator.addExceptionSpecificationTypeId(exception);
|
||||
}
|
||||
|
||||
for(Object handler : handlers) {
|
||||
tryBlockDeclarator.addCatchHandler((ICPPASTCatchHandler)handler);
|
||||
}
|
||||
|
@ -1388,8 +1383,16 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
|
|||
declarator = tryBlockDeclarator;
|
||||
}
|
||||
|
||||
for(Object initializer : initializers) {
|
||||
declarator.addConstructorToChain((ICPPASTConstructorChainInitializer)initializer);
|
||||
|
||||
if(initializers != null && !initializers.isEmpty()) {
|
||||
for(Object initializer : initializers)
|
||||
declarator.addConstructorToChain((ICPPASTConstructorChainInitializer)initializer);
|
||||
|
||||
// recalculate the length of the declarator to include the initializers
|
||||
IASTNode lastInitializer = (IASTNode)initializers.get(initializers.size()-1);
|
||||
int offset = offset(declarator);
|
||||
int length = endOffset(lastInitializer) - offset;
|
||||
setOffsetAndLength(declarator, offset, length);
|
||||
}
|
||||
|
||||
IASTFunctionDefinition definition = nodeFactory.newFunctionDefinition(declSpec, declarator, body);
|
||||
|
|
|
@ -53,6 +53,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisiblityLabel;
|
|||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
|
||||
import org.eclipse.cdt.core.dom.lrparser.action.IASTNodeFactory;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguousDeclaration;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.OverloadableOperator;
|
||||
|
||||
/**
|
||||
* TODO remove CPP from method names.
|
||||
|
@ -62,7 +63,7 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguousDeclaration;
|
|||
@SuppressWarnings("restriction")
|
||||
public interface ICPPASTNodeFactory extends IASTNodeFactory {
|
||||
|
||||
public ICPPASTOperatorName newCPPOperatorName(char[] name);
|
||||
public ICPPASTOperatorName newCPPOperatorName(OverloadableOperator op);
|
||||
|
||||
public ICPPASTNewExpression newCPPNewExpression(IASTExpression placement, IASTExpression initializer, IASTTypeId typeId);
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
|||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator;
|
||||
|
@ -51,16 +52,18 @@ import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
|
|||
*
|
||||
* @author Mike Kucera
|
||||
*/
|
||||
@SuppressWarnings("restriction")
|
||||
@SuppressWarnings({"restriction","nls"})
|
||||
class ASTPrinter {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Prints the AST to the given PrintStream.
|
||||
*/
|
||||
public static void printAST(IASTTranslationUnit root, PrintStream stream) {
|
||||
PrintStream out = stream == null ? System.out : stream;
|
||||
if(root == null) {
|
||||
out.println("null"); //$NON-NLS-1$
|
||||
out.println("null");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -103,7 +106,7 @@ class ASTPrinter {
|
|||
public static void printProblems(IASTTranslationUnit root, PrintStream stream) {
|
||||
PrintStream out = stream == null ? System.out : stream;
|
||||
if(root == null) {
|
||||
out.println("null");//$NON-NLS-1$
|
||||
out.println("null");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -125,10 +128,10 @@ class ASTPrinter {
|
|||
|
||||
private static void print(PrintStream out, int indentLevel, Object n) {
|
||||
for(int i = 0; i < indentLevel; i++)
|
||||
out.print(" "); //$NON-NLS-1$
|
||||
out.print(" ");
|
||||
|
||||
if(n == null) {
|
||||
out.println("NULL"); //$NON-NLS-1$
|
||||
out.println("NULL");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -137,18 +140,18 @@ class ASTPrinter {
|
|||
|
||||
if(n instanceof ASTNode) {
|
||||
ASTNode node = (ASTNode) n;
|
||||
out.print(" (" + node.getOffset() + "," + node.getLength() + ") "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
out.print(" (" + node.getOffset() + "," + node.getLength() + ") "); //$NON-NLS-2$ //$NON-NLS-3$
|
||||
if(node.getParent() == null && !(node instanceof IASTTranslationUnit)) {
|
||||
out.print("PARENT IS NULL ");//$NON-NLS-1$
|
||||
out.print("PARENT IS NULL ");
|
||||
}
|
||||
//out.print(node.getPropertyInParent());
|
||||
out.print(node.getPropertyInParent());
|
||||
}
|
||||
|
||||
if(n instanceof ICArrayType) {
|
||||
ICArrayType at = (ICArrayType)n;
|
||||
try {
|
||||
if(at.isRestrict()) {
|
||||
out.print(" restrict"); //$NON-NLS-1$
|
||||
out.print(" restrict");
|
||||
}
|
||||
} catch (DOMException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -156,26 +159,26 @@ class ASTPrinter {
|
|||
}
|
||||
|
||||
if(n instanceof IASTName) {
|
||||
out.print(" " + ((IASTName)n).toString()); //$NON-NLS-1$
|
||||
out.print(" " + ((IASTName)n).toString());
|
||||
}
|
||||
else if(n instanceof ICASTPointer) {
|
||||
ICASTPointer pointer = (ICASTPointer) n;
|
||||
if(pointer.isConst())
|
||||
out.print(" const"); //$NON-NLS-1$
|
||||
out.print(" const");
|
||||
if(pointer.isVolatile())
|
||||
out.print(" volatile"); //$NON-NLS-1$
|
||||
out.print(" volatile");
|
||||
if(pointer.isRestrict())
|
||||
out.print(" restrict");//$NON-NLS-1$
|
||||
out.print(" restrict");
|
||||
}
|
||||
else if(n instanceof ICPointerType) {
|
||||
ICPointerType pointer = (ICPointerType)n;
|
||||
try {
|
||||
if(pointer.isConst())
|
||||
out.print(" const"); //$NON-NLS-1$
|
||||
out.print(" const");
|
||||
if(pointer.isVolatile())
|
||||
out.print(" volatile"); //$NON-NLS-1$
|
||||
out.print(" volatile");
|
||||
if(pointer.isRestrict())
|
||||
out.print(" restrict");//$NON-NLS-1$
|
||||
out.print(" restrict");
|
||||
} catch (DOMException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -186,7 +189,7 @@ class ASTPrinter {
|
|||
}
|
||||
else if(n instanceof ICASTArrayModifier) {
|
||||
if(((ICASTArrayModifier)n).isRestrict()) {
|
||||
out.print(" restrict"); //$NON-NLS-1$
|
||||
out.print(" restrict");
|
||||
}
|
||||
}
|
||||
else if(n instanceof IASTComment) {
|
||||
|
@ -224,6 +227,10 @@ class ASTPrinter {
|
|||
}
|
||||
|
||||
}
|
||||
else if(n instanceof IProblemBinding) {
|
||||
IProblemBinding problem = (IProblemBinding)n;
|
||||
out.print(problem.getMessage());
|
||||
}
|
||||
|
||||
|
||||
out.println();
|
||||
|
@ -241,23 +248,27 @@ class ASTPrinter {
|
|||
shouldVisitExpressions = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int visit(IASTProblem problem) {
|
||||
print(out, 1, problem);
|
||||
return PROCESS_CONTINUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int visit(IASTDeclaration declaration) {
|
||||
if(declaration instanceof IASTProblemDeclaration)
|
||||
print(out, 0, declaration);
|
||||
return PROCESS_CONTINUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int visit(IASTExpression expression) {
|
||||
if(expression instanceof IASTProblemExpression)
|
||||
print(out, 0, expression);
|
||||
return PROCESS_CONTINUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int visit(IASTStatement statement) {
|
||||
if(statement instanceof IASTProblemStatement)
|
||||
print(out, 0, statement);
|
||||
|
@ -298,24 +309,28 @@ class ASTPrinter {
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int visit(IASTComment comment) {
|
||||
print(comment);
|
||||
indentLevel++;
|
||||
return super.visit(comment);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int visit(ICASTDesignator designator) {
|
||||
print(designator);
|
||||
indentLevel++;
|
||||
return super.visit(designator);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int visit(IASTDeclaration declaration) {
|
||||
print(declaration);
|
||||
indentLevel++;
|
||||
return super.visit(declaration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int visit(IASTDeclarator declarator) {
|
||||
print(declarator);
|
||||
indentLevel++;
|
||||
|
@ -327,146 +342,172 @@ class ASTPrinter {
|
|||
IASTArrayDeclarator decl = (IASTArrayDeclarator)declarator;
|
||||
org.eclipse.cdt.core.dom.ast.IASTArrayModifier[] modifiers = decl.getArrayModifiers();
|
||||
for(int i = 0; i < modifiers.length; i++) {
|
||||
print((IASTNode)modifiers[i]);
|
||||
print(modifiers[i]);
|
||||
}
|
||||
}
|
||||
return super.visit(declarator);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int visit(IASTDeclSpecifier declSpec) {
|
||||
print(declSpec);
|
||||
indentLevel++;
|
||||
return super.visit(declSpec);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int visit(IASTEnumerator enumerator) {
|
||||
print(enumerator);
|
||||
indentLevel++;
|
||||
return super.visit(enumerator);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int visit(IASTExpression expression) {
|
||||
print(expression);
|
||||
indentLevel++;
|
||||
return super.visit(expression);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int visit(IASTInitializer initializer) {
|
||||
print(initializer);
|
||||
indentLevel++;
|
||||
return super.visit(initializer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int visit(IASTName name) {
|
||||
print(name);
|
||||
IBinding binding = name.resolveBinding();
|
||||
print(binding);
|
||||
try {
|
||||
IBinding binding = name.resolveBinding();
|
||||
print(binding);
|
||||
} catch(Exception e) {
|
||||
System.out.println("Exception while resolving binding: " + name);
|
||||
}
|
||||
|
||||
indentLevel++;
|
||||
return super.visit(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int visit(IASTParameterDeclaration parameterDeclaration) {
|
||||
print(parameterDeclaration);
|
||||
indentLevel++;
|
||||
return super.visit(parameterDeclaration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int visit(IASTProblem problem) {
|
||||
print(problem);
|
||||
indentLevel++;
|
||||
return super.visit(problem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int visit(IASTStatement statement) {
|
||||
print(statement);
|
||||
indentLevel++;
|
||||
return super.visit(statement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int visit(IASTTranslationUnit tu) {
|
||||
print(tu);
|
||||
indentLevel++;
|
||||
return super.visit(tu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int visit(IASTTypeId typeId) {
|
||||
print(typeId);
|
||||
indentLevel++;
|
||||
return super.visit(typeId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int leave(IASTComment comment) {
|
||||
indentLevel--;
|
||||
return super.leave(comment);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int leave(ICASTDesignator designator) {
|
||||
indentLevel--;
|
||||
return super.leave(designator);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int leave(IASTDeclaration declaration) {
|
||||
indentLevel--;
|
||||
return super.leave(declaration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int leave(IASTDeclarator declarator) {
|
||||
indentLevel--;
|
||||
return super.leave(declarator);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int leave(IASTDeclSpecifier declSpec) {
|
||||
indentLevel--;
|
||||
return super.leave(declSpec);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int leave(IASTEnumerator enumerator) {
|
||||
indentLevel--;
|
||||
return super.leave(enumerator);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int leave(IASTExpression expression) {
|
||||
indentLevel--;
|
||||
return super.leave(expression);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int leave(IASTInitializer initializer) {
|
||||
indentLevel--;
|
||||
return super.leave(initializer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int leave(IASTName name) {
|
||||
indentLevel--;
|
||||
return super.leave(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int leave(IASTParameterDeclaration parameterDeclaration) {
|
||||
indentLevel--;
|
||||
return super.leave(parameterDeclaration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int leave(IASTProblem problem) {
|
||||
indentLevel--;
|
||||
return super.leave(problem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int leave(IASTStatement statement) {
|
||||
indentLevel--;
|
||||
return super.leave(statement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int leave(IASTTranslationUnit tu) {
|
||||
indentLevel--;
|
||||
return super.leave(tu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int leave(IASTTypeId typeId) {
|
||||
indentLevel--;
|
||||
return super.leave(typeId);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -15,38 +15,38 @@ package org.eclipse.cdt.internal.core.dom.lrparser.cpp;
|
|||
|
||||
public interface CPPExpressionStatementParsersym {
|
||||
public final static int
|
||||
TK_asm = 68,
|
||||
TK_asm = 67,
|
||||
TK_auto = 48,
|
||||
TK_bool = 13,
|
||||
TK_break = 78,
|
||||
TK_case = 79,
|
||||
TK_break = 76,
|
||||
TK_case = 77,
|
||||
TK_catch = 115,
|
||||
TK_char = 14,
|
||||
TK_class = 58,
|
||||
TK_class = 57,
|
||||
TK_const = 46,
|
||||
TK_const_cast = 26,
|
||||
TK_continue = 80,
|
||||
TK_default = 81,
|
||||
TK_continue = 78,
|
||||
TK_default = 79,
|
||||
TK_delete = 40,
|
||||
TK_do = 82,
|
||||
TK_do = 80,
|
||||
TK_double = 15,
|
||||
TK_dynamic_cast = 27,
|
||||
TK_else = 120,
|
||||
TK_enum = 60,
|
||||
TK_enum = 59,
|
||||
TK_explicit = 49,
|
||||
TK_export = 74,
|
||||
TK_extern = 42,
|
||||
TK_false = 28,
|
||||
TK_float = 16,
|
||||
TK_for = 83,
|
||||
TK_for = 81,
|
||||
TK_friend = 50,
|
||||
TK_goto = 84,
|
||||
TK_if = 85,
|
||||
TK_goto = 82,
|
||||
TK_if = 83,
|
||||
TK_inline = 51,
|
||||
TK_int = 17,
|
||||
TK_long = 18,
|
||||
TK_mutable = 52,
|
||||
TK_namespace = 66,
|
||||
TK_namespace = 65,
|
||||
TK_new = 41,
|
||||
TK_operator = 6,
|
||||
TK_private = 116,
|
||||
|
@ -54,14 +54,14 @@ public interface CPPExpressionStatementParsersym {
|
|||
TK_public = 118,
|
||||
TK_register = 53,
|
||||
TK_reinterpret_cast = 29,
|
||||
TK_return = 86,
|
||||
TK_return = 84,
|
||||
TK_short = 19,
|
||||
TK_signed = 20,
|
||||
TK_sizeof = 30,
|
||||
TK_static = 54,
|
||||
TK_static_cast = 31,
|
||||
TK_struct = 61,
|
||||
TK_switch = 87,
|
||||
TK_struct = 60,
|
||||
TK_switch = 85,
|
||||
TK_template = 55,
|
||||
TK_this = 32,
|
||||
TK_throw = 39,
|
||||
|
@ -69,8 +69,8 @@ public interface CPPExpressionStatementParsersym {
|
|||
TK_true = 33,
|
||||
TK_typedef = 56,
|
||||
TK_typeid = 34,
|
||||
TK_typename = 10,
|
||||
TK_union = 62,
|
||||
TK_typename = 8,
|
||||
TK_union = 61,
|
||||
TK_unsigned = 21,
|
||||
TK_using = 64,
|
||||
TK_virtual = 45,
|
||||
|
@ -86,9 +86,9 @@ public interface CPPExpressionStatementParsersym {
|
|||
TK_Completion = 121,
|
||||
TK_EndOfCompletion = 122,
|
||||
TK_Invalid = 123,
|
||||
TK_LeftBracket = 57,
|
||||
TK_LeftBracket = 62,
|
||||
TK_LeftParen = 2,
|
||||
TK_LeftBrace = 59,
|
||||
TK_LeftBrace = 63,
|
||||
TK_Dot = 114,
|
||||
TK_DotStar = 94,
|
||||
TK_Arrow = 101,
|
||||
|
@ -97,16 +97,16 @@ public interface CPPExpressionStatementParsersym {
|
|||
TK_MinusMinus = 12,
|
||||
TK_And = 7,
|
||||
TK_Star = 5,
|
||||
TK_Plus = 8,
|
||||
TK_Minus = 9,
|
||||
TK_Plus = 9,
|
||||
TK_Minus = 10,
|
||||
TK_Tilde = 4,
|
||||
TK_Bang = 25,
|
||||
TK_Slash = 89,
|
||||
TK_Percent = 90,
|
||||
TK_RightShift = 76,
|
||||
TK_LeftShift = 77,
|
||||
TK_LT = 63,
|
||||
TK_GT = 65,
|
||||
TK_RightShift = 86,
|
||||
TK_LeftShift = 87,
|
||||
TK_LT = 58,
|
||||
TK_GT = 66,
|
||||
TK_LE = 91,
|
||||
TK_GE = 92,
|
||||
TK_EQ = 95,
|
||||
|
@ -130,11 +130,11 @@ public interface CPPExpressionStatementParsersym {
|
|||
TK_AndAssign = 109,
|
||||
TK_CaretAssign = 110,
|
||||
TK_OrAssign = 111,
|
||||
TK_Comma = 67,
|
||||
TK_Comma = 68,
|
||||
TK_zero = 38,
|
||||
TK_RightBracket = 113,
|
||||
TK_RightParen = 71,
|
||||
TK_RightBrace = 72,
|
||||
TK_RightParen = 72,
|
||||
TK_RightBrace = 71,
|
||||
TK_SemiColon = 43,
|
||||
TK_ERROR_TOKEN = 44,
|
||||
TK_EOF_TOKEN = 119;
|
||||
|
@ -148,9 +148,9 @@ public interface CPPExpressionStatementParsersym {
|
|||
"Star",
|
||||
"operator",
|
||||
"And",
|
||||
"typename",
|
||||
"Plus",
|
||||
"Minus",
|
||||
"typename",
|
||||
"PlusPlus",
|
||||
"MinusMinus",
|
||||
"bool",
|
||||
|
@ -197,27 +197,25 @@ public interface CPPExpressionStatementParsersym {
|
|||
"static",
|
||||
"template",
|
||||
"typedef",
|
||||
"LeftBracket",
|
||||
"class",
|
||||
"LeftBrace",
|
||||
"LT",
|
||||
"enum",
|
||||
"struct",
|
||||
"union",
|
||||
"LT",
|
||||
"LeftBracket",
|
||||
"LeftBrace",
|
||||
"using",
|
||||
"GT",
|
||||
"namespace",
|
||||
"Comma",
|
||||
"GT",
|
||||
"asm",
|
||||
"Comma",
|
||||
"Assign",
|
||||
"Colon",
|
||||
"RightParen",
|
||||
"RightBrace",
|
||||
"RightParen",
|
||||
"try",
|
||||
"export",
|
||||
"while",
|
||||
"RightShift",
|
||||
"LeftShift",
|
||||
"break",
|
||||
"case",
|
||||
"continue",
|
||||
|
@ -228,6 +226,8 @@ public interface CPPExpressionStatementParsersym {
|
|||
"if",
|
||||
"return",
|
||||
"switch",
|
||||
"RightShift",
|
||||
"LeftShift",
|
||||
"ArrowStar",
|
||||
"Slash",
|
||||
"Percent",
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -15,20 +15,20 @@ package org.eclipse.cdt.internal.core.dom.lrparser.cpp;
|
|||
|
||||
public interface CPPNoCastExpressionParsersym {
|
||||
public final static int
|
||||
TK_asm = 68,
|
||||
TK_asm = 67,
|
||||
TK_auto = 49,
|
||||
TK_bool = 13,
|
||||
TK_break = 78,
|
||||
TK_case = 79,
|
||||
TK_break = 76,
|
||||
TK_case = 77,
|
||||
TK_catch = 116,
|
||||
TK_char = 14,
|
||||
TK_class = 58,
|
||||
TK_const = 46,
|
||||
TK_const_cast = 26,
|
||||
TK_continue = 80,
|
||||
TK_default = 81,
|
||||
TK_continue = 78,
|
||||
TK_default = 79,
|
||||
TK_delete = 40,
|
||||
TK_do = 82,
|
||||
TK_do = 80,
|
||||
TK_double = 15,
|
||||
TK_dynamic_cast = 27,
|
||||
TK_else = 120,
|
||||
|
@ -38,15 +38,15 @@ public interface CPPNoCastExpressionParsersym {
|
|||
TK_extern = 42,
|
||||
TK_false = 28,
|
||||
TK_float = 16,
|
||||
TK_for = 83,
|
||||
TK_for = 81,
|
||||
TK_friend = 51,
|
||||
TK_goto = 84,
|
||||
TK_if = 85,
|
||||
TK_goto = 82,
|
||||
TK_if = 83,
|
||||
TK_inline = 52,
|
||||
TK_int = 17,
|
||||
TK_long = 18,
|
||||
TK_mutable = 53,
|
||||
TK_namespace = 66,
|
||||
TK_namespace = 65,
|
||||
TK_new = 41,
|
||||
TK_operator = 6,
|
||||
TK_private = 117,
|
||||
|
@ -54,14 +54,14 @@ public interface CPPNoCastExpressionParsersym {
|
|||
TK_public = 119,
|
||||
TK_register = 54,
|
||||
TK_reinterpret_cast = 29,
|
||||
TK_return = 86,
|
||||
TK_return = 84,
|
||||
TK_short = 19,
|
||||
TK_signed = 20,
|
||||
TK_sizeof = 30,
|
||||
TK_static = 55,
|
||||
TK_static_cast = 31,
|
||||
TK_struct = 62,
|
||||
TK_switch = 87,
|
||||
TK_switch = 85,
|
||||
TK_template = 47,
|
||||
TK_this = 32,
|
||||
TK_throw = 39,
|
||||
|
@ -69,7 +69,7 @@ public interface CPPNoCastExpressionParsersym {
|
|||
TK_true = 33,
|
||||
TK_typedef = 56,
|
||||
TK_typeid = 34,
|
||||
TK_typename = 10,
|
||||
TK_typename = 8,
|
||||
TK_union = 63,
|
||||
TK_unsigned = 21,
|
||||
TK_using = 64,
|
||||
|
@ -86,9 +86,9 @@ public interface CPPNoCastExpressionParsersym {
|
|||
TK_Completion = 121,
|
||||
TK_EndOfCompletion = 122,
|
||||
TK_Invalid = 123,
|
||||
TK_LeftBracket = 57,
|
||||
TK_LeftBracket = 59,
|
||||
TK_LeftParen = 2,
|
||||
TK_LeftBrace = 59,
|
||||
TK_LeftBrace = 60,
|
||||
TK_Dot = 115,
|
||||
TK_DotStar = 94,
|
||||
TK_Arrow = 101,
|
||||
|
@ -97,16 +97,16 @@ public interface CPPNoCastExpressionParsersym {
|
|||
TK_MinusMinus = 12,
|
||||
TK_And = 7,
|
||||
TK_Star = 5,
|
||||
TK_Plus = 8,
|
||||
TK_Minus = 9,
|
||||
TK_Plus = 9,
|
||||
TK_Minus = 10,
|
||||
TK_Tilde = 4,
|
||||
TK_Bang = 25,
|
||||
TK_Slash = 89,
|
||||
TK_Percent = 90,
|
||||
TK_RightShift = 76,
|
||||
TK_LeftShift = 77,
|
||||
TK_LT = 60,
|
||||
TK_GT = 65,
|
||||
TK_RightShift = 86,
|
||||
TK_LeftShift = 87,
|
||||
TK_LT = 57,
|
||||
TK_GT = 66,
|
||||
TK_LE = 91,
|
||||
TK_GE = 92,
|
||||
TK_EQ = 95,
|
||||
|
@ -130,7 +130,7 @@ public interface CPPNoCastExpressionParsersym {
|
|||
TK_AndAssign = 109,
|
||||
TK_CaretAssign = 110,
|
||||
TK_OrAssign = 111,
|
||||
TK_Comma = 67,
|
||||
TK_Comma = 68,
|
||||
TK_zero = 38,
|
||||
TK_RightBracket = 113,
|
||||
TK_RightParen = 72,
|
||||
|
@ -148,9 +148,9 @@ public interface CPPNoCastExpressionParsersym {
|
|||
"Star",
|
||||
"operator",
|
||||
"And",
|
||||
"typename",
|
||||
"Plus",
|
||||
"Minus",
|
||||
"typename",
|
||||
"PlusPlus",
|
||||
"MinusMinus",
|
||||
"bool",
|
||||
|
@ -197,18 +197,18 @@ public interface CPPNoCastExpressionParsersym {
|
|||
"register",
|
||||
"static",
|
||||
"typedef",
|
||||
"LeftBracket",
|
||||
"class",
|
||||
"LeftBrace",
|
||||
"LT",
|
||||
"class",
|
||||
"LeftBracket",
|
||||
"LeftBrace",
|
||||
"enum",
|
||||
"struct",
|
||||
"union",
|
||||
"using",
|
||||
"GT",
|
||||
"namespace",
|
||||
"Comma",
|
||||
"GT",
|
||||
"asm",
|
||||
"Comma",
|
||||
"Assign",
|
||||
"Colon",
|
||||
"RightBrace",
|
||||
|
@ -216,8 +216,6 @@ public interface CPPNoCastExpressionParsersym {
|
|||
"try",
|
||||
"export",
|
||||
"while",
|
||||
"RightShift",
|
||||
"LeftShift",
|
||||
"break",
|
||||
"case",
|
||||
"continue",
|
||||
|
@ -228,6 +226,8 @@ public interface CPPNoCastExpressionParsersym {
|
|||
"if",
|
||||
"return",
|
||||
"switch",
|
||||
"RightShift",
|
||||
"LeftShift",
|
||||
"ArrowStar",
|
||||
"Slash",
|
||||
"Percent",
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -18,35 +18,35 @@ public interface CPPParsersym {
|
|||
TK_asm = 66,
|
||||
TK_auto = 48,
|
||||
TK_bool = 11,
|
||||
TK_break = 78,
|
||||
TK_case = 79,
|
||||
TK_break = 76,
|
||||
TK_case = 77,
|
||||
TK_catch = 115,
|
||||
TK_char = 12,
|
||||
TK_class = 57,
|
||||
TK_const = 46,
|
||||
TK_const_cast = 26,
|
||||
TK_continue = 80,
|
||||
TK_default = 81,
|
||||
TK_continue = 78,
|
||||
TK_default = 79,
|
||||
TK_delete = 41,
|
||||
TK_do = 82,
|
||||
TK_do = 80,
|
||||
TK_double = 13,
|
||||
TK_dynamic_cast = 27,
|
||||
TK_else = 120,
|
||||
TK_enum = 59,
|
||||
TK_explicit = 49,
|
||||
TK_export = 73,
|
||||
TK_export = 72,
|
||||
TK_extern = 40,
|
||||
TK_false = 28,
|
||||
TK_float = 14,
|
||||
TK_for = 83,
|
||||
TK_for = 81,
|
||||
TK_friend = 50,
|
||||
TK_goto = 84,
|
||||
TK_if = 85,
|
||||
TK_goto = 82,
|
||||
TK_if = 83,
|
||||
TK_inline = 51,
|
||||
TK_int = 15,
|
||||
TK_long = 16,
|
||||
TK_mutable = 52,
|
||||
TK_namespace = 64,
|
||||
TK_namespace = 63,
|
||||
TK_new = 42,
|
||||
TK_operator = 6,
|
||||
TK_private = 116,
|
||||
|
@ -54,14 +54,14 @@ public interface CPPParsersym {
|
|||
TK_public = 118,
|
||||
TK_register = 53,
|
||||
TK_reinterpret_cast = 29,
|
||||
TK_return = 86,
|
||||
TK_return = 84,
|
||||
TK_short = 17,
|
||||
TK_signed = 18,
|
||||
TK_sizeof = 30,
|
||||
TK_static = 54,
|
||||
TK_static_cast = 31,
|
||||
TK_struct = 60,
|
||||
TK_switch = 87,
|
||||
TK_switch = 85,
|
||||
TK_template = 55,
|
||||
TK_this = 32,
|
||||
TK_throw = 39,
|
||||
|
@ -86,9 +86,9 @@ public interface CPPParsersym {
|
|||
TK_Completion = 121,
|
||||
TK_EndOfCompletion = 122,
|
||||
TK_Invalid = 123,
|
||||
TK_LeftBracket = 58,
|
||||
TK_LeftBracket = 64,
|
||||
TK_LeftParen = 2,
|
||||
TK_LeftBrace = 63,
|
||||
TK_LeftBrace = 65,
|
||||
TK_Dot = 114,
|
||||
TK_DotStar = 94,
|
||||
TK_Arrow = 101,
|
||||
|
@ -103,9 +103,9 @@ public interface CPPParsersym {
|
|||
TK_Bang = 25,
|
||||
TK_Slash = 89,
|
||||
TK_Percent = 90,
|
||||
TK_RightShift = 76,
|
||||
TK_LeftShift = 77,
|
||||
TK_LT = 65,
|
||||
TK_RightShift = 86,
|
||||
TK_LeftShift = 87,
|
||||
TK_LT = 58,
|
||||
TK_GT = 67,
|
||||
TK_LE = 91,
|
||||
TK_GE = 92,
|
||||
|
@ -133,8 +133,8 @@ public interface CPPParsersym {
|
|||
TK_Comma = 68,
|
||||
TK_zero = 38,
|
||||
TK_RightBracket = 113,
|
||||
TK_RightParen = 71,
|
||||
TK_RightBrace = 72,
|
||||
TK_RightParen = 73,
|
||||
TK_RightBrace = 71,
|
||||
TK_SemiColon = 43,
|
||||
TK_ERROR_TOKEN = 44,
|
||||
TK_EOF_TOKEN = 119;
|
||||
|
@ -198,26 +198,24 @@ public interface CPPParsersym {
|
|||
"template",
|
||||
"typedef",
|
||||
"class",
|
||||
"LeftBracket",
|
||||
"LT",
|
||||
"enum",
|
||||
"struct",
|
||||
"union",
|
||||
"using",
|
||||
"LeftBrace",
|
||||
"namespace",
|
||||
"LT",
|
||||
"LeftBracket",
|
||||
"LeftBrace",
|
||||
"asm",
|
||||
"GT",
|
||||
"Comma",
|
||||
"Assign",
|
||||
"Colon",
|
||||
"RightParen",
|
||||
"RightBrace",
|
||||
"export",
|
||||
"RightParen",
|
||||
"try",
|
||||
"while",
|
||||
"RightShift",
|
||||
"LeftShift",
|
||||
"break",
|
||||
"case",
|
||||
"continue",
|
||||
|
@ -228,6 +226,8 @@ public interface CPPParsersym {
|
|||
"if",
|
||||
"return",
|
||||
"switch",
|
||||
"RightShift",
|
||||
"LeftShift",
|
||||
"ArrowStar",
|
||||
"Slash",
|
||||
"Percent",
|
||||
|
|
Loading…
Add table
Reference in a new issue