1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56:01 +02:00

added AST building actions for C++ parameter declarations, cleaned up C99 grammar file a bit

This commit is contained in:
Mike Kucera 2008-01-23 19:23:14 +00:00
parent fb314ecfd8
commit 82c457efbc
14 changed files with 3706 additions and 3615 deletions

View file

@ -170,6 +170,6 @@ public class C99DigraphTrigraphTests extends TestCase {
assertEquals("ab", declarator2.getName().toString()); assertEquals("ab", declarator2.getName().toString());
IASTLiteralExpression expr2 = (IASTLiteralExpression)((IASTInitializerExpression)declarator2.getInitializer()).getExpression(); IASTLiteralExpression expr2 = (IASTLiteralExpression)((IASTInitializerExpression)declarator2.getInitializer()).getExpression();
assertEquals(IASTLiteralExpression.lk_string_literal, expr2.getKind()); assertEquals(IASTLiteralExpression.lk_string_literal, expr2.getKind());
assertEquals("its still good", expr2.toString()); assertEquals("\"its still good\"", expr2.toString());
} }
} }

View file

@ -48,6 +48,7 @@ import org.eclipse.cdt.core.dom.ast.IASTLiteralExpression;
import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTNullStatement; import org.eclipse.cdt.core.dom.ast.IASTNullStatement;
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTPointerOperator; import org.eclipse.cdt.core.dom.ast.IASTPointerOperator;
import org.eclipse.cdt.core.dom.ast.IASTProblem; import org.eclipse.cdt.core.dom.ast.IASTProblem;
import org.eclipse.cdt.core.dom.ast.IASTProblemHolder; import org.eclipse.cdt.core.dom.ast.IASTProblemHolder;
@ -61,6 +62,7 @@ import org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression;
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression; import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator; import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator;
import org.eclipse.cdt.core.dom.ast.c.ICASTDeclSpecifier; import org.eclipse.cdt.core.dom.ast.c.ICASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.c.ICASTPointer;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCastExpression; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCastExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLiteralExpression; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLiteralExpression;
@ -749,6 +751,109 @@ public abstract class BuildASTParserAction {
} }
/**
* declarator
* ::= <openscope-ast> ptr_operator_seq direct_declarator
*
* abstract_declarator
* ::= <openscope-ast> ptr_operator_seq
* | <openscope-ast> ptr_operator_seq direct_declarator
*/
public void consumeDeclaratorWithPointer(boolean hasDeclarator) {
if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
IASTDeclarator decl;
if(hasDeclarator)
decl = (IASTDeclarator) astStack.pop();
else
decl = nodeFactory.newDeclarator(nodeFactory.newName());
for(Object pointer : astStack.closeScope())
decl.addPointerOperator((ICASTPointer)pointer);
setOffsetAndLength(decl);
astStack.push(decl);
if(TRACE_AST_STACK) System.out.println(astStack);
}
/**
* init_declarator
* ::= declarator initializer
*
* @param hasDeclarator in C++ its possible for a parameter declaration to specifiy
* a default value without also specifying a named declarator
*/
public void consumeDeclaratorWithInitializer(boolean hasDeclarator) {
if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
IASTInitializer initializer = (IASTInitializer) astStack.pop();
IASTDeclarator declarator;
if(hasDeclarator) {
declarator = (IASTDeclarator) astStack.peek();
}
else {
IASTName emptyName = nodeFactory.newName();
declarator = nodeFactory.newDeclarator(emptyName);
setOffsetAndLength(emptyName);
astStack.push(declarator);
}
declarator.setInitializer(initializer);
setOffsetAndLength(declarator); // adjust the length to include the initializer
if(TRACE_AST_STACK) System.out.println(astStack);
}
/**
* parameter_declaration ::= declaration_specifiers declarator
* | declaration_specifiers abstract_declarator
*/
public void consumeParameterDeclaration() {
if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
IASTDeclarator declarator = (IASTDeclarator) astStack.pop();
IASTDeclSpecifier declSpec = (IASTDeclSpecifier) astStack.pop();
IASTParameterDeclaration declaration = nodeFactory.newParameterDeclaration(declSpec, declarator);
setOffsetAndLength(declaration);
astStack.push(declaration);
if(TRACE_AST_STACK) System.out.println(astStack);
}
/**
* parameter_declaration ::= declaration_specifiers
*/
public void consumeParameterDeclarationWithoutDeclarator(/*IBinding binding*/) {
if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
// offsets need to be calculated differently in this case
final int endOffset = parser.getRightIToken().getEndOffset() + 1;
IASTName name = nodeFactory.newName();
setOffsetAndLength(name, endOffset, 0);
//name.setBinding(binding);
// it appears that a declarator is always required in the AST here
IASTDeclarator declarator = nodeFactory.newDeclarator(name);
setOffsetAndLength(declarator, endOffset, 0);
IASTDeclSpecifier declSpec = (IASTDeclSpecifier) astStack.pop();
IASTParameterDeclaration declaration = nodeFactory.newParameterDeclaration(declSpec, declarator);
setOffsetAndLength(declaration);
astStack.push(declaration);
if(TRACE_AST_STACK) System.out.println(astStack);
}
/** /**
* TODO: do I really want to share declaration rules between the two parsers. * TODO: do I really want to share declaration rules between the two parsers.
* Even if there is potential for reuse it still may be cleaner to leave the * Even if there is potential for reuse it still may be cleaner to leave the
@ -830,7 +935,7 @@ public abstract class BuildASTParserAction {
* the additional array modifiers will need to be added to the array declarator. * the additional array modifiers will need to be added to the array declarator.
* Special care is taken for nested declarators. * Special care is taken for nested declarators.
*/ */
protected void consumeDeclaratorArray(IASTArrayModifier arrayModifier) { protected void addArrayModifier(IASTArrayModifier arrayModifier) {
if(TRACE_ACTIONS) DebugUtil.printMethodTrace(); if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
IASTDeclarator node = (IASTDeclarator) astStack.pop(); IASTDeclarator node = (IASTDeclarator) astStack.pop();
@ -877,8 +982,9 @@ public abstract class BuildASTParserAction {
* Pops a simple declarator from the stack, converts it into * Pops a simple declarator from the stack, converts it into
* a FunctionDeclator, then pushes it. * a FunctionDeclator, then pushes it.
* TODO: is this the best way of doing this? * TODO: is this the best way of doing this?
* TODO, rename this method, its an accidental overload
*/ */
protected void consumeDirectDeclaratorFunctionDeclarator(IASTFunctionDeclarator declarator, int endOffset) { protected void addFunctionModifier(IASTFunctionDeclarator declarator, int endOffset) {
IASTDeclarator decl = (IASTDeclarator) astStack.pop(); IASTDeclarator decl = (IASTDeclarator) astStack.pop();
if(decl.getNestedDeclarator() != null) { if(decl.getNestedDeclarator() != null) {
@ -910,18 +1016,43 @@ public abstract class BuildASTParserAction {
if(TRACE_AST_STACK) System.out.println(astStack); if(TRACE_AST_STACK) System.out.println(astStack);
} }
// /**
// * direct_declarator ::= direct_declarator array_modifier
// * consume the direct_declarator part and add the array modifier
// */
// public void consumeDirectDeclaratorArrayDeclarator() {
// if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
//
// IASTArrayModifier arrayModifier = (IASTArrayModifier) astStack.pop();
// addArrayModifier(arrayModifier);
// }
/** /**
* direct_declarator ::= direct_declarator array_modifier * direct_abstract_declarator
* consume the direct_declarator part and add the array modifier * ::= array_modifier
* | direct_abstract_declarator array_modifier
*/ */
public void consumeDirectDeclaratorArrayDeclarator() { public void consumeDirectDeclaratorArrayDeclarator(boolean hasDeclarator) {
if(TRACE_ACTIONS) DebugUtil.printMethodTrace(); if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
IASTArrayModifier arrayModifier = (IASTArrayModifier) astStack.pop(); IASTArrayModifier arrayModifier = (IASTArrayModifier) astStack.pop();
consumeDeclaratorArray(arrayModifier);
if(hasDeclarator) {
addArrayModifier(arrayModifier);
}
else {
IASTArrayDeclarator decl = nodeFactory.newArrayDeclarator(nodeFactory.newName());
decl.addArrayModifier(arrayModifier);
setOffsetAndLength(decl);
astStack.push(decl);
if(TRACE_AST_STACK) System.out.println(astStack);
}
} }
/** /**
* enum_specifier ::= 'enum' '{' <openscope> enumerator_list_opt '}' * enum_specifier ::= 'enum' '{' <openscope> enumerator_list_opt '}'
* | 'enum' enum_identifier '{' <openscope> enumerator_list_opt '}' * | 'enum' enum_identifier '{' <openscope> enumerator_list_opt '}'

View file

@ -45,6 +45,7 @@ import org.eclipse.cdt.core.dom.ast.IASTLabelStatement;
import org.eclipse.cdt.core.dom.ast.IASTLiteralExpression; import org.eclipse.cdt.core.dom.ast.IASTLiteralExpression;
import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNullStatement; import org.eclipse.cdt.core.dom.ast.IASTNullStatement;
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTProblem; import org.eclipse.cdt.core.dom.ast.IASTProblem;
import org.eclipse.cdt.core.dom.ast.IASTProblemDeclaration; import org.eclipse.cdt.core.dom.ast.IASTProblemDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTProblemExpression; import org.eclipse.cdt.core.dom.ast.IASTProblemExpression;
@ -165,4 +166,6 @@ public interface IASTNodeFactory {
public IASTArrayModifier newArrayModifier(IASTExpression expr); public IASTArrayModifier newArrayModifier(IASTExpression expr);
public IASTArrayDeclarator newArrayDeclarator(IASTName name); public IASTArrayDeclarator newArrayDeclarator(IASTName name);
public IASTParameterDeclaration newParameterDeclaration(IASTDeclSpecifier declSpec, IASTDeclarator declarator);
} }

View file

@ -235,40 +235,6 @@ public class C99BuildASTParserAction extends BuildASTParserAction {
} }
/**
* declarator ::= <openscope> pointer direct_declarator
*
* abstract_declarator -- a declarator that does not include an identifier
* ::= <openscope> pointer
* | <openscope> pointer direct_abstract_declarator
*/
public void consumeDeclaratorWithPointer(boolean hasDeclarator) {
if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
IASTDeclarator decl;
if(hasDeclarator)
decl = (IASTDeclarator) astStack.pop();
else
decl = nodeFactory.newDeclarator(nodeFactory.newName());
// add all the pointers to the declarator
if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
List<Object> scope = astStack.closeScope();
for(Object o : scope) {
decl.addPointerOperator((ICASTPointer)o);
}
setOffsetAndLength(decl);
astStack.push(decl);
if(TRACE_AST_STACK) System.out.println(astStack);
}
/** /**
* type_qualifier ::= const | restrict | volatile * type_qualifier ::= const | restrict | volatile
@ -328,52 +294,13 @@ public class C99BuildASTParserAction extends BuildASTParserAction {
if(TRACE_AST_STACK) System.out.println(astStack); if(TRACE_AST_STACK) System.out.println(astStack);
} }
/**
* init_declarator ::= declarator '=' initializer
*/
public void consumeDeclaratorWithInitializer() {
if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
IASTInitializer initializer = (IASTInitializer) astStack.pop();
IASTDeclarator declarator = (IASTDeclarator) astStack.peek();
declarator.setInitializer(initializer);
setOffsetAndLength(declarator); // adjust the length to include the initializer
}
@Deprecated public void consumeDeclaratorCompleteField(/*IBinding binding*/) { @Deprecated public void consumeDeclaratorCompleteField(/*IBinding binding*/) {
//IASTDeclarator declarator = (IASTDeclarator) astStack.peek(); //IASTDeclarator declarator = (IASTDeclarator) astStack.peek();
//declarator.getName().setBinding(binding); //declarator.getName().setBinding(binding);
} }
/**
* direct_declarator ::= direct_declarator '(' <openscope> parameter_type_list ')'
* direct_declarator ::= direct_declarator '(' ')'
*/
public void consumeDirectDeclaratorFunctionDeclarator(boolean hasParameters) {
if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
IASTName name = nodeFactory.newName();
IASTStandardFunctionDeclarator declarator = nodeFactory.newFunctionDeclarator(name);
if(hasParameters) {
boolean isVarArgs = astStack.pop() == PLACE_HOLDER;
declarator.setVarArgs(isVarArgs);
for(Object o : astStack.closeScope()) {
declarator.addParameterDeclaration((IASTParameterDeclaration)o);
}
}
int endOffset = endOffset(parser.getRightIToken());
consumeDirectDeclaratorFunctionDeclarator(declarator, endOffset);
}
/** /**
* direct_declarator ::= direct_declarator '(' <openscope> identifier_list ')' * direct_declarator ::= direct_declarator '(' <openscope> identifier_list ')'
*/ */
@ -385,7 +312,7 @@ public class C99BuildASTParserAction extends BuildASTParserAction {
declarator.setParameterNames(names); declarator.setParameterNames(names);
astStack.closeScope(); astStack.closeScope();
int endOffset = endOffset(parser.getRightIToken()); int endOffset = endOffset(parser.getRightIToken());
consumeDirectDeclaratorFunctionDeclarator(declarator, endOffset); addFunctionModifier(declarator, endOffset);
} }
@ -402,9 +329,7 @@ public class C99BuildASTParserAction extends BuildASTParserAction {
} }
/** /**
* pointer ::= '*' * pointer ::= '*'
@ -448,49 +373,8 @@ public class C99BuildASTParserAction extends BuildASTParserAction {
} }
/**
* parameter_declaration ::= declaration_specifiers declarator
* | declaration_specifiers abstract_declarator
*/
public void consumeParameterDeclaration() {
if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
IASTDeclarator declarator = (IASTDeclarator) astStack.pop();
IASTDeclSpecifier declSpec = (IASTDeclSpecifier) astStack.pop();
IASTParameterDeclaration declaration = nodeFactory.newParameterDeclaration(declSpec, declarator);
setOffsetAndLength(declaration);
astStack.push(declaration);
if(TRACE_AST_STACK) System.out.println(astStack);
}
/**
* parameter_declaration ::= declaration_specifiers
*/
public void consumeParameterDeclarationWithoutDeclarator(/*IBinding binding*/) {
if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
// offsets need to be calculated differently in this case
final int endOffset = parser.getRightIToken().getEndOffset() + 1;
IASTName name = nodeFactory.newName();
setOffsetAndLength(name, endOffset, 0);
//name.setBinding(binding);
// it appears that a declarator is always required in the AST here
IASTDeclarator declarator = nodeFactory.newDeclarator(name);
setOffsetAndLength(declarator, endOffset, 0);
IASTDeclSpecifier declSpec = (IASTDeclSpecifier) astStack.pop();
IASTParameterDeclaration declaration = nodeFactory.newParameterDeclaration(declSpec, declarator);
setOffsetAndLength(declaration);
astStack.push(declaration);
if(TRACE_AST_STACK) System.out.println(astStack);
}
@Deprecated public void consumeDeclaratorCompleteParameter(/*IBinding binding*/) { @Deprecated public void consumeDeclaratorCompleteParameter(/*IBinding binding*/) {
//if(DEBUG) DebugUtil.printMethodTrace(); //if(DEBUG) DebugUtil.printMethodTrace();
@ -500,28 +384,7 @@ public class C99BuildASTParserAction extends BuildASTParserAction {
} }
/**
* direct_abstract_declarator
* ::= array_modifier
* | direct_abstract_declarator array_modifier
*/
public void consumeAbstractDeclaratorArrayModifier(boolean hasDeclarator) {
if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
IASTArrayModifier arrayModifier = (IASTArrayModifier) astStack.pop();
if(hasDeclarator) {
consumeDeclaratorArray(arrayModifier);
}
else {
IASTArrayDeclarator decl = nodeFactory.newArrayDeclarator(nodeFactory.newName());
decl.addArrayModifier(arrayModifier);
setOffsetAndLength(decl);
astStack.push(decl);
if(TRACE_AST_STACK) System.out.println(astStack);
}
}
/** /**
@ -531,27 +394,29 @@ public class C99BuildASTParserAction extends BuildASTParserAction {
* | '(' <openscope> parameter_type_list ')' * | '(' <openscope> parameter_type_list ')'
* | direct_abstract_declarator '(' <openscope> parameter_type_list ')' * | direct_abstract_declarator '(' <openscope> parameter_type_list ')'
*/ */
public void consumeAbstractDeclaratorFunctionDeclarator(boolean hasDeclarator, boolean hasParameters) { public void consumeDirectDeclaratorFunctionDeclarator(boolean hasDeclarator, boolean hasParameters) {
if(TRACE_ACTIONS) DebugUtil.printMethodTrace(); if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
IASTStandardFunctionDeclarator declarator = nodeFactory.newFunctionDeclarator(nodeFactory.newName()); IASTName name = nodeFactory.newName();
IASTStandardFunctionDeclarator declarator = nodeFactory.newFunctionDeclarator(name);
if(hasParameters) { if(hasParameters) {
if(TRACE_ACTIONS) DebugUtil.printMethodTrace(); boolean isVarArgs = astStack.pop() == PLACE_HOLDER;
for(Object o : astStack.closeScope()) { declarator.setVarArgs(isVarArgs);
declarator.addParameterDeclaration((IASTParameterDeclaration)o);
} for(Object param : astStack.closeScope())
declarator.addParameterDeclaration((IASTParameterDeclaration)param);
} }
if(hasDeclarator) { if(hasDeclarator) {
consumeDirectDeclaratorFunctionDeclarator(declarator, endOffset(parser.getRightIToken())); addFunctionModifier(declarator, endOffset(parser.getRightIToken()));
} }
else { else {
setOffsetAndLength(declarator); setOffsetAndLength(declarator);
astStack.push(declarator); astStack.push(declarator);
if(TRACE_AST_STACK) System.out.println(astStack);
} }
if(TRACE_AST_STACK) System.out.println(astStack);
} }

View file

@ -50,8 +50,6 @@ public interface IC99ASTNodeFactory extends IASTNodeFactory {
public ICASTPointer newCPointer(); public ICASTPointer newCPointer();
public IASTParameterDeclaration newParameterDeclaration(IASTDeclSpecifier declSpec, IASTDeclarator declarator);
public ICASTDesignatedInitializer newCDesignatedInitializer(IASTInitializer rhs); public ICASTDesignatedInitializer newCDesignatedInitializer(IASTInitializer rhs);
public ICASTArrayDesignator newCArrayDesignator(IASTExpression exp); public ICASTArrayDesignator newCArrayDesignator(IASTExpression exp);

View file

@ -46,6 +46,7 @@ import org.eclipse.cdt.core.dom.ast.IASTLabelStatement;
import org.eclipse.cdt.core.dom.ast.IASTLiteralExpression; import org.eclipse.cdt.core.dom.ast.IASTLiteralExpression;
import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNullStatement; import org.eclipse.cdt.core.dom.ast.IASTNullStatement;
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTPointer; import org.eclipse.cdt.core.dom.ast.IASTPointer;
import org.eclipse.cdt.core.dom.ast.IASTProblem; import org.eclipse.cdt.core.dom.ast.IASTProblem;
import org.eclipse.cdt.core.dom.ast.IASTProblemDeclaration; import org.eclipse.cdt.core.dom.ast.IASTProblemDeclaration;
@ -137,6 +138,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTNamespaceDefinition;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTNewExpression; import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTNewExpression;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTNullStatement; import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTNullStatement;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTOperatorName; import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTOperatorName;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTParameterDeclaration;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTPointer; import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTPointer;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTPointerToMember; import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTPointerToMember;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTProblem; import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTProblem;
@ -164,12 +166,13 @@ 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.CPPASTVisibilityLabel;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTWhileStatement; import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTWhileStatement;
@SuppressWarnings("restriction") // all AST node constructors are internal
/** /**
* Abstract factory implementation that creates C++ AST nodes. * Abstract factory implementation that creates C++ AST nodes.
* *
* @author Mike Kucera * @author Mike Kucera
*/ */
@SuppressWarnings("restriction") // all AST node constructors are internal
public class CPPASTNodeFactory implements ICPPASTNodeFactory { public class CPPASTNodeFactory implements ICPPASTNodeFactory {
public static final CPPASTNodeFactory DEFAULT_INSTANCE = new CPPASTNodeFactory(); public static final CPPASTNodeFactory DEFAULT_INSTANCE = new CPPASTNodeFactory();
@ -495,4 +498,9 @@ public class CPPASTNodeFactory implements ICPPASTNodeFactory {
return new CPPASTFunctionDeclarator(name); return new CPPASTFunctionDeclarator(name);
} }
public IASTParameterDeclaration newParameterDeclaration(
IASTDeclSpecifier declSpec, IASTDeclarator declarator) {
return new CPPASTParameterDeclaration(declSpec, declarator);
}
} }

View file

@ -1254,41 +1254,6 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
} }
/**
* declarator
* ::= <openscope-ast> ptr_operator_seq_opt direct_declarator
*/
public void consumeDeclaratorWithPointer() {
if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
IASTDeclarator declarator = (IASTDeclarator) astStack.pop();
for(Object ptr : astStack.closeScope()) {
declarator.addPointerOperator((IASTPointerOperator) ptr);
}
setOffsetAndLength(declarator); // TODO is it correct to change the offset and length?
astStack.push(declarator);
if(TRACE_AST_STACK) System.out.println(astStack);
}
/**
* init_declarator
* ::= declarator initializer
*/
public void consumeDeclaratorWithInitializer() {
if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
IASTInitializer initializer = (IASTInitializer) astStack.pop();
IASTDeclarator declarator = (IASTDeclarator) astStack.peek();
declarator.setInitializer(initializer);
setOffsetAndLength(declarator); // adjust the length to include the initializer
if(TRACE_AST_STACK) System.out.println(astStack);
}
/** /**
* initializer * initializer
@ -1311,7 +1276,7 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
* ::= basic_direct_declarator '(' <openscope-ast> parameter_declaration_clause ')' * ::= basic_direct_declarator '(' <openscope-ast> parameter_declaration_clause ')'
* <openscope-ast> cv_qualifier_seq_opt <openscope-ast> exception_specification_opt * <openscope-ast> cv_qualifier_seq_opt <openscope-ast> exception_specification_opt
*/ */
public void consumeDirectDeclaratorFunctionDeclarator() { public void consumeDirectDeclaratorFunctionDeclarator(boolean hasDeclarator) {
if(TRACE_ACTIONS) DebugUtil.printMethodTrace(); if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
IASTName name = nodeFactory.newName(); IASTName name = nodeFactory.newName();
@ -1320,6 +1285,7 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
for(Object typeId : astStack.closeScope()) { for(Object typeId : astStack.closeScope()) {
declarator.addExceptionSpecificationTypeId((IASTTypeId) typeId); declarator.addExceptionSpecificationTypeId((IASTTypeId) typeId);
} }
for(Object token : astStack.closeScope()) { for(Object token : astStack.closeScope()) {
switch(((IToken)token).getKind()) { switch(((IToken)token).getKind()) {
default: assert false; default: assert false;
@ -1335,8 +1301,14 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
declarator.addParameterDeclaration((IASTParameterDeclaration)o); declarator.addParameterDeclaration((IASTParameterDeclaration)o);
} }
int endOffset = endOffset(parser.getRightIToken()); if(hasDeclarator) {
consumeDirectDeclaratorFunctionDeclarator(declarator, endOffset); int endOffset = endOffset(parser.getRightIToken());
addFunctionModifier(declarator, endOffset);
}
else {
setOffsetAndLength(declarator);
astStack.push(declarator);
}
} }
} }

View file

@ -685,7 +685,7 @@ init_declarator_list
init_declarator init_declarator
::= complete_declarator ::= complete_declarator
| complete_declarator '=' initializer | complete_declarator '=' initializer
/. $Build consumeDeclaratorWithInitializer(); $EndBuild ./ /. $Build consumeDeclaratorWithInitializer(true); $EndBuild ./
complete_declarator complete_declarator
@ -886,7 +886,7 @@ function_specifier
declarator declarator
::= direct_declarator ::= direct_declarator
| <openscope-ast> pointer direct_declarator | <openscope-ast> pointer_seq direct_declarator
/. $Build consumeDeclaratorWithPointer(true); $EndBuild ./ /. $Build consumeDeclaratorWithPointer(true); $EndBuild ./
@ -916,9 +916,9 @@ declarator_id_name
array_direct_declarator array_direct_declarator
::= basic_direct_declarator array_modifier ::= basic_direct_declarator array_modifier
/. $Build consumeDirectDeclaratorArrayDeclarator(); $EndBuild ./ /. $Build consumeDirectDeclaratorArrayDeclarator(true); $EndBuild ./
| array_direct_declarator array_modifier | array_direct_declarator array_modifier
/. $Build consumeDirectDeclaratorArrayDeclarator(); $EndBuild ./ /. $Build consumeDirectDeclaratorArrayDeclarator(true); $EndBuild ./
function_prototype_direct_declarator function_prototype_direct_declarator
@ -928,14 +928,14 @@ function_prototype_direct_declarator
function_direct_declarator function_direct_declarator
::= basic_direct_declarator '(' <openscope-symbol> <openscope-ast> parameter_type_list ')' ::= basic_direct_declarator '(' <openscope-symbol> <openscope-ast> parameter_type_list ')'
/. $Build consumeDirectDeclaratorFunctionDeclarator(true); $EndBuild ./ /. $Build consumeDirectDeclaratorFunctionDeclarator(true, true); $EndBuild ./
| basic_direct_declarator '(' <openscope-symbol> ')' | basic_direct_declarator '(' <openscope-symbol> ')'
/. $Build consumeDirectDeclaratorFunctionDeclarator(false); $EndBuild ./ /. $Build consumeDirectDeclaratorFunctionDeclarator(true, false); $EndBuild ./
function_declarator function_declarator
::= function_direct_declarator ::= function_direct_declarator
| <openscope-ast> pointer function_direct_declarator | <openscope-ast> pointer_seq function_direct_declarator
/. $Build consumeDeclaratorWithPointer(true); $EndBuild ./ /. $Build consumeDeclaratorWithPointer(true); $EndBuild ./
@ -953,7 +953,7 @@ knr_direct_declarator
knr_function_declarator knr_function_declarator
::= knr_direct_declarator ::= knr_direct_declarator
| <openscope-ast> pointer knr_direct_declarator | <openscope-ast> pointer_seq knr_direct_declarator
/. $Build consumeDeclaratorWithPointer(true); $EndBuild ./ /. $Build consumeDeclaratorWithPointer(true); $EndBuild ./
@ -989,14 +989,14 @@ array_modifier_type_qualifiers
::= type_qualifier_list ::= type_qualifier_list
pointer pointer_seq
::= '*' ::= '*'
/. $Build consumePointer(); $EndBuild ./ /. $Build consumePointer(); $EndBuild ./
| pointer '*' | pointer_seq '*'
/. $Build consumePointer(); $EndBuild ./ /. $Build consumePointer(); $EndBuild ./
| '*' <openscope-ast> type_qualifier_list | '*' <openscope-ast> type_qualifier_list
/. $Build consumePointerTypeQualifierList(); $EndBuild ./ /. $Build consumePointerTypeQualifierList(); $EndBuild ./
| pointer '*' <openscope-ast> type_qualifier_list | pointer_seq '*' <openscope-ast> type_qualifier_list
/. $Build consumePointerTypeQualifierList(); $EndBuild ./ /. $Build consumePointerTypeQualifierList(); $EndBuild ./
@ -1066,29 +1066,41 @@ type_name
abstract_declarator -- a declarator that does not include an identifier abstract_declarator -- a declarator that does not include an identifier
::= direct_abstract_declarator ::= direct_abstract_declarator
| <openscope-ast> pointer | <openscope-ast> pointer_seq
/. $Build consumeDeclaratorWithPointer(false); $EndBuild ./
| <openscope-ast> pointer_seq direct_abstract_declarator
/. $Build consumeDeclaratorWithPointer(false); $EndBuild ./ /. $Build consumeDeclaratorWithPointer(false); $EndBuild ./
| <openscope-ast> pointer direct_abstract_declarator
/. $Build consumeDeclaratorWithPointer(true); $EndBuild ./
-- rewritten to use the more general array_modifier rule
direct_abstract_declarator direct_abstract_declarator
::= basic_direct_abstract_declarator
| array_direct_abstract_declarator
| function_direct_abstract_declarator
basic_direct_abstract_declarator
::= '(' abstract_declarator ')' ::= '(' abstract_declarator ')'
/. $Build consumeDirectDeclaratorBracketed(); $EndBuild ./ /. $Build consumeDirectDeclaratorBracketed(); $EndBuild ./
| array_modifier
/. $Build consumeAbstractDeclaratorArrayModifier(false); $EndBuild ./
| direct_abstract_declarator array_modifier array_direct_abstract_declarator
/. $Build consumeAbstractDeclaratorArrayModifier(true); $EndBuild ./ ::= array_modifier
| '(' ')' /. $Build consumeDirectDeclaratorArrayDeclarator(false); $EndBuild ./
/. $Build consumeAbstractDeclaratorFunctionDeclarator(false, false); $EndBuild ./ | array_direct_abstract_declarator array_modifier
| direct_abstract_declarator '(' ')' /. $Build consumeDirectDeclaratorArrayDeclarator(true); $EndBuild ./
/. $Build consumeAbstractDeclaratorFunctionDeclarator(true, false); $EndBuild ./ | basic_direct_abstract_declarator array_modifier
/. $Build consumeDirectDeclaratorArrayDeclarator(true); $EndBuild ./
function_direct_abstract_declarator
::= '(' ')'
/. $Build consumeDirectDeclaratorFunctionDeclarator(false, false); $EndBuild ./
| basic_direct_abstract_declarator '(' ')'
/. $Build consumeDirectDeclaratorFunctionDeclarator(true, false); $EndBuild ./
| '(' <openscope-ast> parameter_type_list ')' | '(' <openscope-ast> parameter_type_list ')'
/. $Build consumeAbstractDeclaratorFunctionDeclarator(false, true); $EndBuild ./ /. $Build consumeDirectDeclaratorFunctionDeclarator(false, true); $EndBuild ./
| direct_abstract_declarator '(' <openscope-ast> parameter_type_list ')' | basic_direct_abstract_declarator '(' <openscope-ast> parameter_type_list ')'
/. $Build consumeAbstractDeclaratorFunctionDeclarator(true, true); $EndBuild ./ /. $Build consumeDirectDeclaratorFunctionDeclarator(true, true); $EndBuild ./
initializer initializer

View file

@ -27,7 +27,6 @@ import org.eclipse.cdt.core.dom.lrparser.IParserActionTokenProvider;
import org.eclipse.cdt.core.dom.lrparser.action.c99.C99ASTNodeFactory; import org.eclipse.cdt.core.dom.lrparser.action.c99.C99ASTNodeFactory;
import org.eclipse.cdt.core.dom.lrparser.action.c99.C99BuildASTParserAction; import org.eclipse.cdt.core.dom.lrparser.action.c99.C99BuildASTParserAction;
import org.eclipse.cdt.core.dom.lrparser.action.c99.C99TypedefTrackerParserAction; import org.eclipse.cdt.core.dom.lrparser.action.c99.C99TypedefTrackerParserAction;
import org.eclipse.cdt.internal.core.dom.lrparser.c99.bindings.IC99Scope;
import org.eclipse.cdt.core.dom.lrparser.util.DebugUtil; import org.eclipse.cdt.core.dom.lrparser.util.DebugUtil;
public class C99Parser extends AbstractTrialUndoActionProvider< C99ParserAction , Object > implements IParserActionTokenProvider, IParser { public class C99Parser extends AbstractTrialUndoActionProvider< C99ParserAction , Object > implements IParserActionTokenProvider, IParser {
@ -181,7 +180,7 @@ public int getKind(int i) {
// Initialize ruleAction array. // Initialize ruleAction array.
// //
static { static {
RULE_ACTIONS = new Action[305 + 1]; RULE_ACTIONS = new Action[309 + 1];
RULE_ACTIONS[0] = null; RULE_ACTIONS[0] = null;
RULE_ACTIONS[1] = new Action1(); RULE_ACTIONS[1] = new Action1();
@ -334,29 +333,30 @@ public int getKind(int i) {
RULE_ACTIONS[266] = new Action266(); RULE_ACTIONS[266] = new Action266();
RULE_ACTIONS[268] = new Action268(); RULE_ACTIONS[268] = new Action268();
RULE_ACTIONS[269] = new Action269(); RULE_ACTIONS[269] = new Action269();
RULE_ACTIONS[270] = new Action270();
RULE_ACTIONS[271] = new Action271();
RULE_ACTIONS[272] = new Action272();
RULE_ACTIONS[273] = new Action273(); RULE_ACTIONS[273] = new Action273();
RULE_ACTIONS[274] = new Action274(); RULE_ACTIONS[274] = new Action274();
RULE_ACTIONS[275] = new Action275(); RULE_ACTIONS[275] = new Action275();
RULE_ACTIONS[276] = new Action276(); RULE_ACTIONS[276] = new Action276();
RULE_ACTIONS[277] = new Action277(); RULE_ACTIONS[277] = new Action277();
RULE_ACTIONS[278] = new Action278(); RULE_ACTIONS[278] = new Action278();
RULE_ACTIONS[283] = new Action283(); RULE_ACTIONS[279] = new Action279();
RULE_ACTIONS[280] = new Action280();
RULE_ACTIONS[281] = new Action281();
RULE_ACTIONS[282] = new Action282();
RULE_ACTIONS[287] = new Action287(); RULE_ACTIONS[287] = new Action287();
RULE_ACTIONS[288] = new Action288();
RULE_ACTIONS[289] = new Action289();
RULE_ACTIONS[290] = new Action290();
RULE_ACTIONS[291] = new Action291(); RULE_ACTIONS[291] = new Action291();
RULE_ACTIONS[292] = new Action292(); RULE_ACTIONS[292] = new Action292();
RULE_ACTIONS[297] = new Action297(); RULE_ACTIONS[293] = new Action293();
RULE_ACTIONS[298] = new Action298(); RULE_ACTIONS[294] = new Action294();
RULE_ACTIONS[295] = new Action295();
RULE_ACTIONS[296] = new Action296();
RULE_ACTIONS[301] = new Action301(); RULE_ACTIONS[301] = new Action301();
RULE_ACTIONS[302] = new Action302(); RULE_ACTIONS[302] = new Action302();
RULE_ACTIONS[303] = new Action303();
RULE_ACTIONS[304] = new Action304();
RULE_ACTIONS[305] = new Action305(); RULE_ACTIONS[305] = new Action305();
RULE_ACTIONS[306] = new Action306();
RULE_ACTIONS[307] = new Action307();
RULE_ACTIONS[308] = new Action308();
RULE_ACTIONS[309] = new Action309();
// //
@ -1345,7 +1345,7 @@ public int getKind(int i) {
static final class Action160 extends DeclaredAction< C99ParserAction , Object > { static final class Action160 extends DeclaredAction< C99ParserAction , Object > {
public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder. public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
consumeDeclaratorWithInitializer(); /* action.builder.getASTStack().print();*/ consumeDeclaratorWithInitializer(true); /* action.builder.getASTStack().print();*/
} }
} }
@ -1701,7 +1701,7 @@ public int getKind(int i) {
} }
// //
// Rule 220: declarator ::= <openscope-ast> pointer direct_declarator // Rule 220: declarator ::= <openscope-ast> pointer_seq direct_declarator
// //
static final class Action220 extends DeclaredAction< C99ParserAction , Object > { static final class Action220 extends DeclaredAction< C99ParserAction , Object > {
@ -1759,7 +1759,7 @@ public int getKind(int i) {
static final class Action228 extends DeclaredAction< C99ParserAction , Object > { static final class Action228 extends DeclaredAction< C99ParserAction , Object > {
public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder. public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
consumeDirectDeclaratorArrayDeclarator(); /* action.builder.getASTStack().print();*/ consumeDirectDeclaratorArrayDeclarator(true); /* action.builder.getASTStack().print();*/
} }
} }
@ -1769,7 +1769,7 @@ public int getKind(int i) {
static final class Action229 extends DeclaredAction< C99ParserAction , Object > { static final class Action229 extends DeclaredAction< C99ParserAction , Object > {
public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder. public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
consumeDirectDeclaratorArrayDeclarator(); /* action.builder.getASTStack().print();*/ consumeDirectDeclaratorArrayDeclarator(true); /* action.builder.getASTStack().print();*/
} }
} }
@ -1795,7 +1795,7 @@ public int getKind(int i) {
static final class Action231 extends DeclaredAction< C99ParserAction , Object > { static final class Action231 extends DeclaredAction< C99ParserAction , Object > {
public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder. public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
consumeDirectDeclaratorFunctionDeclarator(true); /* action.builder.getASTStack().print();*/ consumeDirectDeclaratorFunctionDeclarator(true, true); /* action.builder.getASTStack().print();*/
} }
} }
@ -1805,12 +1805,12 @@ public int getKind(int i) {
static final class Action232 extends DeclaredAction< C99ParserAction , Object > { static final class Action232 extends DeclaredAction< C99ParserAction , Object > {
public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder. public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
consumeDirectDeclaratorFunctionDeclarator(false); /* action.builder.getASTStack().print();*/ consumeDirectDeclaratorFunctionDeclarator(true, false); /* action.builder.getASTStack().print();*/
} }
} }
// //
// Rule 234: function_declarator ::= <openscope-ast> pointer function_direct_declarator // Rule 234: function_declarator ::= <openscope-ast> pointer_seq function_direct_declarator
// //
static final class Action234 extends DeclaredAction< C99ParserAction , Object > { static final class Action234 extends DeclaredAction< C99ParserAction , Object > {
@ -1830,7 +1830,7 @@ public int getKind(int i) {
} }
// //
// Rule 237: knr_function_declarator ::= <openscope-ast> pointer knr_direct_declarator // Rule 237: knr_function_declarator ::= <openscope-ast> pointer_seq knr_direct_declarator
// //
static final class Action237 extends DeclaredAction< C99ParserAction , Object > { static final class Action237 extends DeclaredAction< C99ParserAction , Object > {
@ -1950,7 +1950,7 @@ public int getKind(int i) {
} }
// //
// Rule 250: pointer ::= * // Rule 250: pointer_seq ::= *
// //
static final class Action250 extends DeclaredAction< C99ParserAction , Object > { static final class Action250 extends DeclaredAction< C99ParserAction , Object > {
@ -1960,7 +1960,7 @@ public int getKind(int i) {
} }
// //
// Rule 251: pointer ::= pointer * // Rule 251: pointer_seq ::= pointer_seq *
// //
static final class Action251 extends DeclaredAction< C99ParserAction , Object > { static final class Action251 extends DeclaredAction< C99ParserAction , Object > {
@ -1970,7 +1970,7 @@ public int getKind(int i) {
} }
// //
// Rule 252: pointer ::= * <openscope-ast> type_qualifier_list // Rule 252: pointer_seq ::= * <openscope-ast> type_qualifier_list
// //
static final class Action252 extends DeclaredAction< C99ParserAction , Object > { static final class Action252 extends DeclaredAction< C99ParserAction , Object > {
@ -1980,7 +1980,7 @@ public int getKind(int i) {
} }
// //
// Rule 253: pointer ::= pointer * <openscope-ast> type_qualifier_list // Rule 253: pointer_seq ::= pointer_seq * <openscope-ast> type_qualifier_list
// //
static final class Action253 extends DeclaredAction< C99ParserAction , Object > { static final class Action253 extends DeclaredAction< C99ParserAction , Object > {
@ -2137,7 +2137,7 @@ public int getKind(int i) {
} }
// //
// Rule 268: abstract_declarator ::= <openscope-ast> pointer // Rule 268: abstract_declarator ::= <openscope-ast> pointer_seq
// //
static final class Action268 extends DeclaredAction< C99ParserAction , Object > { static final class Action268 extends DeclaredAction< C99ParserAction , Object > {
@ -2147,19 +2147,19 @@ public int getKind(int i) {
} }
// //
// Rule 269: abstract_declarator ::= <openscope-ast> pointer direct_abstract_declarator // Rule 269: abstract_declarator ::= <openscope-ast> pointer_seq direct_abstract_declarator
// //
static final class Action269 extends DeclaredAction< C99ParserAction , Object > { static final class Action269 extends DeclaredAction< C99ParserAction , Object > {
public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder. public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
consumeDeclaratorWithPointer(true); /* action.builder.getASTStack().print();*/ consumeDeclaratorWithPointer(false); /* action.builder.getASTStack().print();*/
} }
} }
// //
// Rule 270: direct_abstract_declarator ::= ( abstract_declarator ) // Rule 273: basic_direct_abstract_declarator ::= ( abstract_declarator )
// //
static final class Action270 extends DeclaredAction< C99ParserAction , Object > { static final class Action273 extends DeclaredAction< C99ParserAction , Object > {
public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder. public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
consumeDirectDeclaratorBracketed(); /* action.builder.getASTStack().print();*/ consumeDirectDeclaratorBracketed(); /* action.builder.getASTStack().print();*/
@ -2167,79 +2167,89 @@ public int getKind(int i) {
} }
// //
// Rule 271: direct_abstract_declarator ::= array_modifier // Rule 274: array_direct_abstract_declarator ::= array_modifier
//
static final class Action271 extends DeclaredAction< C99ParserAction , Object > {
public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
consumeAbstractDeclaratorArrayModifier(false); /* action.builder.getASTStack().print();*/
}
}
//
// Rule 272: direct_abstract_declarator ::= direct_abstract_declarator array_modifier
//
static final class Action272 extends DeclaredAction< C99ParserAction , Object > {
public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
consumeAbstractDeclaratorArrayModifier(true); /* action.builder.getASTStack().print();*/
}
}
//
// Rule 273: direct_abstract_declarator ::= ( )
//
static final class Action273 extends DeclaredAction< C99ParserAction , Object > {
public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
consumeAbstractDeclaratorFunctionDeclarator(false, false); /* action.builder.getASTStack().print();*/
}
}
//
// Rule 274: direct_abstract_declarator ::= direct_abstract_declarator ( )
// //
static final class Action274 extends DeclaredAction< C99ParserAction , Object > { static final class Action274 extends DeclaredAction< C99ParserAction , Object > {
public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder. public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
consumeAbstractDeclaratorFunctionDeclarator(true, false); /* action.builder.getASTStack().print();*/ consumeDirectDeclaratorArrayDeclarator(false); /* action.builder.getASTStack().print();*/
} }
} }
// //
// Rule 275: direct_abstract_declarator ::= ( <openscope-ast> parameter_type_list ) // Rule 275: array_direct_abstract_declarator ::= array_direct_abstract_declarator array_modifier
// //
static final class Action275 extends DeclaredAction< C99ParserAction , Object > { static final class Action275 extends DeclaredAction< C99ParserAction , Object > {
public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder. public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
consumeAbstractDeclaratorFunctionDeclarator(false, true); /* action.builder.getASTStack().print();*/ consumeDirectDeclaratorArrayDeclarator(true); /* action.builder.getASTStack().print();*/
} }
} }
// //
// Rule 276: direct_abstract_declarator ::= direct_abstract_declarator ( <openscope-ast> parameter_type_list ) // Rule 276: array_direct_abstract_declarator ::= basic_direct_abstract_declarator array_modifier
// //
static final class Action276 extends DeclaredAction< C99ParserAction , Object > { static final class Action276 extends DeclaredAction< C99ParserAction , Object > {
public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder. public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
consumeAbstractDeclaratorFunctionDeclarator(true, true); /* action.builder.getASTStack().print();*/ consumeDirectDeclaratorArrayDeclarator(true); /* action.builder.getASTStack().print();*/
} }
} }
// //
// Rule 277: initializer ::= assignment_expression // Rule 277: function_direct_abstract_declarator ::= ( )
// //
static final class Action277 extends DeclaredAction< C99ParserAction , Object > { static final class Action277 extends DeclaredAction< C99ParserAction , Object > {
public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
consumeDirectDeclaratorFunctionDeclarator(false, false); /* action.builder.getASTStack().print();*/
}
}
//
// Rule 278: function_direct_abstract_declarator ::= basic_direct_abstract_declarator ( )
//
static final class Action278 extends DeclaredAction< C99ParserAction , Object > {
public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
consumeDirectDeclaratorFunctionDeclarator(true, false); /* action.builder.getASTStack().print();*/
}
}
//
// Rule 279: function_direct_abstract_declarator ::= ( <openscope-ast> parameter_type_list )
//
static final class Action279 extends DeclaredAction< C99ParserAction , Object > {
public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
consumeDirectDeclaratorFunctionDeclarator(false, true); /* action.builder.getASTStack().print();*/
}
}
//
// Rule 280: function_direct_abstract_declarator ::= basic_direct_abstract_declarator ( <openscope-ast> parameter_type_list )
//
static final class Action280 extends DeclaredAction< C99ParserAction , Object > {
public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
consumeDirectDeclaratorFunctionDeclarator(true, true); /* action.builder.getASTStack().print();*/
}
}
//
// Rule 281: initializer ::= assignment_expression
//
static final class Action281 extends DeclaredAction< C99ParserAction , Object > {
public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder. public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
consumeInitializer(); /* action.builder.getASTStack().print();*/ consumeInitializer(); /* action.builder.getASTStack().print();*/
} }
} }
// //
// Rule 278: initializer ::= { <openscope-ast> initializer_list comma_opt } // Rule 282: initializer ::= { <openscope-ast> initializer_list comma_opt }
// //
static final class Action278 extends DeclaredAction< C99ParserAction , Object > { static final class Action282 extends DeclaredAction< C99ParserAction , Object > {
public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder. public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
consumeInitializerList(); /* action.builder.getASTStack().print();*/ consumeInitializerList(); /* action.builder.getASTStack().print();*/
@ -2247,9 +2257,9 @@ public int getKind(int i) {
} }
// //
// Rule 283: designated_initializer ::= <openscope-ast> designation = initializer // Rule 287: designated_initializer ::= <openscope-ast> designation = initializer
// //
static final class Action283 extends DeclaredAction< C99ParserAction , Object > { static final class Action287 extends DeclaredAction< C99ParserAction , Object > {
public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder. public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
consumeInitializerDesignated(); /* action.builder.getASTStack().print();*/ consumeInitializerDesignated(); /* action.builder.getASTStack().print();*/
@ -2257,59 +2267,59 @@ public int getKind(int i) {
} }
// //
// Rule 287: designator_base ::= [ constant_expression ] // Rule 291: designator_base ::= [ constant_expression ]
//
static final class Action287 extends DeclaredAction< C99ParserAction , Object > {
public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
consumeDesignatorArray(); /* action.builder.getASTStack().print();*/
}
}
//
// Rule 288: designator_base ::= . identifier_or_typedefname
//
static final class Action288 extends DeclaredAction< C99ParserAction , Object > {
public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
consumeDesignatorField(); /* action.builder.getASTStack().print();*/
}
}
//
// Rule 289: designator ::= [ constant_expression ]
//
static final class Action289 extends DeclaredAction< C99ParserAction , Object > {
public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
consumeDesignatorArray(); /* action.builder.getASTStack().print();*/
}
}
//
// Rule 290: designator ::= . identifier_or_typedefname
//
static final class Action290 extends DeclaredAction< C99ParserAction , Object > {
public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
consumeDesignatorField(); /* action.builder.getASTStack().print();*/
}
}
//
// Rule 291: translation_unit ::= external_declaration_list
// //
static final class Action291 extends DeclaredAction< C99ParserAction , Object > { static final class Action291 extends DeclaredAction< C99ParserAction , Object > {
public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
consumeDesignatorArray(); /* action.builder.getASTStack().print();*/
}
}
//
// Rule 292: designator_base ::= . identifier_or_typedefname
//
static final class Action292 extends DeclaredAction< C99ParserAction , Object > {
public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
consumeDesignatorField(); /* action.builder.getASTStack().print();*/
}
}
//
// Rule 293: designator ::= [ constant_expression ]
//
static final class Action293 extends DeclaredAction< C99ParserAction , Object > {
public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
consumeDesignatorArray(); /* action.builder.getASTStack().print();*/
}
}
//
// Rule 294: designator ::= . identifier_or_typedefname
//
static final class Action294 extends DeclaredAction< C99ParserAction , Object > {
public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
consumeDesignatorField(); /* action.builder.getASTStack().print();*/
}
}
//
// Rule 295: translation_unit ::= external_declaration_list
//
static final class Action295 extends DeclaredAction< C99ParserAction , Object > {
public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder. public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
consumeTranslationUnit(); /* action.builder.getASTStack().print();*/ consumeTranslationUnit(); /* action.builder.getASTStack().print();*/
} }
} }
// //
// Rule 292: translation_unit ::= $Empty // Rule 296: translation_unit ::= $Empty
// //
static final class Action292 extends DeclaredAction< C99ParserAction , Object > { static final class Action296 extends DeclaredAction< C99ParserAction , Object > {
public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder. public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
consumeTranslationUnit(); /* action.builder.getASTStack().print();*/ consumeTranslationUnit(); /* action.builder.getASTStack().print();*/
@ -2317,9 +2327,9 @@ public int getKind(int i) {
} }
// //
// Rule 297: external_declaration ::= ; // Rule 301: external_declaration ::= ;
// //
static final class Action297 extends DeclaredAction< C99ParserAction , Object > { static final class Action301 extends DeclaredAction< C99ParserAction , Object > {
public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder. public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
consumeDeclarationEmpty(); /* action.builder.getASTStack().print();*/ consumeDeclarationEmpty(); /* action.builder.getASTStack().print();*/
@ -2327,9 +2337,9 @@ public int getKind(int i) {
} }
// //
// Rule 298: external_declaration ::= ERROR_TOKEN // Rule 302: external_declaration ::= ERROR_TOKEN
// //
static final class Action298 extends DeclaredAction< C99ParserAction , Object > { static final class Action302 extends DeclaredAction< C99ParserAction , Object > {
public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder. public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
consumeDeclarationProblem(); /* action.builder.getASTStack().print();*/ consumeDeclarationProblem(); /* action.builder.getASTStack().print();*/
@ -2338,9 +2348,9 @@ public int getKind(int i) {
// //
// Rule 301: function_definition ::= declaration_specifiers <openscope-ast> function_declarator function_body // Rule 305: function_definition ::= declaration_specifiers <openscope-ast> function_declarator function_body
// //
static final class Action301 extends DeclaredAction< C99ParserAction , Object > { static final class Action305 extends DeclaredAction< C99ParserAction , Object > {
public boolean doTrial(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.resolver. public boolean doTrial(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.resolver.
@ -2348,7 +2358,7 @@ public int getKind(int i) {
return hasUndo; return hasUndo;
} }
public Action301() { hasUndo = true; }; public Action305() { hasUndo = true; };
public void doUndo(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.resolver.undo(); public void doUndo(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.resolver.undo();
} }
@ -2361,9 +2371,9 @@ public int getKind(int i) {
// //
// Rule 302: function_definition ::= <openscope-declaration> <openscope-ast> function_declarator function_body // Rule 306: function_definition ::= <openscope-declaration> <openscope-ast> function_declarator function_body
// //
static final class Action302 extends DeclaredAction< C99ParserAction , Object > { static final class Action306 extends DeclaredAction< C99ParserAction , Object > {
public boolean doTrial(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.resolver. public boolean doTrial(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.resolver.
@ -2371,7 +2381,7 @@ public int getKind(int i) {
return hasUndo; return hasUndo;
} }
public Action302() { hasUndo = true; }; public Action306() { hasUndo = true; };
public void doUndo(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.resolver.undo(); public void doUndo(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.resolver.undo();
} }
@ -2384,9 +2394,9 @@ public int getKind(int i) {
// //
// Rule 303: function_definition ::= declaration_specifiers <openscope-ast> knr_function_declarator <openscope-ast> declaration_list compound_statement // Rule 307: function_definition ::= declaration_specifiers <openscope-ast> knr_function_declarator <openscope-ast> declaration_list compound_statement
// //
static final class Action303 extends DeclaredAction< C99ParserAction , Object > { static final class Action307 extends DeclaredAction< C99ParserAction , Object > {
public boolean doTrial(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.resolver. public boolean doTrial(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.resolver.
@ -2394,7 +2404,7 @@ public int getKind(int i) {
return hasUndo; return hasUndo;
} }
public Action303() { hasUndo = true; }; public Action307() { hasUndo = true; };
public void doUndo(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.resolver.undo(); public void doUndo(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.resolver.undo();
} }
@ -2406,9 +2416,9 @@ public int getKind(int i) {
} }
// //
// Rule 304: function_body ::= { } // Rule 308: function_body ::= { }
// //
static final class Action304 extends DeclaredAction< C99ParserAction , Object > { static final class Action308 extends DeclaredAction< C99ParserAction , Object > {
public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder. public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
consumeStatementCompoundStatement(false); /* action.builder.getASTStack().print();*/ consumeStatementCompoundStatement(false); /* action.builder.getASTStack().print();*/
@ -2416,9 +2426,9 @@ public int getKind(int i) {
} }
// //
// Rule 305: function_body ::= { <openscope-ast> block_item_list } // Rule 309: function_body ::= { <openscope-ast> block_item_list }
// //
static final class Action305 extends DeclaredAction< C99ParserAction , Object > { static final class Action309 extends DeclaredAction< C99ParserAction , Object > {
public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder. public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
consumeStatementCompoundStatement(true); /* action.builder.getASTStack().print();*/ consumeStatementCompoundStatement(true); /* action.builder.getASTStack().print();*/

View file

@ -923,6 +923,7 @@ declaration_specifiers_opt
no_type_declaration_specifier no_type_declaration_specifier
::= storage_class_specifier ::= storage_class_specifier
| function_specifier | function_specifier
| cv_qualifier
| 'friend' | 'friend'
/. $Build consumeDeclSpecToken(); $EndBuild ./ /. $Build consumeDeclSpecToken(); $EndBuild ./
| 'typedef' | 'typedef'
@ -998,13 +999,12 @@ typedef_name
::= 'identifier' ::= 'identifier'
type_specifier --type_specifier
::= simple_type_specifier -- int, void etc... -- ::= simple_type_specifier -- int, void etc...
| class_specifier -- structs, unions, classes -- | class_specifier -- structs, unions, classes
| enum_specifier -- enums -- | enum_specifier -- enums
| elaborated_type_specifier -- its elaborated, but this is different than c, includes typename -- | elaborated_type_specifier -- its elaborated, but this is different than c, includes typename
| cv_qualifier -- the const and volatile keywords (separated because they can be applied to pointer modifiers) -- | cv_qualifier -- the const and volatile keywords (separated because they can be applied to pointer modifiers)
--simple_type_specifier --simple_type_specifier
@ -1191,12 +1191,13 @@ init_declarator_list_opt
init_declarator init_declarator
::= declarator ::= declarator
| declarator initializer | declarator initializer
/. $Build consumeDeclaratorWithInitializer(); $EndBuild ./ /. $Build consumeDeclaratorWithInitializer(true); $EndBuild ./
declarator declarator
::= <openscope-ast> ptr_operator_seq_opt direct_declarator ::= direct_declarator
/. $Build consumeDeclaratorWithPointer(); $EndBuild ./ | <openscope-ast> ptr_operator_seq direct_declarator
/. $Build consumeDeclaratorWithPointer(true); $EndBuild ./
direct_declarator direct_declarator
@ -1214,13 +1215,14 @@ basic_direct_declarator
function_direct_declarator function_direct_declarator
::= basic_direct_declarator '(' <openscope-ast> parameter_declaration_clause ')' <openscope-ast> cv_qualifier_seq_opt <openscope-ast> exception_specification_opt ::= basic_direct_declarator '(' <openscope-ast> parameter_declaration_clause ')' <openscope-ast> cv_qualifier_seq_opt <openscope-ast> exception_specification_opt
/. $Build consumeDirectDeclaratorFunctionDeclarator(); $EndBuild ./ /. $Build consumeDirectDeclaratorFunctionDeclarator(true); $EndBuild ./
array_direct_declarator array_direct_declarator
::= array_direct_declarator array_modifier ::= array_direct_declarator array_modifier
/. $Build consumeDirectDeclaratorArrayDeclarator(); $EndBuild ./ /. $Build consumeDirectDeclaratorArrayDeclarator(true); $EndBuild ./
| basic_direct_declarator array_modifier | basic_direct_declarator array_modifier
/. $Build consumeDirectDeclaratorArrayDeclarator(); $EndBuild ./ /. $Build consumeDirectDeclaratorArrayDeclarator(true); $EndBuild ./
array_modifier array_modifier
@ -1278,32 +1280,53 @@ type_id
/. $Build consumeTypeId(true); $EndBuild ./ /. $Build consumeTypeId(true); $EndBuild ./
--type_specifier_seq
-- ::= type_specifier
-- | type_specifier_seq type_specifier
-- more lenient than spec, but easier to deal with
type_specifier_seq type_specifier_seq
::= type_specifier ::= declaration_specifiers
| type_specifier_seq type_specifier
abstract_declarator abstract_declarator
::= ptr_operator abstract_declarator_opt ::= direct_abstract_declarator
| direct_abstract_declarator | <openscope-ast> ptr_operator_seq
/. $Build consumeDeclaratorWithPointer(false); $EndBuild ./
| <openscope-ast> ptr_operator_seq direct_abstract_declarator
abstract_declarator_opt /. $Build consumeDeclaratorWithPointer(true); $EndBuild ./
::= abstract_declarator
| $empty
direct_abstract_declarator direct_abstract_declarator
::= direct_abstract_declarator_opt '(' <openscope-ast> parameter_declaration_clause ')' <openscope-ast> cv_qualifier_seq_opt <openscope-ast> exception_specification_opt ::= basic_direct_abstract_declarator
| direct_abstract_declarator_opt '[' constant_expression_opt ']' | array_direct_abstract_declarator
| '(' abstract_declarator ')' | function_direct_abstract_declarator
direct_abstract_declarator_opt
::= direct_abstract_declarator
| $empty
basic_direct_abstract_declarator
::= '(' abstract_declarator ')'
/. $Build consumeDirectDeclaratorBracketed(); $EndBuild ./
array_direct_abstract_declarator
::= array_modifier
/. $Build consumeDirectDeclaratorArrayDeclarator(false); $EndBuild ./
| array_direct_abstract_declarator array_modifier
/. $Build consumeDirectDeclaratorArrayDeclarator(true); $EndBuild ./
| basic_direct_abstract_declarator array_modifier
/. $Build consumeDirectDeclaratorArrayDeclarator(true); $EndBuild ./
function_direct_abstract_declarator
::= basic_direct_abstract_declarator '(' <openscope-ast> parameter_declaration_clause ')' <openscope-ast> cv_qualifier_seq_opt <openscope-ast> exception_specification_opt
/. $Build consumeDirectDeclaratorFunctionDeclarator(true); $EndBuild ./
| '(' <openscope-ast> parameter_declaration_clause ')' <openscope-ast> cv_qualifier_seq_opt <openscope-ast> exception_specification_opt
/. $Build consumeDirectDeclaratorFunctionDeclarator(false); $EndBuild ./
-- actions just place a marker indicating if '...' was parsed
parameter_declaration_clause parameter_declaration_clause
::= parameter_declaration_list_opt '...' ::= parameter_declaration_list_opt '...'
/. $Build consumePlaceHolder(); $EndBuild ./ /. $Build consumePlaceHolder(); $EndBuild ./
@ -1317,15 +1340,47 @@ parameter_declaration_list
::= parameter_declaration ::= parameter_declaration
| parameter_declaration_list ',' parameter_declaration | parameter_declaration_list ',' parameter_declaration
parameter_declaration_list_opt parameter_declaration_list_opt
::= parameter_declaration_list ::= parameter_declaration_list
| $empty | $empty
-- its just a declarator with an initializer
--parameter_declaration
-- ::= declaration_specifiers declarator
-- | declaration_specifiers declarator = assignment_expression
-- | declaration_specifiers abstract_declarator_opt
-- | declaration_specifiers abstract_declarator_opt = assignment_expression
abstract_declarator_opt
::= abstract_declarator
| $empty
/. $Build consumeEmpty(); $EndBuild ./
parameter_declaration parameter_declaration
::= declaration_specifiers declarator ::= declaration_specifiers parameter_init_declarator
| declaration_specifiers declarator = assignment_expression /. $Build consumeParameterDeclaration(); $EndBuild ./
| declaration_specifiers abstract_declarator_opt | declaration_specifiers
| declaration_specifiers abstract_declarator_opt = assignment_expression /. $Build consumeParameterDeclarationWithoutDeclarator(); $EndBuild ./
parameter_init_declarator
::= declarator
| declarator '=' parameter_initializer
/. $Build consumeDeclaratorWithInitializer(true); $EndBuild ./
| abstract_declarator
| abstract_declarator '=' parameter_initializer
/. $Build consumeDeclaratorWithInitializer(true); $EndBuild ./
| '=' parameter_initializer
/. $Build consumeDeclaratorWithInitializer(false); $EndBuild ./
parameter_initializer
::= assignment_expression
/. $Build consumeInitializer(); $EndBuild ./
function_definition function_definition

View file

@ -15,68 +15,68 @@ package org.eclipse.cdt.internal.core.dom.lrparser.cpp;
public interface CPPParsersym { public interface CPPParsersym {
public final static int public final static int
TK_asm = 54, TK_asm = 63,
TK_auto = 55, TK_auto = 49,
TK_bool = 8, TK_bool = 13,
TK_break = 76, TK_break = 76,
TK_case = 77, TK_case = 77,
TK_catch = 115, TK_catch = 115,
TK_char = 9, TK_char = 14,
TK_class = 41, TK_class = 58,
TK_const = 67, TK_const = 47,
TK_const_cast = 26, TK_const_cast = 26,
TK_continue = 78, TK_continue = 78,
TK_default = 79, TK_default = 79,
TK_delete = 42, TK_delete = 41,
TK_do = 80, TK_do = 80,
TK_double = 10, TK_double = 15,
TK_dynamic_cast = 27, TK_dynamic_cast = 27,
TK_else = 120, TK_else = 120,
TK_enum = 44, TK_enum = 64,
TK_explicit = 56, TK_explicit = 50,
TK_export = 72, TK_export = 72,
TK_extern = 45, TK_extern = 42,
TK_false = 28, TK_false = 28,
TK_float = 11, TK_float = 16,
TK_for = 81, TK_for = 81,
TK_friend = 57, TK_friend = 51,
TK_goto = 82, TK_goto = 82,
TK_if = 83, TK_if = 83,
TK_inline = 58, TK_inline = 52,
TK_int = 12, TK_int = 17,
TK_long = 13, TK_long = 18,
TK_mutable = 59, TK_mutable = 53,
TK_namespace = 53, TK_namespace = 60,
TK_new = 43, TK_new = 43,
TK_operator = 7, TK_operator = 6,
TK_private = 116, TK_private = 116,
TK_protected = 117, TK_protected = 117,
TK_public = 118, TK_public = 118,
TK_register = 60, TK_register = 54,
TK_reinterpret_cast = 29, TK_reinterpret_cast = 29,
TK_return = 84, TK_return = 84,
TK_short = 14, TK_short = 19,
TK_signed = 15, TK_signed = 20,
TK_sizeof = 30, TK_sizeof = 30,
TK_static = 61, TK_static = 55,
TK_static_cast = 31, TK_static_cast = 31,
TK_struct = 46, TK_struct = 65,
TK_switch = 85, TK_switch = 85,
TK_template = 48, TK_template = 44,
TK_this = 32, TK_this = 32,
TK_throw = 39, TK_throw = 39,
TK_try = 73, TK_try = 73,
TK_true = 33, TK_true = 33,
TK_typedef = 62, TK_typedef = 56,
TK_typeid = 34, TK_typeid = 34,
TK_typename = 21, TK_typename = 10,
TK_union = 47, TK_union = 66,
TK_unsigned = 16, TK_unsigned = 21,
TK_using = 51, TK_using = 59,
TK_virtual = 52, TK_virtual = 46,
TK_void = 17, TK_void = 22,
TK_volatile = 68, TK_volatile = 48,
TK_wchar_t = 18, TK_wchar_t = 23,
TK_while = 75, TK_while = 75,
TK_integer = 35, TK_integer = 35,
TK_floating = 36, TK_floating = 36,
@ -88,27 +88,27 @@ public interface CPPParsersym {
TK_Completion = 122, TK_Completion = 122,
TK_EndOfCompletion = 123, TK_EndOfCompletion = 123,
TK_Invalid = 124, TK_Invalid = 124,
TK_LeftBracket = 63, TK_LeftBracket = 61,
TK_LeftParen = 2, TK_LeftParen = 2,
TK_LeftBrace = 50, TK_LeftBrace = 57,
TK_Dot = 114, TK_Dot = 114,
TK_DotStar = 94, TK_DotStar = 94,
TK_Arrow = 101, TK_Arrow = 101,
TK_ArrowStar = 88, TK_ArrowStar = 88,
TK_PlusPlus = 22, TK_PlusPlus = 11,
TK_MinusMinus = 23, TK_MinusMinus = 12,
TK_And = 5, TK_And = 7,
TK_Star = 4, TK_Star = 5,
TK_Plus = 19, TK_Plus = 8,
TK_Minus = 20, TK_Minus = 9,
TK_Tilde = 6, TK_Tilde = 4,
TK_Bang = 25, TK_Bang = 25,
TK_Slash = 89, TK_Slash = 89,
TK_Percent = 90, TK_Percent = 90,
TK_RightShift = 86, TK_RightShift = 86,
TK_LeftShift = 87, TK_LeftShift = 87,
TK_LT = 64, TK_LT = 62,
TK_GT = 65, TK_GT = 67,
TK_LE = 91, TK_LE = 91,
TK_GE = 92, TK_GE = 92,
TK_EQ = 95, TK_EQ = 95,
@ -117,11 +117,11 @@ public interface CPPParsersym {
TK_Or = 98, TK_Or = 98,
TK_AndAnd = 99, TK_AndAnd = 99,
TK_OrOr = 100, TK_OrOr = 100,
TK_Question = 113, TK_Question = 112,
TK_Colon = 69, TK_Colon = 70,
TK_ColonColon = 3, TK_ColonColon = 3,
TK_DotDotDot = 93, TK_DotDotDot = 93,
TK_Assign = 70, TK_Assign = 69,
TK_StarAssign = 102, TK_StarAssign = 102,
TK_SlashAssign = 103, TK_SlashAssign = 103,
TK_PercentAssign = 104, TK_PercentAssign = 104,
@ -132,12 +132,12 @@ public interface CPPParsersym {
TK_AndAssign = 109, TK_AndAssign = 109,
TK_CaretAssign = 110, TK_CaretAssign = 110,
TK_OrAssign = 111, TK_OrAssign = 111,
TK_Comma = 66, TK_Comma = 68,
TK_RightBracket = 112, TK_RightBracket = 113,
TK_RightParen = 74, TK_RightParen = 74,
TK_RightBrace = 71, TK_RightBrace = 71,
TK_SemiColon = 40, TK_SemiColon = 40,
TK_ERROR_TOKEN = 49, TK_ERROR_TOKEN = 45,
TK_EOF_TOKEN = 119; TK_EOF_TOKEN = 119;
public final static String orderedTerminalSymbols[] = { public final static String orderedTerminalSymbols[] = {
@ -145,10 +145,15 @@ public interface CPPParsersym {
"identifier", "identifier",
"LeftParen", "LeftParen",
"ColonColon", "ColonColon",
"Star",
"And",
"Tilde", "Tilde",
"Star",
"operator", "operator",
"And",
"Plus",
"Minus",
"typename",
"PlusPlus",
"MinusMinus",
"bool", "bool",
"char", "char",
"double", "double",
@ -160,11 +165,6 @@ public interface CPPParsersym {
"unsigned", "unsigned",
"void", "void",
"wchar_t", "wchar_t",
"Plus",
"Minus",
"typename",
"PlusPlus",
"MinusMinus",
"stringlit", "stringlit",
"Bang", "Bang",
"const_cast", "const_cast",
@ -182,20 +182,14 @@ public interface CPPParsersym {
"zero", "zero",
"throw", "throw",
"SemiColon", "SemiColon",
"class",
"delete", "delete",
"new",
"enum",
"extern", "extern",
"struct", "new",
"union",
"template", "template",
"ERROR_TOKEN", "ERROR_TOKEN",
"LeftBrace",
"using",
"virtual", "virtual",
"namespace", "const",
"asm", "volatile",
"auto", "auto",
"explicit", "explicit",
"friend", "friend",
@ -204,14 +198,20 @@ public interface CPPParsersym {
"register", "register",
"static", "static",
"typedef", "typedef",
"LeftBrace",
"class",
"using",
"namespace",
"LeftBracket", "LeftBracket",
"LT", "LT",
"asm",
"enum",
"struct",
"union",
"GT", "GT",
"Comma", "Comma",
"const",
"volatile",
"Colon",
"Assign", "Assign",
"Colon",
"RightBrace", "RightBrace",
"export", "export",
"try", "try",
@ -253,8 +253,8 @@ public interface CPPParsersym {
"AndAssign", "AndAssign",
"CaretAssign", "CaretAssign",
"OrAssign", "OrAssign",
"RightBracket",
"Question", "Question",
"RightBracket",
"Dot", "Dot",
"catch", "catch",
"private", "private",