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

Bug 232606 [LR parser] content assist not working in base specifier list

This commit is contained in:
Mike Kucera 2008-05-16 21:23:38 +00:00
parent cec3ad4e98
commit 35a78ba53d
20 changed files with 12421 additions and 12368 deletions

View file

@ -9,12 +9,6 @@
-- IBM Corporation - initial API and implementation -- IBM Corporation - initial API and implementation
---------------------------------------------------------------------------------- ----------------------------------------------------------------------------------
%options la=2
%options package=org.eclipse.cdt.internal.core.dom.lrparser.cpp
%options template=btParserTemplateD.g
$Notice $Notice
-- Copied into all files generated by LPG -- Copied into all files generated by LPG
/./******************************************************************************* /./*******************************************************************************
@ -49,26 +43,20 @@ $Terminals
typeid typename union unsigned using virtual typeid typename union unsigned using virtual
void volatile wchar_t while void volatile wchar_t while
-- Literals (also true and false are considered literals) -- Literals
integer floating charconst stringlit integer floating charconst stringlit
-- zero -- this is a special token used to disambiguate the the grammar rule for pure virtual functions -- Identifiers
-- TODO is this really necessary? because it adds overhead in getKind()
-- identifiers
-- Special token that represents identifiers that have been declared as typedefs (lexer feedback hack)
-- there's going to be more of these
identifier identifier
-- TypedefName
-- Special tokens used in content assist -- Special tokens used in content assist
Completion Completion
EndOfCompletion EndOfCompletion ::= 'EOC'
-- Unrecognized token -- Unrecognized token, not actually used anywhere in the grammar, always leads to syntax error
Invalid Invalid
@ -119,7 +107,6 @@ $Terminals
CaretAssign ::= '^=' CaretAssign ::= '^='
OrAssign ::= '|=' OrAssign ::= '|='
Comma ::= ',' Comma ::= ','
zero ::= '0'
RightBracket -- these four have special rules for content assist RightBracket -- these four have special rules for content assist
RightParen RightParen
@ -229,32 +216,11 @@ $Headers
} }
public int getKind(int i) {
int kind = super.getKind(i);
// There used to be a special token kind for zero used to parser pure virtual function declarations.
// But it turned out to be easier to just parse them as an init_ declarator and programaticaly check
// for pure virtual, see consumeMemberDeclaratorWithInitializer().
//if(kind == CPPParsersym.TK_integer && "0".equals(getTokenText(i))) { //$NON-NLS-1$
// kind = CPPParsersym.TK_zero;
//}
// lexer feedback hack!
//else if(kind == C99Parsersym.TK_identifier && action.resolver.isTypedef(getTokenText(i))) {
// kind = C99Parsersym.TK_TypedefName;
//}
return kind;
}
// uncomment this method to use with backtracking parser // uncomment this method to use with backtracking parser
public List getRuleTokens() { public List getRuleTokens() {
return Collections.unmodifiableList(getTokens().subList(getLeftSpan(), getRightSpan() + 1)); return Collections.unmodifiableList(getTokens().subList(getLeftSpan(), getRightSpan() + 1));
} }
public IASTNode getSecondaryParseResult() { public IASTNode getSecondaryParseResult() {
return action.builder.getSecondaryParseResult(); return action.builder.getSecondaryParseResult();
} }
@ -595,7 +561,7 @@ unary_expression
/. $Build consumeExpressionTypeId(ICPPASTTypeIdExpression.op_sizeof); $EndBuild ./ /. $Build consumeExpressionTypeId(ICPPASTTypeIdExpression.op_sizeof); $EndBuild ./
new_expression -- done new_expression
::= dcolon_opt 'new' new_placement_opt new_type_id <openscope-ast> new_array_expressions_opt new_initializer_opt ::= dcolon_opt 'new' new_placement_opt new_type_id <openscope-ast> new_array_expressions_opt new_initializer_opt
/. $Build consumeExpressionNew(true); $EndBuild ./ /. $Build consumeExpressionNew(true); $EndBuild ./
| dcolon_opt 'new' new_placement_opt '(' type_id ')' <openscope-ast> new_array_expressions_opt new_initializer_opt | dcolon_opt 'new' new_placement_opt '(' type_id ')' <openscope-ast> new_array_expressions_opt new_initializer_opt
@ -1506,12 +1472,15 @@ class_name
| template_id_name | template_id_name
class_specifier -- done class_specifier
::= class_head '{' <openscope-ast> member_declaration_list_opt '}' ::= class_head '{' <openscope-ast> member_declaration_list_opt '}'
/. $Build consumeClassSpecifier(); $EndBuild ./
-- need this for content assist to work properly for base specifiers
| class_head 'EOC' <openscope-ast> member_declaration_list_opt '}'
/. $Build consumeClassSpecifier(); $EndBuild ./ /. $Build consumeClassSpecifier(); $EndBuild ./
class_head -- done class_head
::= class_keyword identifier_name_opt <openscope-ast> base_clause_opt ::= class_keyword identifier_name_opt <openscope-ast> base_clause_opt
/. $Build consumeClassHead(false); $EndBuild ./ /. $Build consumeClassHead(false); $EndBuild ./
| class_keyword template_id_name <openscope-ast> base_clause_opt | class_keyword template_id_name <openscope-ast> base_clause_opt
@ -1575,7 +1544,8 @@ member_declarator_list
member_declarator member_declarator
::= declarator ::= declarator
-- | declarator pure_specifier -- parse this as a constant initializer -- parse pure specifier as a constant_initializer, reduces conflicts
-- | declarator pure_specifier
| declarator constant_initializer | declarator constant_initializer
/. $Build consumeMemberDeclaratorWithInitializer(); $EndBuild ./ /. $Build consumeMemberDeclaratorWithInitializer(); $EndBuild ./
| bit_field_declarator ':' constant_expression | bit_field_declarator ':' constant_expression
@ -1589,10 +1559,6 @@ bit_field_declarator
/. $Build consumeDirectDeclaratorIdentifier(); $EndBuild ./ /. $Build consumeDirectDeclaratorIdentifier(); $EndBuild ./
--pure_specifier -- this leads to ambiguities
-- ::= '=' '0'
constant_initializer constant_initializer
::= '=' constant_expression ::= '=' constant_expression
/. $Build consumeInitializer(); $EndBuild ./ /. $Build consumeInitializer(); $EndBuild ./

View file

@ -1004,18 +1004,9 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
IASTDeclaration declaration = (IASTDeclaration) astStack.pop(); IASTDeclaration declaration = (IASTDeclaration) astStack.pop();
// Ugly hack alert!
// For some reason ambiguous declarators cause bugs when they are a part of a template declaration. // For some reason ambiguous declarators cause bugs when they are a part of a template declaration.
// But it shouldn't be ambiguous anyway, so just throw away the ambiguity node. // But it shouldn't be ambiguous anyway, so just throw away the ambiguity node.
if(declaration instanceof IASTSimpleDeclaration) { resolveAmbiguousDeclaratorsToFunction(declaration);
for(IASTDeclarator declarator : ((IASTSimpleDeclaration)declaration).getDeclarators()) {
if(declarator instanceof CPPASTAmbiguousDeclarator) {
IASTAmbiguityParent owner = (IASTAmbiguityParent) declaration;
CPPASTAmbiguousDeclarator ambiguity = (CPPASTAmbiguousDeclarator)declarator;
owner.replace(ambiguity, ambiguity.getNodes()[0]);
}
}
}
ICPPASTTemplateDeclaration templateDeclaration = nodeFactory.newTemplateDeclaration(declaration); ICPPASTTemplateDeclaration templateDeclaration = nodeFactory.newTemplateDeclaration(declaration);
@ -1032,6 +1023,23 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
} }
/**
* If we know that a declarator must be a function declarator then we can resolve
* the ambiguity without resorting to binding resolution.
*/
private static void resolveAmbiguousDeclaratorsToFunction(IASTDeclaration declaration) {
if(declaration instanceof IASTSimpleDeclaration) {
for(IASTDeclarator declarator : ((IASTSimpleDeclaration)declaration).getDeclarators()) {
if(declarator instanceof CPPASTAmbiguousDeclarator) {
IASTAmbiguityParent owner = (IASTAmbiguityParent) declaration;
CPPASTAmbiguousDeclarator ambiguity = (CPPASTAmbiguousDeclarator)declarator;
owner.replace(ambiguity, ambiguity.getNodes()[0]);
}
}
}
}
/** /**
* explicit_instantiation * explicit_instantiation
* ::= 'template' declaration * ::= 'template' declaration
@ -1212,14 +1220,12 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
/** /**
* simple_declaration * simple_declaration
* ::= declaration_specifiers_opt <openscope-ast> init_declarator_list_opt ';' * ::= declaration_specifiers_opt <openscope-ast> init_declarator_list_opt ';'
*
* TODO: remove attemptAmbiguityResolution parameter
*/ */
public void consumeDeclarationSimple(boolean hasDeclaratorList) { public void consumeDeclarationSimple(boolean hasDeclaratorList) {
if(TRACE_ACTIONS) DebugUtil.printMethodTrace(); if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
List<Object> declarators = hasDeclaratorList ? astStack.closeScope() : Collections.emptyList(); List<Object> declarators = hasDeclaratorList ? astStack.closeScope() : Collections.emptyList();
IASTDeclSpecifier declSpecifier = (IASTDeclSpecifier) astStack.pop(); // may be null ICPPASTDeclSpecifier declSpecifier = (ICPPASTDeclSpecifier) astStack.pop(); // may be null
List<IToken> ruleTokens = parser.getRuleTokens(); List<IToken> ruleTokens = parser.getRuleTokens();
IToken nameToken = null; IToken nameToken = null;
@ -1240,7 +1246,7 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
// can happen if implicit int is used // can happen if implicit int is used
else if(declSpecifier == null) { else if(declSpecifier == null) {
declSpecifier = nodeFactory.newSimpleDeclSpecifier(); declSpecifier = nodeFactory.newCPPSimpleDeclSpecifier();
setOffsetAndLength(declSpecifier, parser.getLeftIToken().getStartOffset(), 0); setOffsetAndLength(declSpecifier, parser.getLeftIToken().getStartOffset(), 0);
} }
@ -1251,9 +1257,9 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
ruleTokens.size() >= 2 && ruleTokens.size() >= 2 &&
baseKind(nameToken = ruleTokens.get(ruleTokens.size() - 2)) == TK_identifier) { baseKind(nameToken = ruleTokens.get(ruleTokens.size() - 2)) == TK_identifier) {
declSpecifier = nodeFactory.newSimpleDeclSpecifier(); declSpecifier = nodeFactory.newCPPSimpleDeclSpecifier();
for(IToken t : ruleTokens.subList(0, ruleTokens.size()-1)) for(IToken t : ruleTokens.subList(0, ruleTokens.size()-1))
setSpecifier((ICPPASTDeclSpecifier)declSpecifier, t); setSpecifier(declSpecifier, t);
int offset = offset(parser.getLeftIToken()); int offset = offset(parser.getLeftIToken());
int length = endOffset(ruleTokens.get(ruleTokens.size()-2)) - offset; int length = endOffset(ruleTokens.get(ruleTokens.size()-2)) - offset;
@ -1271,6 +1277,20 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
for(Object declarator : declarators) for(Object declarator : declarators)
declaration.addDeclarator((IASTDeclarator)declarator); declaration.addDeclarator((IASTDeclarator)declarator);
// simple ambiguity resolutions
// if(declSpecifier.isFriend())
// resolveAmbiguousDeclaratorsToFunction(declaration);
//
// if(declSpecifier instanceof IASTSimpleDeclSpecifier) {
// IASTSimpleDeclSpecifier simple = (IASTSimpleDeclSpecifier) declSpecifier;
// if(simple.getType() == IASTSimpleDeclSpecifier.t_void && declaration.getDeclarators()[0].getPointerOperators().length == 0)
// resolveAmbiguousDeclaratorsToFunction(declaration);
//
// }
astStack.push(declaration); astStack.push(declaration);

View file

@ -209,32 +209,11 @@ public IASTCompletionNode parse(IASTTranslationUnit tu) {
} }
public int getKind(int i) {
int kind = super.getKind(i);
// There used to be a special token kind for zero used to parser pure virtual function declarations.
// But it turned out to be easier to just parse them as an init_ declarator and programaticaly check
// for pure virtual, see consumeMemberDeclaratorWithInitializer().
//if(kind == CPPParsersym.TK_integer && "0".equals(getTokenText(i))) { //$NON-NLS-1$
// kind = CPPParsersym.TK_zero;
//}
// lexer feedback hack!
//else if(kind == C99Parsersym.TK_identifier && action.resolver.isTypedef(getTokenText(i))) {
// kind = C99Parsersym.TK_TypedefName;
//}
return kind;
}
// uncomment this method to use with backtracking parser // uncomment this method to use with backtracking parser
public List getRuleTokens() { public List getRuleTokens() {
return Collections.unmodifiableList(getTokens().subList(getLeftSpan(), getRightSpan() + 1)); return Collections.unmodifiableList(getTokens().subList(getLeftSpan(), getRightSpan() + 1));
} }
public IASTNode getSecondaryParseResult() { public IASTNode getSecondaryParseResult() {
return action.builder.getSecondaryParseResult(); return action.builder.getSecondaryParseResult();
} }
@ -1911,366 +1890,373 @@ public CPPExpressionStatementParser(String[] mapFrom) { // constructor
} }
// //
// Rule 389: class_head ::= class_keyword identifier_name_opt <openscope-ast> base_clause_opt // Rule 389: class_specifier ::= class_head EOC <openscope-ast> member_declaration_list_opt }
// //
case 389: { action.builder. case 389: { action.builder.
consumeClassHead(false); break; consumeClassSpecifier(); break;
} }
// //
// Rule 390: class_head ::= class_keyword template_id_name <openscope-ast> base_clause_opt // Rule 390: class_head ::= class_keyword identifier_name_opt <openscope-ast> base_clause_opt
// //
case 390: { action.builder. case 390: { action.builder.
consumeClassHead(false); break; consumeClassHead(false); break;
} }
// //
// Rule 391: class_head ::= class_keyword nested_name_specifier identifier_name <openscope-ast> base_clause_opt // Rule 391: class_head ::= class_keyword template_id_name <openscope-ast> base_clause_opt
// //
case 391: { action.builder. case 391: { action.builder.
consumeClassHead(true); break; consumeClassHead(false); break;
} }
// //
// Rule 392: class_head ::= class_keyword nested_name_specifier template_id_name <openscope-ast> base_clause_opt // Rule 392: class_head ::= class_keyword nested_name_specifier identifier_name <openscope-ast> base_clause_opt
// //
case 392: { action.builder. case 392: { action.builder.
consumeClassHead(true); break; consumeClassHead(true); break;
} }
// //
// Rule 394: identifier_name_opt ::= $Empty // Rule 393: class_head ::= class_keyword nested_name_specifier template_id_name <openscope-ast> base_clause_opt
// //
case 394: { action.builder. case 393: { action.builder.
consumeClassHead(true); break;
}
//
// Rule 395: identifier_name_opt ::= $Empty
//
case 395: { action.builder.
consumeEmpty(); break; consumeEmpty(); break;
} }
// //
// Rule 398: visibility_label ::= access_specifier_keyword : // Rule 399: visibility_label ::= access_specifier_keyword :
// //
case 398: { action.builder. case 399: { action.builder.
consumeVisibilityLabel(); break; consumeVisibilityLabel(); break;
} }
// //
// Rule 399: member_declaration ::= declaration_specifiers_opt <openscope-ast> member_declarator_list ; // Rule 400: member_declaration ::= declaration_specifiers_opt <openscope-ast> member_declarator_list ;
// //
case 399: { action.builder. case 400: { action.builder.
consumeDeclarationSimple(true); break; consumeDeclarationSimple(true); break;
} }
// //
// Rule 400: member_declaration ::= declaration_specifiers_opt ; // Rule 401: member_declaration ::= declaration_specifiers_opt ;
// //
case 400: { action.builder. case 401: { action.builder.
consumeDeclarationSimple(false); break; consumeDeclarationSimple(false); break;
} }
// //
// Rule 403: member_declaration ::= dcolon_opt nested_name_specifier template_opt unqualified_id_name ; // Rule 404: member_declaration ::= dcolon_opt nested_name_specifier template_opt unqualified_id_name ;
// //
case 403: { action.builder. case 404: { action.builder.
consumeMemberDeclarationQualifiedId(); break; consumeMemberDeclarationQualifiedId(); break;
} }
// //
// Rule 409: member_declaration ::= ERROR_TOKEN // Rule 410: member_declaration ::= ERROR_TOKEN
// //
case 409: { action.builder. case 410: { action.builder.
consumeDeclarationProblem(); break; consumeDeclarationProblem(); break;
} }
// //
// Rule 417: member_declarator ::= declarator constant_initializer // Rule 418: member_declarator ::= declarator constant_initializer
// //
case 417: { action.builder. case 418: { action.builder.
consumeMemberDeclaratorWithInitializer(); break; consumeMemberDeclaratorWithInitializer(); break;
} }
// //
// Rule 418: member_declarator ::= bit_field_declarator : constant_expression // Rule 419: member_declarator ::= bit_field_declarator : constant_expression
// //
case 418: { action.builder. case 419: { action.builder.
consumeBitField(true); break; consumeBitField(true); break;
} }
// //
// Rule 419: member_declarator ::= : constant_expression // Rule 420: member_declarator ::= : constant_expression
// //
case 419: { action.builder. case 420: { action.builder.
consumeBitField(false); break; consumeBitField(false); break;
} }
// //
// Rule 420: bit_field_declarator ::= identifier_name // Rule 421: bit_field_declarator ::= identifier_name
// //
case 420: { action.builder. case 421: { action.builder.
consumeDirectDeclaratorIdentifier(); break; consumeDirectDeclaratorIdentifier(); break;
} }
// //
// Rule 421: constant_initializer ::= = constant_expression // Rule 422: constant_initializer ::= = constant_expression
// //
case 421: { action.builder. case 422: { action.builder.
consumeInitializer(); break; consumeInitializer(); break;
} }
// //
// Rule 427: base_specifier ::= dcolon_opt nested_name_specifier_opt class_name // Rule 428: base_specifier ::= dcolon_opt nested_name_specifier_opt class_name
// //
case 427: { action.builder. case 428: { action.builder.
consumeBaseSpecifier(false, false); break; consumeBaseSpecifier(false, false); break;
} }
// //
// Rule 428: base_specifier ::= virtual access_specifier_keyword_opt dcolon_opt nested_name_specifier_opt class_name // Rule 429: base_specifier ::= virtual access_specifier_keyword_opt dcolon_opt nested_name_specifier_opt class_name
//
case 428: { action.builder.
consumeBaseSpecifier(true, true); break;
}
//
// Rule 429: base_specifier ::= access_specifier_keyword virtual dcolon_opt nested_name_specifier_opt class_name
// //
case 429: { action.builder. case 429: { action.builder.
consumeBaseSpecifier(true, true); break; consumeBaseSpecifier(true, true); break;
} }
// //
// Rule 430: base_specifier ::= access_specifier_keyword dcolon_opt nested_name_specifier_opt class_name // Rule 430: base_specifier ::= access_specifier_keyword virtual dcolon_opt nested_name_specifier_opt class_name
// //
case 430: { action.builder. case 430: { action.builder.
consumeBaseSpecifier(true, true); break;
}
//
// Rule 431: base_specifier ::= access_specifier_keyword dcolon_opt nested_name_specifier_opt class_name
//
case 431: { action.builder.
consumeBaseSpecifier(true, false); break; consumeBaseSpecifier(true, false); break;
} }
// //
// Rule 431: access_specifier_keyword ::= private // Rule 432: access_specifier_keyword ::= private
//
case 431: { action.builder.
consumeAccessKeywordToken(); break;
}
//
// Rule 432: access_specifier_keyword ::= protected
// //
case 432: { action.builder. case 432: { action.builder.
consumeAccessKeywordToken(); break; consumeAccessKeywordToken(); break;
} }
// //
// Rule 433: access_specifier_keyword ::= public // Rule 433: access_specifier_keyword ::= protected
// //
case 433: { action.builder. case 433: { action.builder.
consumeAccessKeywordToken(); break; consumeAccessKeywordToken(); break;
} }
// //
// Rule 435: access_specifier_keyword_opt ::= $Empty // Rule 434: access_specifier_keyword ::= public
// //
case 435: { action.builder. case 434: { action.builder.
consumeAccessKeywordToken(); break;
}
//
// Rule 436: access_specifier_keyword_opt ::= $Empty
//
case 436: { action.builder.
consumeEmpty(); break; consumeEmpty(); break;
} }
// //
// Rule 437: conversion_function_id_name ::= conversion_function_id < <openscope-ast> template_argument_list_opt > // Rule 438: conversion_function_id_name ::= conversion_function_id < <openscope-ast> template_argument_list_opt >
// //
case 437: { action.builder. case 438: { action.builder.
consumeTemplateId(); break; consumeTemplateId(); break;
} }
// //
// Rule 438: conversion_function_id ::= operator conversion_type_id // Rule 439: conversion_function_id ::= operator conversion_type_id
// //
case 438: { action.builder. case 439: { action.builder.
consumeConversionName(); break; consumeConversionName(); break;
} }
// //
// Rule 439: conversion_type_id ::= type_specifier_seq conversion_declarator // Rule 440: conversion_type_id ::= type_specifier_seq conversion_declarator
// //
case 439: { action.builder. case 440: { action.builder.
consumeTypeId(true); break; consumeTypeId(true); break;
} }
// //
// Rule 440: conversion_type_id ::= type_specifier_seq // Rule 441: conversion_type_id ::= type_specifier_seq
// //
case 440: { action.builder. case 441: { action.builder.
consumeTypeId(false); break; consumeTypeId(false); break;
} }
// //
// Rule 441: conversion_declarator ::= <openscope-ast> ptr_operator_seq // Rule 442: conversion_declarator ::= <openscope-ast> ptr_operator_seq
// //
case 441: { action.builder. case 442: { action.builder.
consumeDeclaratorWithPointer(false); break; consumeDeclaratorWithPointer(false); break;
} }
// //
// Rule 447: mem_initializer ::= mem_initializer_name ( expression_list_opt ) // Rule 448: mem_initializer ::= mem_initializer_name ( expression_list_opt )
// //
case 447: { action.builder. case 448: { action.builder.
consumeConstructorChainInitializer(); break; consumeConstructorChainInitializer(); break;
} }
// //
// Rule 448: mem_initializer_name ::= dcolon_opt nested_name_specifier_opt class_name // Rule 449: mem_initializer_name ::= dcolon_opt nested_name_specifier_opt class_name
// //
case 448: { action.builder. case 449: { action.builder.
consumeQualifiedId(false); break; consumeQualifiedId(false); break;
} }
// //
// Rule 451: operator_function_id_name ::= operator_id_name < <openscope-ast> template_argument_list_opt > // Rule 452: operator_function_id_name ::= operator_id_name < <openscope-ast> template_argument_list_opt >
// //
case 451: { action.builder. case 452: { action.builder.
consumeTemplateId(); break; consumeTemplateId(); break;
} }
// //
// Rule 452: operator_id_name ::= operator overloadable_operator // Rule 453: operator_id_name ::= operator overloadable_operator
// //
case 452: { action.builder. case 453: { action.builder.
consumeOperatorName(); break; consumeOperatorName(); break;
} }
// //
// Rule 495: template_declaration ::= export_opt template < <openscope-ast> template_parameter_list > declaration // Rule 496: template_declaration ::= export_opt template < <openscope-ast> template_parameter_list > declaration
// //
case 495: { action.builder. case 496: { action.builder.
consumeTemplateDeclaration(); break; consumeTemplateDeclaration(); break;
} }
// //
// Rule 496: export_opt ::= export // Rule 497: export_opt ::= export
// //
case 496: { action.builder. case 497: { action.builder.
consumePlaceHolder(); break; consumePlaceHolder(); break;
} }
// //
// Rule 497: export_opt ::= $Empty // Rule 498: export_opt ::= $Empty
// //
case 497: { action.builder. case 498: { action.builder.
consumeEmpty(); break; consumeEmpty(); break;
} }
// //
// Rule 501: template_parameter ::= parameter_declaration // Rule 502: template_parameter ::= parameter_declaration
// //
case 501: { action.builder. case 502: { action.builder.
consumeTemplateParamterDeclaration(); break; consumeTemplateParamterDeclaration(); break;
} }
// //
// Rule 502: type_parameter ::= class identifier_name_opt // Rule 503: type_parameter ::= class identifier_name_opt
//
case 502: { action.builder.
consumeSimpleTypeTemplateParameter(false); break;
}
//
// Rule 503: type_parameter ::= class identifier_name_opt = type_id
// //
case 503: { action.builder. case 503: { action.builder.
consumeSimpleTypeTemplateParameter(true); break;
}
//
// Rule 504: type_parameter ::= typename identifier_name_opt
//
case 504: { action.builder.
consumeSimpleTypeTemplateParameter(false); break; consumeSimpleTypeTemplateParameter(false); break;
} }
// //
// Rule 505: type_parameter ::= typename identifier_name_opt = type_id // Rule 504: type_parameter ::= class identifier_name_opt = type_id
// //
case 505: { action.builder. case 504: { action.builder.
consumeSimpleTypeTemplateParameter(true); break; consumeSimpleTypeTemplateParameter(true); break;
} }
// //
// Rule 506: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt // Rule 505: type_parameter ::= typename identifier_name_opt
//
case 505: { action.builder.
consumeSimpleTypeTemplateParameter(false); break;
}
//
// Rule 506: type_parameter ::= typename identifier_name_opt = type_id
// //
case 506: { action.builder. case 506: { action.builder.
consumeSimpleTypeTemplateParameter(true); break;
}
//
// Rule 507: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt
//
case 507: { action.builder.
consumeTemplatedTypeTemplateParameter(false); break; consumeTemplatedTypeTemplateParameter(false); break;
} }
// //
// Rule 507: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt = id_expression // Rule 508: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt = id_expression
// //
case 507: { action.builder. case 508: { action.builder.
consumeTemplatedTypeTemplateParameter(true); break; consumeTemplatedTypeTemplateParameter(true); break;
} }
// //
// Rule 508: template_id_name ::= identifier_name < <openscope-ast> template_argument_list_opt > // Rule 509: template_id_name ::= identifier_name < <openscope-ast> template_argument_list_opt >
// //
case 508: { action.builder. case 509: { action.builder.
consumeTemplateId(); break; consumeTemplateId(); break;
} }
// //
// Rule 516: explicit_instantiation ::= template declaration // Rule 517: explicit_instantiation ::= template declaration
// //
case 516: { action.builder. case 517: { action.builder.
consumeTemplateExplicitInstantiation(); break; consumeTemplateExplicitInstantiation(); break;
} }
// //
// Rule 517: explicit_specialization ::= template < > declaration // Rule 518: explicit_specialization ::= template < > declaration
// //
case 517: { action.builder. case 518: { action.builder.
consumeTemplateExplicitSpecialization(); break; consumeTemplateExplicitSpecialization(); break;
} }
// //
// Rule 518: try_block ::= try compound_statement <openscope-ast> handler_seq // Rule 519: try_block ::= try compound_statement <openscope-ast> handler_seq
// //
case 518: { action.builder. case 519: { action.builder.
consumeStatementTryBlock(); break; consumeStatementTryBlock(); break;
} }
// //
// Rule 521: handler ::= catch ( exception_declaration ) compound_statement // Rule 522: handler ::= catch ( exception_declaration ) compound_statement
// //
case 521: { action.builder. case 522: { action.builder.
consumeStatementCatchHandler(false); break; consumeStatementCatchHandler(false); break;
} }
// //
// Rule 522: handler ::= catch ( ... ) compound_statement // Rule 523: handler ::= catch ( ... ) compound_statement
// //
case 522: { action.builder. case 523: { action.builder.
consumeStatementCatchHandler(true); break; consumeStatementCatchHandler(true); break;
} }
// //
// Rule 523: exception_declaration ::= type_specifier_seq <openscope-ast> declarator // Rule 524: exception_declaration ::= type_specifier_seq <openscope-ast> declarator
//
case 523: { action.builder.
consumeDeclarationSimple(true); break;
}
//
// Rule 524: exception_declaration ::= type_specifier_seq <openscope-ast> abstract_declarator
// //
case 524: { action.builder. case 524: { action.builder.
consumeDeclarationSimple(true); break; consumeDeclarationSimple(true); break;
} }
// //
// Rule 525: exception_declaration ::= type_specifier_seq // Rule 525: exception_declaration ::= type_specifier_seq <openscope-ast> abstract_declarator
// //
case 525: { action.builder. case 525: { action.builder.
consumeDeclarationSimple(true); break;
}
//
// Rule 526: exception_declaration ::= type_specifier_seq
//
case 526: { action.builder.
consumeDeclarationSimple(false); break; consumeDeclarationSimple(false); break;
} }
// //
// Rule 533: expression_parser_start ::= ERROR_TOKEN // Rule 534: expression_parser_start ::= ERROR_TOKEN
// //
case 533: { action.builder. case 534: { action.builder.
consumeExpressionProblem(); break; consumeExpressionProblem(); break;
} }

View file

@ -15,83 +15,83 @@ package org.eclipse.cdt.internal.core.dom.lrparser.cpp;
public interface CPPExpressionStatementParsersym { public interface CPPExpressionStatementParsersym {
public final static int public final static int
TK_asm = 62, TK_asm = 63,
TK_auto = 49, TK_auto = 48,
TK_bool = 14, TK_bool = 14,
TK_break = 77, TK_break = 78,
TK_case = 78, TK_case = 79,
TK_catch = 119, TK_catch = 119,
TK_char = 15, TK_char = 15,
TK_class = 63, TK_class = 62,
TK_const = 46, TK_const = 46,
TK_const_cast = 31, TK_const_cast = 32,
TK_continue = 79, TK_continue = 80,
TK_default = 80, TK_default = 81,
TK_delete = 64, TK_delete = 64,
TK_do = 81, TK_do = 82,
TK_double = 16, TK_double = 16,
TK_dynamic_cast = 32, TK_dynamic_cast = 33,
TK_else = 121, TK_else = 121,
TK_enum = 68, TK_enum = 68,
TK_explicit = 50, TK_explicit = 49,
TK_export = 82, TK_export = 75,
TK_extern = 17, TK_extern = 17,
TK_false = 33, TK_false = 34,
TK_float = 18, TK_float = 18,
TK_for = 83, TK_for = 83,
TK_friend = 51, TK_friend = 50,
TK_goto = 84, TK_goto = 84,
TK_if = 85, TK_if = 85,
TK_inline = 52, TK_inline = 51,
TK_int = 19, TK_int = 19,
TK_long = 20, TK_long = 20,
TK_mutable = 53, TK_mutable = 52,
TK_namespace = 57, TK_namespace = 57,
TK_new = 65, TK_new = 65,
TK_operator = 7, TK_operator = 7,
TK_private = 114, TK_private = 103,
TK_protected = 115, TK_protected = 104,
TK_public = 116, TK_public = 105,
TK_register = 54, TK_register = 53,
TK_reinterpret_cast = 34, TK_reinterpret_cast = 35,
TK_return = 86, TK_return = 86,
TK_short = 21, TK_short = 21,
TK_signed = 22, TK_signed = 22,
TK_sizeof = 35, TK_sizeof = 36,
TK_static = 55, TK_static = 54,
TK_static_cast = 36, TK_static_cast = 37,
TK_struct = 69, TK_struct = 69,
TK_switch = 87, TK_switch = 87,
TK_template = 37, TK_template = 31,
TK_this = 38, TK_this = 38,
TK_throw = 58, TK_throw = 58,
TK_try = 75, TK_try = 76,
TK_true = 39, TK_true = 39,
TK_typedef = 56, TK_typedef = 55,
TK_typeid = 40, TK_typeid = 40,
TK_typename = 10, TK_typename = 10,
TK_union = 70, TK_union = 70,
TK_unsigned = 23, TK_unsigned = 23,
TK_using = 59, TK_using = 59,
TK_virtual = 45, TK_virtual = 41,
TK_void = 24, TK_void = 24,
TK_volatile = 47, TK_volatile = 47,
TK_wchar_t = 25, TK_wchar_t = 25,
TK_while = 76, TK_while = 77,
TK_integer = 41, TK_integer = 42,
TK_floating = 42, TK_floating = 43,
TK_charconst = 43, TK_charconst = 44,
TK_stringlit = 29, TK_stringlit = 29,
TK_identifier = 1, TK_identifier = 1,
TK_Completion = 2, TK_Completion = 2,
TK_EndOfCompletion = 9, TK_EndOfCompletion = 9,
TK_Invalid = 123, TK_Invalid = 123,
TK_LeftBracket = 48, TK_LeftBracket = 56,
TK_LeftParen = 3, TK_LeftParen = 3,
TK_LeftBrace = 60, TK_LeftBrace = 60,
TK_Dot = 120, TK_Dot = 120,
TK_DotStar = 96, TK_DotStar = 96,
TK_Arrow = 103, TK_Arrow = 106,
TK_ArrowStar = 90, TK_ArrowStar = 90,
TK_PlusPlus = 26, TK_PlusPlus = 26,
TK_MinusMinus = 27, TK_MinusMinus = 27,
@ -120,23 +120,23 @@ public interface CPPExpressionStatementParsersym {
TK_ColonColon = 4, TK_ColonColon = 4,
TK_DotDotDot = 95, TK_DotDotDot = 95,
TK_Assign = 67, TK_Assign = 67,
TK_StarAssign = 104, TK_StarAssign = 107,
TK_SlashAssign = 105, TK_SlashAssign = 108,
TK_PercentAssign = 106, TK_PercentAssign = 109,
TK_PlusAssign = 107, TK_PlusAssign = 110,
TK_MinusAssign = 108, TK_MinusAssign = 111,
TK_RightShiftAssign = 109, TK_RightShiftAssign = 112,
TK_LeftShiftAssign = 110, TK_LeftShiftAssign = 113,
TK_AndAssign = 111, TK_AndAssign = 114,
TK_CaretAssign = 112, TK_CaretAssign = 115,
TK_OrAssign = 113, TK_OrAssign = 116,
TK_Comma = 66, TK_Comma = 66,
TK_zero = 44,
TK_RightBracket = 118, TK_RightBracket = 118,
TK_RightParen = 72, TK_RightParen = 73,
TK_RightBrace = 73, TK_RightBrace = 72,
TK_SemiColon = 13, TK_SemiColon = 13,
TK_ERROR_TOKEN = 74, TK_ERROR_TOKEN = 74,
TK_0 = 45,
TK_EOF_TOKEN = 122; TK_EOF_TOKEN = 122;
public final static String orderedTerminalSymbols[] = { public final static String orderedTerminalSymbols[] = {
@ -171,24 +171,23 @@ public interface CPPExpressionStatementParsersym {
"LT", "LT",
"stringlit", "stringlit",
"Bang", "Bang",
"template",
"const_cast", "const_cast",
"dynamic_cast", "dynamic_cast",
"false", "false",
"reinterpret_cast", "reinterpret_cast",
"sizeof", "sizeof",
"static_cast", "static_cast",
"template",
"this", "this",
"true", "true",
"typeid", "typeid",
"virtual",
"integer", "integer",
"floating", "floating",
"charconst", "charconst",
"zero", "0",
"virtual",
"const", "const",
"volatile", "volatile",
"LeftBracket",
"auto", "auto",
"explicit", "explicit",
"friend", "friend",
@ -197,13 +196,14 @@ public interface CPPExpressionStatementParsersym {
"register", "register",
"static", "static",
"typedef", "typedef",
"LeftBracket",
"namespace", "namespace",
"throw", "throw",
"using", "using",
"LeftBrace", "LeftBrace",
"GT", "GT",
"asm",
"class", "class",
"asm",
"delete", "delete",
"new", "new",
"Comma", "Comma",
@ -212,9 +212,10 @@ public interface CPPExpressionStatementParsersym {
"struct", "struct",
"union", "union",
"Colon", "Colon",
"RightParen",
"RightBrace", "RightBrace",
"RightParen",
"ERROR_TOKEN", "ERROR_TOKEN",
"export",
"try", "try",
"while", "while",
"break", "break",
@ -222,7 +223,6 @@ public interface CPPExpressionStatementParsersym {
"continue", "continue",
"default", "default",
"do", "do",
"export",
"for", "for",
"goto", "goto",
"if", "if",
@ -243,6 +243,9 @@ public interface CPPExpressionStatementParsersym {
"Or", "Or",
"AndAnd", "AndAnd",
"OrOr", "OrOr",
"private",
"protected",
"public",
"Arrow", "Arrow",
"StarAssign", "StarAssign",
"SlashAssign", "SlashAssign",
@ -254,9 +257,6 @@ public interface CPPExpressionStatementParsersym {
"AndAssign", "AndAssign",
"CaretAssign", "CaretAssign",
"OrAssign", "OrAssign",
"private",
"protected",
"public",
"Question", "Question",
"RightBracket", "RightBracket",
"catch", "catch",

View file

@ -209,32 +209,11 @@ public IASTCompletionNode parse(IASTTranslationUnit tu) {
} }
public int getKind(int i) {
int kind = super.getKind(i);
// There used to be a special token kind for zero used to parser pure virtual function declarations.
// But it turned out to be easier to just parse them as an init_ declarator and programaticaly check
// for pure virtual, see consumeMemberDeclaratorWithInitializer().
//if(kind == CPPParsersym.TK_integer && "0".equals(getTokenText(i))) { //$NON-NLS-1$
// kind = CPPParsersym.TK_zero;
//}
// lexer feedback hack!
//else if(kind == C99Parsersym.TK_identifier && action.resolver.isTypedef(getTokenText(i))) {
// kind = C99Parsersym.TK_TypedefName;
//}
return kind;
}
// uncomment this method to use with backtracking parser // uncomment this method to use with backtracking parser
public List getRuleTokens() { public List getRuleTokens() {
return Collections.unmodifiableList(getTokens().subList(getLeftSpan(), getRightSpan() + 1)); return Collections.unmodifiableList(getTokens().subList(getLeftSpan(), getRightSpan() + 1));
} }
public IASTNode getSecondaryParseResult() { public IASTNode getSecondaryParseResult() {
return action.builder.getSecondaryParseResult(); return action.builder.getSecondaryParseResult();
} }
@ -1904,366 +1883,373 @@ public CPPNoCastExpressionParser(String[] mapFrom) { // constructor
} }
// //
// Rule 388: class_head ::= class_keyword identifier_name_opt <openscope-ast> base_clause_opt // Rule 388: class_specifier ::= class_head EOC <openscope-ast> member_declaration_list_opt }
// //
case 388: { action.builder. case 388: { action.builder.
consumeClassHead(false); break; consumeClassSpecifier(); break;
} }
// //
// Rule 389: class_head ::= class_keyword template_id_name <openscope-ast> base_clause_opt // Rule 389: class_head ::= class_keyword identifier_name_opt <openscope-ast> base_clause_opt
// //
case 389: { action.builder. case 389: { action.builder.
consumeClassHead(false); break; consumeClassHead(false); break;
} }
// //
// Rule 390: class_head ::= class_keyword nested_name_specifier identifier_name <openscope-ast> base_clause_opt // Rule 390: class_head ::= class_keyword template_id_name <openscope-ast> base_clause_opt
// //
case 390: { action.builder. case 390: { action.builder.
consumeClassHead(true); break; consumeClassHead(false); break;
} }
// //
// Rule 391: class_head ::= class_keyword nested_name_specifier template_id_name <openscope-ast> base_clause_opt // Rule 391: class_head ::= class_keyword nested_name_specifier identifier_name <openscope-ast> base_clause_opt
// //
case 391: { action.builder. case 391: { action.builder.
consumeClassHead(true); break; consumeClassHead(true); break;
} }
// //
// Rule 393: identifier_name_opt ::= $Empty // Rule 392: class_head ::= class_keyword nested_name_specifier template_id_name <openscope-ast> base_clause_opt
// //
case 393: { action.builder. case 392: { action.builder.
consumeClassHead(true); break;
}
//
// Rule 394: identifier_name_opt ::= $Empty
//
case 394: { action.builder.
consumeEmpty(); break; consumeEmpty(); break;
} }
// //
// Rule 397: visibility_label ::= access_specifier_keyword : // Rule 398: visibility_label ::= access_specifier_keyword :
// //
case 397: { action.builder. case 398: { action.builder.
consumeVisibilityLabel(); break; consumeVisibilityLabel(); break;
} }
// //
// Rule 398: member_declaration ::= declaration_specifiers_opt <openscope-ast> member_declarator_list ; // Rule 399: member_declaration ::= declaration_specifiers_opt <openscope-ast> member_declarator_list ;
// //
case 398: { action.builder. case 399: { action.builder.
consumeDeclarationSimple(true); break; consumeDeclarationSimple(true); break;
} }
// //
// Rule 399: member_declaration ::= declaration_specifiers_opt ; // Rule 400: member_declaration ::= declaration_specifiers_opt ;
// //
case 399: { action.builder. case 400: { action.builder.
consumeDeclarationSimple(false); break; consumeDeclarationSimple(false); break;
} }
// //
// Rule 402: member_declaration ::= dcolon_opt nested_name_specifier template_opt unqualified_id_name ; // Rule 403: member_declaration ::= dcolon_opt nested_name_specifier template_opt unqualified_id_name ;
// //
case 402: { action.builder. case 403: { action.builder.
consumeMemberDeclarationQualifiedId(); break; consumeMemberDeclarationQualifiedId(); break;
} }
// //
// Rule 408: member_declaration ::= ERROR_TOKEN // Rule 409: member_declaration ::= ERROR_TOKEN
// //
case 408: { action.builder. case 409: { action.builder.
consumeDeclarationProblem(); break; consumeDeclarationProblem(); break;
} }
// //
// Rule 416: member_declarator ::= declarator constant_initializer // Rule 417: member_declarator ::= declarator constant_initializer
// //
case 416: { action.builder. case 417: { action.builder.
consumeMemberDeclaratorWithInitializer(); break; consumeMemberDeclaratorWithInitializer(); break;
} }
// //
// Rule 417: member_declarator ::= bit_field_declarator : constant_expression // Rule 418: member_declarator ::= bit_field_declarator : constant_expression
// //
case 417: { action.builder. case 418: { action.builder.
consumeBitField(true); break; consumeBitField(true); break;
} }
// //
// Rule 418: member_declarator ::= : constant_expression // Rule 419: member_declarator ::= : constant_expression
// //
case 418: { action.builder. case 419: { action.builder.
consumeBitField(false); break; consumeBitField(false); break;
} }
// //
// Rule 419: bit_field_declarator ::= identifier_name // Rule 420: bit_field_declarator ::= identifier_name
// //
case 419: { action.builder. case 420: { action.builder.
consumeDirectDeclaratorIdentifier(); break; consumeDirectDeclaratorIdentifier(); break;
} }
// //
// Rule 420: constant_initializer ::= = constant_expression // Rule 421: constant_initializer ::= = constant_expression
// //
case 420: { action.builder. case 421: { action.builder.
consumeInitializer(); break; consumeInitializer(); break;
} }
// //
// Rule 426: base_specifier ::= dcolon_opt nested_name_specifier_opt class_name // Rule 427: base_specifier ::= dcolon_opt nested_name_specifier_opt class_name
// //
case 426: { action.builder. case 427: { action.builder.
consumeBaseSpecifier(false, false); break; consumeBaseSpecifier(false, false); break;
} }
// //
// Rule 427: base_specifier ::= virtual access_specifier_keyword_opt dcolon_opt nested_name_specifier_opt class_name // Rule 428: base_specifier ::= virtual access_specifier_keyword_opt dcolon_opt nested_name_specifier_opt class_name
//
case 427: { action.builder.
consumeBaseSpecifier(true, true); break;
}
//
// Rule 428: base_specifier ::= access_specifier_keyword virtual dcolon_opt nested_name_specifier_opt class_name
// //
case 428: { action.builder. case 428: { action.builder.
consumeBaseSpecifier(true, true); break; consumeBaseSpecifier(true, true); break;
} }
// //
// Rule 429: base_specifier ::= access_specifier_keyword dcolon_opt nested_name_specifier_opt class_name // Rule 429: base_specifier ::= access_specifier_keyword virtual dcolon_opt nested_name_specifier_opt class_name
// //
case 429: { action.builder. case 429: { action.builder.
consumeBaseSpecifier(true, true); break;
}
//
// Rule 430: base_specifier ::= access_specifier_keyword dcolon_opt nested_name_specifier_opt class_name
//
case 430: { action.builder.
consumeBaseSpecifier(true, false); break; consumeBaseSpecifier(true, false); break;
} }
// //
// Rule 430: access_specifier_keyword ::= private // Rule 431: access_specifier_keyword ::= private
//
case 430: { action.builder.
consumeAccessKeywordToken(); break;
}
//
// Rule 431: access_specifier_keyword ::= protected
// //
case 431: { action.builder. case 431: { action.builder.
consumeAccessKeywordToken(); break; consumeAccessKeywordToken(); break;
} }
// //
// Rule 432: access_specifier_keyword ::= public // Rule 432: access_specifier_keyword ::= protected
// //
case 432: { action.builder. case 432: { action.builder.
consumeAccessKeywordToken(); break; consumeAccessKeywordToken(); break;
} }
// //
// Rule 434: access_specifier_keyword_opt ::= $Empty // Rule 433: access_specifier_keyword ::= public
// //
case 434: { action.builder. case 433: { action.builder.
consumeAccessKeywordToken(); break;
}
//
// Rule 435: access_specifier_keyword_opt ::= $Empty
//
case 435: { action.builder.
consumeEmpty(); break; consumeEmpty(); break;
} }
// //
// Rule 436: conversion_function_id_name ::= conversion_function_id < <openscope-ast> template_argument_list_opt > // Rule 437: conversion_function_id_name ::= conversion_function_id < <openscope-ast> template_argument_list_opt >
// //
case 436: { action.builder. case 437: { action.builder.
consumeTemplateId(); break; consumeTemplateId(); break;
} }
// //
// Rule 437: conversion_function_id ::= operator conversion_type_id // Rule 438: conversion_function_id ::= operator conversion_type_id
// //
case 437: { action.builder. case 438: { action.builder.
consumeConversionName(); break; consumeConversionName(); break;
} }
// //
// Rule 438: conversion_type_id ::= type_specifier_seq conversion_declarator // Rule 439: conversion_type_id ::= type_specifier_seq conversion_declarator
// //
case 438: { action.builder. case 439: { action.builder.
consumeTypeId(true); break; consumeTypeId(true); break;
} }
// //
// Rule 439: conversion_type_id ::= type_specifier_seq // Rule 440: conversion_type_id ::= type_specifier_seq
// //
case 439: { action.builder. case 440: { action.builder.
consumeTypeId(false); break; consumeTypeId(false); break;
} }
// //
// Rule 440: conversion_declarator ::= <openscope-ast> ptr_operator_seq // Rule 441: conversion_declarator ::= <openscope-ast> ptr_operator_seq
// //
case 440: { action.builder. case 441: { action.builder.
consumeDeclaratorWithPointer(false); break; consumeDeclaratorWithPointer(false); break;
} }
// //
// Rule 446: mem_initializer ::= mem_initializer_name ( expression_list_opt ) // Rule 447: mem_initializer ::= mem_initializer_name ( expression_list_opt )
// //
case 446: { action.builder. case 447: { action.builder.
consumeConstructorChainInitializer(); break; consumeConstructorChainInitializer(); break;
} }
// //
// Rule 447: mem_initializer_name ::= dcolon_opt nested_name_specifier_opt class_name // Rule 448: mem_initializer_name ::= dcolon_opt nested_name_specifier_opt class_name
// //
case 447: { action.builder. case 448: { action.builder.
consumeQualifiedId(false); break; consumeQualifiedId(false); break;
} }
// //
// Rule 450: operator_function_id_name ::= operator_id_name < <openscope-ast> template_argument_list_opt > // Rule 451: operator_function_id_name ::= operator_id_name < <openscope-ast> template_argument_list_opt >
// //
case 450: { action.builder. case 451: { action.builder.
consumeTemplateId(); break; consumeTemplateId(); break;
} }
// //
// Rule 451: operator_id_name ::= operator overloadable_operator // Rule 452: operator_id_name ::= operator overloadable_operator
// //
case 451: { action.builder. case 452: { action.builder.
consumeOperatorName(); break; consumeOperatorName(); break;
} }
// //
// Rule 494: template_declaration ::= export_opt template < <openscope-ast> template_parameter_list > declaration // Rule 495: template_declaration ::= export_opt template < <openscope-ast> template_parameter_list > declaration
// //
case 494: { action.builder. case 495: { action.builder.
consumeTemplateDeclaration(); break; consumeTemplateDeclaration(); break;
} }
// //
// Rule 495: export_opt ::= export // Rule 496: export_opt ::= export
// //
case 495: { action.builder. case 496: { action.builder.
consumePlaceHolder(); break; consumePlaceHolder(); break;
} }
// //
// Rule 496: export_opt ::= $Empty // Rule 497: export_opt ::= $Empty
// //
case 496: { action.builder. case 497: { action.builder.
consumeEmpty(); break; consumeEmpty(); break;
} }
// //
// Rule 500: template_parameter ::= parameter_declaration // Rule 501: template_parameter ::= parameter_declaration
// //
case 500: { action.builder. case 501: { action.builder.
consumeTemplateParamterDeclaration(); break; consumeTemplateParamterDeclaration(); break;
} }
// //
// Rule 501: type_parameter ::= class identifier_name_opt // Rule 502: type_parameter ::= class identifier_name_opt
//
case 501: { action.builder.
consumeSimpleTypeTemplateParameter(false); break;
}
//
// Rule 502: type_parameter ::= class identifier_name_opt = type_id
// //
case 502: { action.builder. case 502: { action.builder.
consumeSimpleTypeTemplateParameter(true); break;
}
//
// Rule 503: type_parameter ::= typename identifier_name_opt
//
case 503: { action.builder.
consumeSimpleTypeTemplateParameter(false); break; consumeSimpleTypeTemplateParameter(false); break;
} }
// //
// Rule 504: type_parameter ::= typename identifier_name_opt = type_id // Rule 503: type_parameter ::= class identifier_name_opt = type_id
// //
case 504: { action.builder. case 503: { action.builder.
consumeSimpleTypeTemplateParameter(true); break; consumeSimpleTypeTemplateParameter(true); break;
} }
// //
// Rule 505: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt // Rule 504: type_parameter ::= typename identifier_name_opt
//
case 504: { action.builder.
consumeSimpleTypeTemplateParameter(false); break;
}
//
// Rule 505: type_parameter ::= typename identifier_name_opt = type_id
// //
case 505: { action.builder. case 505: { action.builder.
consumeSimpleTypeTemplateParameter(true); break;
}
//
// Rule 506: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt
//
case 506: { action.builder.
consumeTemplatedTypeTemplateParameter(false); break; consumeTemplatedTypeTemplateParameter(false); break;
} }
// //
// Rule 506: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt = id_expression // Rule 507: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt = id_expression
// //
case 506: { action.builder. case 507: { action.builder.
consumeTemplatedTypeTemplateParameter(true); break; consumeTemplatedTypeTemplateParameter(true); break;
} }
// //
// Rule 507: template_id_name ::= identifier_name < <openscope-ast> template_argument_list_opt > // Rule 508: template_id_name ::= identifier_name < <openscope-ast> template_argument_list_opt >
// //
case 507: { action.builder. case 508: { action.builder.
consumeTemplateId(); break; consumeTemplateId(); break;
} }
// //
// Rule 515: explicit_instantiation ::= template declaration // Rule 516: explicit_instantiation ::= template declaration
// //
case 515: { action.builder. case 516: { action.builder.
consumeTemplateExplicitInstantiation(); break; consumeTemplateExplicitInstantiation(); break;
} }
// //
// Rule 516: explicit_specialization ::= template < > declaration // Rule 517: explicit_specialization ::= template < > declaration
// //
case 516: { action.builder. case 517: { action.builder.
consumeTemplateExplicitSpecialization(); break; consumeTemplateExplicitSpecialization(); break;
} }
// //
// Rule 517: try_block ::= try compound_statement <openscope-ast> handler_seq // Rule 518: try_block ::= try compound_statement <openscope-ast> handler_seq
// //
case 517: { action.builder. case 518: { action.builder.
consumeStatementTryBlock(); break; consumeStatementTryBlock(); break;
} }
// //
// Rule 520: handler ::= catch ( exception_declaration ) compound_statement // Rule 521: handler ::= catch ( exception_declaration ) compound_statement
// //
case 520: { action.builder. case 521: { action.builder.
consumeStatementCatchHandler(false); break; consumeStatementCatchHandler(false); break;
} }
// //
// Rule 521: handler ::= catch ( ... ) compound_statement // Rule 522: handler ::= catch ( ... ) compound_statement
// //
case 521: { action.builder. case 522: { action.builder.
consumeStatementCatchHandler(true); break; consumeStatementCatchHandler(true); break;
} }
// //
// Rule 522: exception_declaration ::= type_specifier_seq <openscope-ast> declarator // Rule 523: exception_declaration ::= type_specifier_seq <openscope-ast> declarator
//
case 522: { action.builder.
consumeDeclarationSimple(true); break;
}
//
// Rule 523: exception_declaration ::= type_specifier_seq <openscope-ast> abstract_declarator
// //
case 523: { action.builder. case 523: { action.builder.
consumeDeclarationSimple(true); break; consumeDeclarationSimple(true); break;
} }
// //
// Rule 524: exception_declaration ::= type_specifier_seq // Rule 524: exception_declaration ::= type_specifier_seq <openscope-ast> abstract_declarator
// //
case 524: { action.builder. case 524: { action.builder.
consumeDeclarationSimple(true); break;
}
//
// Rule 525: exception_declaration ::= type_specifier_seq
//
case 525: { action.builder.
consumeDeclarationSimple(false); break; consumeDeclarationSimple(false); break;
} }
// //
// Rule 532: no_cast_start ::= ERROR_TOKEN // Rule 533: no_cast_start ::= ERROR_TOKEN
// //
case 532: { action.builder. case 533: { action.builder.
consumeExpressionProblem(); break; consumeExpressionProblem(); break;
} }

View file

@ -15,83 +15,83 @@ package org.eclipse.cdt.internal.core.dom.lrparser.cpp;
public interface CPPNoCastExpressionParsersym { public interface CPPNoCastExpressionParsersym {
public final static int public final static int
TK_asm = 62, TK_asm = 63,
TK_auto = 49, TK_auto = 48,
TK_bool = 14, TK_bool = 14,
TK_break = 77, TK_break = 78,
TK_case = 78, TK_case = 79,
TK_catch = 119, TK_catch = 119,
TK_char = 15, TK_char = 15,
TK_class = 63, TK_class = 62,
TK_const = 46, TK_const = 46,
TK_const_cast = 31, TK_const_cast = 32,
TK_continue = 79, TK_continue = 80,
TK_default = 80, TK_default = 81,
TK_delete = 64, TK_delete = 64,
TK_do = 81, TK_do = 82,
TK_double = 16, TK_double = 16,
TK_dynamic_cast = 32, TK_dynamic_cast = 33,
TK_else = 122, TK_else = 122,
TK_enum = 68, TK_enum = 68,
TK_explicit = 50, TK_explicit = 49,
TK_export = 82, TK_export = 75,
TK_extern = 17, TK_extern = 17,
TK_false = 33, TK_false = 34,
TK_float = 18, TK_float = 18,
TK_for = 83, TK_for = 83,
TK_friend = 51, TK_friend = 50,
TK_goto = 84, TK_goto = 84,
TK_if = 85, TK_if = 85,
TK_inline = 52, TK_inline = 51,
TK_int = 19, TK_int = 19,
TK_long = 20, TK_long = 20,
TK_mutable = 53, TK_mutable = 52,
TK_namespace = 57, TK_namespace = 57,
TK_new = 65, TK_new = 65,
TK_operator = 7, TK_operator = 7,
TK_private = 114, TK_private = 103,
TK_protected = 115, TK_protected = 104,
TK_public = 116, TK_public = 105,
TK_register = 54, TK_register = 53,
TK_reinterpret_cast = 34, TK_reinterpret_cast = 35,
TK_return = 86, TK_return = 86,
TK_short = 21, TK_short = 21,
TK_signed = 22, TK_signed = 22,
TK_sizeof = 35, TK_sizeof = 36,
TK_static = 55, TK_static = 54,
TK_static_cast = 36, TK_static_cast = 37,
TK_struct = 69, TK_struct = 69,
TK_switch = 87, TK_switch = 87,
TK_template = 37, TK_template = 31,
TK_this = 38, TK_this = 38,
TK_throw = 58, TK_throw = 58,
TK_try = 75, TK_try = 76,
TK_true = 39, TK_true = 39,
TK_typedef = 56, TK_typedef = 55,
TK_typeid = 40, TK_typeid = 40,
TK_typename = 10, TK_typename = 10,
TK_union = 70, TK_union = 70,
TK_unsigned = 23, TK_unsigned = 23,
TK_using = 59, TK_using = 59,
TK_virtual = 45, TK_virtual = 41,
TK_void = 24, TK_void = 24,
TK_volatile = 47, TK_volatile = 47,
TK_wchar_t = 25, TK_wchar_t = 25,
TK_while = 76, TK_while = 77,
TK_integer = 41, TK_integer = 42,
TK_floating = 42, TK_floating = 43,
TK_charconst = 43, TK_charconst = 44,
TK_stringlit = 29, TK_stringlit = 29,
TK_identifier = 1, TK_identifier = 1,
TK_Completion = 2, TK_Completion = 2,
TK_EndOfCompletion = 9, TK_EndOfCompletion = 9,
TK_Invalid = 123, TK_Invalid = 123,
TK_LeftBracket = 48, TK_LeftBracket = 56,
TK_LeftParen = 3, TK_LeftParen = 3,
TK_LeftBrace = 60, TK_LeftBrace = 60,
TK_Dot = 120, TK_Dot = 120,
TK_DotStar = 96, TK_DotStar = 96,
TK_Arrow = 103, TK_Arrow = 106,
TK_ArrowStar = 90, TK_ArrowStar = 90,
TK_PlusPlus = 26, TK_PlusPlus = 26,
TK_MinusMinus = 27, TK_MinusMinus = 27,
@ -120,23 +120,23 @@ public interface CPPNoCastExpressionParsersym {
TK_ColonColon = 4, TK_ColonColon = 4,
TK_DotDotDot = 95, TK_DotDotDot = 95,
TK_Assign = 67, TK_Assign = 67,
TK_StarAssign = 104, TK_StarAssign = 107,
TK_SlashAssign = 105, TK_SlashAssign = 108,
TK_PercentAssign = 106, TK_PercentAssign = 109,
TK_PlusAssign = 107, TK_PlusAssign = 110,
TK_MinusAssign = 108, TK_MinusAssign = 111,
TK_RightShiftAssign = 109, TK_RightShiftAssign = 112,
TK_LeftShiftAssign = 110, TK_LeftShiftAssign = 113,
TK_AndAssign = 111, TK_AndAssign = 114,
TK_CaretAssign = 112, TK_CaretAssign = 115,
TK_OrAssign = 113, TK_OrAssign = 116,
TK_Comma = 66, TK_Comma = 66,
TK_zero = 44,
TK_RightBracket = 118, TK_RightBracket = 118,
TK_RightParen = 72, TK_RightParen = 73,
TK_RightBrace = 73, TK_RightBrace = 72,
TK_SemiColon = 13, TK_SemiColon = 13,
TK_ERROR_TOKEN = 74, TK_ERROR_TOKEN = 74,
TK_0 = 45,
TK_EOF_TOKEN = 121; TK_EOF_TOKEN = 121;
public final static String orderedTerminalSymbols[] = { public final static String orderedTerminalSymbols[] = {
@ -171,24 +171,23 @@ public interface CPPNoCastExpressionParsersym {
"LT", "LT",
"stringlit", "stringlit",
"Bang", "Bang",
"template",
"const_cast", "const_cast",
"dynamic_cast", "dynamic_cast",
"false", "false",
"reinterpret_cast", "reinterpret_cast",
"sizeof", "sizeof",
"static_cast", "static_cast",
"template",
"this", "this",
"true", "true",
"typeid", "typeid",
"virtual",
"integer", "integer",
"floating", "floating",
"charconst", "charconst",
"zero", "0",
"virtual",
"const", "const",
"volatile", "volatile",
"LeftBracket",
"auto", "auto",
"explicit", "explicit",
"friend", "friend",
@ -197,13 +196,14 @@ public interface CPPNoCastExpressionParsersym {
"register", "register",
"static", "static",
"typedef", "typedef",
"LeftBracket",
"namespace", "namespace",
"throw", "throw",
"using", "using",
"LeftBrace", "LeftBrace",
"GT", "GT",
"asm",
"class", "class",
"asm",
"delete", "delete",
"new", "new",
"Comma", "Comma",
@ -212,9 +212,10 @@ public interface CPPNoCastExpressionParsersym {
"struct", "struct",
"union", "union",
"Colon", "Colon",
"RightParen",
"RightBrace", "RightBrace",
"RightParen",
"ERROR_TOKEN", "ERROR_TOKEN",
"export",
"try", "try",
"while", "while",
"break", "break",
@ -222,7 +223,6 @@ public interface CPPNoCastExpressionParsersym {
"continue", "continue",
"default", "default",
"do", "do",
"export",
"for", "for",
"goto", "goto",
"if", "if",
@ -243,6 +243,9 @@ public interface CPPNoCastExpressionParsersym {
"Or", "Or",
"AndAnd", "AndAnd",
"OrOr", "OrOr",
"private",
"protected",
"public",
"Arrow", "Arrow",
"StarAssign", "StarAssign",
"SlashAssign", "SlashAssign",
@ -254,9 +257,6 @@ public interface CPPNoCastExpressionParsersym {
"AndAssign", "AndAssign",
"CaretAssign", "CaretAssign",
"OrAssign", "OrAssign",
"private",
"protected",
"public",
"Question", "Question",
"RightBracket", "RightBracket",
"catch", "catch",

View file

@ -209,32 +209,11 @@ public IASTCompletionNode parse(IASTTranslationUnit tu) {
} }
public int getKind(int i) {
int kind = super.getKind(i);
// There used to be a special token kind for zero used to parser pure virtual function declarations.
// But it turned out to be easier to just parse them as an init_ declarator and programaticaly check
// for pure virtual, see consumeMemberDeclaratorWithInitializer().
//if(kind == CPPParsersym.TK_integer && "0".equals(getTokenText(i))) { //$NON-NLS-1$
// kind = CPPParsersym.TK_zero;
//}
// lexer feedback hack!
//else if(kind == C99Parsersym.TK_identifier && action.resolver.isTypedef(getTokenText(i))) {
// kind = C99Parsersym.TK_TypedefName;
//}
return kind;
}
// uncomment this method to use with backtracking parser // uncomment this method to use with backtracking parser
public List getRuleTokens() { public List getRuleTokens() {
return Collections.unmodifiableList(getTokens().subList(getLeftSpan(), getRightSpan() + 1)); return Collections.unmodifiableList(getTokens().subList(getLeftSpan(), getRightSpan() + 1));
} }
public IASTNode getSecondaryParseResult() { public IASTNode getSecondaryParseResult() {
return action.builder.getSecondaryParseResult(); return action.builder.getSecondaryParseResult();
} }
@ -1904,366 +1883,373 @@ public CPPNoFunctionDeclaratorParser(String[] mapFrom) { // constructor
} }
// //
// Rule 387: class_head ::= class_keyword identifier_name_opt <openscope-ast> base_clause_opt // Rule 387: class_specifier ::= class_head EOC <openscope-ast> member_declaration_list_opt }
// //
case 387: { action.builder. case 387: { action.builder.
consumeClassHead(false); break; consumeClassSpecifier(); break;
} }
// //
// Rule 388: class_head ::= class_keyword template_id_name <openscope-ast> base_clause_opt // Rule 388: class_head ::= class_keyword identifier_name_opt <openscope-ast> base_clause_opt
// //
case 388: { action.builder. case 388: { action.builder.
consumeClassHead(false); break; consumeClassHead(false); break;
} }
// //
// Rule 389: class_head ::= class_keyword nested_name_specifier identifier_name <openscope-ast> base_clause_opt // Rule 389: class_head ::= class_keyword template_id_name <openscope-ast> base_clause_opt
// //
case 389: { action.builder. case 389: { action.builder.
consumeClassHead(true); break; consumeClassHead(false); break;
} }
// //
// Rule 390: class_head ::= class_keyword nested_name_specifier template_id_name <openscope-ast> base_clause_opt // Rule 390: class_head ::= class_keyword nested_name_specifier identifier_name <openscope-ast> base_clause_opt
// //
case 390: { action.builder. case 390: { action.builder.
consumeClassHead(true); break; consumeClassHead(true); break;
} }
// //
// Rule 392: identifier_name_opt ::= $Empty // Rule 391: class_head ::= class_keyword nested_name_specifier template_id_name <openscope-ast> base_clause_opt
// //
case 392: { action.builder. case 391: { action.builder.
consumeClassHead(true); break;
}
//
// Rule 393: identifier_name_opt ::= $Empty
//
case 393: { action.builder.
consumeEmpty(); break; consumeEmpty(); break;
} }
// //
// Rule 396: visibility_label ::= access_specifier_keyword : // Rule 397: visibility_label ::= access_specifier_keyword :
// //
case 396: { action.builder. case 397: { action.builder.
consumeVisibilityLabel(); break; consumeVisibilityLabel(); break;
} }
// //
// Rule 397: member_declaration ::= declaration_specifiers_opt <openscope-ast> member_declarator_list ; // Rule 398: member_declaration ::= declaration_specifiers_opt <openscope-ast> member_declarator_list ;
// //
case 397: { action.builder. case 398: { action.builder.
consumeDeclarationSimple(true); break; consumeDeclarationSimple(true); break;
} }
// //
// Rule 398: member_declaration ::= declaration_specifiers_opt ; // Rule 399: member_declaration ::= declaration_specifiers_opt ;
// //
case 398: { action.builder. case 399: { action.builder.
consumeDeclarationSimple(false); break; consumeDeclarationSimple(false); break;
} }
// //
// Rule 401: member_declaration ::= dcolon_opt nested_name_specifier template_opt unqualified_id_name ; // Rule 402: member_declaration ::= dcolon_opt nested_name_specifier template_opt unqualified_id_name ;
// //
case 401: { action.builder. case 402: { action.builder.
consumeMemberDeclarationQualifiedId(); break; consumeMemberDeclarationQualifiedId(); break;
} }
// //
// Rule 407: member_declaration ::= ERROR_TOKEN // Rule 408: member_declaration ::= ERROR_TOKEN
// //
case 407: { action.builder. case 408: { action.builder.
consumeDeclarationProblem(); break; consumeDeclarationProblem(); break;
} }
// //
// Rule 415: member_declarator ::= declarator constant_initializer // Rule 416: member_declarator ::= declarator constant_initializer
// //
case 415: { action.builder. case 416: { action.builder.
consumeMemberDeclaratorWithInitializer(); break; consumeMemberDeclaratorWithInitializer(); break;
} }
// //
// Rule 416: member_declarator ::= bit_field_declarator : constant_expression // Rule 417: member_declarator ::= bit_field_declarator : constant_expression
// //
case 416: { action.builder. case 417: { action.builder.
consumeBitField(true); break; consumeBitField(true); break;
} }
// //
// Rule 417: member_declarator ::= : constant_expression // Rule 418: member_declarator ::= : constant_expression
// //
case 417: { action.builder. case 418: { action.builder.
consumeBitField(false); break; consumeBitField(false); break;
} }
// //
// Rule 418: bit_field_declarator ::= identifier_name // Rule 419: bit_field_declarator ::= identifier_name
// //
case 418: { action.builder. case 419: { action.builder.
consumeDirectDeclaratorIdentifier(); break; consumeDirectDeclaratorIdentifier(); break;
} }
// //
// Rule 419: constant_initializer ::= = constant_expression // Rule 420: constant_initializer ::= = constant_expression
// //
case 419: { action.builder. case 420: { action.builder.
consumeInitializer(); break; consumeInitializer(); break;
} }
// //
// Rule 425: base_specifier ::= dcolon_opt nested_name_specifier_opt class_name // Rule 426: base_specifier ::= dcolon_opt nested_name_specifier_opt class_name
// //
case 425: { action.builder. case 426: { action.builder.
consumeBaseSpecifier(false, false); break; consumeBaseSpecifier(false, false); break;
} }
// //
// Rule 426: base_specifier ::= virtual access_specifier_keyword_opt dcolon_opt nested_name_specifier_opt class_name // Rule 427: base_specifier ::= virtual access_specifier_keyword_opt dcolon_opt nested_name_specifier_opt class_name
//
case 426: { action.builder.
consumeBaseSpecifier(true, true); break;
}
//
// Rule 427: base_specifier ::= access_specifier_keyword virtual dcolon_opt nested_name_specifier_opt class_name
// //
case 427: { action.builder. case 427: { action.builder.
consumeBaseSpecifier(true, true); break; consumeBaseSpecifier(true, true); break;
} }
// //
// Rule 428: base_specifier ::= access_specifier_keyword dcolon_opt nested_name_specifier_opt class_name // Rule 428: base_specifier ::= access_specifier_keyword virtual dcolon_opt nested_name_specifier_opt class_name
// //
case 428: { action.builder. case 428: { action.builder.
consumeBaseSpecifier(true, true); break;
}
//
// Rule 429: base_specifier ::= access_specifier_keyword dcolon_opt nested_name_specifier_opt class_name
//
case 429: { action.builder.
consumeBaseSpecifier(true, false); break; consumeBaseSpecifier(true, false); break;
} }
// //
// Rule 429: access_specifier_keyword ::= private // Rule 430: access_specifier_keyword ::= private
//
case 429: { action.builder.
consumeAccessKeywordToken(); break;
}
//
// Rule 430: access_specifier_keyword ::= protected
// //
case 430: { action.builder. case 430: { action.builder.
consumeAccessKeywordToken(); break; consumeAccessKeywordToken(); break;
} }
// //
// Rule 431: access_specifier_keyword ::= public // Rule 431: access_specifier_keyword ::= protected
// //
case 431: { action.builder. case 431: { action.builder.
consumeAccessKeywordToken(); break; consumeAccessKeywordToken(); break;
} }
// //
// Rule 433: access_specifier_keyword_opt ::= $Empty // Rule 432: access_specifier_keyword ::= public
// //
case 433: { action.builder. case 432: { action.builder.
consumeAccessKeywordToken(); break;
}
//
// Rule 434: access_specifier_keyword_opt ::= $Empty
//
case 434: { action.builder.
consumeEmpty(); break; consumeEmpty(); break;
} }
// //
// Rule 435: conversion_function_id_name ::= conversion_function_id < <openscope-ast> template_argument_list_opt > // Rule 436: conversion_function_id_name ::= conversion_function_id < <openscope-ast> template_argument_list_opt >
// //
case 435: { action.builder. case 436: { action.builder.
consumeTemplateId(); break; consumeTemplateId(); break;
} }
// //
// Rule 436: conversion_function_id ::= operator conversion_type_id // Rule 437: conversion_function_id ::= operator conversion_type_id
// //
case 436: { action.builder. case 437: { action.builder.
consumeConversionName(); break; consumeConversionName(); break;
} }
// //
// Rule 437: conversion_type_id ::= type_specifier_seq conversion_declarator // Rule 438: conversion_type_id ::= type_specifier_seq conversion_declarator
// //
case 437: { action.builder. case 438: { action.builder.
consumeTypeId(true); break; consumeTypeId(true); break;
} }
// //
// Rule 438: conversion_type_id ::= type_specifier_seq // Rule 439: conversion_type_id ::= type_specifier_seq
// //
case 438: { action.builder. case 439: { action.builder.
consumeTypeId(false); break; consumeTypeId(false); break;
} }
// //
// Rule 439: conversion_declarator ::= <openscope-ast> ptr_operator_seq // Rule 440: conversion_declarator ::= <openscope-ast> ptr_operator_seq
// //
case 439: { action.builder. case 440: { action.builder.
consumeDeclaratorWithPointer(false); break; consumeDeclaratorWithPointer(false); break;
} }
// //
// Rule 445: mem_initializer ::= mem_initializer_name ( expression_list_opt ) // Rule 446: mem_initializer ::= mem_initializer_name ( expression_list_opt )
// //
case 445: { action.builder. case 446: { action.builder.
consumeConstructorChainInitializer(); break; consumeConstructorChainInitializer(); break;
} }
// //
// Rule 446: mem_initializer_name ::= dcolon_opt nested_name_specifier_opt class_name // Rule 447: mem_initializer_name ::= dcolon_opt nested_name_specifier_opt class_name
// //
case 446: { action.builder. case 447: { action.builder.
consumeQualifiedId(false); break; consumeQualifiedId(false); break;
} }
// //
// Rule 449: operator_function_id_name ::= operator_id_name < <openscope-ast> template_argument_list_opt > // Rule 450: operator_function_id_name ::= operator_id_name < <openscope-ast> template_argument_list_opt >
// //
case 449: { action.builder. case 450: { action.builder.
consumeTemplateId(); break; consumeTemplateId(); break;
} }
// //
// Rule 450: operator_id_name ::= operator overloadable_operator // Rule 451: operator_id_name ::= operator overloadable_operator
// //
case 450: { action.builder. case 451: { action.builder.
consumeOperatorName(); break; consumeOperatorName(); break;
} }
// //
// Rule 493: template_declaration ::= export_opt template < <openscope-ast> template_parameter_list > declaration // Rule 494: template_declaration ::= export_opt template < <openscope-ast> template_parameter_list > declaration
// //
case 493: { action.builder. case 494: { action.builder.
consumeTemplateDeclaration(); break; consumeTemplateDeclaration(); break;
} }
// //
// Rule 494: export_opt ::= export // Rule 495: export_opt ::= export
// //
case 494: { action.builder. case 495: { action.builder.
consumePlaceHolder(); break; consumePlaceHolder(); break;
} }
// //
// Rule 495: export_opt ::= $Empty // Rule 496: export_opt ::= $Empty
// //
case 495: { action.builder. case 496: { action.builder.
consumeEmpty(); break; consumeEmpty(); break;
} }
// //
// Rule 499: template_parameter ::= parameter_declaration // Rule 500: template_parameter ::= parameter_declaration
// //
case 499: { action.builder. case 500: { action.builder.
consumeTemplateParamterDeclaration(); break; consumeTemplateParamterDeclaration(); break;
} }
// //
// Rule 500: type_parameter ::= class identifier_name_opt // Rule 501: type_parameter ::= class identifier_name_opt
//
case 500: { action.builder.
consumeSimpleTypeTemplateParameter(false); break;
}
//
// Rule 501: type_parameter ::= class identifier_name_opt = type_id
// //
case 501: { action.builder. case 501: { action.builder.
consumeSimpleTypeTemplateParameter(true); break;
}
//
// Rule 502: type_parameter ::= typename identifier_name_opt
//
case 502: { action.builder.
consumeSimpleTypeTemplateParameter(false); break; consumeSimpleTypeTemplateParameter(false); break;
} }
// //
// Rule 503: type_parameter ::= typename identifier_name_opt = type_id // Rule 502: type_parameter ::= class identifier_name_opt = type_id
// //
case 503: { action.builder. case 502: { action.builder.
consumeSimpleTypeTemplateParameter(true); break; consumeSimpleTypeTemplateParameter(true); break;
} }
// //
// Rule 504: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt // Rule 503: type_parameter ::= typename identifier_name_opt
//
case 503: { action.builder.
consumeSimpleTypeTemplateParameter(false); break;
}
//
// Rule 504: type_parameter ::= typename identifier_name_opt = type_id
// //
case 504: { action.builder. case 504: { action.builder.
consumeSimpleTypeTemplateParameter(true); break;
}
//
// Rule 505: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt
//
case 505: { action.builder.
consumeTemplatedTypeTemplateParameter(false); break; consumeTemplatedTypeTemplateParameter(false); break;
} }
// //
// Rule 505: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt = id_expression // Rule 506: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt = id_expression
// //
case 505: { action.builder. case 506: { action.builder.
consumeTemplatedTypeTemplateParameter(true); break; consumeTemplatedTypeTemplateParameter(true); break;
} }
// //
// Rule 506: template_id_name ::= identifier_name < <openscope-ast> template_argument_list_opt > // Rule 507: template_id_name ::= identifier_name < <openscope-ast> template_argument_list_opt >
// //
case 506: { action.builder. case 507: { action.builder.
consumeTemplateId(); break; consumeTemplateId(); break;
} }
// //
// Rule 514: explicit_instantiation ::= template declaration // Rule 515: explicit_instantiation ::= template declaration
// //
case 514: { action.builder. case 515: { action.builder.
consumeTemplateExplicitInstantiation(); break; consumeTemplateExplicitInstantiation(); break;
} }
// //
// Rule 515: explicit_specialization ::= template < > declaration // Rule 516: explicit_specialization ::= template < > declaration
// //
case 515: { action.builder. case 516: { action.builder.
consumeTemplateExplicitSpecialization(); break; consumeTemplateExplicitSpecialization(); break;
} }
// //
// Rule 516: try_block ::= try compound_statement <openscope-ast> handler_seq // Rule 517: try_block ::= try compound_statement <openscope-ast> handler_seq
// //
case 516: { action.builder. case 517: { action.builder.
consumeStatementTryBlock(); break; consumeStatementTryBlock(); break;
} }
// //
// Rule 519: handler ::= catch ( exception_declaration ) compound_statement // Rule 520: handler ::= catch ( exception_declaration ) compound_statement
// //
case 519: { action.builder. case 520: { action.builder.
consumeStatementCatchHandler(false); break; consumeStatementCatchHandler(false); break;
} }
// //
// Rule 520: handler ::= catch ( ... ) compound_statement // Rule 521: handler ::= catch ( ... ) compound_statement
// //
case 520: { action.builder. case 521: { action.builder.
consumeStatementCatchHandler(true); break; consumeStatementCatchHandler(true); break;
} }
// //
// Rule 521: exception_declaration ::= type_specifier_seq <openscope-ast> declarator // Rule 522: exception_declaration ::= type_specifier_seq <openscope-ast> declarator
//
case 521: { action.builder.
consumeDeclarationSimple(true); break;
}
//
// Rule 522: exception_declaration ::= type_specifier_seq <openscope-ast> abstract_declarator
// //
case 522: { action.builder. case 522: { action.builder.
consumeDeclarationSimple(true); break; consumeDeclarationSimple(true); break;
} }
// //
// Rule 523: exception_declaration ::= type_specifier_seq // Rule 523: exception_declaration ::= type_specifier_seq <openscope-ast> abstract_declarator
// //
case 523: { action.builder. case 523: { action.builder.
consumeDeclarationSimple(true); break;
}
//
// Rule 524: exception_declaration ::= type_specifier_seq
//
case 524: { action.builder.
consumeDeclarationSimple(false); break; consumeDeclarationSimple(false); break;
} }
// //
// Rule 531: no_function_declarator_start ::= ERROR_TOKEN // Rule 532: no_function_declarator_start ::= ERROR_TOKEN
// //
case 531: { action.builder. case 532: { action.builder.
consumeDeclarationProblem(); break; consumeDeclarationProblem(); break;
} }

View file

@ -15,92 +15,92 @@ package org.eclipse.cdt.internal.core.dom.lrparser.cpp;
public interface CPPNoFunctionDeclaratorParsersym { public interface CPPNoFunctionDeclaratorParsersym {
public final static int public final static int
TK_asm = 62, TK_asm = 63,
TK_auto = 49, TK_auto = 48,
TK_bool = 15, TK_bool = 15,
TK_break = 77, TK_break = 78,
TK_case = 78, TK_case = 79,
TK_catch = 119, TK_catch = 119,
TK_char = 16, TK_char = 16,
TK_class = 63, TK_class = 62,
TK_const = 46, TK_const = 33,
TK_const_cast = 32, TK_const_cast = 34,
TK_continue = 79, TK_continue = 80,
TK_default = 80, TK_default = 81,
TK_delete = 65, TK_delete = 65,
TK_do = 81, TK_do = 82,
TK_double = 17, TK_double = 17,
TK_dynamic_cast = 33, TK_dynamic_cast = 35,
TK_else = 122, TK_else = 122,
TK_enum = 68, TK_enum = 68,
TK_explicit = 50, TK_explicit = 49,
TK_export = 82, TK_export = 75,
TK_extern = 14, TK_extern = 12,
TK_false = 34, TK_false = 36,
TK_float = 18, TK_float = 18,
TK_for = 83, TK_for = 83,
TK_friend = 51, TK_friend = 50,
TK_goto = 84, TK_goto = 84,
TK_if = 85, TK_if = 85,
TK_inline = 52, TK_inline = 51,
TK_int = 19, TK_int = 19,
TK_long = 20, TK_long = 20,
TK_mutable = 53, TK_mutable = 52,
TK_namespace = 57, TK_namespace = 57,
TK_new = 66, TK_new = 66,
TK_operator = 7, TK_operator = 7,
TK_private = 114, TK_private = 103,
TK_protected = 115, TK_protected = 104,
TK_public = 116, TK_public = 105,
TK_register = 54, TK_register = 53,
TK_reinterpret_cast = 35, TK_reinterpret_cast = 37,
TK_return = 86, TK_return = 86,
TK_short = 21, TK_short = 21,
TK_signed = 22, TK_signed = 22,
TK_sizeof = 36, TK_sizeof = 38,
TK_static = 55, TK_static = 54,
TK_static_cast = 37, TK_static_cast = 39,
TK_struct = 69, TK_struct = 69,
TK_switch = 87, TK_switch = 87,
TK_template = 31, TK_template = 30,
TK_this = 38, TK_this = 40,
TK_throw = 58, TK_throw = 59,
TK_try = 75, TK_try = 76,
TK_true = 39, TK_true = 41,
TK_typedef = 56, TK_typedef = 55,
TK_typeid = 40, TK_typeid = 42,
TK_typename = 10, TK_typename = 10,
TK_union = 70, TK_union = 70,
TK_unsigned = 23, TK_unsigned = 23,
TK_using = 59, TK_using = 58,
TK_virtual = 41, TK_virtual = 32,
TK_void = 24, TK_void = 24,
TK_volatile = 47, TK_volatile = 43,
TK_wchar_t = 25, TK_wchar_t = 25,
TK_while = 76, TK_while = 77,
TK_integer = 42, TK_integer = 44,
TK_floating = 43, TK_floating = 45,
TK_charconst = 44, TK_charconst = 46,
TK_stringlit = 29, TK_stringlit = 29,
TK_identifier = 1, TK_identifier = 1,
TK_Completion = 2, TK_Completion = 2,
TK_EndOfCompletion = 9, TK_EndOfCompletion = 9,
TK_Invalid = 123, TK_Invalid = 123,
TK_LeftBracket = 48, TK_LeftBracket = 56,
TK_LeftParen = 3, TK_LeftParen = 3,
TK_LeftBrace = 60, TK_LeftBrace = 60,
TK_Dot = 120, TK_Dot = 120,
TK_DotStar = 96, TK_DotStar = 96,
TK_Arrow = 103, TK_Arrow = 106,
TK_ArrowStar = 90, TK_ArrowStar = 90,
TK_PlusPlus = 26, TK_PlusPlus = 26,
TK_MinusMinus = 27, TK_MinusMinus = 27,
TK_And = 8, TK_And = 8,
TK_Star = 6, TK_Star = 6,
TK_Plus = 11, TK_Plus = 13,
TK_Minus = 12, TK_Minus = 14,
TK_Tilde = 5, TK_Tilde = 5,
TK_Bang = 30, TK_Bang = 31,
TK_Slash = 91, TK_Slash = 91,
TK_Percent = 92, TK_Percent = 92,
TK_RightShift = 88, TK_RightShift = 88,
@ -120,23 +120,23 @@ public interface CPPNoFunctionDeclaratorParsersym {
TK_ColonColon = 4, TK_ColonColon = 4,
TK_DotDotDot = 95, TK_DotDotDot = 95,
TK_Assign = 67, TK_Assign = 67,
TK_StarAssign = 104, TK_StarAssign = 107,
TK_SlashAssign = 105, TK_SlashAssign = 108,
TK_PercentAssign = 106, TK_PercentAssign = 109,
TK_PlusAssign = 107, TK_PlusAssign = 110,
TK_MinusAssign = 108, TK_MinusAssign = 111,
TK_RightShiftAssign = 109, TK_RightShiftAssign = 112,
TK_LeftShiftAssign = 110, TK_LeftShiftAssign = 113,
TK_AndAssign = 111, TK_AndAssign = 114,
TK_CaretAssign = 112, TK_CaretAssign = 115,
TK_OrAssign = 113, TK_OrAssign = 116,
TK_Comma = 64, TK_Comma = 64,
TK_zero = 45,
TK_RightBracket = 118, TK_RightBracket = 118,
TK_RightParen = 72, TK_RightParen = 73,
TK_RightBrace = 73, TK_RightBrace = 72,
TK_SemiColon = 13, TK_SemiColon = 11,
TK_ERROR_TOKEN = 74, TK_ERROR_TOKEN = 74,
TK_0 = 47,
TK_EOF_TOKEN = 121; TK_EOF_TOKEN = 121;
public final static String orderedTerminalSymbols[] = { public final static String orderedTerminalSymbols[] = {
@ -151,10 +151,10 @@ public interface CPPNoFunctionDeclaratorParsersym {
"And", "And",
"EndOfCompletion", "EndOfCompletion",
"typename", "typename",
"Plus",
"Minus",
"SemiColon", "SemiColon",
"extern", "extern",
"Plus",
"Minus",
"bool", "bool",
"char", "char",
"double", "double",
@ -170,8 +170,10 @@ public interface CPPNoFunctionDeclaratorParsersym {
"MinusMinus", "MinusMinus",
"LT", "LT",
"stringlit", "stringlit",
"Bang",
"template", "template",
"Bang",
"virtual",
"const",
"const_cast", "const_cast",
"dynamic_cast", "dynamic_cast",
"false", "false",
@ -181,14 +183,11 @@ public interface CPPNoFunctionDeclaratorParsersym {
"this", "this",
"true", "true",
"typeid", "typeid",
"virtual", "volatile",
"integer", "integer",
"floating", "floating",
"charconst", "charconst",
"zero", "0",
"const",
"volatile",
"LeftBracket",
"auto", "auto",
"explicit", "explicit",
"friend", "friend",
@ -197,13 +196,14 @@ public interface CPPNoFunctionDeclaratorParsersym {
"register", "register",
"static", "static",
"typedef", "typedef",
"LeftBracket",
"namespace", "namespace",
"throw",
"using", "using",
"throw",
"LeftBrace", "LeftBrace",
"GT", "GT",
"asm",
"class", "class",
"asm",
"Comma", "Comma",
"delete", "delete",
"new", "new",
@ -212,9 +212,10 @@ public interface CPPNoFunctionDeclaratorParsersym {
"struct", "struct",
"union", "union",
"Colon", "Colon",
"RightParen",
"RightBrace", "RightBrace",
"RightParen",
"ERROR_TOKEN", "ERROR_TOKEN",
"export",
"try", "try",
"while", "while",
"break", "break",
@ -222,7 +223,6 @@ public interface CPPNoFunctionDeclaratorParsersym {
"continue", "continue",
"default", "default",
"do", "do",
"export",
"for", "for",
"goto", "goto",
"if", "if",
@ -243,6 +243,9 @@ public interface CPPNoFunctionDeclaratorParsersym {
"Or", "Or",
"AndAnd", "AndAnd",
"OrOr", "OrOr",
"private",
"protected",
"public",
"Arrow", "Arrow",
"StarAssign", "StarAssign",
"SlashAssign", "SlashAssign",
@ -254,9 +257,6 @@ public interface CPPNoFunctionDeclaratorParsersym {
"AndAssign", "AndAssign",
"CaretAssign", "CaretAssign",
"OrAssign", "OrAssign",
"private",
"protected",
"public",
"Question", "Question",
"RightBracket", "RightBracket",
"catch", "catch",

View file

@ -209,32 +209,11 @@ public IASTCompletionNode parse(IASTTranslationUnit tu) {
} }
public int getKind(int i) {
int kind = super.getKind(i);
// There used to be a special token kind for zero used to parser pure virtual function declarations.
// But it turned out to be easier to just parse them as an init_ declarator and programaticaly check
// for pure virtual, see consumeMemberDeclaratorWithInitializer().
//if(kind == CPPParsersym.TK_integer && "0".equals(getTokenText(i))) { //$NON-NLS-1$
// kind = CPPParsersym.TK_zero;
//}
// lexer feedback hack!
//else if(kind == C99Parsersym.TK_identifier && action.resolver.isTypedef(getTokenText(i))) {
// kind = C99Parsersym.TK_TypedefName;
//}
return kind;
}
// uncomment this method to use with backtracking parser // uncomment this method to use with backtracking parser
public List getRuleTokens() { public List getRuleTokens() {
return Collections.unmodifiableList(getTokens().subList(getLeftSpan(), getRightSpan() + 1)); return Collections.unmodifiableList(getTokens().subList(getLeftSpan(), getRightSpan() + 1));
} }
public IASTNode getSecondaryParseResult() { public IASTNode getSecondaryParseResult() {
return action.builder.getSecondaryParseResult(); return action.builder.getSecondaryParseResult();
} }
@ -1911,359 +1890,366 @@ public CPPParser(String[] mapFrom) { // constructor
} }
// //
// Rule 389: class_head ::= class_keyword identifier_name_opt <openscope-ast> base_clause_opt // Rule 389: class_specifier ::= class_head EOC <openscope-ast> member_declaration_list_opt }
// //
case 389: { action.builder. case 389: { action.builder.
consumeClassHead(false); break; consumeClassSpecifier(); break;
} }
// //
// Rule 390: class_head ::= class_keyword template_id_name <openscope-ast> base_clause_opt // Rule 390: class_head ::= class_keyword identifier_name_opt <openscope-ast> base_clause_opt
// //
case 390: { action.builder. case 390: { action.builder.
consumeClassHead(false); break; consumeClassHead(false); break;
} }
// //
// Rule 391: class_head ::= class_keyword nested_name_specifier identifier_name <openscope-ast> base_clause_opt // Rule 391: class_head ::= class_keyword template_id_name <openscope-ast> base_clause_opt
// //
case 391: { action.builder. case 391: { action.builder.
consumeClassHead(true); break; consumeClassHead(false); break;
} }
// //
// Rule 392: class_head ::= class_keyword nested_name_specifier template_id_name <openscope-ast> base_clause_opt // Rule 392: class_head ::= class_keyword nested_name_specifier identifier_name <openscope-ast> base_clause_opt
// //
case 392: { action.builder. case 392: { action.builder.
consumeClassHead(true); break; consumeClassHead(true); break;
} }
// //
// Rule 394: identifier_name_opt ::= $Empty // Rule 393: class_head ::= class_keyword nested_name_specifier template_id_name <openscope-ast> base_clause_opt
// //
case 394: { action.builder. case 393: { action.builder.
consumeClassHead(true); break;
}
//
// Rule 395: identifier_name_opt ::= $Empty
//
case 395: { action.builder.
consumeEmpty(); break; consumeEmpty(); break;
} }
// //
// Rule 398: visibility_label ::= access_specifier_keyword : // Rule 399: visibility_label ::= access_specifier_keyword :
// //
case 398: { action.builder. case 399: { action.builder.
consumeVisibilityLabel(); break; consumeVisibilityLabel(); break;
} }
// //
// Rule 399: member_declaration ::= declaration_specifiers_opt <openscope-ast> member_declarator_list ; // Rule 400: member_declaration ::= declaration_specifiers_opt <openscope-ast> member_declarator_list ;
// //
case 399: { action.builder. case 400: { action.builder.
consumeDeclarationSimple(true); break; consumeDeclarationSimple(true); break;
} }
// //
// Rule 400: member_declaration ::= declaration_specifiers_opt ; // Rule 401: member_declaration ::= declaration_specifiers_opt ;
// //
case 400: { action.builder. case 401: { action.builder.
consumeDeclarationSimple(false); break; consumeDeclarationSimple(false); break;
} }
// //
// Rule 403: member_declaration ::= dcolon_opt nested_name_specifier template_opt unqualified_id_name ; // Rule 404: member_declaration ::= dcolon_opt nested_name_specifier template_opt unqualified_id_name ;
// //
case 403: { action.builder. case 404: { action.builder.
consumeMemberDeclarationQualifiedId(); break; consumeMemberDeclarationQualifiedId(); break;
} }
// //
// Rule 409: member_declaration ::= ERROR_TOKEN // Rule 410: member_declaration ::= ERROR_TOKEN
// //
case 409: { action.builder. case 410: { action.builder.
consumeDeclarationProblem(); break; consumeDeclarationProblem(); break;
} }
// //
// Rule 417: member_declarator ::= declarator constant_initializer // Rule 418: member_declarator ::= declarator constant_initializer
// //
case 417: { action.builder. case 418: { action.builder.
consumeMemberDeclaratorWithInitializer(); break; consumeMemberDeclaratorWithInitializer(); break;
} }
// //
// Rule 418: member_declarator ::= bit_field_declarator : constant_expression // Rule 419: member_declarator ::= bit_field_declarator : constant_expression
// //
case 418: { action.builder. case 419: { action.builder.
consumeBitField(true); break; consumeBitField(true); break;
} }
// //
// Rule 419: member_declarator ::= : constant_expression // Rule 420: member_declarator ::= : constant_expression
// //
case 419: { action.builder. case 420: { action.builder.
consumeBitField(false); break; consumeBitField(false); break;
} }
// //
// Rule 420: bit_field_declarator ::= identifier_name // Rule 421: bit_field_declarator ::= identifier_name
// //
case 420: { action.builder. case 421: { action.builder.
consumeDirectDeclaratorIdentifier(); break; consumeDirectDeclaratorIdentifier(); break;
} }
// //
// Rule 421: constant_initializer ::= = constant_expression // Rule 422: constant_initializer ::= = constant_expression
// //
case 421: { action.builder. case 422: { action.builder.
consumeInitializer(); break; consumeInitializer(); break;
} }
// //
// Rule 427: base_specifier ::= dcolon_opt nested_name_specifier_opt class_name // Rule 428: base_specifier ::= dcolon_opt nested_name_specifier_opt class_name
// //
case 427: { action.builder. case 428: { action.builder.
consumeBaseSpecifier(false, false); break; consumeBaseSpecifier(false, false); break;
} }
// //
// Rule 428: base_specifier ::= virtual access_specifier_keyword_opt dcolon_opt nested_name_specifier_opt class_name // Rule 429: base_specifier ::= virtual access_specifier_keyword_opt dcolon_opt nested_name_specifier_opt class_name
//
case 428: { action.builder.
consumeBaseSpecifier(true, true); break;
}
//
// Rule 429: base_specifier ::= access_specifier_keyword virtual dcolon_opt nested_name_specifier_opt class_name
// //
case 429: { action.builder. case 429: { action.builder.
consumeBaseSpecifier(true, true); break; consumeBaseSpecifier(true, true); break;
} }
// //
// Rule 430: base_specifier ::= access_specifier_keyword dcolon_opt nested_name_specifier_opt class_name // Rule 430: base_specifier ::= access_specifier_keyword virtual dcolon_opt nested_name_specifier_opt class_name
// //
case 430: { action.builder. case 430: { action.builder.
consumeBaseSpecifier(true, true); break;
}
//
// Rule 431: base_specifier ::= access_specifier_keyword dcolon_opt nested_name_specifier_opt class_name
//
case 431: { action.builder.
consumeBaseSpecifier(true, false); break; consumeBaseSpecifier(true, false); break;
} }
// //
// Rule 431: access_specifier_keyword ::= private // Rule 432: access_specifier_keyword ::= private
//
case 431: { action.builder.
consumeAccessKeywordToken(); break;
}
//
// Rule 432: access_specifier_keyword ::= protected
// //
case 432: { action.builder. case 432: { action.builder.
consumeAccessKeywordToken(); break; consumeAccessKeywordToken(); break;
} }
// //
// Rule 433: access_specifier_keyword ::= public // Rule 433: access_specifier_keyword ::= protected
// //
case 433: { action.builder. case 433: { action.builder.
consumeAccessKeywordToken(); break; consumeAccessKeywordToken(); break;
} }
// //
// Rule 435: access_specifier_keyword_opt ::= $Empty // Rule 434: access_specifier_keyword ::= public
// //
case 435: { action.builder. case 434: { action.builder.
consumeAccessKeywordToken(); break;
}
//
// Rule 436: access_specifier_keyword_opt ::= $Empty
//
case 436: { action.builder.
consumeEmpty(); break; consumeEmpty(); break;
} }
// //
// Rule 437: conversion_function_id_name ::= conversion_function_id < <openscope-ast> template_argument_list_opt > // Rule 438: conversion_function_id_name ::= conversion_function_id < <openscope-ast> template_argument_list_opt >
// //
case 437: { action.builder. case 438: { action.builder.
consumeTemplateId(); break; consumeTemplateId(); break;
} }
// //
// Rule 438: conversion_function_id ::= operator conversion_type_id // Rule 439: conversion_function_id ::= operator conversion_type_id
// //
case 438: { action.builder. case 439: { action.builder.
consumeConversionName(); break; consumeConversionName(); break;
} }
// //
// Rule 439: conversion_type_id ::= type_specifier_seq conversion_declarator // Rule 440: conversion_type_id ::= type_specifier_seq conversion_declarator
// //
case 439: { action.builder. case 440: { action.builder.
consumeTypeId(true); break; consumeTypeId(true); break;
} }
// //
// Rule 440: conversion_type_id ::= type_specifier_seq // Rule 441: conversion_type_id ::= type_specifier_seq
// //
case 440: { action.builder. case 441: { action.builder.
consumeTypeId(false); break; consumeTypeId(false); break;
} }
// //
// Rule 441: conversion_declarator ::= <openscope-ast> ptr_operator_seq // Rule 442: conversion_declarator ::= <openscope-ast> ptr_operator_seq
// //
case 441: { action.builder. case 442: { action.builder.
consumeDeclaratorWithPointer(false); break; consumeDeclaratorWithPointer(false); break;
} }
// //
// Rule 447: mem_initializer ::= mem_initializer_name ( expression_list_opt ) // Rule 448: mem_initializer ::= mem_initializer_name ( expression_list_opt )
// //
case 447: { action.builder. case 448: { action.builder.
consumeConstructorChainInitializer(); break; consumeConstructorChainInitializer(); break;
} }
// //
// Rule 448: mem_initializer_name ::= dcolon_opt nested_name_specifier_opt class_name // Rule 449: mem_initializer_name ::= dcolon_opt nested_name_specifier_opt class_name
// //
case 448: { action.builder. case 449: { action.builder.
consumeQualifiedId(false); break; consumeQualifiedId(false); break;
} }
// //
// Rule 451: operator_function_id_name ::= operator_id_name < <openscope-ast> template_argument_list_opt > // Rule 452: operator_function_id_name ::= operator_id_name < <openscope-ast> template_argument_list_opt >
// //
case 451: { action.builder. case 452: { action.builder.
consumeTemplateId(); break; consumeTemplateId(); break;
} }
// //
// Rule 452: operator_id_name ::= operator overloadable_operator // Rule 453: operator_id_name ::= operator overloadable_operator
// //
case 452: { action.builder. case 453: { action.builder.
consumeOperatorName(); break; consumeOperatorName(); break;
} }
// //
// Rule 495: template_declaration ::= export_opt template < <openscope-ast> template_parameter_list > declaration // Rule 496: template_declaration ::= export_opt template < <openscope-ast> template_parameter_list > declaration
// //
case 495: { action.builder. case 496: { action.builder.
consumeTemplateDeclaration(); break; consumeTemplateDeclaration(); break;
} }
// //
// Rule 496: export_opt ::= export // Rule 497: export_opt ::= export
// //
case 496: { action.builder. case 497: { action.builder.
consumePlaceHolder(); break; consumePlaceHolder(); break;
} }
// //
// Rule 497: export_opt ::= $Empty // Rule 498: export_opt ::= $Empty
// //
case 497: { action.builder. case 498: { action.builder.
consumeEmpty(); break; consumeEmpty(); break;
} }
// //
// Rule 501: template_parameter ::= parameter_declaration // Rule 502: template_parameter ::= parameter_declaration
// //
case 501: { action.builder. case 502: { action.builder.
consumeTemplateParamterDeclaration(); break; consumeTemplateParamterDeclaration(); break;
} }
// //
// Rule 502: type_parameter ::= class identifier_name_opt // Rule 503: type_parameter ::= class identifier_name_opt
//
case 502: { action.builder.
consumeSimpleTypeTemplateParameter(false); break;
}
//
// Rule 503: type_parameter ::= class identifier_name_opt = type_id
// //
case 503: { action.builder. case 503: { action.builder.
consumeSimpleTypeTemplateParameter(true); break;
}
//
// Rule 504: type_parameter ::= typename identifier_name_opt
//
case 504: { action.builder.
consumeSimpleTypeTemplateParameter(false); break; consumeSimpleTypeTemplateParameter(false); break;
} }
// //
// Rule 505: type_parameter ::= typename identifier_name_opt = type_id // Rule 504: type_parameter ::= class identifier_name_opt = type_id
// //
case 505: { action.builder. case 504: { action.builder.
consumeSimpleTypeTemplateParameter(true); break; consumeSimpleTypeTemplateParameter(true); break;
} }
// //
// Rule 506: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt // Rule 505: type_parameter ::= typename identifier_name_opt
//
case 505: { action.builder.
consumeSimpleTypeTemplateParameter(false); break;
}
//
// Rule 506: type_parameter ::= typename identifier_name_opt = type_id
// //
case 506: { action.builder. case 506: { action.builder.
consumeSimpleTypeTemplateParameter(true); break;
}
//
// Rule 507: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt
//
case 507: { action.builder.
consumeTemplatedTypeTemplateParameter(false); break; consumeTemplatedTypeTemplateParameter(false); break;
} }
// //
// Rule 507: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt = id_expression // Rule 508: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt = id_expression
// //
case 507: { action.builder. case 508: { action.builder.
consumeTemplatedTypeTemplateParameter(true); break; consumeTemplatedTypeTemplateParameter(true); break;
} }
// //
// Rule 508: template_id_name ::= identifier_name < <openscope-ast> template_argument_list_opt > // Rule 509: template_id_name ::= identifier_name < <openscope-ast> template_argument_list_opt >
// //
case 508: { action.builder. case 509: { action.builder.
consumeTemplateId(); break; consumeTemplateId(); break;
} }
// //
// Rule 516: explicit_instantiation ::= template declaration // Rule 517: explicit_instantiation ::= template declaration
// //
case 516: { action.builder. case 517: { action.builder.
consumeTemplateExplicitInstantiation(); break; consumeTemplateExplicitInstantiation(); break;
} }
// //
// Rule 517: explicit_specialization ::= template < > declaration // Rule 518: explicit_specialization ::= template < > declaration
// //
case 517: { action.builder. case 518: { action.builder.
consumeTemplateExplicitSpecialization(); break; consumeTemplateExplicitSpecialization(); break;
} }
// //
// Rule 518: try_block ::= try compound_statement <openscope-ast> handler_seq // Rule 519: try_block ::= try compound_statement <openscope-ast> handler_seq
// //
case 518: { action.builder. case 519: { action.builder.
consumeStatementTryBlock(); break; consumeStatementTryBlock(); break;
} }
// //
// Rule 521: handler ::= catch ( exception_declaration ) compound_statement // Rule 522: handler ::= catch ( exception_declaration ) compound_statement
// //
case 521: { action.builder. case 522: { action.builder.
consumeStatementCatchHandler(false); break; consumeStatementCatchHandler(false); break;
} }
// //
// Rule 522: handler ::= catch ( ... ) compound_statement // Rule 523: handler ::= catch ( ... ) compound_statement
// //
case 522: { action.builder. case 523: { action.builder.
consumeStatementCatchHandler(true); break; consumeStatementCatchHandler(true); break;
} }
// //
// Rule 523: exception_declaration ::= type_specifier_seq <openscope-ast> declarator // Rule 524: exception_declaration ::= type_specifier_seq <openscope-ast> declarator
//
case 523: { action.builder.
consumeDeclarationSimple(true); break;
}
//
// Rule 524: exception_declaration ::= type_specifier_seq <openscope-ast> abstract_declarator
// //
case 524: { action.builder. case 524: { action.builder.
consumeDeclarationSimple(true); break; consumeDeclarationSimple(true); break;
} }
// //
// Rule 525: exception_declaration ::= type_specifier_seq // Rule 525: exception_declaration ::= type_specifier_seq <openscope-ast> abstract_declarator
// //
case 525: { action.builder. case 525: { action.builder.
consumeDeclarationSimple(true); break;
}
//
// Rule 526: exception_declaration ::= type_specifier_seq
//
case 526: { action.builder.
consumeDeclarationSimple(false); break; consumeDeclarationSimple(false); break;
} }

View file

@ -15,83 +15,83 @@ 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 = 59, TK_asm = 60,
TK_auto = 35, TK_auto = 35,
TK_bool = 13, TK_bool = 13,
TK_break = 78, TK_break = 78,
TK_case = 79, TK_case = 79,
TK_catch = 119, TK_catch = 119,
TK_char = 14, TK_char = 14,
TK_class = 60, TK_class = 59,
TK_const = 33, TK_const = 32,
TK_const_cast = 36, TK_const_cast = 43,
TK_continue = 80, TK_continue = 80,
TK_default = 81, TK_default = 81,
TK_delete = 65, TK_delete = 68,
TK_do = 82, TK_do = 82,
TK_double = 15, TK_double = 15,
TK_dynamic_cast = 37, TK_dynamic_cast = 44,
TK_else = 122, TK_else = 122,
TK_enum = 66, TK_enum = 64,
TK_explicit = 38, TK_explicit = 36,
TK_export = 75, TK_export = 75,
TK_extern = 12, TK_extern = 12,
TK_false = 39, TK_false = 45,
TK_float = 16, TK_float = 16,
TK_for = 83, TK_for = 83,
TK_friend = 40, TK_friend = 37,
TK_goto = 84, TK_goto = 84,
TK_if = 85, TK_if = 85,
TK_inline = 41, TK_inline = 38,
TK_int = 17, TK_int = 17,
TK_long = 18, TK_long = 18,
TK_mutable = 42, TK_mutable = 39,
TK_namespace = 56, TK_namespace = 46,
TK_new = 67, TK_new = 69,
TK_operator = 7, TK_operator = 7,
TK_private = 114, TK_private = 103,
TK_protected = 115, TK_protected = 104,
TK_public = 116, TK_public = 105,
TK_register = 43, TK_register = 40,
TK_reinterpret_cast = 44, TK_reinterpret_cast = 47,
TK_return = 86, TK_return = 86,
TK_short = 19, TK_short = 19,
TK_signed = 20, TK_signed = 20,
TK_sizeof = 45, TK_sizeof = 48,
TK_static = 46, TK_static = 41,
TK_static_cast = 47, TK_static_cast = 49,
TK_struct = 68, TK_struct = 65,
TK_switch = 87, TK_switch = 87,
TK_template = 29, TK_template = 29,
TK_this = 48, TK_this = 50,
TK_throw = 61, TK_throw = 61,
TK_try = 76, TK_try = 76,
TK_true = 49, TK_true = 51,
TK_typedef = 50, TK_typedef = 42,
TK_typeid = 51, TK_typeid = 52,
TK_typename = 10, TK_typename = 10,
TK_union = 69, TK_union = 66,
TK_unsigned = 21, TK_unsigned = 21,
TK_using = 58, TK_using = 57,
TK_virtual = 31, TK_virtual = 30,
TK_void = 22, TK_void = 22,
TK_volatile = 34, TK_volatile = 33,
TK_wchar_t = 23, TK_wchar_t = 23,
TK_while = 77, TK_while = 77,
TK_integer = 52, TK_integer = 53,
TK_floating = 53, TK_floating = 54,
TK_charconst = 54, TK_charconst = 55,
TK_stringlit = 30, TK_stringlit = 31,
TK_identifier = 1, TK_identifier = 1,
TK_Completion = 2, TK_Completion = 2,
TK_EndOfCompletion = 9, TK_EndOfCompletion = 9,
TK_Invalid = 123, TK_Invalid = 123,
TK_LeftBracket = 57, TK_LeftBracket = 58,
TK_LeftParen = 3, TK_LeftParen = 3,
TK_LeftBrace = 62, TK_LeftBrace = 62,
TK_Dot = 120, TK_Dot = 120,
TK_DotStar = 96, TK_DotStar = 96,
TK_Arrow = 103, TK_Arrow = 106,
TK_ArrowStar = 90, TK_ArrowStar = 90,
TK_PlusPlus = 26, TK_PlusPlus = 26,
TK_MinusMinus = 27, TK_MinusMinus = 27,
@ -100,7 +100,7 @@ public interface CPPParsersym {
TK_Plus = 24, TK_Plus = 24,
TK_Minus = 25, TK_Minus = 25,
TK_Tilde = 5, TK_Tilde = 5,
TK_Bang = 32, TK_Bang = 34,
TK_Slash = 91, TK_Slash = 91,
TK_Percent = 92, TK_Percent = 92,
TK_RightShift = 88, TK_RightShift = 88,
@ -120,23 +120,23 @@ public interface CPPParsersym {
TK_ColonColon = 4, TK_ColonColon = 4,
TK_DotDotDot = 95, TK_DotDotDot = 95,
TK_Assign = 70, TK_Assign = 70,
TK_StarAssign = 104, TK_StarAssign = 107,
TK_SlashAssign = 105, TK_SlashAssign = 108,
TK_PercentAssign = 106, TK_PercentAssign = 109,
TK_PlusAssign = 107, TK_PlusAssign = 110,
TK_MinusAssign = 108, TK_MinusAssign = 111,
TK_RightShiftAssign = 109, TK_RightShiftAssign = 112,
TK_LeftShiftAssign = 110, TK_LeftShiftAssign = 113,
TK_AndAssign = 111, TK_AndAssign = 114,
TK_CaretAssign = 112, TK_CaretAssign = 115,
TK_OrAssign = 113, TK_OrAssign = 116,
TK_Comma = 64, TK_Comma = 67,
TK_zero = 55,
TK_RightBracket = 118, TK_RightBracket = 118,
TK_RightParen = 72, TK_RightParen = 73,
TK_RightBrace = 73, TK_RightBrace = 72,
TK_SemiColon = 11, TK_SemiColon = 11,
TK_ERROR_TOKEN = 74, TK_ERROR_TOKEN = 74,
TK_0 = 56,
TK_EOF_TOKEN = 121; TK_EOF_TOKEN = 121;
public final static String orderedTerminalSymbols[] = { public final static String orderedTerminalSymbols[] = {
@ -170,50 +170,50 @@ public interface CPPParsersym {
"MinusMinus", "MinusMinus",
"LT", "LT",
"template", "template",
"stringlit",
"virtual", "virtual",
"Bang", "stringlit",
"const", "const",
"volatile", "volatile",
"Bang",
"auto", "auto",
"const_cast",
"dynamic_cast",
"explicit", "explicit",
"false",
"friend", "friend",
"inline", "inline",
"mutable", "mutable",
"register", "register",
"static",
"typedef",
"const_cast",
"dynamic_cast",
"false",
"namespace",
"reinterpret_cast", "reinterpret_cast",
"sizeof", "sizeof",
"static",
"static_cast", "static_cast",
"this", "this",
"true", "true",
"typedef",
"typeid", "typeid",
"integer", "integer",
"floating", "floating",
"charconst", "charconst",
"zero", "0",
"namespace",
"LeftBracket",
"using", "using",
"asm", "LeftBracket",
"class", "class",
"asm",
"throw", "throw",
"LeftBrace", "LeftBrace",
"GT", "GT",
"Comma",
"delete",
"enum", "enum",
"new",
"struct", "struct",
"union", "union",
"Comma",
"delete",
"new",
"Assign", "Assign",
"Colon", "Colon",
"RightParen",
"RightBrace", "RightBrace",
"RightParen",
"ERROR_TOKEN", "ERROR_TOKEN",
"export", "export",
"try", "try",
@ -243,6 +243,9 @@ public interface CPPParsersym {
"Or", "Or",
"AndAnd", "AndAnd",
"OrOr", "OrOr",
"private",
"protected",
"public",
"Arrow", "Arrow",
"StarAssign", "StarAssign",
"SlashAssign", "SlashAssign",
@ -254,9 +257,6 @@ public interface CPPParsersym {
"AndAssign", "AndAssign",
"CaretAssign", "CaretAssign",
"OrAssign", "OrAssign",
"private",
"protected",
"public",
"Question", "Question",
"RightBracket", "RightBracket",
"catch", "catch",

View file

@ -209,32 +209,11 @@ public IASTCompletionNode parse(IASTTranslationUnit tu) {
} }
public int getKind(int i) {
int kind = super.getKind(i);
// There used to be a special token kind for zero used to parser pure virtual function declarations.
// But it turned out to be easier to just parse them as an init_ declarator and programaticaly check
// for pure virtual, see consumeMemberDeclaratorWithInitializer().
//if(kind == CPPParsersym.TK_integer && "0".equals(getTokenText(i))) { //$NON-NLS-1$
// kind = CPPParsersym.TK_zero;
//}
// lexer feedback hack!
//else if(kind == C99Parsersym.TK_identifier && action.resolver.isTypedef(getTokenText(i))) {
// kind = C99Parsersym.TK_TypedefName;
//}
return kind;
}
// uncomment this method to use with backtracking parser // uncomment this method to use with backtracking parser
public List getRuleTokens() { public List getRuleTokens() {
return Collections.unmodifiableList(getTokens().subList(getLeftSpan(), getRightSpan() + 1)); return Collections.unmodifiableList(getTokens().subList(getLeftSpan(), getRightSpan() + 1));
} }
public IASTNode getSecondaryParseResult() { public IASTNode getSecondaryParseResult() {
return action.builder.getSecondaryParseResult(); return action.builder.getSecondaryParseResult();
} }
@ -1897,366 +1876,373 @@ public CPPSizeofExpressionParser(String[] mapFrom) { // constructor
} }
// //
// Rule 387: class_head ::= class_keyword identifier_name_opt <openscope-ast> base_clause_opt // Rule 387: class_specifier ::= class_head EOC <openscope-ast> member_declaration_list_opt }
// //
case 387: { action.builder. case 387: { action.builder.
consumeClassHead(false); break; consumeClassSpecifier(); break;
} }
// //
// Rule 388: class_head ::= class_keyword template_id_name <openscope-ast> base_clause_opt // Rule 388: class_head ::= class_keyword identifier_name_opt <openscope-ast> base_clause_opt
// //
case 388: { action.builder. case 388: { action.builder.
consumeClassHead(false); break; consumeClassHead(false); break;
} }
// //
// Rule 389: class_head ::= class_keyword nested_name_specifier identifier_name <openscope-ast> base_clause_opt // Rule 389: class_head ::= class_keyword template_id_name <openscope-ast> base_clause_opt
// //
case 389: { action.builder. case 389: { action.builder.
consumeClassHead(true); break; consumeClassHead(false); break;
} }
// //
// Rule 390: class_head ::= class_keyword nested_name_specifier template_id_name <openscope-ast> base_clause_opt // Rule 390: class_head ::= class_keyword nested_name_specifier identifier_name <openscope-ast> base_clause_opt
// //
case 390: { action.builder. case 390: { action.builder.
consumeClassHead(true); break; consumeClassHead(true); break;
} }
// //
// Rule 392: identifier_name_opt ::= $Empty // Rule 391: class_head ::= class_keyword nested_name_specifier template_id_name <openscope-ast> base_clause_opt
// //
case 392: { action.builder. case 391: { action.builder.
consumeClassHead(true); break;
}
//
// Rule 393: identifier_name_opt ::= $Empty
//
case 393: { action.builder.
consumeEmpty(); break; consumeEmpty(); break;
} }
// //
// Rule 396: visibility_label ::= access_specifier_keyword : // Rule 397: visibility_label ::= access_specifier_keyword :
// //
case 396: { action.builder. case 397: { action.builder.
consumeVisibilityLabel(); break; consumeVisibilityLabel(); break;
} }
// //
// Rule 397: member_declaration ::= declaration_specifiers_opt <openscope-ast> member_declarator_list ; // Rule 398: member_declaration ::= declaration_specifiers_opt <openscope-ast> member_declarator_list ;
// //
case 397: { action.builder. case 398: { action.builder.
consumeDeclarationSimple(true); break; consumeDeclarationSimple(true); break;
} }
// //
// Rule 398: member_declaration ::= declaration_specifiers_opt ; // Rule 399: member_declaration ::= declaration_specifiers_opt ;
// //
case 398: { action.builder. case 399: { action.builder.
consumeDeclarationSimple(false); break; consumeDeclarationSimple(false); break;
} }
// //
// Rule 401: member_declaration ::= dcolon_opt nested_name_specifier template_opt unqualified_id_name ; // Rule 402: member_declaration ::= dcolon_opt nested_name_specifier template_opt unqualified_id_name ;
// //
case 401: { action.builder. case 402: { action.builder.
consumeMemberDeclarationQualifiedId(); break; consumeMemberDeclarationQualifiedId(); break;
} }
// //
// Rule 407: member_declaration ::= ERROR_TOKEN // Rule 408: member_declaration ::= ERROR_TOKEN
// //
case 407: { action.builder. case 408: { action.builder.
consumeDeclarationProblem(); break; consumeDeclarationProblem(); break;
} }
// //
// Rule 415: member_declarator ::= declarator constant_initializer // Rule 416: member_declarator ::= declarator constant_initializer
// //
case 415: { action.builder. case 416: { action.builder.
consumeMemberDeclaratorWithInitializer(); break; consumeMemberDeclaratorWithInitializer(); break;
} }
// //
// Rule 416: member_declarator ::= bit_field_declarator : constant_expression // Rule 417: member_declarator ::= bit_field_declarator : constant_expression
// //
case 416: { action.builder. case 417: { action.builder.
consumeBitField(true); break; consumeBitField(true); break;
} }
// //
// Rule 417: member_declarator ::= : constant_expression // Rule 418: member_declarator ::= : constant_expression
// //
case 417: { action.builder. case 418: { action.builder.
consumeBitField(false); break; consumeBitField(false); break;
} }
// //
// Rule 418: bit_field_declarator ::= identifier_name // Rule 419: bit_field_declarator ::= identifier_name
// //
case 418: { action.builder. case 419: { action.builder.
consumeDirectDeclaratorIdentifier(); break; consumeDirectDeclaratorIdentifier(); break;
} }
// //
// Rule 419: constant_initializer ::= = constant_expression // Rule 420: constant_initializer ::= = constant_expression
// //
case 419: { action.builder. case 420: { action.builder.
consumeInitializer(); break; consumeInitializer(); break;
} }
// //
// Rule 425: base_specifier ::= dcolon_opt nested_name_specifier_opt class_name // Rule 426: base_specifier ::= dcolon_opt nested_name_specifier_opt class_name
// //
case 425: { action.builder. case 426: { action.builder.
consumeBaseSpecifier(false, false); break; consumeBaseSpecifier(false, false); break;
} }
// //
// Rule 426: base_specifier ::= virtual access_specifier_keyword_opt dcolon_opt nested_name_specifier_opt class_name // Rule 427: base_specifier ::= virtual access_specifier_keyword_opt dcolon_opt nested_name_specifier_opt class_name
//
case 426: { action.builder.
consumeBaseSpecifier(true, true); break;
}
//
// Rule 427: base_specifier ::= access_specifier_keyword virtual dcolon_opt nested_name_specifier_opt class_name
// //
case 427: { action.builder. case 427: { action.builder.
consumeBaseSpecifier(true, true); break; consumeBaseSpecifier(true, true); break;
} }
// //
// Rule 428: base_specifier ::= access_specifier_keyword dcolon_opt nested_name_specifier_opt class_name // Rule 428: base_specifier ::= access_specifier_keyword virtual dcolon_opt nested_name_specifier_opt class_name
// //
case 428: { action.builder. case 428: { action.builder.
consumeBaseSpecifier(true, true); break;
}
//
// Rule 429: base_specifier ::= access_specifier_keyword dcolon_opt nested_name_specifier_opt class_name
//
case 429: { action.builder.
consumeBaseSpecifier(true, false); break; consumeBaseSpecifier(true, false); break;
} }
// //
// Rule 429: access_specifier_keyword ::= private // Rule 430: access_specifier_keyword ::= private
//
case 429: { action.builder.
consumeAccessKeywordToken(); break;
}
//
// Rule 430: access_specifier_keyword ::= protected
// //
case 430: { action.builder. case 430: { action.builder.
consumeAccessKeywordToken(); break; consumeAccessKeywordToken(); break;
} }
// //
// Rule 431: access_specifier_keyword ::= public // Rule 431: access_specifier_keyword ::= protected
// //
case 431: { action.builder. case 431: { action.builder.
consumeAccessKeywordToken(); break; consumeAccessKeywordToken(); break;
} }
// //
// Rule 433: access_specifier_keyword_opt ::= $Empty // Rule 432: access_specifier_keyword ::= public
// //
case 433: { action.builder. case 432: { action.builder.
consumeAccessKeywordToken(); break;
}
//
// Rule 434: access_specifier_keyword_opt ::= $Empty
//
case 434: { action.builder.
consumeEmpty(); break; consumeEmpty(); break;
} }
// //
// Rule 435: conversion_function_id_name ::= conversion_function_id < <openscope-ast> template_argument_list_opt > // Rule 436: conversion_function_id_name ::= conversion_function_id < <openscope-ast> template_argument_list_opt >
// //
case 435: { action.builder. case 436: { action.builder.
consumeTemplateId(); break; consumeTemplateId(); break;
} }
// //
// Rule 436: conversion_function_id ::= operator conversion_type_id // Rule 437: conversion_function_id ::= operator conversion_type_id
// //
case 436: { action.builder. case 437: { action.builder.
consumeConversionName(); break; consumeConversionName(); break;
} }
// //
// Rule 437: conversion_type_id ::= type_specifier_seq conversion_declarator // Rule 438: conversion_type_id ::= type_specifier_seq conversion_declarator
// //
case 437: { action.builder. case 438: { action.builder.
consumeTypeId(true); break; consumeTypeId(true); break;
} }
// //
// Rule 438: conversion_type_id ::= type_specifier_seq // Rule 439: conversion_type_id ::= type_specifier_seq
// //
case 438: { action.builder. case 439: { action.builder.
consumeTypeId(false); break; consumeTypeId(false); break;
} }
// //
// Rule 439: conversion_declarator ::= <openscope-ast> ptr_operator_seq // Rule 440: conversion_declarator ::= <openscope-ast> ptr_operator_seq
// //
case 439: { action.builder. case 440: { action.builder.
consumeDeclaratorWithPointer(false); break; consumeDeclaratorWithPointer(false); break;
} }
// //
// Rule 445: mem_initializer ::= mem_initializer_name ( expression_list_opt ) // Rule 446: mem_initializer ::= mem_initializer_name ( expression_list_opt )
// //
case 445: { action.builder. case 446: { action.builder.
consumeConstructorChainInitializer(); break; consumeConstructorChainInitializer(); break;
} }
// //
// Rule 446: mem_initializer_name ::= dcolon_opt nested_name_specifier_opt class_name // Rule 447: mem_initializer_name ::= dcolon_opt nested_name_specifier_opt class_name
// //
case 446: { action.builder. case 447: { action.builder.
consumeQualifiedId(false); break; consumeQualifiedId(false); break;
} }
// //
// Rule 449: operator_function_id_name ::= operator_id_name < <openscope-ast> template_argument_list_opt > // Rule 450: operator_function_id_name ::= operator_id_name < <openscope-ast> template_argument_list_opt >
// //
case 449: { action.builder. case 450: { action.builder.
consumeTemplateId(); break; consumeTemplateId(); break;
} }
// //
// Rule 450: operator_id_name ::= operator overloadable_operator // Rule 451: operator_id_name ::= operator overloadable_operator
// //
case 450: { action.builder. case 451: { action.builder.
consumeOperatorName(); break; consumeOperatorName(); break;
} }
// //
// Rule 493: template_declaration ::= export_opt template < <openscope-ast> template_parameter_list > declaration // Rule 494: template_declaration ::= export_opt template < <openscope-ast> template_parameter_list > declaration
// //
case 493: { action.builder. case 494: { action.builder.
consumeTemplateDeclaration(); break; consumeTemplateDeclaration(); break;
} }
// //
// Rule 494: export_opt ::= export // Rule 495: export_opt ::= export
// //
case 494: { action.builder. case 495: { action.builder.
consumePlaceHolder(); break; consumePlaceHolder(); break;
} }
// //
// Rule 495: export_opt ::= $Empty // Rule 496: export_opt ::= $Empty
// //
case 495: { action.builder. case 496: { action.builder.
consumeEmpty(); break; consumeEmpty(); break;
} }
// //
// Rule 499: template_parameter ::= parameter_declaration // Rule 500: template_parameter ::= parameter_declaration
// //
case 499: { action.builder. case 500: { action.builder.
consumeTemplateParamterDeclaration(); break; consumeTemplateParamterDeclaration(); break;
} }
// //
// Rule 500: type_parameter ::= class identifier_name_opt // Rule 501: type_parameter ::= class identifier_name_opt
//
case 500: { action.builder.
consumeSimpleTypeTemplateParameter(false); break;
}
//
// Rule 501: type_parameter ::= class identifier_name_opt = type_id
// //
case 501: { action.builder. case 501: { action.builder.
consumeSimpleTypeTemplateParameter(true); break;
}
//
// Rule 502: type_parameter ::= typename identifier_name_opt
//
case 502: { action.builder.
consumeSimpleTypeTemplateParameter(false); break; consumeSimpleTypeTemplateParameter(false); break;
} }
// //
// Rule 503: type_parameter ::= typename identifier_name_opt = type_id // Rule 502: type_parameter ::= class identifier_name_opt = type_id
// //
case 503: { action.builder. case 502: { action.builder.
consumeSimpleTypeTemplateParameter(true); break; consumeSimpleTypeTemplateParameter(true); break;
} }
// //
// Rule 504: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt // Rule 503: type_parameter ::= typename identifier_name_opt
//
case 503: { action.builder.
consumeSimpleTypeTemplateParameter(false); break;
}
//
// Rule 504: type_parameter ::= typename identifier_name_opt = type_id
// //
case 504: { action.builder. case 504: { action.builder.
consumeSimpleTypeTemplateParameter(true); break;
}
//
// Rule 505: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt
//
case 505: { action.builder.
consumeTemplatedTypeTemplateParameter(false); break; consumeTemplatedTypeTemplateParameter(false); break;
} }
// //
// Rule 505: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt = id_expression // Rule 506: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt = id_expression
// //
case 505: { action.builder. case 506: { action.builder.
consumeTemplatedTypeTemplateParameter(true); break; consumeTemplatedTypeTemplateParameter(true); break;
} }
// //
// Rule 506: template_id_name ::= identifier_name < <openscope-ast> template_argument_list_opt > // Rule 507: template_id_name ::= identifier_name < <openscope-ast> template_argument_list_opt >
// //
case 506: { action.builder. case 507: { action.builder.
consumeTemplateId(); break; consumeTemplateId(); break;
} }
// //
// Rule 514: explicit_instantiation ::= template declaration // Rule 515: explicit_instantiation ::= template declaration
// //
case 514: { action.builder. case 515: { action.builder.
consumeTemplateExplicitInstantiation(); break; consumeTemplateExplicitInstantiation(); break;
} }
// //
// Rule 515: explicit_specialization ::= template < > declaration // Rule 516: explicit_specialization ::= template < > declaration
// //
case 515: { action.builder. case 516: { action.builder.
consumeTemplateExplicitSpecialization(); break; consumeTemplateExplicitSpecialization(); break;
} }
// //
// Rule 516: try_block ::= try compound_statement <openscope-ast> handler_seq // Rule 517: try_block ::= try compound_statement <openscope-ast> handler_seq
// //
case 516: { action.builder. case 517: { action.builder.
consumeStatementTryBlock(); break; consumeStatementTryBlock(); break;
} }
// //
// Rule 519: handler ::= catch ( exception_declaration ) compound_statement // Rule 520: handler ::= catch ( exception_declaration ) compound_statement
// //
case 519: { action.builder. case 520: { action.builder.
consumeStatementCatchHandler(false); break; consumeStatementCatchHandler(false); break;
} }
// //
// Rule 520: handler ::= catch ( ... ) compound_statement // Rule 521: handler ::= catch ( ... ) compound_statement
// //
case 520: { action.builder. case 521: { action.builder.
consumeStatementCatchHandler(true); break; consumeStatementCatchHandler(true); break;
} }
// //
// Rule 521: exception_declaration ::= type_specifier_seq <openscope-ast> declarator // Rule 522: exception_declaration ::= type_specifier_seq <openscope-ast> declarator
//
case 521: { action.builder.
consumeDeclarationSimple(true); break;
}
//
// Rule 522: exception_declaration ::= type_specifier_seq <openscope-ast> abstract_declarator
// //
case 522: { action.builder. case 522: { action.builder.
consumeDeclarationSimple(true); break; consumeDeclarationSimple(true); break;
} }
// //
// Rule 523: exception_declaration ::= type_specifier_seq // Rule 523: exception_declaration ::= type_specifier_seq <openscope-ast> abstract_declarator
// //
case 523: { action.builder. case 523: { action.builder.
consumeDeclarationSimple(true); break;
}
//
// Rule 524: exception_declaration ::= type_specifier_seq
//
case 524: { action.builder.
consumeDeclarationSimple(false); break; consumeDeclarationSimple(false); break;
} }
// //
// Rule 531: no_sizeof_type_name_start ::= ERROR_TOKEN // Rule 532: no_sizeof_type_name_start ::= ERROR_TOKEN
// //
case 531: { action.builder. case 532: { action.builder.
consumeExpressionProblem(); break; consumeExpressionProblem(); break;
} }

View file

@ -15,83 +15,83 @@ package org.eclipse.cdt.internal.core.dom.lrparser.cpp;
public interface CPPSizeofExpressionParsersym { public interface CPPSizeofExpressionParsersym {
public final static int public final static int
TK_asm = 62, TK_asm = 63,
TK_auto = 49, TK_auto = 48,
TK_bool = 14, TK_bool = 14,
TK_break = 77, TK_break = 78,
TK_case = 78, TK_case = 79,
TK_catch = 119, TK_catch = 119,
TK_char = 15, TK_char = 15,
TK_class = 63, TK_class = 62,
TK_const = 46, TK_const = 46,
TK_const_cast = 31, TK_const_cast = 32,
TK_continue = 79, TK_continue = 80,
TK_default = 80, TK_default = 81,
TK_delete = 64, TK_delete = 64,
TK_do = 81, TK_do = 82,
TK_double = 16, TK_double = 16,
TK_dynamic_cast = 32, TK_dynamic_cast = 33,
TK_else = 122, TK_else = 122,
TK_enum = 68, TK_enum = 68,
TK_explicit = 50, TK_explicit = 49,
TK_export = 82, TK_export = 75,
TK_extern = 17, TK_extern = 17,
TK_false = 33, TK_false = 34,
TK_float = 18, TK_float = 18,
TK_for = 83, TK_for = 83,
TK_friend = 51, TK_friend = 50,
TK_goto = 84, TK_goto = 84,
TK_if = 85, TK_if = 85,
TK_inline = 52, TK_inline = 51,
TK_int = 19, TK_int = 19,
TK_long = 20, TK_long = 20,
TK_mutable = 53, TK_mutable = 52,
TK_namespace = 57, TK_namespace = 57,
TK_new = 65, TK_new = 65,
TK_operator = 7, TK_operator = 7,
TK_private = 114, TK_private = 103,
TK_protected = 115, TK_protected = 104,
TK_public = 116, TK_public = 105,
TK_register = 54, TK_register = 53,
TK_reinterpret_cast = 34, TK_reinterpret_cast = 35,
TK_return = 86, TK_return = 86,
TK_short = 21, TK_short = 21,
TK_signed = 22, TK_signed = 22,
TK_sizeof = 35, TK_sizeof = 36,
TK_static = 55, TK_static = 54,
TK_static_cast = 36, TK_static_cast = 37,
TK_struct = 69, TK_struct = 69,
TK_switch = 87, TK_switch = 87,
TK_template = 37, TK_template = 31,
TK_this = 38, TK_this = 38,
TK_throw = 58, TK_throw = 58,
TK_try = 75, TK_try = 76,
TK_true = 39, TK_true = 39,
TK_typedef = 56, TK_typedef = 55,
TK_typeid = 40, TK_typeid = 40,
TK_typename = 10, TK_typename = 10,
TK_union = 70, TK_union = 70,
TK_unsigned = 23, TK_unsigned = 23,
TK_using = 59, TK_using = 59,
TK_virtual = 45, TK_virtual = 41,
TK_void = 24, TK_void = 24,
TK_volatile = 47, TK_volatile = 47,
TK_wchar_t = 25, TK_wchar_t = 25,
TK_while = 76, TK_while = 77,
TK_integer = 41, TK_integer = 42,
TK_floating = 42, TK_floating = 43,
TK_charconst = 43, TK_charconst = 44,
TK_stringlit = 29, TK_stringlit = 29,
TK_identifier = 1, TK_identifier = 1,
TK_Completion = 2, TK_Completion = 2,
TK_EndOfCompletion = 9, TK_EndOfCompletion = 9,
TK_Invalid = 123, TK_Invalid = 123,
TK_LeftBracket = 48, TK_LeftBracket = 56,
TK_LeftParen = 3, TK_LeftParen = 3,
TK_LeftBrace = 60, TK_LeftBrace = 60,
TK_Dot = 120, TK_Dot = 120,
TK_DotStar = 96, TK_DotStar = 96,
TK_Arrow = 103, TK_Arrow = 106,
TK_ArrowStar = 90, TK_ArrowStar = 90,
TK_PlusPlus = 26, TK_PlusPlus = 26,
TK_MinusMinus = 27, TK_MinusMinus = 27,
@ -120,23 +120,23 @@ public interface CPPSizeofExpressionParsersym {
TK_ColonColon = 4, TK_ColonColon = 4,
TK_DotDotDot = 95, TK_DotDotDot = 95,
TK_Assign = 67, TK_Assign = 67,
TK_StarAssign = 104, TK_StarAssign = 107,
TK_SlashAssign = 105, TK_SlashAssign = 108,
TK_PercentAssign = 106, TK_PercentAssign = 109,
TK_PlusAssign = 107, TK_PlusAssign = 110,
TK_MinusAssign = 108, TK_MinusAssign = 111,
TK_RightShiftAssign = 109, TK_RightShiftAssign = 112,
TK_LeftShiftAssign = 110, TK_LeftShiftAssign = 113,
TK_AndAssign = 111, TK_AndAssign = 114,
TK_CaretAssign = 112, TK_CaretAssign = 115,
TK_OrAssign = 113, TK_OrAssign = 116,
TK_Comma = 66, TK_Comma = 66,
TK_zero = 44,
TK_RightBracket = 118, TK_RightBracket = 118,
TK_RightParen = 72, TK_RightParen = 73,
TK_RightBrace = 73, TK_RightBrace = 72,
TK_SemiColon = 13, TK_SemiColon = 13,
TK_ERROR_TOKEN = 74, TK_ERROR_TOKEN = 74,
TK_0 = 45,
TK_EOF_TOKEN = 121; TK_EOF_TOKEN = 121;
public final static String orderedTerminalSymbols[] = { public final static String orderedTerminalSymbols[] = {
@ -171,24 +171,23 @@ public interface CPPSizeofExpressionParsersym {
"LT", "LT",
"stringlit", "stringlit",
"Bang", "Bang",
"template",
"const_cast", "const_cast",
"dynamic_cast", "dynamic_cast",
"false", "false",
"reinterpret_cast", "reinterpret_cast",
"sizeof", "sizeof",
"static_cast", "static_cast",
"template",
"this", "this",
"true", "true",
"typeid", "typeid",
"virtual",
"integer", "integer",
"floating", "floating",
"charconst", "charconst",
"zero", "0",
"virtual",
"const", "const",
"volatile", "volatile",
"LeftBracket",
"auto", "auto",
"explicit", "explicit",
"friend", "friend",
@ -197,13 +196,14 @@ public interface CPPSizeofExpressionParsersym {
"register", "register",
"static", "static",
"typedef", "typedef",
"LeftBracket",
"namespace", "namespace",
"throw", "throw",
"using", "using",
"LeftBrace", "LeftBrace",
"GT", "GT",
"asm",
"class", "class",
"asm",
"delete", "delete",
"new", "new",
"Comma", "Comma",
@ -212,9 +212,10 @@ public interface CPPSizeofExpressionParsersym {
"struct", "struct",
"union", "union",
"Colon", "Colon",
"RightParen",
"RightBrace", "RightBrace",
"RightParen",
"ERROR_TOKEN", "ERROR_TOKEN",
"export",
"try", "try",
"while", "while",
"break", "break",
@ -222,7 +223,6 @@ public interface CPPSizeofExpressionParsersym {
"continue", "continue",
"default", "default",
"do", "do",
"export",
"for", "for",
"goto", "goto",
"if", "if",
@ -243,6 +243,9 @@ public interface CPPSizeofExpressionParsersym {
"Or", "Or",
"AndAnd", "AndAnd",
"OrOr", "OrOr",
"private",
"protected",
"public",
"Arrow", "Arrow",
"StarAssign", "StarAssign",
"SlashAssign", "SlashAssign",
@ -254,9 +257,6 @@ public interface CPPSizeofExpressionParsersym {
"AndAssign", "AndAssign",
"CaretAssign", "CaretAssign",
"OrAssign", "OrAssign",
"private",
"protected",
"public",
"Question", "Question",
"RightBracket", "RightBracket",
"catch", "catch",

View file

@ -209,32 +209,11 @@ public IASTCompletionNode parse(IASTTranslationUnit tu) {
} }
public int getKind(int i) {
int kind = super.getKind(i);
// There used to be a special token kind for zero used to parser pure virtual function declarations.
// But it turned out to be easier to just parse them as an init_ declarator and programaticaly check
// for pure virtual, see consumeMemberDeclaratorWithInitializer().
//if(kind == CPPParsersym.TK_integer && "0".equals(getTokenText(i))) { //$NON-NLS-1$
// kind = CPPParsersym.TK_zero;
//}
// lexer feedback hack!
//else if(kind == C99Parsersym.TK_identifier && action.resolver.isTypedef(getTokenText(i))) {
// kind = C99Parsersym.TK_TypedefName;
//}
return kind;
}
// uncomment this method to use with backtracking parser // uncomment this method to use with backtracking parser
public List getRuleTokens() { public List getRuleTokens() {
return Collections.unmodifiableList(getTokens().subList(getLeftSpan(), getRightSpan() + 1)); return Collections.unmodifiableList(getTokens().subList(getLeftSpan(), getRightSpan() + 1));
} }
public IASTNode getSecondaryParseResult() { public IASTNode getSecondaryParseResult() {
return action.builder.getSecondaryParseResult(); return action.builder.getSecondaryParseResult();
} }
@ -1911,366 +1890,373 @@ public CPPTemplateTypeParameterParser(String[] mapFrom) { // constructor
} }
// //
// Rule 389: class_head ::= class_keyword identifier_name_opt <openscope-ast> base_clause_opt // Rule 389: class_specifier ::= class_head EOC <openscope-ast> member_declaration_list_opt }
// //
case 389: { action.builder. case 389: { action.builder.
consumeClassHead(false); break; consumeClassSpecifier(); break;
} }
// //
// Rule 390: class_head ::= class_keyword template_id_name <openscope-ast> base_clause_opt // Rule 390: class_head ::= class_keyword identifier_name_opt <openscope-ast> base_clause_opt
// //
case 390: { action.builder. case 390: { action.builder.
consumeClassHead(false); break; consumeClassHead(false); break;
} }
// //
// Rule 391: class_head ::= class_keyword nested_name_specifier identifier_name <openscope-ast> base_clause_opt // Rule 391: class_head ::= class_keyword template_id_name <openscope-ast> base_clause_opt
// //
case 391: { action.builder. case 391: { action.builder.
consumeClassHead(true); break; consumeClassHead(false); break;
} }
// //
// Rule 392: class_head ::= class_keyword nested_name_specifier template_id_name <openscope-ast> base_clause_opt // Rule 392: class_head ::= class_keyword nested_name_specifier identifier_name <openscope-ast> base_clause_opt
// //
case 392: { action.builder. case 392: { action.builder.
consumeClassHead(true); break; consumeClassHead(true); break;
} }
// //
// Rule 394: identifier_name_opt ::= $Empty // Rule 393: class_head ::= class_keyword nested_name_specifier template_id_name <openscope-ast> base_clause_opt
// //
case 394: { action.builder. case 393: { action.builder.
consumeClassHead(true); break;
}
//
// Rule 395: identifier_name_opt ::= $Empty
//
case 395: { action.builder.
consumeEmpty(); break; consumeEmpty(); break;
} }
// //
// Rule 398: visibility_label ::= access_specifier_keyword : // Rule 399: visibility_label ::= access_specifier_keyword :
// //
case 398: { action.builder. case 399: { action.builder.
consumeVisibilityLabel(); break; consumeVisibilityLabel(); break;
} }
// //
// Rule 399: member_declaration ::= declaration_specifiers_opt <openscope-ast> member_declarator_list ; // Rule 400: member_declaration ::= declaration_specifiers_opt <openscope-ast> member_declarator_list ;
// //
case 399: { action.builder. case 400: { action.builder.
consumeDeclarationSimple(true); break; consumeDeclarationSimple(true); break;
} }
// //
// Rule 400: member_declaration ::= declaration_specifiers_opt ; // Rule 401: member_declaration ::= declaration_specifiers_opt ;
// //
case 400: { action.builder. case 401: { action.builder.
consumeDeclarationSimple(false); break; consumeDeclarationSimple(false); break;
} }
// //
// Rule 403: member_declaration ::= dcolon_opt nested_name_specifier template_opt unqualified_id_name ; // Rule 404: member_declaration ::= dcolon_opt nested_name_specifier template_opt unqualified_id_name ;
// //
case 403: { action.builder. case 404: { action.builder.
consumeMemberDeclarationQualifiedId(); break; consumeMemberDeclarationQualifiedId(); break;
} }
// //
// Rule 409: member_declaration ::= ERROR_TOKEN // Rule 410: member_declaration ::= ERROR_TOKEN
// //
case 409: { action.builder. case 410: { action.builder.
consumeDeclarationProblem(); break; consumeDeclarationProblem(); break;
} }
// //
// Rule 417: member_declarator ::= declarator constant_initializer // Rule 418: member_declarator ::= declarator constant_initializer
// //
case 417: { action.builder. case 418: { action.builder.
consumeMemberDeclaratorWithInitializer(); break; consumeMemberDeclaratorWithInitializer(); break;
} }
// //
// Rule 418: member_declarator ::= bit_field_declarator : constant_expression // Rule 419: member_declarator ::= bit_field_declarator : constant_expression
// //
case 418: { action.builder. case 419: { action.builder.
consumeBitField(true); break; consumeBitField(true); break;
} }
// //
// Rule 419: member_declarator ::= : constant_expression // Rule 420: member_declarator ::= : constant_expression
// //
case 419: { action.builder. case 420: { action.builder.
consumeBitField(false); break; consumeBitField(false); break;
} }
// //
// Rule 420: bit_field_declarator ::= identifier_name // Rule 421: bit_field_declarator ::= identifier_name
// //
case 420: { action.builder. case 421: { action.builder.
consumeDirectDeclaratorIdentifier(); break; consumeDirectDeclaratorIdentifier(); break;
} }
// //
// Rule 421: constant_initializer ::= = constant_expression // Rule 422: constant_initializer ::= = constant_expression
// //
case 421: { action.builder. case 422: { action.builder.
consumeInitializer(); break; consumeInitializer(); break;
} }
// //
// Rule 427: base_specifier ::= dcolon_opt nested_name_specifier_opt class_name // Rule 428: base_specifier ::= dcolon_opt nested_name_specifier_opt class_name
// //
case 427: { action.builder. case 428: { action.builder.
consumeBaseSpecifier(false, false); break; consumeBaseSpecifier(false, false); break;
} }
// //
// Rule 428: base_specifier ::= virtual access_specifier_keyword_opt dcolon_opt nested_name_specifier_opt class_name // Rule 429: base_specifier ::= virtual access_specifier_keyword_opt dcolon_opt nested_name_specifier_opt class_name
//
case 428: { action.builder.
consumeBaseSpecifier(true, true); break;
}
//
// Rule 429: base_specifier ::= access_specifier_keyword virtual dcolon_opt nested_name_specifier_opt class_name
// //
case 429: { action.builder. case 429: { action.builder.
consumeBaseSpecifier(true, true); break; consumeBaseSpecifier(true, true); break;
} }
// //
// Rule 430: base_specifier ::= access_specifier_keyword dcolon_opt nested_name_specifier_opt class_name // Rule 430: base_specifier ::= access_specifier_keyword virtual dcolon_opt nested_name_specifier_opt class_name
// //
case 430: { action.builder. case 430: { action.builder.
consumeBaseSpecifier(true, true); break;
}
//
// Rule 431: base_specifier ::= access_specifier_keyword dcolon_opt nested_name_specifier_opt class_name
//
case 431: { action.builder.
consumeBaseSpecifier(true, false); break; consumeBaseSpecifier(true, false); break;
} }
// //
// Rule 431: access_specifier_keyword ::= private // Rule 432: access_specifier_keyword ::= private
//
case 431: { action.builder.
consumeAccessKeywordToken(); break;
}
//
// Rule 432: access_specifier_keyword ::= protected
// //
case 432: { action.builder. case 432: { action.builder.
consumeAccessKeywordToken(); break; consumeAccessKeywordToken(); break;
} }
// //
// Rule 433: access_specifier_keyword ::= public // Rule 433: access_specifier_keyword ::= protected
// //
case 433: { action.builder. case 433: { action.builder.
consumeAccessKeywordToken(); break; consumeAccessKeywordToken(); break;
} }
// //
// Rule 435: access_specifier_keyword_opt ::= $Empty // Rule 434: access_specifier_keyword ::= public
// //
case 435: { action.builder. case 434: { action.builder.
consumeAccessKeywordToken(); break;
}
//
// Rule 436: access_specifier_keyword_opt ::= $Empty
//
case 436: { action.builder.
consumeEmpty(); break; consumeEmpty(); break;
} }
// //
// Rule 437: conversion_function_id_name ::= conversion_function_id < <openscope-ast> template_argument_list_opt > // Rule 438: conversion_function_id_name ::= conversion_function_id < <openscope-ast> template_argument_list_opt >
// //
case 437: { action.builder. case 438: { action.builder.
consumeTemplateId(); break; consumeTemplateId(); break;
} }
// //
// Rule 438: conversion_function_id ::= operator conversion_type_id // Rule 439: conversion_function_id ::= operator conversion_type_id
// //
case 438: { action.builder. case 439: { action.builder.
consumeConversionName(); break; consumeConversionName(); break;
} }
// //
// Rule 439: conversion_type_id ::= type_specifier_seq conversion_declarator // Rule 440: conversion_type_id ::= type_specifier_seq conversion_declarator
// //
case 439: { action.builder. case 440: { action.builder.
consumeTypeId(true); break; consumeTypeId(true); break;
} }
// //
// Rule 440: conversion_type_id ::= type_specifier_seq // Rule 441: conversion_type_id ::= type_specifier_seq
// //
case 440: { action.builder. case 441: { action.builder.
consumeTypeId(false); break; consumeTypeId(false); break;
} }
// //
// Rule 441: conversion_declarator ::= <openscope-ast> ptr_operator_seq // Rule 442: conversion_declarator ::= <openscope-ast> ptr_operator_seq
// //
case 441: { action.builder. case 442: { action.builder.
consumeDeclaratorWithPointer(false); break; consumeDeclaratorWithPointer(false); break;
} }
// //
// Rule 447: mem_initializer ::= mem_initializer_name ( expression_list_opt ) // Rule 448: mem_initializer ::= mem_initializer_name ( expression_list_opt )
// //
case 447: { action.builder. case 448: { action.builder.
consumeConstructorChainInitializer(); break; consumeConstructorChainInitializer(); break;
} }
// //
// Rule 448: mem_initializer_name ::= dcolon_opt nested_name_specifier_opt class_name // Rule 449: mem_initializer_name ::= dcolon_opt nested_name_specifier_opt class_name
// //
case 448: { action.builder. case 449: { action.builder.
consumeQualifiedId(false); break; consumeQualifiedId(false); break;
} }
// //
// Rule 451: operator_function_id_name ::= operator_id_name < <openscope-ast> template_argument_list_opt > // Rule 452: operator_function_id_name ::= operator_id_name < <openscope-ast> template_argument_list_opt >
// //
case 451: { action.builder. case 452: { action.builder.
consumeTemplateId(); break; consumeTemplateId(); break;
} }
// //
// Rule 452: operator_id_name ::= operator overloadable_operator // Rule 453: operator_id_name ::= operator overloadable_operator
// //
case 452: { action.builder. case 453: { action.builder.
consumeOperatorName(); break; consumeOperatorName(); break;
} }
// //
// Rule 495: template_declaration ::= export_opt template < <openscope-ast> template_parameter_list > declaration // Rule 496: template_declaration ::= export_opt template < <openscope-ast> template_parameter_list > declaration
// //
case 495: { action.builder. case 496: { action.builder.
consumeTemplateDeclaration(); break; consumeTemplateDeclaration(); break;
} }
// //
// Rule 496: export_opt ::= export // Rule 497: export_opt ::= export
// //
case 496: { action.builder. case 497: { action.builder.
consumePlaceHolder(); break; consumePlaceHolder(); break;
} }
// //
// Rule 497: export_opt ::= $Empty // Rule 498: export_opt ::= $Empty
// //
case 497: { action.builder. case 498: { action.builder.
consumeEmpty(); break; consumeEmpty(); break;
} }
// //
// Rule 501: template_parameter ::= parameter_declaration // Rule 502: template_parameter ::= parameter_declaration
// //
case 501: { action.builder. case 502: { action.builder.
consumeTemplateParamterDeclaration(); break; consumeTemplateParamterDeclaration(); break;
} }
// //
// Rule 502: type_parameter ::= class identifier_name_opt // Rule 503: type_parameter ::= class identifier_name_opt
//
case 502: { action.builder.
consumeSimpleTypeTemplateParameter(false); break;
}
//
// Rule 503: type_parameter ::= class identifier_name_opt = type_id
// //
case 503: { action.builder. case 503: { action.builder.
consumeSimpleTypeTemplateParameter(true); break;
}
//
// Rule 504: type_parameter ::= typename identifier_name_opt
//
case 504: { action.builder.
consumeSimpleTypeTemplateParameter(false); break; consumeSimpleTypeTemplateParameter(false); break;
} }
// //
// Rule 505: type_parameter ::= typename identifier_name_opt = type_id // Rule 504: type_parameter ::= class identifier_name_opt = type_id
// //
case 505: { action.builder. case 504: { action.builder.
consumeSimpleTypeTemplateParameter(true); break; consumeSimpleTypeTemplateParameter(true); break;
} }
// //
// Rule 506: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt // Rule 505: type_parameter ::= typename identifier_name_opt
//
case 505: { action.builder.
consumeSimpleTypeTemplateParameter(false); break;
}
//
// Rule 506: type_parameter ::= typename identifier_name_opt = type_id
// //
case 506: { action.builder. case 506: { action.builder.
consumeSimpleTypeTemplateParameter(true); break;
}
//
// Rule 507: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt
//
case 507: { action.builder.
consumeTemplatedTypeTemplateParameter(false); break; consumeTemplatedTypeTemplateParameter(false); break;
} }
// //
// Rule 507: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt = id_expression // Rule 508: type_parameter ::= template < <openscope-ast> template_parameter_list > class identifier_name_opt = id_expression
// //
case 507: { action.builder. case 508: { action.builder.
consumeTemplatedTypeTemplateParameter(true); break; consumeTemplatedTypeTemplateParameter(true); break;
} }
// //
// Rule 508: template_id_name ::= identifier_name < <openscope-ast> template_argument_list_opt > // Rule 509: template_id_name ::= identifier_name < <openscope-ast> template_argument_list_opt >
// //
case 508: { action.builder. case 509: { action.builder.
consumeTemplateId(); break; consumeTemplateId(); break;
} }
// //
// Rule 516: explicit_instantiation ::= template declaration // Rule 517: explicit_instantiation ::= template declaration
// //
case 516: { action.builder. case 517: { action.builder.
consumeTemplateExplicitInstantiation(); break; consumeTemplateExplicitInstantiation(); break;
} }
// //
// Rule 517: explicit_specialization ::= template < > declaration // Rule 518: explicit_specialization ::= template < > declaration
// //
case 517: { action.builder. case 518: { action.builder.
consumeTemplateExplicitSpecialization(); break; consumeTemplateExplicitSpecialization(); break;
} }
// //
// Rule 518: try_block ::= try compound_statement <openscope-ast> handler_seq // Rule 519: try_block ::= try compound_statement <openscope-ast> handler_seq
// //
case 518: { action.builder. case 519: { action.builder.
consumeStatementTryBlock(); break; consumeStatementTryBlock(); break;
} }
// //
// Rule 521: handler ::= catch ( exception_declaration ) compound_statement // Rule 522: handler ::= catch ( exception_declaration ) compound_statement
// //
case 521: { action.builder. case 522: { action.builder.
consumeStatementCatchHandler(false); break; consumeStatementCatchHandler(false); break;
} }
// //
// Rule 522: handler ::= catch ( ... ) compound_statement // Rule 523: handler ::= catch ( ... ) compound_statement
// //
case 522: { action.builder. case 523: { action.builder.
consumeStatementCatchHandler(true); break; consumeStatementCatchHandler(true); break;
} }
// //
// Rule 523: exception_declaration ::= type_specifier_seq <openscope-ast> declarator // Rule 524: exception_declaration ::= type_specifier_seq <openscope-ast> declarator
//
case 523: { action.builder.
consumeDeclarationSimple(true); break;
}
//
// Rule 524: exception_declaration ::= type_specifier_seq <openscope-ast> abstract_declarator
// //
case 524: { action.builder. case 524: { action.builder.
consumeDeclarationSimple(true); break; consumeDeclarationSimple(true); break;
} }
// //
// Rule 525: exception_declaration ::= type_specifier_seq // Rule 525: exception_declaration ::= type_specifier_seq <openscope-ast> abstract_declarator
// //
case 525: { action.builder. case 525: { action.builder.
consumeDeclarationSimple(true); break;
}
//
// Rule 526: exception_declaration ::= type_specifier_seq
//
case 526: { action.builder.
consumeDeclarationSimple(false); break; consumeDeclarationSimple(false); break;
} }
// //
// Rule 533: type_parameter_start ::= ERROR_TOKEN // Rule 534: type_parameter_start ::= ERROR_TOKEN
// //
case 533: { action.builder. case 534: { action.builder.
consumeDeclarationProblem(); break; consumeDeclarationProblem(); break;
} }

View file

@ -16,89 +16,89 @@ package org.eclipse.cdt.internal.core.dom.lrparser.cpp;
public interface CPPTemplateTypeParameterParsersym { public interface CPPTemplateTypeParameterParsersym {
public final static int public final static int
TK_asm = 63, TK_asm = 63,
TK_auto = 49, TK_auto = 48,
TK_bool = 15, TK_bool = 15,
TK_break = 77, TK_break = 78,
TK_case = 78, TK_case = 79,
TK_catch = 119, TK_catch = 119,
TK_char = 16, TK_char = 16,
TK_class = 62, TK_class = 59,
TK_const = 46, TK_const = 33,
TK_const_cast = 32, TK_const_cast = 34,
TK_continue = 79, TK_continue = 80,
TK_default = 80, TK_default = 81,
TK_delete = 65, TK_delete = 65,
TK_do = 81, TK_do = 82,
TK_double = 17, TK_double = 17,
TK_dynamic_cast = 33, TK_dynamic_cast = 35,
TK_else = 122, TK_else = 122,
TK_enum = 68, TK_enum = 68,
TK_explicit = 50, TK_explicit = 49,
TK_export = 82, TK_export = 75,
TK_extern = 14, TK_extern = 12,
TK_false = 34, TK_false = 36,
TK_float = 18, TK_float = 18,
TK_for = 83, TK_for = 83,
TK_friend = 51, TK_friend = 50,
TK_goto = 84, TK_goto = 84,
TK_if = 85, TK_if = 85,
TK_inline = 52, TK_inline = 51,
TK_int = 19, TK_int = 19,
TK_long = 20, TK_long = 20,
TK_mutable = 53, TK_mutable = 52,
TK_namespace = 57, TK_namespace = 57,
TK_new = 66, TK_new = 66,
TK_operator = 7, TK_operator = 7,
TK_private = 114, TK_private = 103,
TK_protected = 115, TK_protected = 104,
TK_public = 116, TK_public = 105,
TK_register = 54, TK_register = 53,
TK_reinterpret_cast = 35, TK_reinterpret_cast = 37,
TK_return = 86, TK_return = 86,
TK_short = 21, TK_short = 21,
TK_signed = 22, TK_signed = 22,
TK_sizeof = 36, TK_sizeof = 38,
TK_static = 55, TK_static = 54,
TK_static_cast = 37, TK_static_cast = 39,
TK_struct = 69, TK_struct = 69,
TK_switch = 87, TK_switch = 87,
TK_template = 30, TK_template = 29,
TK_this = 38, TK_this = 40,
TK_throw = 58, TK_throw = 60,
TK_try = 75, TK_try = 76,
TK_true = 39, TK_true = 41,
TK_typedef = 56, TK_typedef = 55,
TK_typeid = 40, TK_typeid = 42,
TK_typename = 10, TK_typename = 10,
TK_union = 70, TK_union = 70,
TK_unsigned = 23, TK_unsigned = 23,
TK_using = 59, TK_using = 58,
TK_virtual = 41, TK_virtual = 32,
TK_void = 24, TK_void = 24,
TK_volatile = 47, TK_volatile = 43,
TK_wchar_t = 25, TK_wchar_t = 25,
TK_while = 76, TK_while = 77,
TK_integer = 42, TK_integer = 44,
TK_floating = 43, TK_floating = 45,
TK_charconst = 44, TK_charconst = 46,
TK_stringlit = 29, TK_stringlit = 30,
TK_identifier = 1, TK_identifier = 1,
TK_Completion = 2, TK_Completion = 2,
TK_EndOfCompletion = 9, TK_EndOfCompletion = 9,
TK_Invalid = 123, TK_Invalid = 123,
TK_LeftBracket = 48, TK_LeftBracket = 56,
TK_LeftParen = 3, TK_LeftParen = 3,
TK_LeftBrace = 60, TK_LeftBrace = 61,
TK_Dot = 120, TK_Dot = 120,
TK_DotStar = 96, TK_DotStar = 96,
TK_Arrow = 103, TK_Arrow = 106,
TK_ArrowStar = 90, TK_ArrowStar = 90,
TK_PlusPlus = 26, TK_PlusPlus = 26,
TK_MinusMinus = 27, TK_MinusMinus = 27,
TK_And = 8, TK_And = 8,
TK_Star = 6, TK_Star = 6,
TK_Plus = 11, TK_Plus = 13,
TK_Minus = 12, TK_Minus = 14,
TK_Tilde = 5, TK_Tilde = 5,
TK_Bang = 31, TK_Bang = 31,
TK_Slash = 91, TK_Slash = 91,
@ -106,7 +106,7 @@ public interface CPPTemplateTypeParameterParsersym {
TK_RightShift = 88, TK_RightShift = 88,
TK_LeftShift = 89, TK_LeftShift = 89,
TK_LT = 28, TK_LT = 28,
TK_GT = 61, TK_GT = 62,
TK_LE = 93, TK_LE = 93,
TK_GE = 94, TK_GE = 94,
TK_EQ = 97, TK_EQ = 97,
@ -120,23 +120,23 @@ public interface CPPTemplateTypeParameterParsersym {
TK_ColonColon = 4, TK_ColonColon = 4,
TK_DotDotDot = 95, TK_DotDotDot = 95,
TK_Assign = 67, TK_Assign = 67,
TK_StarAssign = 104, TK_StarAssign = 107,
TK_SlashAssign = 105, TK_SlashAssign = 108,
TK_PercentAssign = 106, TK_PercentAssign = 109,
TK_PlusAssign = 107, TK_PlusAssign = 110,
TK_MinusAssign = 108, TK_MinusAssign = 111,
TK_RightShiftAssign = 109, TK_RightShiftAssign = 112,
TK_LeftShiftAssign = 110, TK_LeftShiftAssign = 113,
TK_AndAssign = 111, TK_AndAssign = 114,
TK_CaretAssign = 112, TK_CaretAssign = 115,
TK_OrAssign = 113, TK_OrAssign = 116,
TK_Comma = 64, TK_Comma = 64,
TK_zero = 45,
TK_RightBracket = 118, TK_RightBracket = 118,
TK_RightParen = 72, TK_RightParen = 73,
TK_RightBrace = 73, TK_RightBrace = 72,
TK_SemiColon = 13, TK_SemiColon = 11,
TK_ERROR_TOKEN = 74, TK_ERROR_TOKEN = 74,
TK_0 = 47,
TK_EOF_TOKEN = 121; TK_EOF_TOKEN = 121;
public final static String orderedTerminalSymbols[] = { public final static String orderedTerminalSymbols[] = {
@ -151,10 +151,10 @@ public interface CPPTemplateTypeParameterParsersym {
"And", "And",
"EndOfCompletion", "EndOfCompletion",
"typename", "typename",
"Plus",
"Minus",
"SemiColon", "SemiColon",
"extern", "extern",
"Plus",
"Minus",
"bool", "bool",
"char", "char",
"double", "double",
@ -169,9 +169,11 @@ public interface CPPTemplateTypeParameterParsersym {
"PlusPlus", "PlusPlus",
"MinusMinus", "MinusMinus",
"LT", "LT",
"stringlit",
"template", "template",
"stringlit",
"Bang", "Bang",
"virtual",
"const",
"const_cast", "const_cast",
"dynamic_cast", "dynamic_cast",
"false", "false",
@ -181,14 +183,11 @@ public interface CPPTemplateTypeParameterParsersym {
"this", "this",
"true", "true",
"typeid", "typeid",
"virtual", "volatile",
"integer", "integer",
"floating", "floating",
"charconst", "charconst",
"zero", "0",
"const",
"volatile",
"LeftBracket",
"auto", "auto",
"explicit", "explicit",
"friend", "friend",
@ -197,12 +196,13 @@ public interface CPPTemplateTypeParameterParsersym {
"register", "register",
"static", "static",
"typedef", "typedef",
"LeftBracket",
"namespace", "namespace",
"throw",
"using", "using",
"class",
"throw",
"LeftBrace", "LeftBrace",
"GT", "GT",
"class",
"asm", "asm",
"Comma", "Comma",
"delete", "delete",
@ -212,9 +212,10 @@ public interface CPPTemplateTypeParameterParsersym {
"struct", "struct",
"union", "union",
"Colon", "Colon",
"RightParen",
"RightBrace", "RightBrace",
"RightParen",
"ERROR_TOKEN", "ERROR_TOKEN",
"export",
"try", "try",
"while", "while",
"break", "break",
@ -222,7 +223,6 @@ public interface CPPTemplateTypeParameterParsersym {
"continue", "continue",
"default", "default",
"do", "do",
"export",
"for", "for",
"goto", "goto",
"if", "if",
@ -243,6 +243,9 @@ public interface CPPTemplateTypeParameterParsersym {
"Or", "Or",
"AndAnd", "AndAnd",
"OrOr", "OrOr",
"private",
"protected",
"public",
"Arrow", "Arrow",
"StarAssign", "StarAssign",
"SlashAssign", "SlashAssign",
@ -254,9 +257,6 @@ public interface CPPTemplateTypeParameterParsersym {
"AndAssign", "AndAssign",
"CaretAssign", "CaretAssign",
"OrAssign", "OrAssign",
"private",
"protected",
"public",
"Question", "Question",
"RightBracket", "RightBracket",
"catch", "catch",