diff --git a/lrparser/org.eclipse.cdt.core.lrparser.tests/src/org/eclipse/cdt/core/lrparser/tests/c99/C99SpecTests.java b/lrparser/org.eclipse.cdt.core.lrparser.tests/src/org/eclipse/cdt/core/lrparser/tests/c99/C99SpecTests.java index d2c40f058f6..378d27d35f7 100644 --- a/lrparser/org.eclipse.cdt.core.lrparser.tests/src/org/eclipse/cdt/core/lrparser/tests/c99/C99SpecTests.java +++ b/lrparser/org.eclipse.cdt.core.lrparser.tests/src/org/eclipse/cdt/core/lrparser/tests/c99/C99SpecTests.java @@ -29,7 +29,7 @@ public class C99SpecTests extends AST2CSpecTest { @Override protected void parseCandCPP( String code, boolean checkBindings, int expectedProblemBindings ) throws ParserException { - //parse(code, ParserLanguage.C, checkBindings, expectedProblemBindings); + parse(code, ParserLanguage.C, checkBindings, expectedProblemBindings); parse(code, ParserLanguage.CPP, checkBindings, expectedProblemBindings); } @@ -62,18 +62,6 @@ public class C99SpecTests extends AST2CSpecTest { } - // offsetof does not work if is not included! - @Override - public void test6_7_2_1s17() throws Exception { - try { - super.test6_7_2_1s17(); - } catch(AssertionFailedError _) { - return; - } - - fail(); - } - // Tests from AST2CSpecFailingTests diff --git a/lrparser/org.eclipse.cdt.core.lrparser/grammar/build.xml b/lrparser/org.eclipse.cdt.core.lrparser/grammar/build.xml index 7733b3ce90b..44530494367 100644 --- a/lrparser/org.eclipse.cdt.core.lrparser/grammar/build.xml +++ b/lrparser/org.eclipse.cdt.core.lrparser/grammar/build.xml @@ -30,40 +30,53 @@ - - Generate the C++ parser - - - - - - - Generate the C99 parser - - + - - - + - - - + - + + + + + + + + Generate the C++ parser + + + + + + + + + + + - + + + + + + + + + + diff --git a/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99ExpressionStatementParser.g b/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99ExpressionStatementParser.g index b77d2f19054..b61a6d6cb18 100644 --- a/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99ExpressionStatementParser.g +++ b/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99ExpressionStatementParser.g @@ -15,9 +15,6 @@ -- All we need to do is import the main parser and redefine the start symbol. -$Define - $sym_class /. C99ExpressionStatementParsersym ./ -$End $Import C99Grammar.g @@ -27,21 +24,11 @@ $Start expression_parser_start $End - - -$Headers -/. - public IASTExpression getParseResult() { - return (IASTExpression) action.getSecondaryParseResult(); - } -./ -$End - $Rules -expression_parser_start - ::= expression ';' - | ERROR_TOKEN - /. $Build consumeExpressionProblem(); $EndBuild ./ + expression_parser_start + ::= expression ';' + | ERROR_TOKEN + /. $Build consumeExpressionProblem(); $EndBuild ./ $End \ No newline at end of file diff --git a/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99Grammar.g b/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99Grammar.g index d0ce8c53fd4..16430d49a6d 100644 --- a/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99Grammar.g +++ b/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99Grammar.g @@ -11,8 +11,10 @@ -- TODO "complete" rules can be removed +-- TODO when the architecture has solidified try to move common +-- stuff between C99 and C++ into one file. $Include -../common.g +common.g $End @@ -111,7 +113,6 @@ $End $Define $build_action_class /. C99BuildASTParserAction ./ - $resolve_action_class /. C99TypedefTrackerParserAction ./ $node_factory_create_expression /. C99ASTNodeFactory.DEFAULT_INSTANCE ./ $End diff --git a/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99NoCastExpressionParser.g b/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99NoCastExpressionParser.g index 2d7c6f51ff4..581e21cf792 100644 --- a/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99NoCastExpressionParser.g +++ b/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99NoCastExpressionParser.g @@ -13,45 +13,24 @@ %options package=org.eclipse.cdt.internal.core.dom.lrparser.c99 %options template=btParserTemplateD.g - -$Define - $sym_class /. C99NoCastExpressionParsersym ./ -$End - $Import C99Grammar.g - $DropRules -cast_expression - ::= '(' type_name ')' cast_expression - --- The following rule remains in the grammar: --- cast_expression ::= unary_expression + cast_expression + ::= '(' type_name ')' cast_expression $End - $Start no_cast_start $End - - -$Headers -/. - public IASTExpression getParseResult() { - return (IASTExpression) action.getSecondaryParseResult(); - } -./ -$End - - $Rules -no_cast_start - ::= expression - | ERROR_TOKEN - /. $Build consumeExpressionProblem(); $EndBuild ./ + no_cast_start + ::= expression + | ERROR_TOKEN + /. $Build consumeExpressionProblem(); $EndBuild ./ $End \ No newline at end of file diff --git a/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99Parser.g b/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99Parser.g index 79573ff2a26..c6881517397 100644 --- a/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99Parser.g +++ b/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99Parser.g @@ -13,11 +13,9 @@ %options package=org.eclipse.cdt.internal.core.dom.lrparser.c99 %options template=btParserTemplateD.g --- All we need to do is import the main parser and redefine the start symbol. -$Define - $sym_class /. C99Parsersym ./ -$End - +-- This file is needed because LPG won't allow redefinition of the +-- start symbol, so C99Grammar.g cannot define a start symbol. + $Import C99Grammar.g $End diff --git a/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99SizeofExpressionParser.g b/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99SizeofExpressionParser.g index f5708ce8e0d..c65f720f3fd 100644 --- a/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99SizeofExpressionParser.g +++ b/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99SizeofExpressionParser.g @@ -14,41 +14,24 @@ %options template=btParserTemplateD.g -$Define - $sym_class /. C99SizeofExpressionParsersym ./ -$End - $Import C99Grammar.g - $DropRules -unary_expression - ::= 'sizeof' '(' type_name ')' + unary_expression + ::= 'sizeof' '(' type_name ')' $End - $Start no_sizeof_type_name_start $End - - -$Headers -/. - public IASTExpression getParseResult() { - return (IASTExpression) action.getSecondaryParseResult(); - } -./ -$End - - $Rules -no_sizeof_type_name_start - ::= expression - | ERROR_TOKEN - /. $Build consumeExpressionProblem(); $EndBuild ./ + no_sizeof_type_name_start + ::= expression + | ERROR_TOKEN + /. $Build consumeExpressionProblem(); $EndBuild ./ $End \ No newline at end of file diff --git a/lrparser/org.eclipse.cdt.core.lrparser/grammar/common.g b/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/common.g similarity index 91% rename from lrparser/org.eclipse.cdt.core.lrparser/grammar/common.g rename to lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/common.g index 530e744f92f..e509b80d509 100644 --- a/lrparser/org.eclipse.cdt.core.lrparser/grammar/common.g +++ b/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/common.g @@ -33,7 +33,8 @@ $Define $ast_class /.Object./ $data_class /. Object ./ -- allow anything to be passed between actions - $additional_interfaces /. , IParserActionTokenProvider, IParser ./ + $extra_interfaces /. ./ + $additional_interfaces /. , IParserActionTokenProvider, IParser $extra_interfaces ./ $build_action_class /. ./ $resolve_action_class /. ./ @@ -67,7 +68,7 @@ $Headers private void initActions(IASTTranslationUnit tu) { action = new $build_action_class($node_factory_create_expression, this, tu); - action.setTokenMap($sym_class.orderedTerminalSymbols); + action.setTokenMap($sym_type.orderedTerminalSymbols); } @@ -99,6 +100,11 @@ $Headers return Collections.unmodifiableList(getTokens().subList(getLeftSpan(), getRightSpan() + 1)); } + + public IASTNode getSecondaryParseResult() { + return action.getSecondaryParseResult(); + } + ./ $End @@ -121,12 +127,14 @@ $Headers token.setKind(tokenMap.mapKind(token.getKind())); addToken(token); } - addToken(new Token(null, 0, 0, $sym_class.TK_EOF_TOKEN)); + addToken(new Token(null, 0, 0, $sym_type.TK_EOF_TOKEN)); } public $action_type(String[] mapFrom) { // constructor - tokenMap = new TokenMap($sym_class.orderedTerminalSymbols, mapFrom); + tokenMap = new TokenMap($sym_type.orderedTerminalSymbols, mapFrom); } + ./ -$End \ No newline at end of file +$End + diff --git a/lrparser/org.eclipse.cdt.core.lrparser/grammar/cpp/CPPExpressionStatementParser.g b/lrparser/org.eclipse.cdt.core.lrparser/grammar/cpp/CPPExpressionStatementParser.g new file mode 100644 index 00000000000..e9d5c216ef8 --- /dev/null +++ b/lrparser/org.eclipse.cdt.core.lrparser/grammar/cpp/CPPExpressionStatementParser.g @@ -0,0 +1,33 @@ +----------------------------------------------------------------------------------- +-- Copyright (c) 2006, 2008 IBM Corporation and others. +-- All rights reserved. This program and the accompanying materials +-- are made available under the terms of the Eclipse Public License v1.0 +-- which accompanies this distribution, and is available at +-- http://www.eclipse.org/legal/epl-v10.html +-- +-- Contributors: +-- IBM Corporation - initial API and implementation +----------------------------------------------------------------------------------- + +%options la=2 +%options package=org.eclipse.cdt.internal.core.dom.lrparser.cpp +%options template=btParserTemplateD.g + +-- All we need to do is import the main parser and redefine the start symbol. + +$Import + CPPGrammar.g +$End + +$Start + expression_parser_start +$End + +$Rules + + expression_parser_start + ::= expression ';' + | ERROR_TOKEN + /. $Build consumeExpressionProblem(); $EndBuild ./ + +$End \ No newline at end of file diff --git a/lrparser/org.eclipse.cdt.core.lrparser/grammar/cpp/CPPGrammar.g b/lrparser/org.eclipse.cdt.core.lrparser/grammar/cpp/CPPGrammar.g new file mode 100644 index 00000000000..229c7f3ab49 --- /dev/null +++ b/lrparser/org.eclipse.cdt.core.lrparser/grammar/cpp/CPPGrammar.g @@ -0,0 +1,1779 @@ +---------------------------------------------------------------------------------- +-- Copyright (c) 2006, 2008 IBM Corporation and others. +-- All rights reserved. This program and the accompanying materials +-- are made available under the terms of the Eclipse Public License v1.0 +-- which accompanies this distribution, and is available at +-- http://www.eclipse.org/legal/epl_v10.html +-- +-- Contributors: +-- IBM Corporation - initial API and implementation +---------------------------------------------------------------------------------- + +%options la=2 +%options package=org.eclipse.cdt.internal.core.dom.lrparser.cpp +%options template=btParserTemplateD.g + + + +$Notice +-- Copied into all files generated by LPG +/./******************************************************************************* + * Copyright (c) 2006, 2008 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl_v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *********************************************************************************/ + + // This file was generated by LPG +./ +$End + + + +$Terminals + + -- Keywords + + asm auto bool break case catch char class + const const_cast continue default delete do + double dynamic_cast else enum explicit export + extern false float for friend goto if inline + int long mutable namespace new operator private + protected public register reinterpret_cast return + short signed sizeof static static_cast struct + switch template this throw try true typedef + typeid typename union unsigned using virtual + void volatile wchar_t while + + -- Literals (also true and false are considered literals) + + integer floating charconst stringlit + + -- zero -- this is a special token used to disambiguate the the grammar rule for pure virtual functions + -- 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 + -- TypedefName + + -- Special tokens used in content assist + + Completion + EndOfCompletion + + -- Unrecognized token + + Invalid + + -- Punctuation (with aliases to make grammar more readable) + + LeftBracket ::= '[' + LeftParen ::= '(' + LeftBrace ::= '{' + Dot ::= '.' + DotStar ::= '.*' + Arrow ::= '->' + ArrowStar ::= '->*' + PlusPlus ::= '++' + MinusMinus ::= '--' + And ::= '&' + Star ::= '*' + Plus ::= '+' + Minus ::= '-' + Tilde ::= '~' + Bang ::= '!' + Slash ::= '/' + Percent ::= '%' + RightShift ::= '>>' + LeftShift ::= '<<' + LT ::= '<' + GT ::= '>' + LE ::= '<=' + GE ::= '>=' + EQ ::= '==' + NE ::= '!=' + Caret ::= '^' + Or ::= '|' + AndAnd ::= '&&' + OrOr ::= '||' + Question ::= '?' + Colon ::= ':' + ColonColon ::= '::' + DotDotDot ::= '...' + Assign ::= '=' + StarAssign ::= '*=' + SlashAssign ::= '/=' + PercentAssign ::= '%=' + PlusAssign ::= '+=' + MinusAssign ::= '-=' + RightShiftAssign ::= '>>=' + LeftShiftAssign ::= '<<=' + AndAssign ::= '&=' + CaretAssign ::= '^=' + OrAssign ::= '|=' + Comma ::= ',' + zero ::= '0' + + RightBracket -- these four have special rules for content assist + RightParen + RightBrace + SemiColon + +$End + + +$Globals +/. + import java.util.*; + + import org.eclipse.cdt.core.dom.ast.*; + import org.eclipse.cdt.core.dom.ast.cpp.*; + import org.eclipse.cdt.core.dom.lrparser.action.cpp.CPPASTNodeFactory; + import org.eclipse.cdt.core.dom.lrparser.action.cpp.CPPBuildASTParserAction; + import org.eclipse.cdt.core.dom.lrparser.IParser; + import org.eclipse.cdt.core.dom.lrparser.IParserActionTokenProvider; + import org.eclipse.cdt.core.dom.lrparser.util.DebugUtil; +./ +$End + +-- TODO move as much code and macros as possible into a common file + +$Define + -- These macros allow the template and header code to be customized by an extending parser. + $ast_class /.Object./ + $additional_interfaces /. , IParserActionTokenProvider, IParser ./ + + $build_action_class /. CPPBuildASTParserAction ./ + $resolve_action_class /. C99TypedefTrackerParserAction ./ + $node_factory_create_expression /. CPPASTNodeFactory.DEFAULT_INSTANCE ./ + + $action_class /. CPPParserAction ./ + $data_class /. Object ./ -- allow anything to be passed between actions + + $UndoResolver /.$Undo action.resolver.undo(); $EndUndo./ + + $Resolve /. $BeginTrial $resolve. + ./ + $EndResolve /. $EndTrial + $UndoResolver + ./ -- undo actions are automatically generated for binding resolution actions + + $Builder /. $BeginFinal $builder. + ./ + $EndBuilder /. $EndFinal ./ + + $Build /. $Action $Builder ./ + $EndBuild /. $EndBuilder $EndAction ./ + + $resolve /. action.resolver./ + $builder /. action.builder./ + + -- comment out when using trial/undo + $Action /. $BeginAction ./ + $BeginFinal /. ./ + $EndFinal /. ./ + +$End + + +$Headers +/. + private $action_class action; + + // uncomment to use with backtracking parser + public $action_type() { // constructor + } + + private void initActions(IASTTranslationUnit tu) { + // binding resolution actions need access to IASTName nodes, temporary + action = new $action_class(); + //action.resolver = new $resolve_action_class(this); + action.builder = new $build_action_class($node_factory_create_expression, this, tu); + //action.builder.setTokenMap(CPPParsersym.orderedTerminalSymbols); + + // comment this line to use with backtracking parser + //setParserAction(action); + } + + + public void addToken(IToken token) { + token.setKind(mapKind(token.getKind())); + super.addToken(token); + } + + + public IASTCompletionNode parse(IASTTranslationUnit tu) { + // this has to be done, or... kaboom! + setStreamLength(getSize()); + initActions(tu); + + final int errorRepairCount = -1; // _1 means full error handling + parser(null, errorRepairCount); // do the actual parse + super.resetTokenStream(); // allow tokens to be garbage collected + + // the completion node may be null + IASTCompletionNode compNode = action.builder.getASTCompletionNode(); + + //action = null; // causes getSecondaryParseResult() to fail + + // Comment this line to use with backtracking parser + //parserAction = null; + + return compNode; + } + + + 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 + public List getRuleTokens() { + return Collections.unmodifiableList(getTokens().subList(getLeftSpan(), getRightSpan() + 1)); + } + + + public IASTNode getSecondaryParseResult() { + return action.builder.getSecondaryParseResult(); + } +./ +$End + +-- TODO this has to be moved into a common file + +$Globals +/. + import org.eclipse.cdt.core.dom.lrparser.action.ITokenMap; + import org.eclipse.cdt.core.dom.lrparser.action.TokenMap; +./ +$End + +$Headers +/. + + private ITokenMap tokenMap = null; + + public void setTokens(List tokens) { + resetTokenStream(); + addToken(new Token(null, 0, 0, 0)); // dummy token + for(IToken token : tokens) { + token.setKind(tokenMap.mapKind(token.getKind())); + addToken(token); + } + addToken(new Token(null, 0, 0, $sym_type.TK_EOF_TOKEN)); + } + + public $action_type(String[] mapFrom) { // constructor + tokenMap = new TokenMap($sym_type.orderedTerminalSymbols, mapFrom); + } + + +./ +$End + + +$Rules + +------------------------------------------------------------------------------------------ +-- AST and Symbol Table Scoping +------------------------------------------------------------------------------------------ + + + + ::= $empty + /.$Action $Builder openASTScope(); $EndBuilder $EndAction./ + + + ::= $empty + -- /.$Action $Resolve openSymbolScope(); $EndResolve $EndAction./ + + + ::= $empty + -- /.$Action $Resolve openDeclarationScope(); $EndResolve $EndAction./ + + + ::= $empty + /.$Action $Builder consumePlaceHolder(); $EndBuilder $EndAction./ + + + ::= $empty + /.$Action $Builder consumeEmpty(); $EndBuilder $EndAction./ + +------------------------------------------------------------------------------------------ +-- Content assist +------------------------------------------------------------------------------------------ + +-- The EndOfCompletion token is a special token that matches some punctuation. +-- These tokens allow the parse to complete successfully after a Completion token +-- is encountered. + + +']' ::=? 'RightBracket' + --| 'EndOfCompletion' + +')' ::=? 'RightParen' + --| 'EndOfCompletion' + +'}' ::=? 'RightBrace' + --| 'EndOfCompletion' + +';' ::=? 'SemiColon' + --| 'EndOfCompletion' + + + + +------------------------------------------------------------------------------------------ +-- Basic Concepts +------------------------------------------------------------------------------------------ + + +translation_unit + ::= declaration_seq + /. $Build consumeTranslationUnit(); $EndBuild ./ + | $empty + /. $Build consumeTranslationUnit(); $EndBuild ./ + +--expression_as_translation_unit +-- ::= expression +-- /. $Build consumeExpressionAsTranslationUnit(); $EndBuild ./ + + +------------------------------------------------------------------------------------------ +-- Expressions +------------------------------------------------------------------------------------------ + +literal + ::= 'integer' + /. $Build consumeExpressionLiteral(ICPPASTLiteralExpression.lk_integer_constant); $EndBuild ./ + | '0' + /. $Build consumeExpressionLiteral(ICPPASTLiteralExpression.lk_integer_constant); $EndBuild ./ + | 'floating' + /. $Build consumeExpressionLiteral(ICPPASTLiteralExpression.lk_float_constant); $EndBuild ./ + | 'charconst' + /. $Build consumeExpressionLiteral(ICPPASTLiteralExpression.lk_char_constant); $EndBuild ./ + | 'stringlit' + /. $Build consumeExpressionLiteral(ICPPASTLiteralExpression.lk_string_literal); $EndBuild ./ + | 'true' + /. $Build consumeExpressionLiteral(ICPPASTLiteralExpression.lk_true); $EndBuild ./ + | 'false' + /. $Build consumeExpressionLiteral(ICPPASTLiteralExpression.lk_false); $EndBuild ./ + | 'this' + /. $Build consumeExpressionLiteral(ICPPASTLiteralExpression.lk_this); $EndBuild ./ + + +primary_expression + ::= literal + | '(' expression ')' + /. $Build consumeExpressionBracketed(); $EndBuild ./ + | id_expression + + +id_expression + ::= qualified_or_unqualified_name + /. $Build consumeExpressionName(); $EndBuild ./ + + +-- Pushes an IASTName on the stack, if you want an id expression then wrap the name +qualified_or_unqualified_name + ::= unqualified_id_name + | qualified_id_name + + +unqualified_id_name + ::= identifier_name + | operator_function_id_name + | conversion_function_id_name + | template_id_name + | '~' class_name + /. $Build consumeDestructorName(); $EndBuild ./ + + +-- wrap an identifier in a name node +identifier_name + ::= 'identifier' + /. $Build consumeIdentifierName(); $EndBuild ./ + + +template_opt + ::= 'template' + /. $Build consumePlaceHolder(); $EndBuild ./ + | $empty + /. $Build consumeEmpty(); $EndBuild ./ + + +dcolon_opt + ::= '::' + /. $Build consumePlaceHolder(); $EndBuild ./ + | $empty + /. $Build consumeEmpty(); $EndBuild ./ + + +-- this is a compound name +qualified_id_name + ::= dcolon_opt nested_name_specifier template_opt unqualified_id_name + /. $Build consumeQualifiedId(true); $EndBuild ./ + | '::' identifier_name + /. $Build consumeGlobalQualifiedId(); $EndBuild ./ + | '::' operator_function_id_name + /. $Build consumeGlobalQualifiedId(); $EndBuild ./ + | '::' template_id_name + /. $Build consumeGlobalQualifiedId(); $EndBuild ./ + + + +--unqualified_id_with_template_name +-- ::= template_opt unqualified_id_name +-- /. $Build consumeNameWithTemplateKeyword(); $EndBuild ./ + + +-- puts a list of names in reverse order on the stack +-- always ends with :: +-- this is the part of a qualified id that comes before the last :: +-- but does not include a :: at the front +nested_name_specifier + ::= class_or_namespace_name '::' nested_name_specifier_with_template + /. $Build consumeNestedNameSpecifier(true); $EndBuild ./ + | class_or_namespace_name '::' + /. $Build consumeNestedNameSpecifier(false); $EndBuild ./ + + +nested_name_specifier_with_template + ::= class_or_namespace_name_with_template '::' nested_name_specifier_with_template + /. $Build consumeNestedNameSpecifier(true); $EndBuild ./ + | class_or_namespace_name_with_template '::' + /. $Build consumeNestedNameSpecifier(false); $EndBuild ./ + + +class_or_namespace_name_with_template + ::= template_opt class_or_namespace_name + /. $Build consumeNameWithTemplateKeyword(); $EndBuild ./ + + + +nested_name_specifier_opt + ::= nested_name_specifier + | $empty + /. $Build consumeNestedNameSpecifierEmpty(); $EndBuild ./ + + +class_or_namespace_name -- just identifiers + ::= class_name + | namespace_name + + +postfix_expression + ::= primary_expression + | postfix_expression '[' expression ']' + /. $Build consumeExpressionArraySubscript(); $EndBuild ./ + | postfix_expression '(' expression_list_opt ')' + /. $Build consumeExpressionFunctionCall(); $EndBuild ./ + | simple_type_specifier '(' expression_list_opt ')' -- explicit type conversion operator + /. $Build consumeExpressionSimpleTypeConstructor(); $EndBuild ./ + | 'typename' dcolon_opt nested_name_specifier identifier_name '(' expression_list_opt ')' + /. $Build consumeExpressionTypeName(); $EndBuild ./ + | 'typename' dcolon_opt nested_name_specifier template_opt template_id_name '(' expression_list_opt ')' + /. $Build consumeExpressionTypeName(); $EndBuild ./ + | postfix_expression '.' qualified_or_unqualified_name + /. $Build consumeExpressionFieldReference(false, false); $EndBuild ./ + | postfix_expression '->' qualified_or_unqualified_name + /. $Build consumeExpressionFieldReference(true, false); $EndBuild ./ + | postfix_expression '.' 'template' qualified_or_unqualified_name + /. $Build consumeExpressionFieldReference(false, true); $EndBuild ./ + | postfix_expression '->' 'template' qualified_or_unqualified_name + /. $Build consumeExpressionFieldReference(true, true); $EndBuild ./ + | postfix_expression '.' pseudo_destructor_name + /. $Build consumeExpressionFieldReference(false, false); $EndBuild ./ + | postfix_expression '->' pseudo_destructor_name + /. $Build consumeExpressionFieldReference(true, false); $EndBuild ./ + | postfix_expression '++' + /. $Build consumeExpressionUnaryOperator(IASTUnaryExpression.op_postFixIncr); $EndBuild ./ + | postfix_expression '--' + /. $Build consumeExpressionUnaryOperator(IASTUnaryExpression.op_postFixDecr); $EndBuild ./ + | 'dynamic_cast' '<' type_id '>' '(' expression ')' + /. $Build consumeExpressionCast(ICPPASTCastExpression.op_dynamic_cast); $EndBuild ./ + | 'static_cast' '<' type_id '>' '(' expression ')' + /. $Build consumeExpressionCast(ICPPASTCastExpression.op_static_cast); $EndBuild ./ + | 'reinterpret_cast' '<' type_id '>' '(' expression ')' + /. $Build consumeExpressionCast(ICPPASTCastExpression.op_reinterpret_cast); $EndBuild ./ + | 'const_cast' '<' type_id '>' '(' expression ')' + /. $Build consumeExpressionCast(ICPPASTCastExpression.op_const_cast); $EndBuild ./ + | 'typeid' '(' expression ')' + /. $Build consumeExpressionUnaryOperator(ICPPASTUnaryExpression.op_typeid); $EndBuild ./ + | 'typeid' '(' type_id ')' + /. $Build consumeExpressionTypeId(ICPPASTTypeIdExpression.op_typeid); $EndBuild ./ + + + +-- just names +-- Don't even know if I really need this rule, the DOM parser just parses qualified_or_unqualified_name +-- instead of pseudo_destructor_name. But the difference is I have different +-- token types, so maybe I do need this rule. +pseudo_destructor_name + ::= dcolon_opt nested_name_specifier_opt type_name '::' '~' type_name + /. $Build consumePsudoDestructorName(true); $EndBuild ./ + | dcolon_opt nested_name_specifier 'template' template_id_name '::' '~' type_name + /. $Build consumePsudoDestructorName(true); $EndBuild ./ + | dcolon_opt nested_name_specifier_opt '~' type_name + /. $Build consumePsudoDestructorName(false); $EndBuild ./ + + +unary_expression + ::= postfix_expression + | new_expression + | delete_expression + | '++' cast_expression + /. $Build consumeExpressionUnaryOperator(IASTUnaryExpression.op_prefixIncr); $EndBuild ./ + | '--' cast_expression + /. $Build consumeExpressionUnaryOperator(IASTUnaryExpression.op_prefixDecr); $EndBuild ./ + | '&' cast_expression + /. $Build consumeExpressionUnaryOperator(IASTUnaryExpression.op_amper); $EndBuild ./ + | '*' cast_expression + /. $Build consumeExpressionUnaryOperator(IASTUnaryExpression.op_star); $EndBuild ./ + | '+' cast_expression + /. $Build consumeExpressionUnaryOperator(IASTUnaryExpression.op_plus); $EndBuild ./ + | '-' cast_expression + /. $Build consumeExpressionUnaryOperator(IASTUnaryExpression.op_minus); $EndBuild ./ + | '~' cast_expression + /. $Build consumeExpressionUnaryOperator(IASTUnaryExpression.op_tilde); $EndBuild ./ + | '!' cast_expression + /. $Build consumeExpressionUnaryOperator(IASTUnaryExpression.op_not); $EndBuild ./ + | 'sizeof' unary_expression + /. $Build consumeExpressionUnaryOperator(IASTUnaryExpression.op_sizeof); $EndBuild ./ + | 'sizeof' '(' type_id ')' + /. $Build consumeExpressionTypeId(ICPPASTTypeIdExpression.op_sizeof); $EndBuild ./ + + +new_expression -- done + ::= dcolon_opt 'new' new_placement_opt new_type_id new_array_expressions_opt new_initializer_opt + /. $Build consumeExpressionNew(false); $EndBuild ./ + | dcolon_opt 'new' new_placement_opt '(' type_id ')' new_initializer_opt + /. $Build consumeExpressionNew(true); $EndBuild ./ + + +new_placement -- done + ::= '(' expression_list ')' + + +new_placement_opt -- done + ::= new_placement + | $empty + /. $Build consumeEmpty(); $EndBuild ./ + + +new_type_id + ::= type_specifier_seq + /. $Build consumeTypeId(false); $EndBuild ./ + | type_specifier_seq new_declarator + /. $Build consumeTypeId(true); $EndBuild ./ + + +new_declarator -- pointer operators are part of the type id, held in an empty declarator + ::= new_pointer_operators + /. $Build consumeNewDeclarator(); $EndBuild ./ + + +new_pointer_operators -- presumably this will not need an action as ptr_operator will have one + ::= ptr_operator + | ptr_operator new_pointer_operators + + +new_array_expressions + ::= '[' expression ']' + | new_array_expressions '[' constant_expression ']' + + +new_array_expressions_opt + ::= new_array_expressions + | $empty + + +new_initializer -- done + ::= '(' expression_list_opt ')' -- even if the parens are there we get null in the AST + + +new_initializer_opt -- done + ::= new_initializer + | $empty + /. $Build consumeEmpty(); $EndBuild ./ + + +delete_expression + ::= dcolon_opt 'delete' cast_expression + /. $Build consumeExpressionDelete(false); $EndBuild ./ + | dcolon_opt 'delete' '[' ']' cast_expression + /. $Build consumeExpressionDelete(true); $EndBuild ./ + + +cast_expression + ::= unary_expression + | '(' type_id ')' cast_expression + /. $Build consumeExpressionCast(ICPPASTCastExpression.op_cast); $EndBuild ./ + + +pm_expression + ::= cast_expression + | pm_expression '.*' cast_expression + /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_pmdot); $EndBuild ./ + | pm_expression '->*' cast_expression + /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_pmarrow); $EndBuild ./ + + +multiplicative_expression + ::= pm_expression + | multiplicative_expression '*' pm_expression + /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_multiply); $EndBuild ./ + | multiplicative_expression '/' pm_expression + /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_divide); $EndBuild ./ + | multiplicative_expression '%' pm_expression + /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_modulo); $EndBuild ./ + + +additive_expression + ::= multiplicative_expression + | additive_expression '+' multiplicative_expression + /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_plus); $EndBuild ./ + | additive_expression '-' multiplicative_expression + /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_minus); $EndBuild ./ + + +shift_expression + ::= additive_expression + | shift_expression '<<' additive_expression + /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_shiftLeft); $EndBuild ./ + | shift_expression '>>' additive_expression + /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_shiftRight); $EndBuild ./ + + +relational_expression + ::= shift_expression + | relational_expression '<' shift_expression + /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_lessThan); $EndBuild ./ + | relational_expression '>' shift_expression + /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_greaterThan); $EndBuild ./ + | relational_expression '<=' shift_expression + /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_lessEqual); $EndBuild ./ + | relational_expression '>=' shift_expression + /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_greaterEqual); $EndBuild ./ + + +equality_expression + ::= relational_expression + | equality_expression '==' relational_expression + /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_equals); $EndBuild ./ + | equality_expression '!=' relational_expression + /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_notequals); $EndBuild ./ + + +and_expression + ::= equality_expression + | and_expression '&' equality_expression + /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_binaryAnd); $EndBuild ./ + + +exclusive_or_expression + ::= and_expression + | exclusive_or_expression '^' and_expression + /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_binaryXor); $EndBuild ./ + + +inclusive_or_expression + ::= exclusive_or_expression + | inclusive_or_expression '|' exclusive_or_expression + /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_binaryOr); $EndBuild ./ + + +logical_and_expression + ::= inclusive_or_expression + | logical_and_expression '&&' inclusive_or_expression + /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_logicalAnd); $EndBuild ./ + + +logical_or_expression + ::= logical_and_expression + | logical_or_expression '||' logical_and_expression + /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_logicalOr); $EndBuild ./ + + +conditional_expression + ::= logical_or_expression + | logical_or_expression '?' expression ':' assignment_expression + /. $Build consumeExpressionConditional(); $EndBuild ./ + + +throw_expression + ::= 'throw' + /. $Build consumeExpressionThrow(false); $EndBuild ./ + | 'throw' assignment_expression + /. $Build consumeExpressionThrow(true); $EndBuild ./ + + +assignment_expression + ::= conditional_expression + | throw_expression + | logical_or_expression '=' assignment_expression + /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_assign); $EndBuild ./ + | logical_or_expression '*=' assignment_expression + /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_multiplyAssign); $EndBuild ./ + | logical_or_expression '/=' assignment_expression + /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_divideAssign); $EndBuild ./ + | logical_or_expression '%=' assignment_expression + /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_moduloAssign); $EndBuild ./ + | logical_or_expression '+=' assignment_expression + /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_plusAssign); $EndBuild ./ + | logical_or_expression '-=' assignment_expression + /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_minusAssign); $EndBuild ./ + | logical_or_expression '>>=' assignment_expression + /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_shiftRightAssign); $EndBuild ./ + | logical_or_expression '<<=' assignment_expression + /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_shiftLeftAssign); $EndBuild ./ + | logical_or_expression '&=' assignment_expression + /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_binaryAndAssign); $EndBuild ./ + | logical_or_expression '^=' assignment_expression + /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_binaryXorAssign); $EndBuild ./ + | logical_or_expression '|=' assignment_expression + /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_binaryOrAssign); $EndBuild ./ + + +expression + ::= expression_list + | ERROR_TOKEN + /. $Build consumeExpressionProblem(); $EndBuild ./ + +-- expression_list and expression_list_opt always result in a single element on the stack +-- the element might be an expression, an expression list or null + +expression_list + ::= expression_list_actual + /. $Build consumeExpressionList(); $EndBuild ./ + + +expression_list_actual + ::= assignment_expression + | expression_list_actual ',' assignment_expression + + +expression_list_opt + ::= expression_list + | $empty + /. $Build consumeEmpty(); $EndBuild ./ + + +expression_opt + ::= expression + | $empty + /. $Build consumeEmpty(); $EndBuild ./ + + +constant_expression + ::= conditional_expression + + +constant_expression_opt + ::= constant_expression + | $empty + /. $Build consumeEmpty(); $EndBuild ./ + + +------------------------------------------------------------------------------------------ +-- Statements +------------------------------------------------------------------------------------------ + +-- TODO: declarations in conditions + +statement + ::= labeled_statement + | expression_statement + | compound_statement + | selection_statement + | iteration_statement + | jump_statement + | declaration_statement + | try_block + | ERROR_TOKEN + /. $Build consumeStatementProblem(); $EndBuild ./ + + +labeled_statement + ::= identifier ':' statement + /. $Build consumeStatementLabeled(); $EndBuild ./ + | case constant_expression ':' + /. $Build consumeStatementCase(); $EndBuild ./ + | default ':' + /. $Build consumeStatementDefault(); $EndBuild ./ + + +expression_statement + ::= expression ';' + /. $Build consumeStatementExpression(); $EndBuild ./ + | ';' + /. $Build consumeStatementNull(); $EndBuild ./ + + +compound_statement + ::= '{' statement_seq '}' + /. $Build consumeStatementCompoundStatement(true); $EndBuild ./ + | '{' '}' + /. $Build consumeStatementCompoundStatement(false); $EndBuild ./ + + +statement_seq + ::= statement + | statement_seq statement + + +selection_statement + ::= 'if' '(' condition ')' statement + /. $Build consumeStatementIf(false); $EndBuild ./ + | 'if' '(' condition ')' statement 'else' statement + /. $Build consumeStatementIf(true); $EndBuild ./ + | 'switch' '(' condition ')' statement + /. $Build consumeStatementSwitch(); $EndBuild ./ + + + +condition + ::= expression + | type_specifier_seq declarator '=' assignment_expression + /. $Build consumeConditionDeclaration(); $EndBuild ./ + + +-- where did this come from? +--condition_opt +-- ::= condition +-- | $empty +-- /. $Build consumeEmpty(); $EndBuild ./ + + +iteration_statement + ::= 'while' '(' condition ')' statement + /. $Build consumeStatementWhileLoop(); $EndBuild ./ + | 'do' statement 'while' '(' expression ')' ';' + /. $Build consumeStatementDoLoop(); $EndBuild ./ + | 'for' '(' expression_opt ';' expression_opt ';' expression_opt ')' statement + /. $Build consumeStatementForLoop(); $EndBuild ./ + | 'for' '(' simple_declaration expression_opt ';' expression_opt ')' statement + /. $Build consumeStatementForLoop(); $EndBuild ./ + + +jump_statement + ::= 'break' ';' + /. $Build consumeStatementBreak(); $EndBuild ./ + | 'continue' ';' + /. $Build consumeStatementContinue(); $EndBuild ./ + | 'return' expression ';' + /. $Build consumeStatementReturn(true); $EndBuild ./ + | 'return' ';' + /. $Build consumeStatementReturn(false); $EndBuild ./ + | 'goto' 'identifier' ';' + /. $Build consumeStatementGoto(); $EndBuild ./ + + +declaration_statement + ::= block_declaration + /. $Build consumeStatementDeclaration(); $EndBuild ./ + + + +------------------------------------------------------------------------------------------ +-- Declarations +------------------------------------------------------------------------------------------ + + +declaration + ::= block_declaration + | function_definition -- done + | template_declaration -- done + | explicit_instantiation -- done + | explicit_specialization -- done + | linkage_specification -- done + | namespace_definition -- done + + +block_declaration + ::= simple_declaration -- done + | asm_definition -- done + | namespace_alias_definition -- done + | using_declaration -- done + | using_directive -- done + + +declaration_seq + ::= declaration + | declaration_seq declaration + + + +declaration_seq_opt + ::= declaration_seq + | $empty + + + +simple_declaration + ::= declaration_specifiers_opt init_declarator_list_opt ';' + /. $Build consumeDeclarationSimple(true); $EndBuild ./ + + +-- declaration specifier nodes not created here, they are created by sub-rules +-- these rules add IToken modifiers to the declspec nodes +declaration_specifiers + ::= simple_declaration_specifiers + /. $Build consumeDeclarationSpecifiersSimple(); $EndBuild ./ + | class_declaration_specifiers + /. $Build consumeDeclarationSpecifiersComposite(); $EndBuild ./ + | elaborated_declaration_specifiers + /. $Build consumeDeclarationSpecifiersComposite(); $EndBuild ./ + | enum_declaration_specifiers + /. $Build consumeDeclarationSpecifiersComposite(); $EndBuild ./ + | type_name_declaration_specifiers + /. $Build consumeDeclarationSpecifiersTypeName(); $EndBuild ./ + + +declaration_specifiers_opt + ::= declaration_specifiers + | $empty + /. $Build consumeEmpty(); $EndBuild ./ + + +-- what about type qualifiers... cv_qualifier +no_type_declaration_specifier + ::= storage_class_specifier + | function_specifier + | cv_qualifier + | 'friend' + /. $Build consumeDeclSpecToken(); $EndBuild ./ + | 'typedef' + /. $Build consumeDeclSpecToken(); $EndBuild ./ + + +no_type_declaration_specifiers + ::= no_type_declaration_specifier + | no_type_declaration_specifiers no_type_declaration_specifier + + +-- now also includes qualified names +-- if there is no long long then this may be simplified +simple_declaration_specifiers + ::= simple_type_specifier + | no_type_declaration_specifiers simple_type_specifier + | simple_declaration_specifiers simple_type_specifier + | simple_declaration_specifiers no_type_declaration_specifier + + +-- struct, union or class! +class_declaration_specifiers + ::= class_specifier + | no_type_declaration_specifiers class_specifier + | class_declaration_specifiers no_type_declaration_specifier + + +-- elaborated means something different, but how different? +elaborated_declaration_specifiers + ::= elaborated_type_specifier + | no_type_declaration_specifiers elaborated_type_specifier + | elaborated_declaration_specifiers no_type_declaration_specifier + + +-- Think this is the same +enum_declaration_specifiers + ::= enum_specifier + | no_type_declaration_specifiers enum_specifier + | enum_declaration_specifiers no_type_declaration_specifier + + +-- just typedefs in C99, but expanded to type names in C++ (no tagging needed) +type_name_declaration_specifiers + ::= type_name_specifier + | no_type_declaration_specifiers type_name_specifier + | type_name_declaration_specifiers no_type_declaration_specifier + + + -- TODO comment this out +--decl_specifier +-- ::= storage_class_specifier -- just keywords +-- | type_specifier -- this is where the fun is + -- | function_specifier -- just keywords + -- | 'friend' + -- | 'typedef' + + +storage_class_specifier + ::= 'auto' + | 'register' + | 'static' + | 'extern' + | 'mutable' + + +function_specifier + ::= 'inline' + | 'virtual' + | 'explicit' + + +typedef_name + ::= 'identifier' + + +--type_specifier +-- ::= simple_type_specifier -- int, void etc... +-- | class_specifier -- structs, unions, classes +-- | enum_specifier -- enums +-- | elaborated_type_specifier -- its elaborated, but this is different than c, includes typename +-- | cv_qualifier -- the const and volatile keywords (separated because they can be applied to pointer modifiers) + + +--simple_type_specifier +-- ::= dcolon_opt nested_name_specifier_opt type_name +-- /. $Build consumeQualifiedId(false); $EndBuild ./ +-- | dcolon_opt nested_name_specifier 'template' template_id_name +-- /. $Build consumeQualifiedId(false); $EndBuild ./ +-- | simple_type_primitive_specifier + + +simple_type_specifier + ::= simple_type_specifier_token + /. $Build consumeDeclSpecToken(); $EndBuild ./ + + +simple_type_specifier_token + ::= 'char' + | 'wchar_t' + | 'bool' + | 'short' + | 'int' + | 'long' + | 'signed' + | 'unsigned' + | 'float' + | 'double' + | 'void' + + +-- last two rules moved here from simple_type_specifier +type_name -- all identifiers of some kind + ::= class_name + | enum_name -- identifier + | typedef_name + + +-- last two rules moved here from simple_type_specifier +type_name_specifier -- all identifiers of some kind + ::= type_name + | dcolon_opt nested_name_specifier_opt type_name + /. $Build consumeQualifiedId(false); $EndBuild ./ + | dcolon_opt nested_name_specifier 'template' template_id_name + /. $Build consumeQualifiedId(false); $EndBuild ./ + | 'typename' dcolon_opt nested_name_specifier identifier_name + /. $Build consumeQualifiedId(false); $EndBuild ./ + | 'typename' dcolon_opt nested_name_specifier template_opt template_id_name + /. $Build consumeQualifiedId(true); $EndBuild ./ + + +-- used for forward declaration and incomplete types +elaborated_type_specifier + ::= class_keyword dcolon_opt nested_name_specifier_opt identifier_name + /. $Build consumeTypeSpecifierElaborated(false); $EndBuild ./ + | class_keyword dcolon_opt nested_name_specifier_opt template_opt template_id_name + /. $Build consumeTypeSpecifierElaborated(true); $EndBuild ./ + | 'enum' dcolon_opt nested_name_specifier_opt identifier_name + /. $Build consumeTypeSpecifierElaborated(false); $EndBuild ./ + + +enum_name + ::= 'identifier' + + +enum_specifier + ::= 'enum' '{' enumerator_list_opt '}' + /. $Build consumeTypeSpecifierEnumeration(false); $EndBuild ./ + | 'enum' 'identifier' '{' enumerator_list_opt '}' + /. $Build consumeTypeSpecifierEnumeration(true); $EndBuild ./ + + +enumerator_list + ::= enumerator_definition + | enumerator_list ',' enumerator_definition + + +enumerator_list_opt + ::= enumerator_list + | $empty + + +enumerator_definition + ::= enumerator + /. $Build consumeEnumerator(false); $EndBuild ./ + | enumerator '=' constant_expression + /. $Build consumeEnumerator(true); $EndBuild ./ + + +enumerator + ::= 'identifier' + + +namespace_name + ::= original_namespace_name + | namespace_alias + + +original_namespace_name + ::= 'identifier' + + +namespace_definition + ::= named_namespace_definition + | unnamed_namespace_definition + + +named_namespace_definition + ::= original_namespace_definition + | extension_namespace_definition + + +original_namespace_definition + ::= 'namespace' identifier_name '{' declaration_seq_opt '}' + /. $Build consumeNamespaceDefinition(true); $EndBuild ./ + + +extension_namespace_definition + ::= 'namespace' original_namespace_name '{' declaration_seq_opt '}' + /. $Build consumeNamespaceDefinition(true); $EndBuild ./ + + +unnamed_namespace_definition + ::= 'namespace' '{' declaration_seq_opt '}' + /. $Build consumeNamespaceDefinition(false); $EndBuild ./ + + +namespace_alias + ::= 'identifier' + + +namespace_alias_definition + ::= 'namespace' 'identifier' '=' dcolon_opt nested_name_specifier_opt namespace_name ';' + /. $Build consumeNamespaceAliasDefinition(); $EndBuild ./ + + +--qualified_namespace_specifier +-- ::= dcolon_opt nested_name_specifier_opt namespace_name + + +-- make more lenient! +-- using_declaration +-- ::= 'using' typename_opt dcolon_opt nested_name_specifier unqualified_id_name ';' +-- | 'using' '::' unqualified_id_name ';' + + +using_declaration + ::= 'using' typename_opt dcolon_opt nested_name_specifier_opt unqualified_id_name ';' + /. $Build consumeUsingDeclaration(); $EndBuild ./ + + +typename_opt + ::= 'typename' + /. $Build consumePlaceHolder(); $EndBuild ./ + | $empty + /. $Build consumeEmpty(); $EndBuild ./ + + +using_directive + ::= 'using' 'namespace' dcolon_opt nested_name_specifier_opt namespace_name ';' + /. $Build consumeUsingDirective(); $EndBuild ./ + + +asm_definition + ::= 'asm' '(' 'stringlit' ')' ';' + /. $Build consumeDeclarationASM(); $EndBuild ./ + + +linkage_specification + ::= 'extern' 'stringlit' '{' declaration_seq_opt '}' + /. $Build consumeLinkageSpecification(); $EndBuild ./ + | 'extern' 'stringlit' declaration + /. $Build consumeLinkageSpecification(); $EndBuild ./ + + +init_declarator_list + ::= init_declarator + | init_declarator_list ',' init_declarator + + +init_declarator_list_opt + ::= init_declarator_list + | $empty + + +init_declarator + ::= declarator + | declarator initializer + /. $Build consumeDeclaratorWithInitializer(true); $EndBuild ./ + + +declarator + ::= direct_declarator + | ptr_operator_seq direct_declarator + /. $Build consumeDeclaratorWithPointer(true); $EndBuild ./ + + +direct_declarator + ::= basic_direct_declarator + | function_direct_declarator + | array_direct_declarator + + +basic_direct_declarator + ::= declarator_id_name + /. $Build consumeDirectDeclaratorIdentifier(); $EndBuild ./ + | '(' declarator ')' + /. $Build consumeDirectDeclaratorBracketed(); $EndBuild ./ + + +function_direct_declarator + ::= basic_direct_declarator '(' parameter_declaration_clause ')' cv_qualifier_seq_opt exception_specification_opt + /. $Build consumeDirectDeclaratorFunctionDeclarator(true); $EndBuild ./ + + +array_direct_declarator + ::= array_direct_declarator array_modifier + /. $Build consumeDirectDeclaratorArrayDeclarator(true); $EndBuild ./ + | basic_direct_declarator array_modifier + /. $Build consumeDirectDeclaratorArrayDeclarator(true); $EndBuild ./ + + +array_modifier + ::= '[' constant_expression ']' + /. $Build consumeDirectDeclaratorArrayModifier(true); $EndBuild ./ + | '[' ']' + /. $Build consumeDirectDeclaratorArrayModifier(false); $EndBuild ./ + + +ptr_operator + ::= '*' cv_qualifier_seq_opt + /. $Build consumePointer(); $EndBuild ./ + | '&' + /. $Build consumeReferenceOperator(); $EndBuild ./ + | dcolon_opt nested_name_specifier '*' cv_qualifier_seq_opt + /. $Build consumePointerToMember(); $EndBuild ./ + + +ptr_operator_seq + ::= ptr_operator + | ptr_operator_seq ptr_operator + + +--ptr_operator_seq_opt +-- ::= ptr_operator_seq +-- | $empty + + +cv_qualifier_seq + ::= cv_qualifier cv_qualifier_seq_opt + + +cv_qualifier_seq_opt + ::= cv_qualifier_seq + | $empty + + +cv_qualifier + ::= 'const' + /. $Build consumeDeclSpecToken(); $EndBuild ./ + | 'volatile' + /. $Build consumeDeclSpecToken(); $EndBuild ./ + + +declarator_id_name + ::= qualified_or_unqualified_name + | dcolon_opt nested_name_specifier_opt type_name + /. $Build consumeQualifiedId(false); $EndBuild ./ + + +type_id + ::= type_specifier_seq + /. $Build consumeTypeId(false); $EndBuild ./ + | type_specifier_seq abstract_declarator + /. $Build consumeTypeId(true); $EndBuild ./ + + +--type_specifier_seq +-- ::= type_specifier +-- | type_specifier_seq type_specifier + + +-- more lenient than spec, but easier to deal with +type_specifier_seq + ::= declaration_specifiers + + + +abstract_declarator + ::= direct_abstract_declarator + | ptr_operator_seq + /. $Build consumeDeclaratorWithPointer(false); $EndBuild ./ + | ptr_operator_seq direct_abstract_declarator + /. $Build consumeDeclaratorWithPointer(true); $EndBuild ./ + + +direct_abstract_declarator + ::= basic_direct_abstract_declarator + | array_direct_abstract_declarator + | function_direct_abstract_declarator + + +basic_direct_abstract_declarator + ::= '(' abstract_declarator ')' + /. $Build consumeDirectDeclaratorBracketed(); $EndBuild ./ + + +array_direct_abstract_declarator + ::= array_modifier + /. $Build consumeDirectDeclaratorArrayDeclarator(false); $EndBuild ./ + | array_direct_abstract_declarator array_modifier + /. $Build consumeDirectDeclaratorArrayDeclarator(true); $EndBuild ./ + | basic_direct_abstract_declarator array_modifier + /. $Build consumeDirectDeclaratorArrayDeclarator(true); $EndBuild ./ + + +function_direct_abstract_declarator + ::= basic_direct_abstract_declarator '(' parameter_declaration_clause ')' cv_qualifier_seq_opt exception_specification_opt + /. $Build consumeDirectDeclaratorFunctionDeclarator(true); $EndBuild ./ + | '(' parameter_declaration_clause ')' cv_qualifier_seq_opt exception_specification_opt + /. $Build consumeDirectDeclaratorFunctionDeclarator(false); $EndBuild ./ + + +-- actions just place a marker indicating if '...' was parsed +parameter_declaration_clause + ::= parameter_declaration_list_opt '...' + /. $Build consumePlaceHolder(); $EndBuild ./ + | parameter_declaration_list_opt + /. $Build consumeEmpty(); $EndBuild ./ + | parameter_declaration_list ',' '...' + /. $Build consumePlaceHolder(); $EndBuild ./ + + +parameter_declaration_list + ::= parameter_declaration + | parameter_declaration_list ',' parameter_declaration + + +parameter_declaration_list_opt + ::= parameter_declaration_list + | $empty + + +abstract_declarator_opt + ::= abstract_declarator + | $empty + /. $Build consumeEmpty(); $EndBuild ./ + + +parameter_declaration + ::= declaration_specifiers parameter_init_declarator + /. $Build consumeParameterDeclaration(); $EndBuild ./ + | declaration_specifiers + /. $Build consumeParameterDeclarationWithoutDeclarator(); $EndBuild ./ + + +parameter_init_declarator + ::= declarator + | declarator '=' parameter_initializer + /. $Build consumeDeclaratorWithInitializer(true); $EndBuild ./ + | abstract_declarator + | abstract_declarator '=' parameter_initializer + /. $Build consumeDeclaratorWithInitializer(true); $EndBuild ./ + | '=' parameter_initializer + /. $Build consumeDeclaratorWithInitializer(false); $EndBuild ./ + + +parameter_initializer + ::= assignment_expression + /. $Build consumeInitializer(); $EndBuild ./ + + +function_definition + ::= declaration_specifiers_opt function_direct_declarator ctor_initializer_list_opt function_body + /. $Build consumeFunctionDefinition(false); $EndBuild ./ + | declaration_specifiers_opt function_direct_declarator 'try' ctor_initializer_list_opt function_body handler_seq + /. $Build consumeFunctionDefinition(true); $EndBuild ./ + + +function_body + ::= compound_statement + + +initializer + ::= '=' initializer_clause + | '(' expression_list ')' + /. $Build consumeInitializerConstructor(); $EndBuild ./ + + +initializer_clause + ::= assignment_expression + /. $Build consumeInitializer(); $EndBuild ./ + | '{' initializer_list ',' '}' + /. $Build consumeInitializerList(); $EndBuild ./ + | '{' initializer_list '}' + /. $Build consumeInitializerList(); $EndBuild ./ + | '{' '}' + /. $Build consumeInitializerList(); $EndBuild ./ + + +initializer_list + ::= initializer_clause + | initializer_list ',' initializer_clause + + + +------------------------------------------------------------------------------------------ +-- Classes +------------------------------------------------------------------------------------------ + + +class_name + ::= identifier_name + | template_id_name + + +class_specifier -- done + ::= class_head '{' member_declaration_list_opt '}' + /. $Build consumeClassSpecifier(); $EndBuild ./ + + +class_head -- done + ::= class_keyword identifier_name_opt base_clause_opt + /. $Build consumeClassHead(false); $EndBuild ./ + | class_keyword template_id_name base_clause_opt + /. $Build consumeClassHead(false); $EndBuild ./ + | class_keyword nested_name_specifier identifier_name base_clause_opt + /. $Build consumeClassHead(true); $EndBuild ./ + | class_keyword nested_name_specifier template_id_name base_clause_opt + /. $Build consumeClassHead(true); $EndBuild ./ + + +identifier_opt + ::= 'identifier' + | $empty + + +identifier_name_opt + ::= identifier_name + | $empty + /. $Build consumeEmpty(); $EndBuild./ + + +class_keyword + ::= 'class' + | 'struct' + | 'union' + + +visibility_label + ::= access_specifier_keyword ':' + /. $Build consumeVisibilityLabel(); $EndBuild ./ + + + +member_declaration + ::= declaration_specifiers_opt member_declarator_list ';' + /. $Build consumeDeclarationSimple(true); $EndBuild ./ + | declaration_specifiers_opt ';' + /. $Build consumeDeclarationSimple(false); $EndBuild ./ + | function_definition ';' -- done + | function_definition -- done + | dcolon_opt nested_name_specifier template_opt unqualified_id_name ';' + /. $Build consumeMemberDeclarationQualifiedId(); $EndBuild ./ + | using_declaration -- done + | template_declaration + | visibility_label -- done + + + + +member_declaration_list + ::= member_declaration + | member_declaration_list member_declaration + + +member_declaration_list_opt + ::= member_declaration_list + | $empty + + +member_declarator_list + ::= member_declarator + | member_declarator_list ',' member_declarator + + +member_declarator + ::= declarator + -- | declarator pure_specifier -- parse this as a constant initializer + | declarator constant_initializer + /. $Build consumeMemberDeclaratorWithInitializer(); $EndBuild ./ + | bit_field_declarator ':' constant_expression + /. $Build consumeBitField(true); $EndBuild ./ + | ':' constant_expression + /. $Build consumeBitField(false); $EndBuild ./ + + +bit_field_declarator + ::= identifier_name + /. $Build consumeDirectDeclaratorIdentifier(); $EndBuild ./ + + +--pure_specifier -- this leads to ambiguities +-- ::= '=' '0' + + +constant_initializer + ::= '=' constant_expression + + +base_clause + ::= ':' base_specifier_list + + +base_clause_opt + ::= base_clause + | $empty + + +base_specifier_list + ::= base_specifier + | base_specifier_list ',' base_specifier + + +-- make this more lenient, allow virtual both before and after +base_specifier + ::= dcolon_opt nested_name_specifier_opt class_name + /. $Build consumeBaseSpecifier(false); $EndBuild ./ + | virtual_opt access_specifier_keyword virtual_opt dcolon_opt nested_name_specifier_opt class_name + /. $Build consumeBaseSpecifier(true); $EndBuild ./ + + +virtual_opt + ::= 'virtual' + /. $Build consumePlaceHolder(); $EndBuild ./ + | $empty + /. $Build consumeEmpty(); $EndBuild ./ + + +access_specifier_keyword + ::= 'private' + | 'protected' + | 'public' + + +access_specifier_keyword_opt + ::= access_specifier_keyword + | $empty + + +conversion_function_id_name + ::= 'operator' conversion_type_id + /. $Build consumeConversionName(); $EndBuild ./ + + +conversion_type_id + ::= type_specifier_seq conversion_declarator + /. $Build consumeTypeId(true); $EndBuild ./ + | type_specifier_seq + /. $Build consumeTypeId(false); $EndBuild ./ + + +conversion_declarator + ::= ptr_operator_seq + /. $Build consumeDeclaratorWithPointer(false); $EndBuild ./ + + + +--conversion_declarator_opt +-- ::= conversion_declarator +-- | $empty + + +ctor_initializer_list + ::= ':' mem_initializer_list + + +ctor_initializer_list_opt + ::= ctor_initializer_list + | $empty + + +mem_initializer_list + ::= mem_initializer + | mem_initializer ',' mem_initializer_list + + +mem_initializer + ::= mem_initializer_name '(' expression_list_opt ')' + /. $Build consumeConstructorChainInitializer(); $EndBuild ./ + + +mem_initializer_name + ::= dcolon_opt nested_name_specifier_opt class_name + /. $Build consumeQualifiedId(false); $EndBuild ./ + | identifier_name + + +operator_function_id_name + ::= operator_id_name + | operator_id_name '<' template_argument_list_opt '>' + /. $Build consumeTemplateId(); $EndBuild ./ + + +operator_id_name + ::= 'operator' overloadable_operator + /. $Build consumeOperatorName(); $EndBuild ./ + + +overloadable_operator + ::= 'new' | 'delete' | 'new' '[' ']' | 'delete' '[' ']' + | '+' | '-' | '*' | '/' | '%' | '^' | '&' | '|' | '~' + | '!' | '=' | '<' | '>' | '+=' | '-=' | '*=' | '/=' | '%=' + | '^=' | '&=' | '|=' | '<<' | '>>' | '>>=' | '<<=' | '==' | '!=' + | '<=' | '>=' | '&&' | '||' | '++' | '--' | ',' | '->*' | '->' + | '(' ')' | '[' ']' + + +template_declaration + ::= export_opt 'template' '<' template_parameter_list '>' declaration + /. $Build consumeTemplateDeclaration(); $EndBuild ./ + + +export_opt + ::= 'export' + /. $Build consumePlaceHolder(); $EndBuild ./ + | $empty + /. $Build consumeEmpty(); $EndBuild ./ + + +template_parameter_list + ::= template_parameter + | template_parameter_list ',' template_parameter + + +template_parameter + ::= type_parameter + | parameter_declaration + + +type_parameter + ::= 'class' identifier_name_opt + /. $Build consumeSimpleTypeTemplateParameter(false); $EndBuild ./ + | 'class' identifier_name_opt '=' type_id + /. $Build consumeSimpleTypeTemplateParameter(true); $EndBuild ./ + | 'typename' identifier_name_opt + /. $Build consumeSimpleTypeTemplateParameter(false); $EndBuild ./ + | 'typename' identifier_name_opt '=' type_id + /. $Build consumeSimpleTypeTemplateParameter(true); $EndBuild ./ + | 'template' '<' template_parameter_list '>' 'class' identifier_name_opt + /. $Build consumeTemplatedTypeTemplateParameter(false); $EndBuild ./ + | 'template' '<' template_parameter_list '>' 'class' identifier_name_opt '=' id_expression + /. $Build consumeTemplatedTypeTemplateParameter(true); $EndBuild ./ + + +-- pushes name node on stack +template_id_name + ::= template_identifier '<' template_argument_list_opt '>' + /. $Build consumeTemplateId(); $EndBuild ./ + +template_identifier + ::= 'identifier' + + +template_argument_list + ::= template_argument + | template_argument_list ',' template_argument + + +template_argument_list_opt + ::= template_argument_list + | $empty + + +template_argument + ::= assignment_expression + | type_id + | qualified_or_unqualified_name + + +explicit_instantiation + ::= 'template' declaration + /. $Build consumeTemplateExplicitInstantiation(); $EndBuild ./ + + +explicit_specialization + ::= 'template' '<' '>' declaration + /. $Build consumeTemplateExplicitSpecialization(); $EndBuild ./ + + +try_block + ::= 'try' compound_statement handler_seq + /. $Build consumeStatementTryBlock(); $EndBuild ./ + + + + + +handler_seq + ::= handler + | handler_seq handler + + +handler + ::= 'catch' '(' exception_declaration ')' compound_statement + /. $Build consumeStatementCatchHandler(false); $EndBuild ./ + | 'catch' '(' '...' ')' compound_statement + /. $Build consumeStatementCatchHandler(true); $EndBuild ./ + + +-- open a scope just so that we can reuse consumeDeclarationSimple() +exception_declaration + ::= type_specifier_seq declarator + /. $Build consumeDeclarationSimple(true); $EndBuild ./ + | type_specifier_seq abstract_declarator + /. $Build consumeDeclarationSimple(true); $EndBuild ./ + | type_specifier_seq + /. $Build consumeDeclarationSimple(false); $EndBuild ./ + + +-- puts type ids on the stack +exception_specification + ::= 'throw' '(' type_id_list ')' + | 'throw' '(' ')' + + +exception_specification_opt + ::= exception_specification + | $empty + + +type_id_list + ::= type_id + | type_id_list ',' type_id \ No newline at end of file diff --git a/lrparser/org.eclipse.cdt.core.lrparser/grammar/cpp/CPPParser.g b/lrparser/org.eclipse.cdt.core.lrparser/grammar/cpp/CPPParser.g index c306206738f..cecf1af65f8 100644 --- a/lrparser/org.eclipse.cdt.core.lrparser/grammar/cpp/CPPParser.g +++ b/lrparser/org.eclipse.cdt.core.lrparser/grammar/cpp/CPPParser.g @@ -14,1744 +14,13 @@ %options template=btParserTemplateD.g +-- This file is needed because LPG won't allow redefinition of the +-- start symbol, so CPPGrammar.g cannot define a start symbol. -$Notice --- Copied into all files generated by LPG -/./******************************************************************************* - * Copyright (c) 2006, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl_v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *********************************************************************************/ - - // This file was generated by LPG -./ +$Import + CPPGrammar.g $End - - -$Terminals - - -- Keywords - - asm auto bool break case catch char class - const const_cast continue default delete do - double dynamic_cast else enum explicit export - extern false float for friend goto if inline - int long mutable namespace new operator private - protected public register reinterpret_cast return - short signed sizeof static static_cast struct - switch template this throw try true typedef - typeid typename union unsigned using virtual - void volatile wchar_t while - - -- Literals (also true and false are considered literals) - - integer floating charconst stringlit - - -- zero -- this is a special token used to disambiguate the the grammar rule for pure virtual functions - -- 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 - -- TypedefName - - -- Special tokens used in content assist - - Completion - EndOfCompletion - - -- Unrecognized token - - Invalid - - -- Punctuation (with aliases to make grammar more readable) - - LeftBracket ::= '[' - LeftParen ::= '(' - LeftBrace ::= '{' - Dot ::= '.' - DotStar ::= '.*' - Arrow ::= '->' - ArrowStar ::= '->*' - PlusPlus ::= '++' - MinusMinus ::= '--' - And ::= '&' - Star ::= '*' - Plus ::= '+' - Minus ::= '-' - Tilde ::= '~' - Bang ::= '!' - Slash ::= '/' - Percent ::= '%' - RightShift ::= '>>' - LeftShift ::= '<<' - LT ::= '<' - GT ::= '>' - LE ::= '<=' - GE ::= '>=' - EQ ::= '==' - NE ::= '!=' - Caret ::= '^' - Or ::= '|' - AndAnd ::= '&&' - OrOr ::= '||' - Question ::= '?' - Colon ::= ':' - ColonColon ::= '::' - DotDotDot ::= '...' - Assign ::= '=' - StarAssign ::= '*=' - SlashAssign ::= '/=' - PercentAssign ::= '%=' - PlusAssign ::= '+=' - MinusAssign ::= '-=' - RightShiftAssign ::= '>>=' - LeftShiftAssign ::= '<<=' - AndAssign ::= '&=' - CaretAssign ::= '^=' - OrAssign ::= '|=' - Comma ::= ',' - zero ::= '0' - - RightBracket -- these four have special rules for content assist - RightParen - RightBrace - SemiColon - -$End - - -$Globals -/. - import java.util.*; - - import org.eclipse.cdt.core.dom.ast.*; - import org.eclipse.cdt.core.dom.ast.cpp.*; - import org.eclipse.cdt.core.dom.lrparser.action.cpp.CPPASTNodeFactory; - import org.eclipse.cdt.core.dom.lrparser.action.cpp.CPPBuildASTParserAction; - import org.eclipse.cdt.core.dom.lrparser.IParser; - import org.eclipse.cdt.core.dom.lrparser.IParserActionTokenProvider; - import org.eclipse.cdt.core.dom.lrparser.util.DebugUtil; -./ -$End - --- TODO move as much code and macros as possible into a common file - -$Define - -- These macros allow the template and header code to be customized by an extending parser. - $ast_class /.Object./ - $additional_interfaces /. , IParserActionTokenProvider, IParser ./ - - $build_action_class /. CPPBuildASTParserAction ./ - $resolve_action_class /. C99TypedefTrackerParserAction ./ - $node_factory_create_expression /. CPPASTNodeFactory.DEFAULT_INSTANCE ./ - - $action_class /. CPPParserAction ./ - $data_class /. Object ./ -- allow anything to be passed between actions - - $UndoResolver /.$Undo action.resolver.undo(); $EndUndo./ - - $Resolve /. $BeginTrial $resolve. - ./ - $EndResolve /. $EndTrial - $UndoResolver - ./ -- undo actions are automatically generated for binding resolution actions - - $Builder /. $BeginFinal $builder. - ./ - $EndBuilder /. $EndFinal ./ - - $Build /. $Action $Builder ./ - $EndBuild /. $EndBuilder $EndAction ./ - - $resolve /. action.resolver./ - $builder /. action.builder./ - - -- comment out when using trial/undo - $Action /. $BeginAction ./ - $BeginFinal /. ./ - $EndFinal /. ./ - -$End - - -$Headers -/. - private $action_class action; - - // uncomment to use with backtracking parser - public $action_type() { // constructor - } - - private void initActions(IASTTranslationUnit tu) { - // binding resolution actions need access to IASTName nodes, temporary - action = new $action_class(); - //action.resolver = new $resolve_action_class(this); - action.builder = new $build_action_class($node_factory_create_expression, this, tu); - //action.builder.setTokenMap(CPPParsersym.orderedTerminalSymbols); - - // comment this line to use with backtracking parser - //setParserAction(action); - } - - - public void addToken(IToken token) { - token.setKind(mapKind(token.getKind())); - super.addToken(token); - } - - - public void setTokens(List tokens) { - resetTokenStream(); - for(IToken token : tokens) { - addToken(token); - } - } - - public IASTCompletionNode parse(IASTTranslationUnit tu) { - // this has to be done, or... kaboom! - setStreamLength(getSize()); - initActions(tu); - - final int errorRepairCount = -1; // _1 means full error handling - parser(null, errorRepairCount); // do the actual parse - super.resetTokenStream(); // allow tokens to be garbage collected - - // the completion node may be null - IASTCompletionNode compNode = action.builder.getASTCompletionNode(); - - action = null; - - // Comment this line to use with backtracking parser - //parserAction = null; - - return compNode; - } - - - 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 - public List getRuleTokens() { - return Collections.unmodifiableList(getTokens().subList(getLeftSpan(), getRightSpan() + 1)); - } - - -./ -$End - - $Start - translation_unit -$End - - - -$Rules - ------------------------------------------------------------------------------------------- --- AST and Symbol Table Scoping ------------------------------------------------------------------------------------------- - - - - ::= $empty - /.$Action $Builder openASTScope(); $EndBuilder $EndAction./ - - - ::= $empty - -- /.$Action $Resolve openSymbolScope(); $EndResolve $EndAction./ - - - ::= $empty - -- /.$Action $Resolve openDeclarationScope(); $EndResolve $EndAction./ - - - ::= $empty - /.$Action $Builder consumePlaceHolder(); $EndBuilder $EndAction./ - - - ::= $empty - /.$Action $Builder consumeEmpty(); $EndBuilder $EndAction./ - ------------------------------------------------------------------------------------------- --- Content assist ------------------------------------------------------------------------------------------- - --- The EndOfCompletion token is a special token that matches some punctuation. --- These tokens allow the parse to complete successfully after a Completion token --- is encountered. - - -']' ::=? 'RightBracket' - --| 'EndOfCompletion' - -')' ::=? 'RightParen' - --| 'EndOfCompletion' - -'}' ::=? 'RightBrace' - --| 'EndOfCompletion' - -';' ::=? 'SemiColon' - --| 'EndOfCompletion' - - - - ------------------------------------------------------------------------------------------- --- Basic Concepts ------------------------------------------------------------------------------------------- - - -translation_unit - ::= declaration_seq - /. $Build consumeTranslationUnit(); $EndBuild ./ - | $empty - /. $Build consumeTranslationUnit(); $EndBuild ./ - ---expression_as_translation_unit --- ::= expression --- /. $Build consumeExpressionAsTranslationUnit(); $EndBuild ./ - - ------------------------------------------------------------------------------------------- --- Expressions ------------------------------------------------------------------------------------------- - -literal - ::= 'integer' - /. $Build consumeExpressionLiteral(ICPPASTLiteralExpression.lk_integer_constant); $EndBuild ./ - | '0' - /. $Build consumeExpressionLiteral(ICPPASTLiteralExpression.lk_integer_constant); $EndBuild ./ - | 'floating' - /. $Build consumeExpressionLiteral(ICPPASTLiteralExpression.lk_float_constant); $EndBuild ./ - | 'charconst' - /. $Build consumeExpressionLiteral(ICPPASTLiteralExpression.lk_char_constant); $EndBuild ./ - | 'stringlit' - /. $Build consumeExpressionLiteral(ICPPASTLiteralExpression.lk_string_literal); $EndBuild ./ - | 'true' - /. $Build consumeExpressionLiteral(ICPPASTLiteralExpression.lk_true); $EndBuild ./ - | 'false' - /. $Build consumeExpressionLiteral(ICPPASTLiteralExpression.lk_false); $EndBuild ./ - | 'this' - /. $Build consumeExpressionLiteral(ICPPASTLiteralExpression.lk_this); $EndBuild ./ - - -primary_expression - ::= literal - | '(' expression ')' - /. $Build consumeExpressionBracketed(); $EndBuild ./ - | id_expression - - -id_expression - ::= qualified_or_unqualified_name - /. $Build consumeExpressionName(); $EndBuild ./ - - --- Pushes an IASTName on the stack, if you want an id expression then wrap the name -qualified_or_unqualified_name - ::= unqualified_id_name - | qualified_id_name - - -unqualified_id_name - ::= identifier_name - | operator_function_id_name - | conversion_function_id_name - | template_id_name - | '~' class_name - /. $Build consumeDestructorName(); $EndBuild ./ - - --- wrap an identifier in a name node -identifier_name - ::= 'identifier' - /. $Build consumeIdentifierName(); $EndBuild ./ - - -template_opt - ::= 'template' - /. $Build consumePlaceHolder(); $EndBuild ./ - | $empty - /. $Build consumeEmpty(); $EndBuild ./ - - -dcolon_opt - ::= '::' - /. $Build consumePlaceHolder(); $EndBuild ./ - | $empty - /. $Build consumeEmpty(); $EndBuild ./ - - --- this is a compound name -qualified_id_name - ::= dcolon_opt nested_name_specifier template_opt unqualified_id_name - /. $Build consumeQualifiedId(true); $EndBuild ./ - | '::' identifier_name - /. $Build consumeGlobalQualifiedId(); $EndBuild ./ - | '::' operator_function_id_name - /. $Build consumeGlobalQualifiedId(); $EndBuild ./ - | '::' template_id_name - /. $Build consumeGlobalQualifiedId(); $EndBuild ./ - - - ---unqualified_id_with_template_name --- ::= template_opt unqualified_id_name --- /. $Build consumeNameWithTemplateKeyword(); $EndBuild ./ - - --- puts a list of names in reverse order on the stack --- always ends with :: --- this is the part of a qualified id that comes before the last :: --- but does not include a :: at the front -nested_name_specifier - ::= class_or_namespace_name '::' nested_name_specifier_with_template - /. $Build consumeNestedNameSpecifier(true); $EndBuild ./ - | class_or_namespace_name '::' - /. $Build consumeNestedNameSpecifier(false); $EndBuild ./ - - -nested_name_specifier_with_template - ::= class_or_namespace_name_with_template '::' nested_name_specifier_with_template - /. $Build consumeNestedNameSpecifier(true); $EndBuild ./ - | class_or_namespace_name_with_template '::' - /. $Build consumeNestedNameSpecifier(false); $EndBuild ./ - - -class_or_namespace_name_with_template - ::= template_opt class_or_namespace_name - /. $Build consumeNameWithTemplateKeyword(); $EndBuild ./ - - - -nested_name_specifier_opt - ::= nested_name_specifier - | $empty - /. $Build consumeNestedNameSpecifierEmpty(); $EndBuild ./ - - -class_or_namespace_name -- just identifiers - ::= class_name - | namespace_name - - -postfix_expression - ::= primary_expression - | postfix_expression '[' expression ']' - /. $Build consumeExpressionArraySubscript(); $EndBuild ./ - | postfix_expression '(' expression_list_opt ')' - /. $Build consumeExpressionFunctionCall(); $EndBuild ./ - | simple_type_specifier '(' expression_list_opt ')' -- explicit type conversion operator - /. $Build consumeExpressionSimpleTypeConstructor(); $EndBuild ./ - | 'typename' dcolon_opt nested_name_specifier identifier_name '(' expression_list_opt ')' - /. $Build consumeExpressionTypeName(); $EndBuild ./ - | 'typename' dcolon_opt nested_name_specifier template_opt template_id_name '(' expression_list_opt ')' - /. $Build consumeExpressionTypeName(); $EndBuild ./ - | postfix_expression '.' qualified_or_unqualified_name - /. $Build consumeExpressionFieldReference(false, false); $EndBuild ./ - | postfix_expression '->' qualified_or_unqualified_name - /. $Build consumeExpressionFieldReference(true, false); $EndBuild ./ - | postfix_expression '.' 'template' qualified_or_unqualified_name - /. $Build consumeExpressionFieldReference(false, true); $EndBuild ./ - | postfix_expression '->' 'template' qualified_or_unqualified_name - /. $Build consumeExpressionFieldReference(true, true); $EndBuild ./ - | postfix_expression '.' pseudo_destructor_name - /. $Build consumeExpressionFieldReference(false, false); $EndBuild ./ - | postfix_expression '->' pseudo_destructor_name - /. $Build consumeExpressionFieldReference(true, false); $EndBuild ./ - | postfix_expression '++' - /. $Build consumeExpressionUnaryOperator(IASTUnaryExpression.op_postFixIncr); $EndBuild ./ - | postfix_expression '--' - /. $Build consumeExpressionUnaryOperator(IASTUnaryExpression.op_postFixDecr); $EndBuild ./ - | 'dynamic_cast' '<' type_id '>' '(' expression ')' - /. $Build consumeExpressionCast(ICPPASTCastExpression.op_dynamic_cast); $EndBuild ./ - | 'static_cast' '<' type_id '>' '(' expression ')' - /. $Build consumeExpressionCast(ICPPASTCastExpression.op_static_cast); $EndBuild ./ - | 'reinterpret_cast' '<' type_id '>' '(' expression ')' - /. $Build consumeExpressionCast(ICPPASTCastExpression.op_reinterpret_cast); $EndBuild ./ - | 'const_cast' '<' type_id '>' '(' expression ')' - /. $Build consumeExpressionCast(ICPPASTCastExpression.op_const_cast); $EndBuild ./ - | 'typeid' '(' expression ')' - /. $Build consumeExpressionUnaryOperator(ICPPASTUnaryExpression.op_typeid); $EndBuild ./ - | 'typeid' '(' type_id ')' - /. $Build consumeExpressionTypeId(ICPPASTTypeIdExpression.op_typeid); $EndBuild ./ - - - --- just names --- Don't even know if I really need this rule, the DOM parser just parses qualified_or_unqualified_name --- instead of pseudo_destructor_name. But the difference is I have different --- token types, so maybe I do need this rule. -pseudo_destructor_name - ::= dcolon_opt nested_name_specifier_opt type_name '::' '~' type_name - /. $Build consumePsudoDestructorName(true); $EndBuild ./ - | dcolon_opt nested_name_specifier 'template' template_id_name '::' '~' type_name - /. $Build consumePsudoDestructorName(true); $EndBuild ./ - | dcolon_opt nested_name_specifier_opt '~' type_name - /. $Build consumePsudoDestructorName(false); $EndBuild ./ - - -unary_expression - ::= postfix_expression - | new_expression - | delete_expression - | '++' cast_expression - /. $Build consumeExpressionUnaryOperator(IASTUnaryExpression.op_prefixIncr); $EndBuild ./ - | '--' cast_expression - /. $Build consumeExpressionUnaryOperator(IASTUnaryExpression.op_prefixDecr); $EndBuild ./ - | '&' cast_expression - /. $Build consumeExpressionUnaryOperator(IASTUnaryExpression.op_amper); $EndBuild ./ - | '*' cast_expression - /. $Build consumeExpressionUnaryOperator(IASTUnaryExpression.op_star); $EndBuild ./ - | '+' cast_expression - /. $Build consumeExpressionUnaryOperator(IASTUnaryExpression.op_plus); $EndBuild ./ - | '-' cast_expression - /. $Build consumeExpressionUnaryOperator(IASTUnaryExpression.op_minus); $EndBuild ./ - | '~' cast_expression - /. $Build consumeExpressionUnaryOperator(IASTUnaryExpression.op_tilde); $EndBuild ./ - | '!' cast_expression - /. $Build consumeExpressionUnaryOperator(IASTUnaryExpression.op_not); $EndBuild ./ - | 'sizeof' unary_expression - /. $Build consumeExpressionUnaryOperator(IASTUnaryExpression.op_sizeof); $EndBuild ./ - | 'sizeof' '(' type_id ')' - /. $Build consumeExpressionTypeId(ICPPASTTypeIdExpression.op_sizeof); $EndBuild ./ - - -new_expression -- done - ::= dcolon_opt 'new' new_placement_opt new_type_id new_array_expressions_opt new_initializer_opt - /. $Build consumeExpressionNew(false); $EndBuild ./ - | dcolon_opt 'new' new_placement_opt '(' type_id ')' new_initializer_opt - /. $Build consumeExpressionNew(true); $EndBuild ./ - - -new_placement -- done - ::= '(' expression_list ')' - - -new_placement_opt -- done - ::= new_placement - | $empty - /. $Build consumeEmpty(); $EndBuild ./ - - -new_type_id - ::= type_specifier_seq - /. $Build consumeTypeId(false); $EndBuild ./ - | type_specifier_seq new_declarator - /. $Build consumeTypeId(true); $EndBuild ./ - - -new_declarator -- pointer operators are part of the type id, held in an empty declarator - ::= new_pointer_operators - /. $Build consumeNewDeclarator(); $EndBuild ./ - - -new_pointer_operators -- presumably this will not need an action as ptr_operator will have one - ::= ptr_operator - | ptr_operator new_pointer_operators - - -new_array_expressions - ::= '[' expression ']' - | new_array_expressions '[' constant_expression ']' - - -new_array_expressions_opt - ::= new_array_expressions - | $empty - - -new_initializer -- done - ::= '(' expression_list_opt ')' -- even if the parens are there we get null in the AST - - -new_initializer_opt -- done - ::= new_initializer - | $empty - /. $Build consumeEmpty(); $EndBuild ./ - - -delete_expression - ::= dcolon_opt 'delete' cast_expression - /. $Build consumeExpressionDelete(false); $EndBuild ./ - | dcolon_opt 'delete' '[' ']' cast_expression - /. $Build consumeExpressionDelete(true); $EndBuild ./ - - -cast_expression - ::= unary_expression - | '(' type_id ')' cast_expression - /. $Build consumeExpressionCast(ICPPASTCastExpression.op_cast); $EndBuild ./ - - -pm_expression - ::= cast_expression - | pm_expression '.*' cast_expression - /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_pmdot); $EndBuild ./ - | pm_expression '->*' cast_expression - /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_pmarrow); $EndBuild ./ - - -multiplicative_expression - ::= pm_expression - | multiplicative_expression '*' pm_expression - /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_multiply); $EndBuild ./ - | multiplicative_expression '/' pm_expression - /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_divide); $EndBuild ./ - | multiplicative_expression '%' pm_expression - /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_modulo); $EndBuild ./ - - -additive_expression - ::= multiplicative_expression - | additive_expression '+' multiplicative_expression - /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_plus); $EndBuild ./ - | additive_expression '-' multiplicative_expression - /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_minus); $EndBuild ./ - - -shift_expression - ::= additive_expression - | shift_expression '<<' additive_expression - /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_shiftLeft); $EndBuild ./ - | shift_expression '>>' additive_expression - /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_shiftRight); $EndBuild ./ - - -relational_expression - ::= shift_expression - | relational_expression '<' shift_expression - /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_lessThan); $EndBuild ./ - | relational_expression '>' shift_expression - /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_greaterThan); $EndBuild ./ - | relational_expression '<=' shift_expression - /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_lessEqual); $EndBuild ./ - | relational_expression '>=' shift_expression - /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_greaterEqual); $EndBuild ./ - - -equality_expression - ::= relational_expression - | equality_expression '==' relational_expression - /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_equals); $EndBuild ./ - | equality_expression '!=' relational_expression - /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_notequals); $EndBuild ./ - - -and_expression - ::= equality_expression - | and_expression '&' equality_expression - /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_binaryAnd); $EndBuild ./ - - -exclusive_or_expression - ::= and_expression - | exclusive_or_expression '^' and_expression - /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_binaryXor); $EndBuild ./ - - -inclusive_or_expression - ::= exclusive_or_expression - | inclusive_or_expression '|' exclusive_or_expression - /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_binaryOr); $EndBuild ./ - - -logical_and_expression - ::= inclusive_or_expression - | logical_and_expression '&&' inclusive_or_expression - /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_logicalAnd); $EndBuild ./ - - -logical_or_expression - ::= logical_and_expression - | logical_or_expression '||' logical_and_expression - /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_logicalOr); $EndBuild ./ - - -conditional_expression - ::= logical_or_expression - | logical_or_expression '?' expression ':' assignment_expression - /. $Build consumeExpressionConditional(); $EndBuild ./ - - -throw_expression - ::= 'throw' - /. $Build consumeExpressionThrow(false); $EndBuild ./ - | 'throw' assignment_expression - /. $Build consumeExpressionThrow(true); $EndBuild ./ - - -assignment_expression - ::= conditional_expression - | throw_expression - | logical_or_expression '=' assignment_expression - /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_assign); $EndBuild ./ - | logical_or_expression '*=' assignment_expression - /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_multiplyAssign); $EndBuild ./ - | logical_or_expression '/=' assignment_expression - /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_divideAssign); $EndBuild ./ - | logical_or_expression '%=' assignment_expression - /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_moduloAssign); $EndBuild ./ - | logical_or_expression '+=' assignment_expression - /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_plusAssign); $EndBuild ./ - | logical_or_expression '-=' assignment_expression - /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_minusAssign); $EndBuild ./ - | logical_or_expression '>>=' assignment_expression - /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_shiftRightAssign); $EndBuild ./ - | logical_or_expression '<<=' assignment_expression - /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_shiftLeftAssign); $EndBuild ./ - | logical_or_expression '&=' assignment_expression - /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_binaryAndAssign); $EndBuild ./ - | logical_or_expression '^=' assignment_expression - /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_binaryXorAssign); $EndBuild ./ - | logical_or_expression '|=' assignment_expression - /. $Build consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_binaryOrAssign); $EndBuild ./ - - -expression - ::= expression_list - | ERROR_TOKEN - /. $Build consumeExpressionProblem(); $EndBuild ./ - --- expression_list and expression_list_opt always result in a single element on the stack --- the element might be an expression, an expression list or null - -expression_list - ::= expression_list_actual - /. $Build consumeExpressionList(); $EndBuild ./ - - -expression_list_actual - ::= assignment_expression - | expression_list_actual ',' assignment_expression - - -expression_list_opt - ::= expression_list - | $empty - /. $Build consumeEmpty(); $EndBuild ./ - - -expression_opt - ::= expression - | $empty - /. $Build consumeEmpty(); $EndBuild ./ - - -constant_expression - ::= conditional_expression - - -constant_expression_opt - ::= constant_expression - | $empty - /. $Build consumeEmpty(); $EndBuild ./ - - ------------------------------------------------------------------------------------------- --- Statements ------------------------------------------------------------------------------------------- - --- TODO: declarations in conditions - -statement - ::= labeled_statement - | expression_statement - | compound_statement - | selection_statement - | iteration_statement - | jump_statement - | declaration_statement - | try_block - | ERROR_TOKEN - /. $Build consumeStatementProblem(); $EndBuild ./ - - -labeled_statement - ::= identifier ':' statement - /. $Build consumeStatementLabeled(); $EndBuild ./ - | case constant_expression ':' - /. $Build consumeStatementCase(); $EndBuild ./ - | default ':' - /. $Build consumeStatementDefault(); $EndBuild ./ - - -expression_statement - ::= expression ';' - /. $Build consumeStatementExpression(); $EndBuild ./ - | ';' - /. $Build consumeStatementNull(); $EndBuild ./ - - -compound_statement - ::= '{' statement_seq '}' - /. $Build consumeStatementCompoundStatement(true); $EndBuild ./ - | '{' '}' - /. $Build consumeStatementCompoundStatement(false); $EndBuild ./ - - -statement_seq - ::= statement - | statement_seq statement - - -selection_statement - ::= 'if' '(' condition ')' statement - /. $Build consumeStatementIf(false); $EndBuild ./ - | 'if' '(' condition ')' statement 'else' statement - /. $Build consumeStatementIf(true); $EndBuild ./ - | 'switch' '(' condition ')' statement - /. $Build consumeStatementSwitch(); $EndBuild ./ - - - -condition - ::= expression - | type_specifier_seq declarator '=' assignment_expression - /. $Build consumeConditionDeclaration(); $EndBuild ./ - - --- where did this come from? ---condition_opt --- ::= condition --- | $empty --- /. $Build consumeEmpty(); $EndBuild ./ - - -iteration_statement - ::= 'while' '(' condition ')' statement - /. $Build consumeStatementWhileLoop(); $EndBuild ./ - | 'do' statement 'while' '(' expression ')' ';' - /. $Build consumeStatementDoLoop(); $EndBuild ./ - | 'for' '(' expression_opt ';' expression_opt ';' expression_opt ')' statement - /. $Build consumeStatementForLoop(); $EndBuild ./ - | 'for' '(' simple_declaration expression_opt ';' expression_opt ')' statement - /. $Build consumeStatementForLoop(); $EndBuild ./ - - -jump_statement - ::= 'break' ';' - /. $Build consumeStatementBreak(); $EndBuild ./ - | 'continue' ';' - /. $Build consumeStatementContinue(); $EndBuild ./ - | 'return' expression ';' - /. $Build consumeStatementReturn(true); $EndBuild ./ - | 'return' ';' - /. $Build consumeStatementReturn(false); $EndBuild ./ - | 'goto' 'identifier' ';' - /. $Build consumeStatementGoto(); $EndBuild ./ - - -declaration_statement - ::= block_declaration - /. $Build consumeStatementDeclaration(); $EndBuild ./ - - - ------------------------------------------------------------------------------------------- --- Declarations ------------------------------------------------------------------------------------------- - - -declaration - ::= block_declaration - | function_definition -- done - | template_declaration -- done - | explicit_instantiation -- done - | explicit_specialization -- done - | linkage_specification -- done - | namespace_definition -- done - - -block_declaration - ::= simple_declaration -- done - | asm_definition -- done - | namespace_alias_definition -- done - | using_declaration -- done - | using_directive -- done - - -declaration_seq - ::= declaration - | declaration_seq declaration - - - -declaration_seq_opt - ::= declaration_seq - | $empty - - - -simple_declaration - ::= declaration_specifiers_opt init_declarator_list_opt ';' - /. $Build consumeDeclarationSimple(true); $EndBuild ./ - - --- declaration specifier nodes not created here, they are created by sub-rules --- these rules add IToken modifiers to the declspec nodes -declaration_specifiers - ::= simple_declaration_specifiers - /. $Build consumeDeclarationSpecifiersSimple(); $EndBuild ./ - | class_declaration_specifiers - /. $Build consumeDeclarationSpecifiersComposite(); $EndBuild ./ - | elaborated_declaration_specifiers - /. $Build consumeDeclarationSpecifiersComposite(); $EndBuild ./ - | enum_declaration_specifiers - /. $Build consumeDeclarationSpecifiersComposite(); $EndBuild ./ - | type_name_declaration_specifiers - /. $Build consumeDeclarationSpecifiersTypeName(); $EndBuild ./ - - -declaration_specifiers_opt - ::= declaration_specifiers - | $empty - /. $Build consumeEmpty(); $EndBuild ./ - - --- what about type qualifiers... cv_qualifier -no_type_declaration_specifier - ::= storage_class_specifier - | function_specifier - | cv_qualifier - | 'friend' - /. $Build consumeDeclSpecToken(); $EndBuild ./ - | 'typedef' - /. $Build consumeDeclSpecToken(); $EndBuild ./ - - -no_type_declaration_specifiers - ::= no_type_declaration_specifier - | no_type_declaration_specifiers no_type_declaration_specifier - - --- now also includes qualified names --- if there is no long long then this may be simplified -simple_declaration_specifiers - ::= simple_type_specifier - | no_type_declaration_specifiers simple_type_specifier - | simple_declaration_specifiers simple_type_specifier - | simple_declaration_specifiers no_type_declaration_specifier - - --- struct, union or class! -class_declaration_specifiers - ::= class_specifier - | no_type_declaration_specifiers class_specifier - | class_declaration_specifiers no_type_declaration_specifier - - --- elaborated means something different, but how different? -elaborated_declaration_specifiers - ::= elaborated_type_specifier - | no_type_declaration_specifiers elaborated_type_specifier - | elaborated_declaration_specifiers no_type_declaration_specifier - - --- Think this is the same -enum_declaration_specifiers - ::= enum_specifier - | no_type_declaration_specifiers enum_specifier - | enum_declaration_specifiers no_type_declaration_specifier - - --- just typedefs in C99, but expanded to type names in C++ (no tagging needed) -type_name_declaration_specifiers - ::= type_name_specifier - | no_type_declaration_specifiers type_name_specifier - | type_name_declaration_specifiers no_type_declaration_specifier - - - -- TODO comment this out ---decl_specifier --- ::= storage_class_specifier -- just keywords --- | type_specifier -- this is where the fun is - -- | function_specifier -- just keywords - -- | 'friend' - -- | 'typedef' - - -storage_class_specifier - ::= 'auto' - | 'register' - | 'static' - | 'extern' - | 'mutable' - - -function_specifier - ::= 'inline' - | 'virtual' - | 'explicit' - - -typedef_name - ::= 'identifier' - - ---type_specifier --- ::= simple_type_specifier -- int, void etc... --- | class_specifier -- structs, unions, classes --- | enum_specifier -- enums --- | elaborated_type_specifier -- its elaborated, but this is different than c, includes typename --- | cv_qualifier -- the const and volatile keywords (separated because they can be applied to pointer modifiers) - - ---simple_type_specifier --- ::= dcolon_opt nested_name_specifier_opt type_name --- /. $Build consumeQualifiedId(false); $EndBuild ./ --- | dcolon_opt nested_name_specifier 'template' template_id_name --- /. $Build consumeQualifiedId(false); $EndBuild ./ --- | simple_type_primitive_specifier - - -simple_type_specifier - ::= simple_type_specifier_token - /. $Build consumeDeclSpecToken(); $EndBuild ./ - - -simple_type_specifier_token - ::= 'char' - | 'wchar_t' - | 'bool' - | 'short' - | 'int' - | 'long' - | 'signed' - | 'unsigned' - | 'float' - | 'double' - | 'void' - - --- last two rules moved here from simple_type_specifier -type_name -- all identifiers of some kind - ::= class_name - | enum_name -- identifier - | typedef_name - - --- last two rules moved here from simple_type_specifier -type_name_specifier -- all identifiers of some kind - ::= type_name - | dcolon_opt nested_name_specifier_opt type_name - /. $Build consumeQualifiedId(false); $EndBuild ./ - | dcolon_opt nested_name_specifier 'template' template_id_name - /. $Build consumeQualifiedId(false); $EndBuild ./ - | 'typename' dcolon_opt nested_name_specifier identifier_name - /. $Build consumeQualifiedId(false); $EndBuild ./ - | 'typename' dcolon_opt nested_name_specifier template_opt template_id_name - /. $Build consumeQualifiedId(true); $EndBuild ./ - - --- used for forward declaration and incomplete types -elaborated_type_specifier - ::= class_keyword dcolon_opt nested_name_specifier_opt identifier_name - /. $Build consumeTypeSpecifierElaborated(false); $EndBuild ./ - | class_keyword dcolon_opt nested_name_specifier_opt template_opt template_id_name - /. $Build consumeTypeSpecifierElaborated(true); $EndBuild ./ - | 'enum' dcolon_opt nested_name_specifier_opt identifier_name - /. $Build consumeTypeSpecifierElaborated(false); $EndBuild ./ - - -enum_name - ::= 'identifier' - - -enum_specifier - ::= 'enum' '{' enumerator_list_opt '}' - /. $Build consumeTypeSpecifierEnumeration(false); $EndBuild ./ - | 'enum' 'identifier' '{' enumerator_list_opt '}' - /. $Build consumeTypeSpecifierEnumeration(true); $EndBuild ./ - - -enumerator_list - ::= enumerator_definition - | enumerator_list ',' enumerator_definition - - -enumerator_list_opt - ::= enumerator_list - | $empty - - -enumerator_definition - ::= enumerator - /. $Build consumeEnumerator(false); $EndBuild ./ - | enumerator '=' constant_expression - /. $Build consumeEnumerator(true); $EndBuild ./ - - -enumerator - ::= 'identifier' - - -namespace_name - ::= original_namespace_name - | namespace_alias - - -original_namespace_name - ::= 'identifier' - - -namespace_definition - ::= named_namespace_definition - | unnamed_namespace_definition - - -named_namespace_definition - ::= original_namespace_definition - | extension_namespace_definition - - -original_namespace_definition - ::= 'namespace' identifier_name '{' declaration_seq_opt '}' - /. $Build consumeNamespaceDefinition(true); $EndBuild ./ - - -extension_namespace_definition - ::= 'namespace' original_namespace_name '{' declaration_seq_opt '}' - /. $Build consumeNamespaceDefinition(true); $EndBuild ./ - - -unnamed_namespace_definition - ::= 'namespace' '{' declaration_seq_opt '}' - /. $Build consumeNamespaceDefinition(false); $EndBuild ./ - - -namespace_alias - ::= 'identifier' - - -namespace_alias_definition - ::= 'namespace' 'identifier' '=' dcolon_opt nested_name_specifier_opt namespace_name ';' - /. $Build consumeNamespaceAliasDefinition(); $EndBuild ./ - - ---qualified_namespace_specifier --- ::= dcolon_opt nested_name_specifier_opt namespace_name - - --- make more lenient! --- using_declaration --- ::= 'using' typename_opt dcolon_opt nested_name_specifier unqualified_id_name ';' --- | 'using' '::' unqualified_id_name ';' - - -using_declaration - ::= 'using' typename_opt dcolon_opt nested_name_specifier_opt unqualified_id_name ';' - /. $Build consumeUsingDeclaration(); $EndBuild ./ - - -typename_opt - ::= 'typename' - /. $Build consumePlaceHolder(); $EndBuild ./ - | $empty - /. $Build consumeEmpty(); $EndBuild ./ - - -using_directive - ::= 'using' 'namespace' dcolon_opt nested_name_specifier_opt namespace_name ';' - /. $Build consumeUsingDirective(); $EndBuild ./ - - -asm_definition - ::= 'asm' '(' 'stringlit' ')' ';' - /. $Build consumeDeclarationASM(); $EndBuild ./ - - -linkage_specification - ::= 'extern' 'stringlit' '{' declaration_seq_opt '}' - /. $Build consumeLinkageSpecification(); $EndBuild ./ - | 'extern' 'stringlit' declaration - /. $Build consumeLinkageSpecification(); $EndBuild ./ - - -init_declarator_list - ::= init_declarator - | init_declarator_list ',' init_declarator - - -init_declarator_list_opt - ::= init_declarator_list - | $empty - - -init_declarator - ::= declarator - | declarator initializer - /. $Build consumeDeclaratorWithInitializer(true); $EndBuild ./ - - -declarator - ::= direct_declarator - | ptr_operator_seq direct_declarator - /. $Build consumeDeclaratorWithPointer(true); $EndBuild ./ - - -direct_declarator - ::= basic_direct_declarator - | function_direct_declarator - | array_direct_declarator - - -basic_direct_declarator - ::= declarator_id_name - /. $Build consumeDirectDeclaratorIdentifier(); $EndBuild ./ - | '(' declarator ')' - /. $Build consumeDirectDeclaratorBracketed(); $EndBuild ./ - - -function_direct_declarator - ::= basic_direct_declarator '(' parameter_declaration_clause ')' cv_qualifier_seq_opt exception_specification_opt - /. $Build consumeDirectDeclaratorFunctionDeclarator(true); $EndBuild ./ - - -array_direct_declarator - ::= array_direct_declarator array_modifier - /. $Build consumeDirectDeclaratorArrayDeclarator(true); $EndBuild ./ - | basic_direct_declarator array_modifier - /. $Build consumeDirectDeclaratorArrayDeclarator(true); $EndBuild ./ - - -array_modifier - ::= '[' constant_expression ']' - /. $Build consumeDirectDeclaratorArrayModifier(true); $EndBuild ./ - | '[' ']' - /. $Build consumeDirectDeclaratorArrayModifier(false); $EndBuild ./ - - -ptr_operator - ::= '*' cv_qualifier_seq_opt - /. $Build consumePointer(); $EndBuild ./ - | '&' - /. $Build consumeReferenceOperator(); $EndBuild ./ - | dcolon_opt nested_name_specifier '*' cv_qualifier_seq_opt - /. $Build consumePointerToMember(); $EndBuild ./ - - -ptr_operator_seq - ::= ptr_operator - | ptr_operator_seq ptr_operator - - ---ptr_operator_seq_opt --- ::= ptr_operator_seq --- | $empty - - -cv_qualifier_seq - ::= cv_qualifier cv_qualifier_seq_opt - - -cv_qualifier_seq_opt - ::= cv_qualifier_seq - | $empty - - -cv_qualifier - ::= 'const' - /. $Build consumeDeclSpecToken(); $EndBuild ./ - | 'volatile' - /. $Build consumeDeclSpecToken(); $EndBuild ./ - - -declarator_id_name - ::= qualified_or_unqualified_name - | dcolon_opt nested_name_specifier_opt type_name - /. $Build consumeQualifiedId(false); $EndBuild ./ - - -type_id - ::= type_specifier_seq - /. $Build consumeTypeId(false); $EndBuild ./ - | type_specifier_seq abstract_declarator - /. $Build consumeTypeId(true); $EndBuild ./ - - ---type_specifier_seq --- ::= type_specifier --- | type_specifier_seq type_specifier - - --- more lenient than spec, but easier to deal with -type_specifier_seq - ::= declaration_specifiers - - - -abstract_declarator - ::= direct_abstract_declarator - | ptr_operator_seq - /. $Build consumeDeclaratorWithPointer(false); $EndBuild ./ - | ptr_operator_seq direct_abstract_declarator - /. $Build consumeDeclaratorWithPointer(true); $EndBuild ./ - - -direct_abstract_declarator - ::= basic_direct_abstract_declarator - | array_direct_abstract_declarator - | function_direct_abstract_declarator - - -basic_direct_abstract_declarator - ::= '(' abstract_declarator ')' - /. $Build consumeDirectDeclaratorBracketed(); $EndBuild ./ - - -array_direct_abstract_declarator - ::= array_modifier - /. $Build consumeDirectDeclaratorArrayDeclarator(false); $EndBuild ./ - | array_direct_abstract_declarator array_modifier - /. $Build consumeDirectDeclaratorArrayDeclarator(true); $EndBuild ./ - | basic_direct_abstract_declarator array_modifier - /. $Build consumeDirectDeclaratorArrayDeclarator(true); $EndBuild ./ - - -function_direct_abstract_declarator - ::= basic_direct_abstract_declarator '(' parameter_declaration_clause ')' cv_qualifier_seq_opt exception_specification_opt - /. $Build consumeDirectDeclaratorFunctionDeclarator(true); $EndBuild ./ - | '(' parameter_declaration_clause ')' cv_qualifier_seq_opt exception_specification_opt - /. $Build consumeDirectDeclaratorFunctionDeclarator(false); $EndBuild ./ - - --- actions just place a marker indicating if '...' was parsed -parameter_declaration_clause - ::= parameter_declaration_list_opt '...' - /. $Build consumePlaceHolder(); $EndBuild ./ - | parameter_declaration_list_opt - /. $Build consumeEmpty(); $EndBuild ./ - | parameter_declaration_list ',' '...' - /. $Build consumePlaceHolder(); $EndBuild ./ - - -parameter_declaration_list - ::= parameter_declaration - | parameter_declaration_list ',' parameter_declaration - - -parameter_declaration_list_opt - ::= parameter_declaration_list - | $empty - - -abstract_declarator_opt - ::= abstract_declarator - | $empty - /. $Build consumeEmpty(); $EndBuild ./ - - -parameter_declaration - ::= declaration_specifiers parameter_init_declarator - /. $Build consumeParameterDeclaration(); $EndBuild ./ - | declaration_specifiers - /. $Build consumeParameterDeclarationWithoutDeclarator(); $EndBuild ./ - - -parameter_init_declarator - ::= declarator - | declarator '=' parameter_initializer - /. $Build consumeDeclaratorWithInitializer(true); $EndBuild ./ - | abstract_declarator - | abstract_declarator '=' parameter_initializer - /. $Build consumeDeclaratorWithInitializer(true); $EndBuild ./ - | '=' parameter_initializer - /. $Build consumeDeclaratorWithInitializer(false); $EndBuild ./ - - -parameter_initializer - ::= assignment_expression - /. $Build consumeInitializer(); $EndBuild ./ - - -function_definition - ::= declaration_specifiers_opt function_direct_declarator ctor_initializer_list_opt function_body - /. $Build consumeFunctionDefinition(false); $EndBuild ./ - | declaration_specifiers_opt function_direct_declarator 'try' ctor_initializer_list_opt function_body handler_seq - /. $Build consumeFunctionDefinition(true); $EndBuild ./ - - -function_body - ::= compound_statement - - -initializer - ::= '=' initializer_clause - | '(' expression_list ')' - /. $Build consumeInitializerConstructor(); $EndBuild ./ - - -initializer_clause - ::= assignment_expression - /. $Build consumeInitializer(); $EndBuild ./ - | '{' initializer_list ',' '}' - /. $Build consumeInitializerList(); $EndBuild ./ - | '{' initializer_list '}' - /. $Build consumeInitializerList(); $EndBuild ./ - | '{' '}' - /. $Build consumeInitializerList(); $EndBuild ./ - - -initializer_list - ::= initializer_clause - | initializer_list ',' initializer_clause - - - ------------------------------------------------------------------------------------------- --- Classes ------------------------------------------------------------------------------------------- - - -class_name - ::= identifier_name - | template_id_name - - -class_specifier -- done - ::= class_head '{' member_declaration_list_opt '}' - /. $Build consumeClassSpecifier(); $EndBuild ./ - - -class_head -- done - ::= class_keyword identifier_name_opt base_clause_opt - /. $Build consumeClassHead(false); $EndBuild ./ - | class_keyword template_id_name base_clause_opt - /. $Build consumeClassHead(false); $EndBuild ./ - | class_keyword nested_name_specifier identifier_name base_clause_opt - /. $Build consumeClassHead(true); $EndBuild ./ - | class_keyword nested_name_specifier template_id_name base_clause_opt - /. $Build consumeClassHead(true); $EndBuild ./ - - -identifier_opt - ::= 'identifier' - | $empty - - -identifier_name_opt - ::= identifier_name - | $empty - /. $Build consumeEmpty(); $EndBuild./ - - -class_keyword - ::= 'class' - | 'struct' - | 'union' - - -visibility_label - ::= access_specifier_keyword ':' - /. $Build consumeVisibilityLabel(); $EndBuild ./ - - - -member_declaration - ::= declaration_specifiers_opt member_declarator_list ';' - /. $Build consumeDeclarationSimple(true); $EndBuild ./ - | declaration_specifiers_opt ';' - /. $Build consumeDeclarationSimple(false); $EndBuild ./ - | function_definition ';' -- done - | function_definition -- done - | dcolon_opt nested_name_specifier template_opt unqualified_id_name ';' - /. $Build consumeMemberDeclarationQualifiedId(); $EndBuild ./ - | using_declaration -- done - | template_declaration - | visibility_label -- done - - - - -member_declaration_list - ::= member_declaration - | member_declaration_list member_declaration - - -member_declaration_list_opt - ::= member_declaration_list - | $empty - - -member_declarator_list - ::= member_declarator - | member_declarator_list ',' member_declarator - - -member_declarator - ::= declarator - -- | declarator pure_specifier -- parse this as a constant initializer - | declarator constant_initializer - /. $Build consumeMemberDeclaratorWithInitializer(); $EndBuild ./ - | bit_field_declarator ':' constant_expression - /. $Build consumeBitField(true); $EndBuild ./ - | ':' constant_expression - /. $Build consumeBitField(false); $EndBuild ./ - - -bit_field_declarator - ::= identifier_name - /. $Build consumeDirectDeclaratorIdentifier(); $EndBuild ./ - - ---pure_specifier -- this leads to ambiguities --- ::= '=' '0' - - -constant_initializer - ::= '=' constant_expression - - -base_clause - ::= ':' base_specifier_list - - -base_clause_opt - ::= base_clause - | $empty - - -base_specifier_list - ::= base_specifier - | base_specifier_list ',' base_specifier - - --- make this more lenient, allow virtual both before and after -base_specifier - ::= dcolon_opt nested_name_specifier_opt class_name - /. $Build consumeBaseSpecifier(false); $EndBuild ./ - | virtual_opt access_specifier_keyword virtual_opt dcolon_opt nested_name_specifier_opt class_name - /. $Build consumeBaseSpecifier(true); $EndBuild ./ - - -virtual_opt - ::= 'virtual' - /. $Build consumePlaceHolder(); $EndBuild ./ - | $empty - /. $Build consumeEmpty(); $EndBuild ./ - - -access_specifier_keyword - ::= 'private' - | 'protected' - | 'public' - - -access_specifier_keyword_opt - ::= access_specifier_keyword - | $empty - - -conversion_function_id_name - ::= 'operator' conversion_type_id - /. $Build consumeConversionName(); $EndBuild ./ - - -conversion_type_id - ::= type_specifier_seq conversion_declarator - /. $Build consumeTypeId(true); $EndBuild ./ - | type_specifier_seq - /. $Build consumeTypeId(false); $EndBuild ./ - - -conversion_declarator - ::= ptr_operator_seq - /. $Build consumeDeclaratorWithPointer(false); $EndBuild ./ - - - ---conversion_declarator_opt --- ::= conversion_declarator --- | $empty - - -ctor_initializer_list - ::= ':' mem_initializer_list - - -ctor_initializer_list_opt - ::= ctor_initializer_list - | $empty - - -mem_initializer_list - ::= mem_initializer - | mem_initializer ',' mem_initializer_list - - -mem_initializer - ::= mem_initializer_name '(' expression_list_opt ')' - /. $Build consumeConstructorChainInitializer(); $EndBuild ./ - - -mem_initializer_name - ::= dcolon_opt nested_name_specifier_opt class_name - /. $Build consumeQualifiedId(false); $EndBuild ./ - | identifier_name - - -operator_function_id_name - ::= operator_id_name - | operator_id_name '<' template_argument_list_opt '>' - /. $Build consumeTemplateId(); $EndBuild ./ - - -operator_id_name - ::= 'operator' overloadable_operator - /. $Build consumeOperatorName(); $EndBuild ./ - - -overloadable_operator - ::= 'new' | 'delete' | 'new' '[' ']' | 'delete' '[' ']' - | '+' | '-' | '*' | '/' | '%' | '^' | '&' | '|' | '~' - | '!' | '=' | '<' | '>' | '+=' | '-=' | '*=' | '/=' | '%=' - | '^=' | '&=' | '|=' | '<<' | '>>' | '>>=' | '<<=' | '==' | '!=' - | '<=' | '>=' | '&&' | '||' | '++' | '--' | ',' | '->*' | '->' - | '(' ')' | '[' ']' - - -template_declaration - ::= export_opt 'template' '<' template_parameter_list '>' declaration - /. $Build consumeTemplateDeclaration(); $EndBuild ./ - - -export_opt - ::= 'export' - /. $Build consumePlaceHolder(); $EndBuild ./ - | $empty - /. $Build consumeEmpty(); $EndBuild ./ - - -template_parameter_list - ::= template_parameter - | template_parameter_list ',' template_parameter - - -template_parameter - ::= type_parameter - | parameter_declaration - - -type_parameter - ::= 'class' identifier_name_opt - /. $Build consumeSimpleTypeTemplateParameter(false); $EndBuild ./ - | 'class' identifier_name_opt '=' type_id - /. $Build consumeSimpleTypeTemplateParameter(true); $EndBuild ./ - | 'typename' identifier_name_opt - /. $Build consumeSimpleTypeTemplateParameter(false); $EndBuild ./ - | 'typename' identifier_name_opt '=' type_id - /. $Build consumeSimpleTypeTemplateParameter(true); $EndBuild ./ - | 'template' '<' template_parameter_list '>' 'class' identifier_name_opt - /. $Build consumeTemplatedTypeTemplateParameter(false); $EndBuild ./ - | 'template' '<' template_parameter_list '>' 'class' identifier_name_opt '=' id_expression - /. $Build consumeTemplatedTypeTemplateParameter(true); $EndBuild ./ - - --- pushes name node on stack -template_id_name - ::= template_identifier '<' template_argument_list_opt '>' - /. $Build consumeTemplateId(); $EndBuild ./ - -template_identifier - ::= 'identifier' - - -template_argument_list - ::= template_argument - | template_argument_list ',' template_argument - - -template_argument_list_opt - ::= template_argument_list - | $empty - - -template_argument - ::= assignment_expression - | type_id - | qualified_or_unqualified_name - - -explicit_instantiation - ::= 'template' declaration - /. $Build consumeTemplateExplicitInstantiation(); $EndBuild ./ - - -explicit_specialization - ::= 'template' '<' '>' declaration - /. $Build consumeTemplateExplicitSpecialization(); $EndBuild ./ - - -try_block - ::= 'try' compound_statement handler_seq - /. $Build consumeStatementTryBlock(); $EndBuild ./ - - - - - -handler_seq - ::= handler - | handler_seq handler - - -handler - ::= 'catch' '(' exception_declaration ')' compound_statement - /. $Build consumeStatementCatchHandler(false); $EndBuild ./ - | 'catch' '(' '...' ')' compound_statement - /. $Build consumeStatementCatchHandler(true); $EndBuild ./ - - --- open a scope just so that we can reuse consumeDeclarationSimple() -exception_declaration - ::= type_specifier_seq declarator - /. $Build consumeDeclarationSimple(true); $EndBuild ./ - | type_specifier_seq abstract_declarator - /. $Build consumeDeclarationSimple(true); $EndBuild ./ - | type_specifier_seq - /. $Build consumeDeclarationSimple(false); $EndBuild ./ - - --- puts type ids on the stack -exception_specification - ::= 'throw' '(' type_id_list ')' - | 'throw' '(' ')' - - -exception_specification_opt - ::= exception_specification - | $empty - - -type_id_list - ::= type_id - | type_id_list ',' type_id \ No newline at end of file + translation_unit +$End \ No newline at end of file diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/IParser.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/IParser.java index 9510cc46a6a..c713971342f 100644 --- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/IParser.java +++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/IParser.java @@ -11,6 +11,7 @@ package org.eclipse.cdt.core.dom.lrparser; import org.eclipse.cdt.core.dom.ast.IASTCompletionNode; +import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; @@ -38,4 +39,10 @@ public interface IParser extends ITokenCollector { */ public IASTCompletionNode parse(IASTTranslationUnit tu); + + /** + * Returns the result of a secondary parser. + */ + public IASTNode getSecondaryParseResult(); + } diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/ITokenCollector.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/ITokenCollector.java index a35fc09b468..d8286687da1 100644 --- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/ITokenCollector.java +++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/ITokenCollector.java @@ -10,17 +10,43 @@ *******************************************************************************/ package org.eclipse.cdt.core.dom.lrparser; +import java.util.List; + import lpg.lpgjavaruntime.IToken; /** * An LPG parser object is initialized with the list of tokens * before parsing is invoked. * - * This interface allows tokens to be "injected" into the parser - * before the parser is run. - * * @author Mike Kucera */ public interface ITokenCollector { + + /** + * Used to add one token at a time to the parser. + * If this method is used to add tokens then the dummy token + * and the EOF token must be added by the client. + * + * This is really just an optimization, no intermediate data structures + * are required between the preprocessor and the parser. + * + * @throws NullPointerException if token is null + */ public void addToken(IToken token); + + /** + * Set the list of tokens that will be parsed. + * + * The given list does not need to contain dummy and EOF tokens, + * these will be added automatically. + * + * This method causes any tokens already contained in the parser + * to be removed. + * + * This method is mainly used by secondary parsers that are called + * from a main parser. + * + * @throws NullPointerException if tokens is null + */ + public void setTokens(List tokens); } diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/BuildASTParserAction.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/BuildASTParserAction.java index ac647bb859c..38ff5e9e0f7 100644 --- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/BuildASTParserAction.java +++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/BuildASTParserAction.java @@ -29,6 +29,7 @@ import org.eclipse.cdt.core.dom.ast.IASTConditionalExpression; import org.eclipse.cdt.core.dom.ast.IASTContinueStatement; import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier; import org.eclipse.cdt.core.dom.ast.IASTDeclaration; +import org.eclipse.cdt.core.dom.ast.IASTDeclarationStatement; import org.eclipse.cdt.core.dom.ast.IASTDeclarator; import org.eclipse.cdt.core.dom.ast.IASTDefaultStatement; import org.eclipse.cdt.core.dom.ast.IASTDoStatement; @@ -68,6 +69,7 @@ import org.eclipse.cdt.core.dom.ast.c.ICASTDeclSpecifier; import org.eclipse.cdt.core.dom.ast.c.ICASTPointer; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCastExpression; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLiteralExpression; +import org.eclipse.cdt.core.dom.lrparser.IParser; import org.eclipse.cdt.core.dom.lrparser.IParserActionTokenProvider; import org.eclipse.cdt.core.dom.lrparser.util.DebugUtil; import org.eclipse.cdt.internal.core.dom.lrparser.c99.C99NoCastExpressionParser; @@ -129,6 +131,12 @@ public abstract class BuildASTParserAction { protected abstract boolean isCompletionToken(IToken token); + /** + * Get the parser that will recognize expression statements. + */ + protected abstract IParser getExpressionStatementParser(); + + /** * Create a new parser action. * @param tu Root node of the AST, its list of declarations should be empty. @@ -186,8 +194,8 @@ public abstract class BuildASTParserAction { /** * Used to get the result of secondary parsers. */ - public Object getSecondaryParseResult() { - return astStack.pop(); + public IASTNode getSecondaryParseResult() { + return (IASTNode) astStack.pop(); } @@ -248,6 +256,16 @@ public abstract class BuildASTParserAction { } + /** + * Runs the given parser on the tokens that make up the current rule. + */ + protected IASTNode runSecondaryParser(IParser secondaryParser) { + secondaryParser.setTokens(parser.getRuleTokens()); + // need to pass tu because any completion nodes need to be linked directly to the root + IASTCompletionNode compNode = secondaryParser.parse(tu); + addNameToCompletionNode(compNode); + return secondaryParser.getSecondaryParseResult(); + } /************************************************************************************************************* @@ -261,8 +279,6 @@ public abstract class BuildASTParserAction { * in order to create a new scope in the AST stack. */ public void openASTScope() { - if(TRACE_ACTIONS) DebugUtil.printMethodTrace(); - astStack.openScope(); } @@ -365,6 +381,41 @@ public abstract class BuildASTParserAction { } + /** + * block_item ::= declaration | statement + * + * Wrap a declaration in a DeclarationStatement. + */ + public void consumeStatementDeclaration() { + if(TRACE_ACTIONS) DebugUtil.printMethodTrace(); + + IASTDeclaration decl = (IASTDeclaration) astStack.pop(); + IASTDeclarationStatement declarationStatement = nodeFactory.newDeclarationStatement(decl); + setOffsetAndLength(declarationStatement); + + // attempt to also parse the tokens as an expression + IASTExpressionStatement expressionStatement = null; + if(decl instanceof IASTSimpleDeclaration) { + IParser expressionParser = getExpressionStatementParser(); + IASTExpression expr = (IASTExpression) runSecondaryParser(expressionParser); + + if(expr != null && !(expr instanceof IASTProblemExpression)) { // the parse may fail + expressionStatement = nodeFactory.newExpressionStatement(expr); + setOffsetAndLength(expressionStatement); + } + } + + if(expressionStatement == null) + astStack.push(declarationStatement); + else + astStack.push(nodeFactory.newAmbiguousStatement(declarationStatement, expressionStatement)); + + + if(TRACE_AST_STACK) System.out.println(astStack); + } + + + /** * @param kind One of the kind flags from IASTLiteralExpression or ICPPASTLiteralExpression @@ -499,16 +550,13 @@ public abstract class BuildASTParserAction { setOffsetAndLength(expr); // try parsing as non-cast to resolve ambiguities - C99NoCastExpressionParser alternateParser = new C99NoCastExpressionParser(C99Parsersym.orderedTerminalSymbols); - alternateParser.setTokens(parser.getRuleTokens()); - IASTCompletionNode compNode = alternateParser.parse(tu); - addNameToCompletionNode(compNode); - IASTExpression alternateExpr = alternateParser.getParseResult(); + IParser secondaryParser = new C99NoCastExpressionParser(C99Parsersym.orderedTerminalSymbols); + IASTNode alternateExpr = runSecondaryParser(secondaryParser); if(alternateExpr == null || alternateExpr instanceof IASTProblemExpression) astStack.push(expr); else - astStack.push(nodeFactory.newAmbiguousExpression(expr, alternateExpr)); + astStack.push(nodeFactory.newAmbiguousExpression(expr, (IASTExpression)alternateExpr)); if(TRACE_AST_STACK) System.out.println(astStack); @@ -923,8 +971,19 @@ public abstract class BuildASTParserAction { * Even if there is potential for reuse it still may be cleaner to leave the * common stuff to just simple expressions and statements. * + * For C99: + * * declaration ::= declaration_specifiers init_declarator_list ';' * declaration ::= declaration_specifiers ';' + * + * + * For C++: + * + * simple_declaration + * ::= declaration_specifiers_opt init_declarator_list_opt ';' + * + * + * TODO Make both grammars the same here. */ public void consumeDeclarationSimple(boolean hasDeclaratorList) { if(TRACE_ACTIONS) DebugUtil.printMethodTrace(); @@ -932,6 +991,11 @@ public abstract class BuildASTParserAction { List declarators = (hasDeclaratorList) ? astStack.closeScope() : Collections.emptyList(); IASTDeclSpecifier declSpecifier = (IASTDeclSpecifier) astStack.pop(); // may be null + if(declSpecifier == null) { // can happen if implicit int is used + declSpecifier = nodeFactory.newSimpleDeclSpecifier(); + setOffsetAndLength(declSpecifier, parser.getLeftIToken().getStartOffset(), 0); + } + IASTSimpleDeclaration declaration = nodeFactory.newSimpleDeclaration(declSpecifier); for(Object declarator : declarators) diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/IASTNodeFactory.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/IASTNodeFactory.java index 55325fa08ac..1bdde595e87 100644 --- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/IASTNodeFactory.java +++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/IASTNodeFactory.java @@ -178,5 +178,7 @@ public interface IASTNodeFactory { public IASTAmbiguousStatement newAmbiguousStatement(IASTStatement... statements); public IASTAmbiguousExpression newAmbiguousExpression(IASTExpression... expressions); + + public IASTDeclSpecifier newSimpleDeclSpecifier(); } diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/c99/C99ASTNodeFactory.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/c99/C99ASTNodeFactory.java index d6eca72242c..61915917e94 100644 --- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/c99/C99ASTNodeFactory.java +++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/c99/C99ASTNodeFactory.java @@ -404,6 +404,10 @@ public class C99ASTNodeFactory implements IC99ASTNodeFactory { return new CASTEnumerationSpecifier(name); } + public IASTDeclSpecifier newSimpleDeclSpecifier() { + return newCSimpleDeclSpecifier(); + } + } diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/c99/C99BuildASTParserAction.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/c99/C99BuildASTParserAction.java index 6fba094ae82..fd90598e69a 100644 --- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/c99/C99BuildASTParserAction.java +++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/c99/C99BuildASTParserAction.java @@ -53,6 +53,7 @@ import org.eclipse.cdt.core.dom.ast.IASTIfStatement; import org.eclipse.cdt.core.dom.ast.IASTInitializer; import org.eclipse.cdt.core.dom.ast.IASTInitializerList; import org.eclipse.cdt.core.dom.ast.IASTName; +import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration; import org.eclipse.cdt.core.dom.ast.IASTPointer; import org.eclipse.cdt.core.dom.ast.IASTProblemExpression; @@ -78,6 +79,7 @@ import org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier; import org.eclipse.cdt.core.dom.ast.c.ICASTTypeIdInitializerExpression; import org.eclipse.cdt.core.dom.ast.c.ICASTTypedefNameSpecifier; import org.eclipse.cdt.core.dom.ast.gnu.c.ICASTKnRFunctionDeclarator; +import org.eclipse.cdt.core.dom.lrparser.IParser; import org.eclipse.cdt.core.dom.lrparser.IParserActionTokenProvider; import org.eclipse.cdt.core.dom.lrparser.action.BuildASTParserAction; import org.eclipse.cdt.core.dom.lrparser.action.ITokenMap; @@ -136,6 +138,12 @@ public class C99BuildASTParserAction extends BuildASTParserAction { } + @Override + protected IParser getExpressionStatementParser() { + return new C99ExpressionStatementParser(C99Parsersym.orderedTerminalSymbols); + } + + @@ -191,16 +199,13 @@ public class C99BuildASTParserAction extends BuildASTParserAction { setOffsetAndLength(expr); // try parsing as an expression to resolve ambiguities - C99SizeofExpressionParser alternateParser = new C99SizeofExpressionParser(C99Parsersym.orderedTerminalSymbols); - alternateParser.setTokens(parser.getRuleTokens()); - IASTCompletionNode completionNode = alternateParser.parse(tu); - addNameToCompletionNode(completionNode); - IASTExpression alternateExpr = alternateParser.getParseResult(); + C99SizeofExpressionParser secondaryParser = new C99SizeofExpressionParser(C99Parsersym.orderedTerminalSymbols); + IASTNode alternateExpr = runSecondaryParser(secondaryParser); if(alternateExpr == null || alternateExpr instanceof IASTProblemExpression) astStack.push(expr); else - astStack.push(nodeFactory.newAmbiguousExpression(expr, alternateExpr)); + astStack.push(nodeFactory.newAmbiguousExpression(expr, (IASTExpression)alternateExpr)); if(TRACE_AST_STACK) System.out.println(astStack); } @@ -251,38 +256,15 @@ public class C99BuildASTParserAction extends BuildASTParserAction { - - @Deprecated public void consumeDeclaratorComplete(/*IBinding binding*/) { -// if(DEBUG) DebugUtil.printMethodTrace(); -// -// IASTDeclarator declarator = (IASTDeclarator) astStack.peek(); -// -// IASTDeclarator nested; -// while((nested = declarator.getNestedDeclarator()) != null) { -// declarator = nested; -// } -// -// //declarator.getName().setBinding(binding); - } - - - /** * type_qualifier ::= const | restrict | volatile */ private void collectArrayModifierTypeQualifiers(ICASTArrayModifier arrayModifier) { - if(TRACE_ACTIONS) DebugUtil.printMethodTrace(); for(Object o : astStack.closeScope()) { switch(asC99Kind((IToken)o)) { - case TK_const: - arrayModifier.setConst(true); - break; - case TK_restrict: - arrayModifier.setRestrict(true); - break; - case TK_volatile: - arrayModifier.setVolatile(true); - break; + case TK_const: arrayModifier.setConst(true); break; + case TK_restrict: arrayModifier.setRestrict(true); break; + case TK_volatile: arrayModifier.setVolatile(true); break; } } } @@ -326,11 +308,6 @@ public class C99BuildASTParserAction extends BuildASTParserAction { } - @Deprecated public void consumeDeclaratorCompleteField(/*IBinding binding*/) { - //IASTDeclarator declarator = (IASTDeclarator) astStack.peek(); - //declarator.getName().setBinding(binding); - } - /** * direct_declarator ::= direct_declarator '(' identifier_list ')' @@ -405,19 +382,6 @@ public class C99BuildASTParserAction extends BuildASTParserAction { - - - @Deprecated public void consumeDeclaratorCompleteParameter(/*IBinding binding*/) { - //if(DEBUG) DebugUtil.printMethodTrace(); - - //IASTDeclarator declarator = (IASTDeclarator) astStack.peek(); - //declarator.getName().setBinding(binding); - } - - - - - /** * direct_abstract_declarator * ::= '(' ')' @@ -679,93 +643,6 @@ public class C99BuildASTParserAction extends BuildASTParserAction { if(TRACE_AST_STACK) System.out.println(astStack); } - - - /** - * block_item ::= declaration | statement - * - * Wrap a declaration in a DeclarationStatement. - */ - public void consumeStatementDeclaration() { - if(TRACE_ACTIONS) DebugUtil.printMethodTrace(); - - IASTDeclaration decl = (IASTDeclaration) astStack.pop(); - IASTDeclarationStatement declarationStatement = nodeFactory.newDeclarationStatement(decl); - setOffsetAndLength(declarationStatement); - - // attempt to also parse the tokens as an expression - IASTExpressionStatement expressionStatement = null; - if(decl instanceof IASTSimpleDeclaration) { - // TODO this probably has bad performance - C99ExpressionStatementParser expressionParser = new C99ExpressionStatementParser(C99Parsersym.orderedTerminalSymbols); - expressionParser.setTokens(parser.getRuleTokens()); - // need to pass tu because any completion nodes need to be linked directly to the root - IASTCompletionNode compNode = expressionParser.parse(tu); - addNameToCompletionNode(compNode); - IASTExpression expr = expressionParser.getParseResult(); - - if(expr != null && !(expr instanceof IASTProblemExpression)) { // the parse may fail - expressionStatement = nodeFactory.newExpressionStatement(expr); - setOffsetAndLength(expressionStatement); - } - } - - if(expressionStatement == null) { - astStack.push(declarationStatement); - } - else { - astStack.push(nodeFactory.newAmbiguousStatement(declarationStatement, expressionStatement)); - } - - - if(TRACE_AST_STACK) System.out.println(astStack); - } - - - - -// -// /** -// * Kludgy way to disambiguate a certain case. -// * An identifier alone on a line will be parsed as a declaration -// * but it probably should be an expression. -// * eg) i; -// * -// * This only happens in the presence of a completion token. -// * -// * @return true if the hack was applied -// */ -// private boolean disambiguateHackIdentifierExpression(IASTDeclaration decl) { -// if(TRACE_ACTIONS) DebugUtil.printMethodTrace(); -// -// // this is only meant to work with content assist -// List tokens = parser.getRuleTokens(); -// if(tokens.size() != 2 || tokens.get(0).getKind() == TK_typedef) -// return false; -// -// if(decl instanceof IASTSimpleDeclaration) { -// IASTSimpleDeclaration declaration = (IASTSimpleDeclaration) decl; -// if(declaration.getDeclarators() == IASTDeclarator.EMPTY_DECLARATOR_ARRAY) { -// IASTDeclSpecifier declSpec = declaration.getDeclSpecifier(); -// if(declSpec instanceof ICASTTypedefNameSpecifier) { -// ICASTTypedefNameSpecifier typedefNameSpec = (ICASTTypedefNameSpecifier) declSpec; -// IASTName name = typedefNameSpec.getName(); -// -// if(offset(name) == offset(typedefNameSpec) && length(name) == length(typedefNameSpec)) { -// IASTIdExpression idExpr = nodeFactory.newIdExpression(name); -// IASTExpressionStatement stat = nodeFactory.newExpressionStatement(idExpr); -// -// setOffsetAndLength(stat); -// astStack.push(stat); -// return true; -// } -// } -// } -// } -// return false; -// } - - /** * selection_statement ::= switch '(' expression ')' statement @@ -831,14 +708,6 @@ public class C99BuildASTParserAction extends BuildASTParserAction { if(TRACE_AST_STACK) System.out.println(astStack); } - - - @Deprecated public void consumeFunctionDefinitionHeader(/*IBinding binding*/) { -// Object o = astStack.peek(); -// if(o instanceof IASTFunctionDeclarator) { -// ((IASTFunctionDeclarator)o).getName().setBinding(binding); -// } - } /** diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/c99/IC99ASTNodeFactory.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/c99/IC99ASTNodeFactory.java index c777b86f170..7c0fcda16f1 100644 --- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/c99/IC99ASTNodeFactory.java +++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/c99/IC99ASTNodeFactory.java @@ -10,15 +10,11 @@ *******************************************************************************/ package org.eclipse.cdt.core.dom.lrparser.action.c99; -import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier; -import org.eclipse.cdt.core.dom.ast.IASTDeclarator; import org.eclipse.cdt.core.dom.ast.IASTExpression; -import org.eclipse.cdt.core.dom.ast.IASTFieldDeclarator; import org.eclipse.cdt.core.dom.ast.IASTFieldReference; import org.eclipse.cdt.core.dom.ast.IASTInitializer; import org.eclipse.cdt.core.dom.ast.IASTInitializerList; import org.eclipse.cdt.core.dom.ast.IASTName; -import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration; import org.eclipse.cdt.core.dom.ast.IASTTypeId; import org.eclipse.cdt.core.dom.ast.c.ICASTArrayDesignator; import org.eclipse.cdt.core.dom.ast.c.ICASTArrayModifier; diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/cpp/CPPASTNodeFactory.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/cpp/CPPASTNodeFactory.java index 51f15475d5f..4ff98952a13 100644 --- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/cpp/CPPASTNodeFactory.java +++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/cpp/CPPASTNodeFactory.java @@ -551,4 +551,8 @@ public class CPPASTNodeFactory implements ICPPASTNodeFactory { return new CPPASTAmbiguousStatement(statements); } + public IASTDeclSpecifier newSimpleDeclSpecifier() { + return newCPPSimpleDeclSpecifier(); + } + } diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/cpp/CPPBuildASTParserAction.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/cpp/CPPBuildASTParserAction.java index e81b0827bc4..d88202b8abc 100644 --- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/cpp/CPPBuildASTParserAction.java +++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/cpp/CPPBuildASTParserAction.java @@ -82,9 +82,14 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUsingDeclaration; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUsingDirective; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisiblityLabel; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier; +import org.eclipse.cdt.core.dom.lrparser.IParser; import org.eclipse.cdt.core.dom.lrparser.IParserActionTokenProvider; import org.eclipse.cdt.core.dom.lrparser.action.BuildASTParserAction; import org.eclipse.cdt.core.dom.lrparser.util.DebugUtil; +import org.eclipse.cdt.internal.core.dom.lrparser.c99.C99ExpressionStatementParser; +import org.eclipse.cdt.internal.core.dom.lrparser.c99.C99Parsersym; +import org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPExpressionStatementParser; +import org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym; import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTFunctionDeclarator; /** @@ -110,12 +115,18 @@ public class CPPBuildASTParserAction extends BuildASTParserAction { this.nodeFactory = nodeFactory; } - @Override protected boolean isCompletionToken(IToken token) { + @Override + protected boolean isCompletionToken(IToken token) { // TODO Auto-generated method stub return false; } + @Override + protected IParser getExpressionStatementParser() { + return new CPPExpressionStatementParser(CPPParsersym.orderedTerminalSymbols); + } + // /** // * Used only for debugging purposes. // * @@ -536,24 +547,6 @@ public class CPPBuildASTParserAction extends BuildASTParserAction { } - /** - * block_item ::= declaration | statement - * - * Wrap a declaration in a DeclarationStatement. - */ - public void consumeStatementDeclaration() { - if(TRACE_ACTIONS) DebugUtil.printMethodTrace(); - - IASTDeclaration decl = (IASTDeclaration) astStack.pop(); - - IASTDeclarationStatement stat = nodeFactory.newDeclarationStatement(decl); - setOffsetAndLength(stat); - astStack.push(stat); - - if(TRACE_AST_STACK) System.out.println(astStack); - } - - /** * try_block * ::= 'try' compound_statement handler_seq @@ -1180,6 +1173,9 @@ public class CPPBuildASTParserAction extends BuildASTParserAction { nestedNames.addFirst(className); className = createQualifiedName(nestedNames, false); } + + if(className == null) + className = nodeFactory.newName(); ICPPASTCompositeTypeSpecifier classSpecifier = nodeFactory.newCPPCompositeTypeSpecifier(key, className); diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99ExpressionStatementParser.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99ExpressionStatementParser.java index 62caf961668..04b1018709a 100644 --- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99ExpressionStatementParser.java +++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99ExpressionStatementParser.java @@ -28,7 +28,7 @@ import org.eclipse.cdt.core.dom.lrparser.action.c99.C99ASTNodeFactory; import org.eclipse.cdt.core.dom.lrparser.action.c99.C99BuildASTParserAction; import org.eclipse.cdt.core.dom.lrparser.action.c99.C99TypedefTrackerParserAction; -public class C99ExpressionStatementParser extends PrsStream implements RuleAction , IParserActionTokenProvider, IParser +public class C99ExpressionStatementParser extends PrsStream implements RuleAction , IParserActionTokenProvider, IParser { private static ParseTable prs = new C99ExpressionStatementParserprs(); private BacktrackingParser btParser; @@ -172,7 +172,7 @@ public C99ExpressionStatementParser() { // constructor private void initActions(IASTTranslationUnit tu) { action = new C99BuildASTParserAction ( C99ASTNodeFactory.DEFAULT_INSTANCE , this, tu); - action.setTokenMap( C99ExpressionStatementParsersym .orderedTerminalSymbols); + action.setTokenMap(C99ExpressionStatementParsersym.orderedTerminalSymbols); } @@ -205,6 +205,11 @@ public List getRuleTokens() { } +public IASTNode getSecondaryParseResult() { + return action.getSecondaryParseResult(); +} + + private ITokenMap tokenMap = null; @@ -215,17 +220,14 @@ public void setTokens(List tokens) { token.setKind(tokenMap.mapKind(token.getKind())); addToken(token); } - addToken(new Token(null, 0, 0, C99ExpressionStatementParsersym .TK_EOF_TOKEN)); + addToken(new Token(null, 0, 0, C99ExpressionStatementParsersym.TK_EOF_TOKEN)); } public C99ExpressionStatementParser(String[] mapFrom) { // constructor - tokenMap = new TokenMap( C99ExpressionStatementParsersym .orderedTerminalSymbols, mapFrom); + tokenMap = new TokenMap(C99ExpressionStatementParsersym.orderedTerminalSymbols, mapFrom); } -public IASTExpression getParseResult() { - return (IASTExpression) action.getSecondaryParseResult(); -} public void ruleAction(int ruleNumber) { diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99NoCastExpressionParser.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99NoCastExpressionParser.java index 1f30f8b8311..a7b73eff9d2 100644 --- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99NoCastExpressionParser.java +++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99NoCastExpressionParser.java @@ -28,7 +28,7 @@ import org.eclipse.cdt.core.dom.lrparser.action.c99.C99ASTNodeFactory; import org.eclipse.cdt.core.dom.lrparser.action.c99.C99BuildASTParserAction; import org.eclipse.cdt.core.dom.lrparser.action.c99.C99TypedefTrackerParserAction; -public class C99NoCastExpressionParser extends PrsStream implements RuleAction , IParserActionTokenProvider, IParser +public class C99NoCastExpressionParser extends PrsStream implements RuleAction , IParserActionTokenProvider, IParser { private static ParseTable prs = new C99NoCastExpressionParserprs(); private BacktrackingParser btParser; @@ -172,7 +172,7 @@ public C99NoCastExpressionParser() { // constructor private void initActions(IASTTranslationUnit tu) { action = new C99BuildASTParserAction ( C99ASTNodeFactory.DEFAULT_INSTANCE , this, tu); - action.setTokenMap( C99NoCastExpressionParsersym .orderedTerminalSymbols); + action.setTokenMap(C99NoCastExpressionParsersym.orderedTerminalSymbols); } @@ -205,6 +205,11 @@ public List getRuleTokens() { } +public IASTNode getSecondaryParseResult() { + return action.getSecondaryParseResult(); +} + + private ITokenMap tokenMap = null; @@ -215,17 +220,14 @@ public void setTokens(List tokens) { token.setKind(tokenMap.mapKind(token.getKind())); addToken(token); } - addToken(new Token(null, 0, 0, C99NoCastExpressionParsersym .TK_EOF_TOKEN)); + addToken(new Token(null, 0, 0, C99NoCastExpressionParsersym.TK_EOF_TOKEN)); } public C99NoCastExpressionParser(String[] mapFrom) { // constructor - tokenMap = new TokenMap( C99NoCastExpressionParsersym .orderedTerminalSymbols, mapFrom); + tokenMap = new TokenMap(C99NoCastExpressionParsersym.orderedTerminalSymbols, mapFrom); } -public IASTExpression getParseResult() { - return (IASTExpression) action.getSecondaryParseResult(); -} public void ruleAction(int ruleNumber) { diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99Parser.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99Parser.java index 2eba59c6233..c1f5c6363ba 100644 --- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99Parser.java +++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99Parser.java @@ -28,7 +28,7 @@ import org.eclipse.cdt.core.dom.lrparser.action.c99.C99ASTNodeFactory; import org.eclipse.cdt.core.dom.lrparser.action.c99.C99BuildASTParserAction; import org.eclipse.cdt.core.dom.lrparser.action.c99.C99TypedefTrackerParserAction; -public class C99Parser extends PrsStream implements RuleAction , IParserActionTokenProvider, IParser +public class C99Parser extends PrsStream implements RuleAction , IParserActionTokenProvider, IParser { private static ParseTable prs = new C99Parserprs(); private BacktrackingParser btParser; @@ -172,7 +172,7 @@ public C99Parser() { // constructor private void initActions(IASTTranslationUnit tu) { action = new C99BuildASTParserAction ( C99ASTNodeFactory.DEFAULT_INSTANCE , this, tu); - action.setTokenMap( C99Parsersym .orderedTerminalSymbols); + action.setTokenMap(C99Parsersym.orderedTerminalSymbols); } @@ -205,6 +205,11 @@ public List getRuleTokens() { } +public IASTNode getSecondaryParseResult() { + return action.getSecondaryParseResult(); +} + + private ITokenMap tokenMap = null; @@ -215,14 +220,15 @@ public void setTokens(List tokens) { token.setKind(tokenMap.mapKind(token.getKind())); addToken(token); } - addToken(new Token(null, 0, 0, C99Parsersym .TK_EOF_TOKEN)); + addToken(new Token(null, 0, 0, C99Parsersym.TK_EOF_TOKEN)); } public C99Parser(String[] mapFrom) { // constructor - tokenMap = new TokenMap( C99Parsersym .orderedTerminalSymbols, mapFrom); + tokenMap = new TokenMap(C99Parsersym.orderedTerminalSymbols, mapFrom); } + public void ruleAction(int ruleNumber) { switch (ruleNumber) diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99SizeofExpressionParser.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99SizeofExpressionParser.java index 3a4e74ce561..5723868677c 100644 --- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99SizeofExpressionParser.java +++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99SizeofExpressionParser.java @@ -28,7 +28,7 @@ import org.eclipse.cdt.core.dom.lrparser.action.c99.C99ASTNodeFactory; import org.eclipse.cdt.core.dom.lrparser.action.c99.C99BuildASTParserAction; import org.eclipse.cdt.core.dom.lrparser.action.c99.C99TypedefTrackerParserAction; -public class C99SizeofExpressionParser extends PrsStream implements RuleAction , IParserActionTokenProvider, IParser +public class C99SizeofExpressionParser extends PrsStream implements RuleAction , IParserActionTokenProvider, IParser { private static ParseTable prs = new C99SizeofExpressionParserprs(); private BacktrackingParser btParser; @@ -172,7 +172,7 @@ public C99SizeofExpressionParser() { // constructor private void initActions(IASTTranslationUnit tu) { action = new C99BuildASTParserAction ( C99ASTNodeFactory.DEFAULT_INSTANCE , this, tu); - action.setTokenMap( C99SizeofExpressionParsersym .orderedTerminalSymbols); + action.setTokenMap(C99SizeofExpressionParsersym.orderedTerminalSymbols); } @@ -205,6 +205,11 @@ public List getRuleTokens() { } +public IASTNode getSecondaryParseResult() { + return action.getSecondaryParseResult(); +} + + private ITokenMap tokenMap = null; @@ -215,17 +220,14 @@ public void setTokens(List tokens) { token.setKind(tokenMap.mapKind(token.getKind())); addToken(token); } - addToken(new Token(null, 0, 0, C99SizeofExpressionParsersym .TK_EOF_TOKEN)); + addToken(new Token(null, 0, 0, C99SizeofExpressionParsersym.TK_EOF_TOKEN)); } public C99SizeofExpressionParser(String[] mapFrom) { // constructor - tokenMap = new TokenMap( C99SizeofExpressionParsersym .orderedTerminalSymbols, mapFrom); + tokenMap = new TokenMap(C99SizeofExpressionParsersym.orderedTerminalSymbols, mapFrom); } -public IASTExpression getParseResult() { - return (IASTExpression) action.getSecondaryParseResult(); -} public void ruleAction(int ruleNumber) { diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPExpressionStatementParser.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPExpressionStatementParser.java new file mode 100644 index 00000000000..866754059dc --- /dev/null +++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPExpressionStatementParser.java @@ -0,0 +1,2045 @@ +/******************************************************************************* +* Copyright (c) 2006, 2008 IBM Corporation and others. +* All rights reserved. This program and the accompanying materials +* are made available under the terms of the Eclipse Public License v1.0 +* which accompanies this distribution, and is available at +* http://www.eclipse.org/legal/epl_v10.html +* +* Contributors: +* IBM Corporation - initial API and implementation +*********************************************************************************/ + +// This file was generated by LPG + +package org.eclipse.cdt.internal.core.dom.lrparser.cpp; + +import lpg.lpgjavaruntime.*; + +import java.util.*; + +import org.eclipse.cdt.core.dom.ast.*; +import org.eclipse.cdt.core.dom.ast.cpp.*; +import org.eclipse.cdt.core.dom.lrparser.action.cpp.CPPASTNodeFactory; +import org.eclipse.cdt.core.dom.lrparser.action.cpp.CPPBuildASTParserAction; +import org.eclipse.cdt.core.dom.lrparser.IParser; +import org.eclipse.cdt.core.dom.lrparser.IParserActionTokenProvider; +import org.eclipse.cdt.core.dom.lrparser.util.DebugUtil; + +import org.eclipse.cdt.core.dom.lrparser.action.ITokenMap; +import org.eclipse.cdt.core.dom.lrparser.action.TokenMap; + +public class CPPExpressionStatementParser extends PrsStream implements RuleAction , IParserActionTokenProvider, IParser +{ + private static ParseTable prs = new CPPExpressionStatementParserprs(); + private BacktrackingParser btParser; + + public BacktrackingParser getParser() { return btParser; } + private void setResult(Object object) { btParser.setSym1(object); } + public Object getRhsSym(int i) { return btParser.getSym(i); } + + public int getRhsTokenIndex(int i) { return btParser.getToken(i); } + public IToken getRhsIToken(int i) { return super.getIToken(getRhsTokenIndex(i)); } + + public int getRhsFirstTokenIndex(int i) { return btParser.getFirstToken(i); } + public IToken getRhsFirstIToken(int i) { return super.getIToken(getRhsFirstTokenIndex(i)); } + + public int getRhsLastTokenIndex(int i) { return btParser.getLastToken(i); } + public IToken getRhsLastIToken(int i) { return super.getIToken(getRhsLastTokenIndex(i)); } + + public int getLeftSpan() { return btParser.getFirstToken(); } + public IToken getLeftIToken() { return super.getIToken(getLeftSpan()); } + + public int getRightSpan() { return btParser.getLastToken(); } + public IToken getRightIToken() { return super.getIToken(getRightSpan()); } + + public int getRhsErrorTokenIndex(int i) + { + int index = btParser.getToken(i); + IToken err = super.getIToken(index); + return (err instanceof ErrorToken ? index : 0); + } + public ErrorToken getRhsErrorIToken(int i) + { + int index = btParser.getToken(i); + IToken err = super.getIToken(index); + return (ErrorToken) (err instanceof ErrorToken ? err : null); + } + + public CPPExpressionStatementParser(LexStream lexStream) + { + super(lexStream); + + try + { + super.remapTerminalSymbols(orderedTerminalSymbols(), CPPExpressionStatementParserprs.EOFT_SYMBOL); + } + catch(NullExportedSymbolsException e) { + } + catch(NullTerminalSymbolsException e) { + } + catch(UnimplementedTerminalsException e) + { + java.util.ArrayList unimplemented_symbols = e.getSymbols(); + System.out.println("The Lexer will not scan the following token(s):"); + for (int i = 0; i < unimplemented_symbols.size(); i++) + { + Integer id = (Integer) unimplemented_symbols.get(i); + System.out.println(" " + CPPExpressionStatementParsersym.orderedTerminalSymbols[id.intValue()]); + } + System.out.println(); + } + catch(UndefinedEofSymbolException e) + { + throw new Error(new UndefinedEofSymbolException + ("The Lexer does not implement the Eof symbol " + + CPPExpressionStatementParsersym.orderedTerminalSymbols[CPPExpressionStatementParserprs.EOFT_SYMBOL])); + } + } + + public String[] orderedTerminalSymbols() { return CPPExpressionStatementParsersym.orderedTerminalSymbols; } + public String getTokenKindName(int kind) { return CPPExpressionStatementParsersym.orderedTerminalSymbols[kind]; } + public int getEOFTokenKind() { return CPPExpressionStatementParserprs.EOFT_SYMBOL; } + public PrsStream getParseStream() { return (PrsStream) this; } + + // + // Report error message for given error_token. + // + public final void reportErrorTokenMessage(int error_token, String msg) + { + int firsttok = super.getFirstErrorToken(error_token), + lasttok = super.getLastErrorToken(error_token); + String location = super.getFileName() + ':' + + (firsttok > lasttok + ? (super.getEndLine(lasttok) + ":" + super.getEndColumn(lasttok)) + : (super.getLine(error_token) + ":" + + super.getColumn(error_token) + ":" + + super.getEndLine(error_token) + ":" + + super.getEndColumn(error_token))) + + ": "; + super.reportError((firsttok > lasttok ? ParseErrorCodes.INSERTION_CODE : ParseErrorCodes.SUBSTITUTION_CODE), location, msg); + } + + public Object parser() + { + return parser(null, 0); + } + + public Object parser(Monitor monitor) + { + return parser(monitor, 0); + } + + public Object parser(int error_repair_count) + { + return parser(null, error_repair_count); + } + + public Object parser(Monitor monitor, int error_repair_count) + { + try + { + btParser = new BacktrackingParser(monitor, (TokenStream) this, prs, (RuleAction) this); + } + catch (NotBacktrackParseTableException e) + { + throw new Error(new NotBacktrackParseTableException + ("Regenerate CPPExpressionStatementParserprs.java with -BACKTRACK option")); + } + catch (BadParseSymFileException e) + { + throw new Error(new BadParseSymFileException("Bad Parser Symbol File -- CPPExpressionStatementParsersym.java")); + } + + try + { + return (Object) btParser.parse(error_repair_count); + } + catch (BadParseException e) + { + reset(e.error_token); // point to error token + DiagnoseParser diagnoseParser = new DiagnoseParser(this, prs); + diagnoseParser.diagnose(e.error_token); + } + + return null; + } + + +private CPPParserAction action; + +// uncomment to use with backtracking parser +public CPPExpressionStatementParser() { // constructor +} + +private void initActions(IASTTranslationUnit tu) { + // binding resolution actions need access to IASTName nodes, temporary + action = new CPPParserAction (); + //action.resolver = new C99TypedefTrackerParserAction (this); + action.builder = new CPPBuildASTParserAction ( CPPASTNodeFactory.DEFAULT_INSTANCE , this, tu); + //action.builder.setTokenMap(CPPParsersym.orderedTerminalSymbols); + + // comment this line to use with backtracking parser + //setParserAction(action); +} + + +public void addToken(IToken token) { + token.setKind(mapKind(token.getKind())); + super.addToken(token); +} + + +public IASTCompletionNode parse(IASTTranslationUnit tu) { + // this has to be done, or... kaboom! + setStreamLength(getSize()); + initActions(tu); + + final int errorRepairCount = -1; // _1 means full error handling + parser(null, errorRepairCount); // do the actual parse + super.resetTokenStream(); // allow tokens to be garbage collected + + // the completion node may be null + IASTCompletionNode compNode = action.builder.getASTCompletionNode(); + + //action = null; // causes getSecondaryParseResult() to fail + + // Comment this line to use with backtracking parser + //parserAction = null; + + return compNode; +} + + +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 +public List getRuleTokens() { + return Collections.unmodifiableList(getTokens().subList(getLeftSpan(), getRightSpan() + 1)); +} + + +public IASTNode getSecondaryParseResult() { + return action.builder.getSecondaryParseResult(); +} + + +private ITokenMap tokenMap = null; + +public void setTokens(List tokens) { + resetTokenStream(); + addToken(new Token(null, 0, 0, 0)); // dummy token + for(IToken token : tokens) { + token.setKind(tokenMap.mapKind(token.getKind())); + addToken(token); + } + addToken(new Token(null, 0, 0, CPPExpressionStatementParsersym.TK_EOF_TOKEN)); +} + +public CPPExpressionStatementParser(String[] mapFrom) { // constructor + tokenMap = new TokenMap(CPPExpressionStatementParsersym.orderedTerminalSymbols, mapFrom); +} + + + + public void ruleAction(int ruleNumber) + { + switch (ruleNumber) + { + + // + // Rule 1: ::= $Empty + // + case 1: { action.builder. + openASTScope(); break; + } + + // + // Rule 4: ::= $Empty + // + case 4: { action.builder. + consumePlaceHolder(); break; + } + + // + // Rule 5: ::= $Empty + // + case 5: { action.builder. + consumeEmpty(); break; + } + + // + // Rule 10: translation_unit ::= declaration_seq + // + case 10: { action.builder. + consumeTranslationUnit(); break; + } + + // + // Rule 11: translation_unit ::= $Empty + // + case 11: { action.builder. + consumeTranslationUnit(); break; + } + + // + // Rule 12: literal ::= integer + // + case 12: { action.builder. + consumeExpressionLiteral(ICPPASTLiteralExpression.lk_integer_constant); break; + } + + // + // Rule 13: literal ::= 0 + // + case 13: { action.builder. + consumeExpressionLiteral(ICPPASTLiteralExpression.lk_integer_constant); break; + } + + // + // Rule 14: literal ::= floating + // + case 14: { action.builder. + consumeExpressionLiteral(ICPPASTLiteralExpression.lk_float_constant); break; + } + + // + // Rule 15: literal ::= charconst + // + case 15: { action.builder. + consumeExpressionLiteral(ICPPASTLiteralExpression.lk_char_constant); break; + } + + // + // Rule 16: literal ::= stringlit + // + case 16: { action.builder. + consumeExpressionLiteral(ICPPASTLiteralExpression.lk_string_literal); break; + } + + // + // Rule 17: literal ::= true + // + case 17: { action.builder. + consumeExpressionLiteral(ICPPASTLiteralExpression.lk_true); break; + } + + // + // Rule 18: literal ::= false + // + case 18: { action.builder. + consumeExpressionLiteral(ICPPASTLiteralExpression.lk_false); break; + } + + // + // Rule 19: literal ::= this + // + case 19: { action.builder. + consumeExpressionLiteral(ICPPASTLiteralExpression.lk_this); break; + } + + // + // Rule 21: primary_expression ::= ( expression ) + // + case 21: { action.builder. + consumeExpressionBracketed(); break; + } + + // + // Rule 23: id_expression ::= qualified_or_unqualified_name + // + case 23: { action.builder. + consumeExpressionName(); break; + } + + // + // Rule 30: unqualified_id_name ::= ~ class_name + // + case 30: { action.builder. + consumeDestructorName(); break; + } + + // + // Rule 31: identifier_name ::= identifier + // + case 31: { action.builder. + consumeIdentifierName(); break; + } + + // + // Rule 32: template_opt ::= template + // + case 32: { action.builder. + consumePlaceHolder(); break; + } + + // + // Rule 33: template_opt ::= $Empty + // + case 33: { action.builder. + consumeEmpty(); break; + } + + // + // Rule 34: dcolon_opt ::= :: + // + case 34: { action.builder. + consumePlaceHolder(); break; + } + + // + // Rule 35: dcolon_opt ::= $Empty + // + case 35: { action.builder. + consumeEmpty(); break; + } + + // + // Rule 36: qualified_id_name ::= dcolon_opt nested_name_specifier template_opt unqualified_id_name + // + case 36: { action.builder. + consumeQualifiedId(true); break; + } + + // + // Rule 37: qualified_id_name ::= :: identifier_name + // + case 37: { action.builder. + consumeGlobalQualifiedId(); break; + } + + // + // Rule 38: qualified_id_name ::= :: operator_function_id_name + // + case 38: { action.builder. + consumeGlobalQualifiedId(); break; + } + + // + // Rule 39: qualified_id_name ::= :: template_id_name + // + case 39: { action.builder. + consumeGlobalQualifiedId(); break; + } + + // + // Rule 40: nested_name_specifier ::= class_or_namespace_name :: nested_name_specifier_with_template + // + case 40: { action.builder. + consumeNestedNameSpecifier(true); break; + } + + // + // Rule 41: nested_name_specifier ::= class_or_namespace_name :: + // + case 41: { action.builder. + consumeNestedNameSpecifier(false); break; + } + + // + // Rule 42: nested_name_specifier_with_template ::= class_or_namespace_name_with_template :: nested_name_specifier_with_template + // + case 42: { action.builder. + consumeNestedNameSpecifier(true); break; + } + + // + // Rule 43: nested_name_specifier_with_template ::= class_or_namespace_name_with_template :: + // + case 43: { action.builder. + consumeNestedNameSpecifier(false); break; + } + + // + // Rule 44: class_or_namespace_name_with_template ::= template_opt class_or_namespace_name + // + case 44: { action.builder. + consumeNameWithTemplateKeyword(); break; + } + + // + // Rule 46: nested_name_specifier_opt ::= $Empty + // + case 46: { action.builder. + consumeNestedNameSpecifierEmpty(); break; + } + + // + // Rule 50: postfix_expression ::= postfix_expression [ expression ] + // + case 50: { action.builder. + consumeExpressionArraySubscript(); break; + } + + // + // Rule 51: postfix_expression ::= postfix_expression ( expression_list_opt ) + // + case 51: { action.builder. + consumeExpressionFunctionCall(); break; + } + + // + // Rule 52: postfix_expression ::= simple_type_specifier ( expression_list_opt ) + // + case 52: { action.builder. + consumeExpressionSimpleTypeConstructor(); break; + } + + // + // Rule 53: postfix_expression ::= typename dcolon_opt nested_name_specifier identifier_name ( expression_list_opt ) + // + case 53: { action.builder. + consumeExpressionTypeName(); break; + } + + // + // Rule 54: postfix_expression ::= typename dcolon_opt nested_name_specifier template_opt template_id_name ( expression_list_opt ) + // + case 54: { action.builder. + consumeExpressionTypeName(); break; + } + + // + // Rule 55: postfix_expression ::= postfix_expression . qualified_or_unqualified_name + // + case 55: { action.builder. + consumeExpressionFieldReference(false, false); break; + } + + // + // Rule 56: postfix_expression ::= postfix_expression -> qualified_or_unqualified_name + // + case 56: { action.builder. + consumeExpressionFieldReference(true, false); break; + } + + // + // Rule 57: postfix_expression ::= postfix_expression . template qualified_or_unqualified_name + // + case 57: { action.builder. + consumeExpressionFieldReference(false, true); break; + } + + // + // Rule 58: postfix_expression ::= postfix_expression -> template qualified_or_unqualified_name + // + case 58: { action.builder. + consumeExpressionFieldReference(true, true); break; + } + + // + // Rule 59: postfix_expression ::= postfix_expression . pseudo_destructor_name + // + case 59: { action.builder. + consumeExpressionFieldReference(false, false); break; + } + + // + // Rule 60: postfix_expression ::= postfix_expression -> pseudo_destructor_name + // + case 60: { action.builder. + consumeExpressionFieldReference(true, false); break; + } + + // + // Rule 61: postfix_expression ::= postfix_expression ++ + // + case 61: { action.builder. + consumeExpressionUnaryOperator(IASTUnaryExpression.op_postFixIncr); break; + } + + // + // Rule 62: postfix_expression ::= postfix_expression -- + // + case 62: { action.builder. + consumeExpressionUnaryOperator(IASTUnaryExpression.op_postFixDecr); break; + } + + // + // Rule 63: postfix_expression ::= dynamic_cast < type_id > ( expression ) + // + case 63: { action.builder. + consumeExpressionCast(ICPPASTCastExpression.op_dynamic_cast); break; + } + + // + // Rule 64: postfix_expression ::= static_cast < type_id > ( expression ) + // + case 64: { action.builder. + consumeExpressionCast(ICPPASTCastExpression.op_static_cast); break; + } + + // + // Rule 65: postfix_expression ::= reinterpret_cast < type_id > ( expression ) + // + case 65: { action.builder. + consumeExpressionCast(ICPPASTCastExpression.op_reinterpret_cast); break; + } + + // + // Rule 66: postfix_expression ::= const_cast < type_id > ( expression ) + // + case 66: { action.builder. + consumeExpressionCast(ICPPASTCastExpression.op_const_cast); break; + } + + // + // Rule 67: postfix_expression ::= typeid ( expression ) + // + case 67: { action.builder. + consumeExpressionUnaryOperator(ICPPASTUnaryExpression.op_typeid); break; + } + + // + // Rule 68: postfix_expression ::= typeid ( type_id ) + // + case 68: { action.builder. + consumeExpressionTypeId(ICPPASTTypeIdExpression.op_typeid); break; + } + + // + // Rule 69: pseudo_destructor_name ::= dcolon_opt nested_name_specifier_opt type_name :: ~ type_name + // + case 69: { action.builder. + consumePsudoDestructorName(true); break; + } + + // + // Rule 70: pseudo_destructor_name ::= dcolon_opt nested_name_specifier template template_id_name :: ~ type_name + // + case 70: { action.builder. + consumePsudoDestructorName(true); break; + } + + // + // Rule 71: pseudo_destructor_name ::= dcolon_opt nested_name_specifier_opt ~ type_name + // + case 71: { action.builder. + consumePsudoDestructorName(false); break; + } + + // + // Rule 75: unary_expression ::= ++ cast_expression + // + case 75: { action.builder. + consumeExpressionUnaryOperator(IASTUnaryExpression.op_prefixIncr); break; + } + + // + // Rule 76: unary_expression ::= -- cast_expression + // + case 76: { action.builder. + consumeExpressionUnaryOperator(IASTUnaryExpression.op_prefixDecr); break; + } + + // + // Rule 77: unary_expression ::= & cast_expression + // + case 77: { action.builder. + consumeExpressionUnaryOperator(IASTUnaryExpression.op_amper); break; + } + + // + // Rule 78: unary_expression ::= * cast_expression + // + case 78: { action.builder. + consumeExpressionUnaryOperator(IASTUnaryExpression.op_star); break; + } + + // + // Rule 79: unary_expression ::= + cast_expression + // + case 79: { action.builder. + consumeExpressionUnaryOperator(IASTUnaryExpression.op_plus); break; + } + + // + // Rule 80: unary_expression ::= - cast_expression + // + case 80: { action.builder. + consumeExpressionUnaryOperator(IASTUnaryExpression.op_minus); break; + } + + // + // Rule 81: unary_expression ::= ~ cast_expression + // + case 81: { action.builder. + consumeExpressionUnaryOperator(IASTUnaryExpression.op_tilde); break; + } + + // + // Rule 82: unary_expression ::= ! cast_expression + // + case 82: { action.builder. + consumeExpressionUnaryOperator(IASTUnaryExpression.op_not); break; + } + + // + // Rule 83: unary_expression ::= sizeof unary_expression + // + case 83: { action.builder. + consumeExpressionUnaryOperator(IASTUnaryExpression.op_sizeof); break; + } + + // + // Rule 84: unary_expression ::= sizeof ( type_id ) + // + case 84: { action.builder. + consumeExpressionTypeId(ICPPASTTypeIdExpression.op_sizeof); break; + } + + // + // Rule 85: new_expression ::= dcolon_opt new new_placement_opt new_type_id new_array_expressions_opt new_initializer_opt + // + case 85: { action.builder. + consumeExpressionNew(false); break; + } + + // + // Rule 86: new_expression ::= dcolon_opt new new_placement_opt ( type_id ) new_initializer_opt + // + case 86: { action.builder. + consumeExpressionNew(true); break; + } + + // + // Rule 89: new_placement_opt ::= $Empty + // + case 89: { action.builder. + consumeEmpty(); break; + } + + // + // Rule 90: new_type_id ::= type_specifier_seq + // + case 90: { action.builder. + consumeTypeId(false); break; + } + + // + // Rule 91: new_type_id ::= type_specifier_seq new_declarator + // + case 91: { action.builder. + consumeTypeId(true); break; + } + + // + // Rule 92: new_declarator ::= new_pointer_operators + // + case 92: { action.builder. + consumeNewDeclarator(); break; + } + + // + // Rule 101: new_initializer_opt ::= $Empty + // + case 101: { action.builder. + consumeEmpty(); break; + } + + // + // Rule 102: delete_expression ::= dcolon_opt delete cast_expression + // + case 102: { action.builder. + consumeExpressionDelete(false); break; + } + + // + // Rule 103: delete_expression ::= dcolon_opt delete [ ] cast_expression + // + case 103: { action.builder. + consumeExpressionDelete(true); break; + } + + // + // Rule 105: cast_expression ::= ( type_id ) cast_expression + // + case 105: { action.builder. + consumeExpressionCast(ICPPASTCastExpression.op_cast); break; + } + + // + // Rule 107: pm_expression ::= pm_expression .* cast_expression + // + case 107: { action.builder. + consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_pmdot); break; + } + + // + // Rule 108: pm_expression ::= pm_expression ->* cast_expression + // + case 108: { action.builder. + consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_pmarrow); break; + } + + // + // Rule 110: multiplicative_expression ::= multiplicative_expression * pm_expression + // + case 110: { action.builder. + consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_multiply); break; + } + + // + // Rule 111: multiplicative_expression ::= multiplicative_expression / pm_expression + // + case 111: { action.builder. + consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_divide); break; + } + + // + // Rule 112: multiplicative_expression ::= multiplicative_expression % pm_expression + // + case 112: { action.builder. + consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_modulo); break; + } + + // + // Rule 114: additive_expression ::= additive_expression + multiplicative_expression + // + case 114: { action.builder. + consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_plus); break; + } + + // + // Rule 115: additive_expression ::= additive_expression - multiplicative_expression + // + case 115: { action.builder. + consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_minus); break; + } + + // + // Rule 117: shift_expression ::= shift_expression << additive_expression + // + case 117: { action.builder. + consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_shiftLeft); break; + } + + // + // Rule 118: shift_expression ::= shift_expression >> additive_expression + // + case 118: { action.builder. + consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_shiftRight); break; + } + + // + // Rule 120: relational_expression ::= relational_expression < shift_expression + // + case 120: { action.builder. + consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_lessThan); break; + } + + // + // Rule 121: relational_expression ::= relational_expression > shift_expression + // + case 121: { action.builder. + consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_greaterThan); break; + } + + // + // Rule 122: relational_expression ::= relational_expression <= shift_expression + // + case 122: { action.builder. + consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_lessEqual); break; + } + + // + // Rule 123: relational_expression ::= relational_expression >= shift_expression + // + case 123: { action.builder. + consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_greaterEqual); break; + } + + // + // Rule 125: equality_expression ::= equality_expression == relational_expression + // + case 125: { action.builder. + consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_equals); break; + } + + // + // Rule 126: equality_expression ::= equality_expression != relational_expression + // + case 126: { action.builder. + consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_notequals); break; + } + + // + // Rule 128: and_expression ::= and_expression & equality_expression + // + case 128: { action.builder. + consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_binaryAnd); break; + } + + // + // Rule 130: exclusive_or_expression ::= exclusive_or_expression ^ and_expression + // + case 130: { action.builder. + consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_binaryXor); break; + } + + // + // Rule 132: inclusive_or_expression ::= inclusive_or_expression | exclusive_or_expression + // + case 132: { action.builder. + consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_binaryOr); break; + } + + // + // Rule 134: logical_and_expression ::= logical_and_expression && inclusive_or_expression + // + case 134: { action.builder. + consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_logicalAnd); break; + } + + // + // Rule 136: logical_or_expression ::= logical_or_expression || logical_and_expression + // + case 136: { action.builder. + consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_logicalOr); break; + } + + // + // Rule 138: conditional_expression ::= logical_or_expression ? expression : assignment_expression + // + case 138: { action.builder. + consumeExpressionConditional(); break; + } + + // + // Rule 139: throw_expression ::= throw + // + case 139: { action.builder. + consumeExpressionThrow(false); break; + } + + // + // Rule 140: throw_expression ::= throw assignment_expression + // + case 140: { action.builder. + consumeExpressionThrow(true); break; + } + + // + // Rule 143: assignment_expression ::= logical_or_expression = assignment_expression + // + case 143: { action.builder. + consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_assign); break; + } + + // + // Rule 144: assignment_expression ::= logical_or_expression *= assignment_expression + // + case 144: { action.builder. + consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_multiplyAssign); break; + } + + // + // Rule 145: assignment_expression ::= logical_or_expression /= assignment_expression + // + case 145: { action.builder. + consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_divideAssign); break; + } + + // + // Rule 146: assignment_expression ::= logical_or_expression %= assignment_expression + // + case 146: { action.builder. + consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_moduloAssign); break; + } + + // + // Rule 147: assignment_expression ::= logical_or_expression += assignment_expression + // + case 147: { action.builder. + consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_plusAssign); break; + } + + // + // Rule 148: assignment_expression ::= logical_or_expression -= assignment_expression + // + case 148: { action.builder. + consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_minusAssign); break; + } + + // + // Rule 149: assignment_expression ::= logical_or_expression >>= assignment_expression + // + case 149: { action.builder. + consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_shiftRightAssign); break; + } + + // + // Rule 150: assignment_expression ::= logical_or_expression <<= assignment_expression + // + case 150: { action.builder. + consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_shiftLeftAssign); break; + } + + // + // Rule 151: assignment_expression ::= logical_or_expression &= assignment_expression + // + case 151: { action.builder. + consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_binaryAndAssign); break; + } + + // + // Rule 152: assignment_expression ::= logical_or_expression ^= assignment_expression + // + case 152: { action.builder. + consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_binaryXorAssign); break; + } + + // + // Rule 153: assignment_expression ::= logical_or_expression |= assignment_expression + // + case 153: { action.builder. + consumeExpressionBinaryOperator(ICPPASTBinaryExpression.op_binaryOrAssign); break; + } + + // + // Rule 155: expression ::= ERROR_TOKEN + // + case 155: { action.builder. + consumeExpressionProblem(); break; + } + + // + // Rule 156: expression_list ::= expression_list_actual + // + case 156: { action.builder. + consumeExpressionList(); break; + } + + // + // Rule 160: expression_list_opt ::= $Empty + // + case 160: { action.builder. + consumeEmpty(); break; + } + + // + // Rule 162: expression_opt ::= $Empty + // + case 162: { action.builder. + consumeEmpty(); break; + } + + // + // Rule 165: constant_expression_opt ::= $Empty + // + case 165: { action.builder. + consumeEmpty(); break; + } + + // + // Rule 174: statement ::= ERROR_TOKEN + // + case 174: { action.builder. + consumeStatementProblem(); break; + } + + // + // Rule 175: labeled_statement ::= identifier : statement + // + case 175: { action.builder. + consumeStatementLabeled(); break; + } + + // + // Rule 176: labeled_statement ::= case constant_expression : + // + case 176: { action.builder. + consumeStatementCase(); break; + } + + // + // Rule 177: labeled_statement ::= default : + // + case 177: { action.builder. + consumeStatementDefault(); break; + } + + // + // Rule 178: expression_statement ::= expression ; + // + case 178: { action.builder. + consumeStatementExpression(); break; + } + + // + // Rule 179: expression_statement ::= ; + // + case 179: { action.builder. + consumeStatementNull(); break; + } + + // + // Rule 180: compound_statement ::= { statement_seq } + // + case 180: { action.builder. + consumeStatementCompoundStatement(true); break; + } + + // + // Rule 181: compound_statement ::= { } + // + case 181: { action.builder. + consumeStatementCompoundStatement(false); break; + } + + // + // Rule 184: selection_statement ::= if ( condition ) statement + // + case 184: { action.builder. + consumeStatementIf(false); break; + } + + // + // Rule 185: selection_statement ::= if ( condition ) statement else statement + // + case 185: { action.builder. + consumeStatementIf(true); break; + } + + // + // Rule 186: selection_statement ::= switch ( condition ) statement + // + case 186: { action.builder. + consumeStatementSwitch(); break; + } + + // + // Rule 188: condition ::= type_specifier_seq declarator = assignment_expression + // + case 188: { action.builder. + consumeConditionDeclaration(); break; + } + + // + // Rule 189: iteration_statement ::= while ( condition ) statement + // + case 189: { action.builder. + consumeStatementWhileLoop(); break; + } + + // + // Rule 190: iteration_statement ::= do statement while ( expression ) ; + // + case 190: { action.builder. + consumeStatementDoLoop(); break; + } + + // + // Rule 191: iteration_statement ::= for ( expression_opt ; expression_opt ; expression_opt ) statement + // + case 191: { action.builder. + consumeStatementForLoop(); break; + } + + // + // Rule 192: iteration_statement ::= for ( simple_declaration expression_opt ; expression_opt ) statement + // + case 192: { action.builder. + consumeStatementForLoop(); break; + } + + // + // Rule 193: jump_statement ::= break ; + // + case 193: { action.builder. + consumeStatementBreak(); break; + } + + // + // Rule 194: jump_statement ::= continue ; + // + case 194: { action.builder. + consumeStatementContinue(); break; + } + + // + // Rule 195: jump_statement ::= return expression ; + // + case 195: { action.builder. + consumeStatementReturn(true); break; + } + + // + // Rule 196: jump_statement ::= return ; + // + case 196: { action.builder. + consumeStatementReturn(false); break; + } + + // + // Rule 197: jump_statement ::= goto identifier ; + // + case 197: { action.builder. + consumeStatementGoto(); break; + } + + // + // Rule 198: declaration_statement ::= block_declaration + // + case 198: { action.builder. + consumeStatementDeclaration(); break; + } + + // + // Rule 215: simple_declaration ::= declaration_specifiers_opt init_declarator_list_opt ; + // + case 215: { action.builder. + consumeDeclarationSimple(true); break; + } + + // + // Rule 216: declaration_specifiers ::= simple_declaration_specifiers + // + case 216: { action.builder. + consumeDeclarationSpecifiersSimple(); break; + } + + // + // Rule 217: declaration_specifiers ::= class_declaration_specifiers + // + case 217: { action.builder. + consumeDeclarationSpecifiersComposite(); break; + } + + // + // Rule 218: declaration_specifiers ::= elaborated_declaration_specifiers + // + case 218: { action.builder. + consumeDeclarationSpecifiersComposite(); break; + } + + // + // Rule 219: declaration_specifiers ::= enum_declaration_specifiers + // + case 219: { action.builder. + consumeDeclarationSpecifiersComposite(); break; + } + + // + // Rule 220: declaration_specifiers ::= type_name_declaration_specifiers + // + case 220: { action.builder. + consumeDeclarationSpecifiersTypeName(); break; + } + + // + // Rule 222: declaration_specifiers_opt ::= $Empty + // + case 222: { action.builder. + consumeEmpty(); break; + } + + // + // Rule 226: no_type_declaration_specifier ::= friend + // + case 226: { action.builder. + consumeDeclSpecToken(); break; + } + + // + // Rule 227: no_type_declaration_specifier ::= typedef + // + case 227: { action.builder. + consumeDeclSpecToken(); break; + } + + // + // Rule 255: simple_type_specifier ::= simple_type_specifier_token + // + case 255: { action.builder. + consumeDeclSpecToken(); break; + } + + // + // Rule 271: type_name_specifier ::= dcolon_opt nested_name_specifier_opt type_name + // + case 271: { action.builder. + consumeQualifiedId(false); break; + } + + // + // Rule 272: type_name_specifier ::= dcolon_opt nested_name_specifier template template_id_name + // + case 272: { action.builder. + consumeQualifiedId(false); break; + } + + // + // Rule 273: type_name_specifier ::= typename dcolon_opt nested_name_specifier identifier_name + // + case 273: { action.builder. + consumeQualifiedId(false); break; + } + + // + // Rule 274: type_name_specifier ::= typename dcolon_opt nested_name_specifier template_opt template_id_name + // + case 274: { action.builder. + consumeQualifiedId(true); break; + } + + // + // Rule 275: elaborated_type_specifier ::= class_keyword dcolon_opt nested_name_specifier_opt identifier_name + // + case 275: { action.builder. + consumeTypeSpecifierElaborated(false); break; + } + + // + // Rule 276: elaborated_type_specifier ::= class_keyword dcolon_opt nested_name_specifier_opt template_opt template_id_name + // + case 276: { action.builder. + consumeTypeSpecifierElaborated(true); break; + } + + // + // Rule 277: elaborated_type_specifier ::= enum dcolon_opt nested_name_specifier_opt identifier_name + // + case 277: { action.builder. + consumeTypeSpecifierElaborated(false); break; + } + + // + // Rule 279: enum_specifier ::= enum { enumerator_list_opt } + // + case 279: { action.builder. + consumeTypeSpecifierEnumeration(false); break; + } + + // + // Rule 280: enum_specifier ::= enum identifier { enumerator_list_opt } + // + case 280: { action.builder. + consumeTypeSpecifierEnumeration(true); break; + } + + // + // Rule 285: enumerator_definition ::= enumerator + // + case 285: { action.builder. + consumeEnumerator(false); break; + } + + // + // Rule 286: enumerator_definition ::= enumerator = constant_expression + // + case 286: { action.builder. + consumeEnumerator(true); break; + } + + // + // Rule 295: original_namespace_definition ::= namespace identifier_name { declaration_seq_opt } + // + case 295: { action.builder. + consumeNamespaceDefinition(true); break; + } + + // + // Rule 296: extension_namespace_definition ::= namespace original_namespace_name { declaration_seq_opt } + // + case 296: { action.builder. + consumeNamespaceDefinition(true); break; + } + + // + // Rule 297: unnamed_namespace_definition ::= namespace { declaration_seq_opt } + // + case 297: { action.builder. + consumeNamespaceDefinition(false); break; + } + + // + // Rule 299: namespace_alias_definition ::= namespace identifier = dcolon_opt nested_name_specifier_opt namespace_name ; + // + case 299: { action.builder. + consumeNamespaceAliasDefinition(); break; + } + + // + // Rule 300: using_declaration ::= using typename_opt dcolon_opt nested_name_specifier_opt unqualified_id_name ; + // + case 300: { action.builder. + consumeUsingDeclaration(); break; + } + + // + // Rule 301: typename_opt ::= typename + // + case 301: { action.builder. + consumePlaceHolder(); break; + } + + // + // Rule 302: typename_opt ::= $Empty + // + case 302: { action.builder. + consumeEmpty(); break; + } + + // + // Rule 303: using_directive ::= using namespace dcolon_opt nested_name_specifier_opt namespace_name ; + // + case 303: { action.builder. + consumeUsingDirective(); break; + } + + // + // Rule 304: asm_definition ::= asm ( stringlit ) ; + // + case 304: { action.builder. + consumeDeclarationASM(); break; + } + + // + // Rule 305: linkage_specification ::= extern stringlit { declaration_seq_opt } + // + case 305: { action.builder. + consumeLinkageSpecification(); break; + } + + // + // Rule 306: linkage_specification ::= extern stringlit declaration + // + case 306: { action.builder. + consumeLinkageSpecification(); break; + } + + // + // Rule 312: init_declarator ::= declarator initializer + // + case 312: { action.builder. + consumeDeclaratorWithInitializer(true); break; + } + + // + // Rule 314: declarator ::= ptr_operator_seq direct_declarator + // + case 314: { action.builder. + consumeDeclaratorWithPointer(true); break; + } + + // + // Rule 318: basic_direct_declarator ::= declarator_id_name + // + case 318: { action.builder. + consumeDirectDeclaratorIdentifier(); break; + } + + // + // Rule 319: basic_direct_declarator ::= ( declarator ) + // + case 319: { action.builder. + consumeDirectDeclaratorBracketed(); break; + } + + // + // Rule 320: function_direct_declarator ::= basic_direct_declarator ( parameter_declaration_clause ) cv_qualifier_seq_opt exception_specification_opt + // + case 320: { action.builder. + consumeDirectDeclaratorFunctionDeclarator(true); break; + } + + // + // Rule 321: array_direct_declarator ::= array_direct_declarator array_modifier + // + case 321: { action.builder. + consumeDirectDeclaratorArrayDeclarator(true); break; + } + + // + // Rule 322: array_direct_declarator ::= basic_direct_declarator array_modifier + // + case 322: { action.builder. + consumeDirectDeclaratorArrayDeclarator(true); break; + } + + // + // Rule 323: array_modifier ::= [ constant_expression ] + // + case 323: { action.builder. + consumeDirectDeclaratorArrayModifier(true); break; + } + + // + // Rule 324: array_modifier ::= [ ] + // + case 324: { action.builder. + consumeDirectDeclaratorArrayModifier(false); break; + } + + // + // Rule 325: ptr_operator ::= * cv_qualifier_seq_opt + // + case 325: { action.builder. + consumePointer(); break; + } + + // + // Rule 326: ptr_operator ::= & + // + case 326: { action.builder. + consumeReferenceOperator(); break; + } + + // + // Rule 327: ptr_operator ::= dcolon_opt nested_name_specifier * cv_qualifier_seq_opt + // + case 327: { action.builder. + consumePointerToMember(); break; + } + + // + // Rule 333: cv_qualifier ::= const + // + case 333: { action.builder. + consumeDeclSpecToken(); break; + } + + // + // Rule 334: cv_qualifier ::= volatile + // + case 334: { action.builder. + consumeDeclSpecToken(); break; + } + + // + // Rule 336: declarator_id_name ::= dcolon_opt nested_name_specifier_opt type_name + // + case 336: { action.builder. + consumeQualifiedId(false); break; + } + + // + // Rule 337: type_id ::= type_specifier_seq + // + case 337: { action.builder. + consumeTypeId(false); break; + } + + // + // Rule 338: type_id ::= type_specifier_seq abstract_declarator + // + case 338: { action.builder. + consumeTypeId(true); break; + } + + // + // Rule 341: abstract_declarator ::= ptr_operator_seq + // + case 341: { action.builder. + consumeDeclaratorWithPointer(false); break; + } + + // + // Rule 342: abstract_declarator ::= ptr_operator_seq direct_abstract_declarator + // + case 342: { action.builder. + consumeDeclaratorWithPointer(true); break; + } + + // + // Rule 346: basic_direct_abstract_declarator ::= ( abstract_declarator ) + // + case 346: { action.builder. + consumeDirectDeclaratorBracketed(); break; + } + + // + // Rule 347: array_direct_abstract_declarator ::= array_modifier + // + case 347: { action.builder. + consumeDirectDeclaratorArrayDeclarator(false); break; + } + + // + // Rule 348: array_direct_abstract_declarator ::= array_direct_abstract_declarator array_modifier + // + case 348: { action.builder. + consumeDirectDeclaratorArrayDeclarator(true); break; + } + + // + // Rule 349: array_direct_abstract_declarator ::= basic_direct_abstract_declarator array_modifier + // + case 349: { action.builder. + consumeDirectDeclaratorArrayDeclarator(true); break; + } + + // + // Rule 350: function_direct_abstract_declarator ::= basic_direct_abstract_declarator ( parameter_declaration_clause ) cv_qualifier_seq_opt exception_specification_opt + // + case 350: { action.builder. + consumeDirectDeclaratorFunctionDeclarator(true); break; + } + + // + // Rule 351: function_direct_abstract_declarator ::= ( parameter_declaration_clause ) cv_qualifier_seq_opt exception_specification_opt + // + case 351: { action.builder. + consumeDirectDeclaratorFunctionDeclarator(false); break; + } + + // + // Rule 352: parameter_declaration_clause ::= parameter_declaration_list_opt ... + // + case 352: { action.builder. + consumePlaceHolder(); break; + } + + // + // Rule 353: parameter_declaration_clause ::= parameter_declaration_list_opt + // + case 353: { action.builder. + consumeEmpty(); break; + } + + // + // Rule 354: parameter_declaration_clause ::= parameter_declaration_list , ... + // + case 354: { action.builder. + consumePlaceHolder(); break; + } + + // + // Rule 360: abstract_declarator_opt ::= $Empty + // + case 360: { action.builder. + consumeEmpty(); break; + } + + // + // Rule 361: parameter_declaration ::= declaration_specifiers parameter_init_declarator + // + case 361: { action.builder. + consumeParameterDeclaration(); break; + } + + // + // Rule 362: parameter_declaration ::= declaration_specifiers + // + case 362: { action.builder. + consumeParameterDeclarationWithoutDeclarator(); break; + } + + // + // Rule 364: parameter_init_declarator ::= declarator = parameter_initializer + // + case 364: { action.builder. + consumeDeclaratorWithInitializer(true); break; + } + + // + // Rule 366: parameter_init_declarator ::= abstract_declarator = parameter_initializer + // + case 366: { action.builder. + consumeDeclaratorWithInitializer(true); break; + } + + // + // Rule 367: parameter_init_declarator ::= = parameter_initializer + // + case 367: { action.builder. + consumeDeclaratorWithInitializer(false); break; + } + + // + // Rule 368: parameter_initializer ::= assignment_expression + // + case 368: { action.builder. + consumeInitializer(); break; + } + + // + // Rule 369: function_definition ::= declaration_specifiers_opt function_direct_declarator ctor_initializer_list_opt function_body + // + case 369: { action.builder. + consumeFunctionDefinition(false); break; + } + + // + // Rule 370: function_definition ::= declaration_specifiers_opt function_direct_declarator try ctor_initializer_list_opt function_body handler_seq + // + case 370: { action.builder. + consumeFunctionDefinition(true); break; + } + + // + // Rule 373: initializer ::= ( expression_list ) + // + case 373: { action.builder. + consumeInitializerConstructor(); break; + } + + // + // Rule 374: initializer_clause ::= assignment_expression + // + case 374: { action.builder. + consumeInitializer(); break; + } + + // + // Rule 375: initializer_clause ::= { initializer_list , } + // + case 375: { action.builder. + consumeInitializerList(); break; + } + + // + // Rule 376: initializer_clause ::= { initializer_list } + // + case 376: { action.builder. + consumeInitializerList(); break; + } + + // + // Rule 377: initializer_clause ::= { } + // + case 377: { action.builder. + consumeInitializerList(); break; + } + + // + // Rule 382: class_specifier ::= class_head { member_declaration_list_opt } + // + case 382: { action.builder. + consumeClassSpecifier(); break; + } + + // + // Rule 383: class_head ::= class_keyword identifier_name_opt base_clause_opt + // + case 383: { action.builder. + consumeClassHead(false); break; + } + + // + // Rule 384: class_head ::= class_keyword template_id_name base_clause_opt + // + case 384: { action.builder. + consumeClassHead(false); break; + } + + // + // Rule 385: class_head ::= class_keyword nested_name_specifier identifier_name base_clause_opt + // + case 385: { action.builder. + consumeClassHead(true); break; + } + + // + // Rule 386: class_head ::= class_keyword nested_name_specifier template_id_name base_clause_opt + // + case 386: { action.builder. + consumeClassHead(true); break; + } + + // + // Rule 390: identifier_name_opt ::= $Empty + // + case 390: { action.builder. + consumeEmpty(); break; + } + + // + // Rule 394: visibility_label ::= access_specifier_keyword : + // + case 394: { action.builder. + consumeVisibilityLabel(); break; + } + + // + // Rule 395: member_declaration ::= declaration_specifiers_opt member_declarator_list ; + // + case 395: { action.builder. + consumeDeclarationSimple(true); break; + } + + // + // Rule 396: member_declaration ::= declaration_specifiers_opt ; + // + case 396: { action.builder. + consumeDeclarationSimple(false); break; + } + + // + // Rule 399: member_declaration ::= dcolon_opt nested_name_specifier template_opt unqualified_id_name ; + // + case 399: { action.builder. + consumeMemberDeclarationQualifiedId(); break; + } + + // + // Rule 410: member_declarator ::= declarator constant_initializer + // + case 410: { action.builder. + consumeMemberDeclaratorWithInitializer(); break; + } + + // + // Rule 411: member_declarator ::= bit_field_declarator : constant_expression + // + case 411: { action.builder. + consumeBitField(true); break; + } + + // + // Rule 412: member_declarator ::= : constant_expression + // + case 412: { action.builder. + consumeBitField(false); break; + } + + // + // Rule 413: bit_field_declarator ::= identifier_name + // + case 413: { action.builder. + consumeDirectDeclaratorIdentifier(); break; + } + + // + // Rule 420: base_specifier ::= dcolon_opt nested_name_specifier_opt class_name + // + case 420: { action.builder. + consumeBaseSpecifier(false); break; + } + + // + // Rule 421: base_specifier ::= virtual_opt access_specifier_keyword virtual_opt dcolon_opt nested_name_specifier_opt class_name + // + case 421: { action.builder. + consumeBaseSpecifier(true); break; + } + + // + // Rule 422: virtual_opt ::= virtual + // + case 422: { action.builder. + consumePlaceHolder(); break; + } + + // + // Rule 423: virtual_opt ::= $Empty + // + case 423: { action.builder. + consumeEmpty(); break; + } + + // + // Rule 429: conversion_function_id_name ::= operator conversion_type_id + // + case 429: { action.builder. + consumeConversionName(); break; + } + + // + // Rule 430: conversion_type_id ::= type_specifier_seq conversion_declarator + // + case 430: { action.builder. + consumeTypeId(true); break; + } + + // + // Rule 431: conversion_type_id ::= type_specifier_seq + // + case 431: { action.builder. + consumeTypeId(false); break; + } + + // + // Rule 432: conversion_declarator ::= ptr_operator_seq + // + case 432: { action.builder. + consumeDeclaratorWithPointer(false); break; + } + + // + // Rule 438: mem_initializer ::= mem_initializer_name ( expression_list_opt ) + // + case 438: { action.builder. + consumeConstructorChainInitializer(); break; + } + + // + // Rule 439: mem_initializer_name ::= dcolon_opt nested_name_specifier_opt class_name + // + case 439: { action.builder. + consumeQualifiedId(false); break; + } + + // + // Rule 442: operator_function_id_name ::= operator_id_name < template_argument_list_opt > + // + case 442: { action.builder. + consumeTemplateId(); break; + } + + // + // Rule 443: operator_id_name ::= operator overloadable_operator + // + case 443: { action.builder. + consumeOperatorName(); break; + } + + // + // Rule 486: template_declaration ::= export_opt template < template_parameter_list > declaration + // + case 486: { action.builder. + consumeTemplateDeclaration(); break; + } + + // + // Rule 487: export_opt ::= export + // + case 487: { action.builder. + consumePlaceHolder(); break; + } + + // + // Rule 488: export_opt ::= $Empty + // + case 488: { action.builder. + consumeEmpty(); break; + } + + // + // Rule 493: type_parameter ::= class identifier_name_opt + // + case 493: { action.builder. + consumeSimpleTypeTemplateParameter(false); break; + } + + // + // Rule 494: type_parameter ::= class identifier_name_opt = type_id + // + case 494: { action.builder. + consumeSimpleTypeTemplateParameter(true); break; + } + + // + // Rule 495: type_parameter ::= typename identifier_name_opt + // + case 495: { action.builder. + consumeSimpleTypeTemplateParameter(false); break; + } + + // + // Rule 496: type_parameter ::= typename identifier_name_opt = type_id + // + case 496: { action.builder. + consumeSimpleTypeTemplateParameter(true); break; + } + + // + // Rule 497: type_parameter ::= template < template_parameter_list > class identifier_name_opt + // + case 497: { action.builder. + consumeTemplatedTypeTemplateParameter(false); break; + } + + // + // Rule 498: type_parameter ::= template < template_parameter_list > class identifier_name_opt = id_expression + // + case 498: { action.builder. + consumeTemplatedTypeTemplateParameter(true); break; + } + + // + // Rule 499: template_id_name ::= template_identifier < template_argument_list_opt > + // + case 499: { action.builder. + consumeTemplateId(); break; + } + + // + // Rule 508: explicit_instantiation ::= template declaration + // + case 508: { action.builder. + consumeTemplateExplicitInstantiation(); break; + } + + // + // Rule 509: explicit_specialization ::= template < > declaration + // + case 509: { action.builder. + consumeTemplateExplicitSpecialization(); break; + } + + // + // Rule 510: try_block ::= try compound_statement handler_seq + // + case 510: { action.builder. + consumeStatementTryBlock(); break; + } + + // + // Rule 513: handler ::= catch ( exception_declaration ) compound_statement + // + case 513: { action.builder. + consumeStatementCatchHandler(false); break; + } + + // + // Rule 514: handler ::= catch ( ... ) compound_statement + // + case 514: { action.builder. + consumeStatementCatchHandler(true); break; + } + + // + // Rule 515: exception_declaration ::= type_specifier_seq declarator + // + case 515: { action.builder. + consumeDeclarationSimple(true); break; + } + + // + // Rule 516: exception_declaration ::= type_specifier_seq abstract_declarator + // + case 516: { action.builder. + consumeDeclarationSimple(true); break; + } + + // + // Rule 517: exception_declaration ::= type_specifier_seq + // + case 517: { action.builder. + consumeDeclarationSimple(false); break; + } + + // + // Rule 525: expression_parser_start ::= ERROR_TOKEN + // + case 525: { action.builder. + consumeExpressionProblem(); break; + } + + + default: + break; + } + return; + } +} + diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPExpressionStatementParserprs.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPExpressionStatementParserprs.java new file mode 100644 index 00000000000..3c192f5a5b2 --- /dev/null +++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPExpressionStatementParserprs.java @@ -0,0 +1,2728 @@ +/******************************************************************************* +* Copyright (c) 2006, 2008 IBM Corporation and others. +* All rights reserved. This program and the accompanying materials +* are made available under the terms of the Eclipse Public License v1.0 +* which accompanies this distribution, and is available at +* http://www.eclipse.org/legal/epl_v10.html +* +* Contributors: +* IBM Corporation - initial API and implementation +*********************************************************************************/ + +// This file was generated by LPG + +package org.eclipse.cdt.internal.core.dom.lrparser.cpp; + +public class CPPExpressionStatementParserprs implements lpg.lpgjavaruntime.ParseTable, CPPExpressionStatementParsersym { + + public interface IsKeyword { + public final static byte isKeyword[] = {0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0 + }; + }; + public final static byte isKeyword[] = IsKeyword.isKeyword; + public final boolean isKeyword(int index) { return isKeyword[index] != 0; } + + public interface BaseCheck { + public final static short baseCheck[] = {0, + 0,0,0,0,0,1,1,1,1,1, + 0,1,1,1,1,1,1,1,1,1, + 3,1,1,1,1,1,1,1,1,2, + 1,1,0,1,0,4,2,2,2,3, + 2,3,2,2,1,0,1,1,1,4, + 4,4,8,8,3,3,4,4,3,3, + 2,2,7,7,7,7,4,4,6,7, + 4,1,1,1,2,2,2,2,2,2, + 2,2,2,4,7,7,3,1,0,1, + 2,2,1,2,3,4,1,0,3,1, + 0,3,5,1,4,1,3,3,1,3, + 3,3,1,3,3,1,3,3,1,3, + 3,3,3,1,3,3,1,3,1,3, + 1,3,1,3,1,3,1,5,1,2, + 1,1,3,3,3,3,3,3,3,3, + 3,3,3,1,1,2,1,3,1,0, + 1,0,1,1,0,1,1,1,1,1, + 1,1,1,1,3,3,2,2,1,4, + 2,1,2,5,7,5,1,4,5,7, + 9,8,2,2,3,2,3,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,2,1,0,4,2,2,2,2,2, + 1,0,1,1,1,1,1,1,2,1, + 2,2,2,1,2,2,1,2,2,1, + 2,2,1,2,2,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 3,4,4,5,4,5,4,1,5,6, + 1,3,1,0,1,3,1,1,1,1, + 1,1,1,1,6,6,5,1,7,6, + 1,0,6,5,6,4,1,3,1,0, + 1,2,1,3,1,1,1,1,3,9, + 2,2,3,2,3,1,5,1,2,2, + 1,0,1,1,1,3,1,2,1,1, + 2,3,1,1,1,3,1,2,2,9, + 8,2,1,3,1,3,1,0,1,0, + 2,1,1,3,1,3,2,1,5,8, + 1,2,3,1,5,4,3,1,3,1, + 1,5,4,4,5,5,1,0,1,0, + 1,1,1,2,4,2,2,1,5,1, + 1,1,1,2,1,0,1,3,1,2, + 3,2,1,2,2,1,0,1,3,3, + 6,1,0,1,1,1,1,0,2,2, + 1,2,2,1,0,1,3,4,3,1, + 1,5,2,1,1,3,3,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,2,2,7,1,0,1,3, + 1,1,2,4,2,4,7,9,5,1, + 1,3,1,0,1,1,1,2,4,4, + 1,2,5,5,3,3,1,4,3,1, + 0,1,3,2,1,-63,0,0,0,-2, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,-12,0, + 0,0,0,0,0,0,0,0,-124,0, + 0,0,0,0,-5,0,0,-145,0,0, + 0,-6,-128,0,0,0,0,0,-83,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,-140,0,0,0,0,0,-7,-327,0, + 0,0,0,0,0,0,0,0,0,0, + 0,-23,0,0,0,-55,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,-186,0, + 0,0,0,0,-148,0,0,0,0,0, + 0,0,0,0,0,0,-3,0,0,0, + 0,0,0,0,-116,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,-300,0,0,0,0,0,0,0, + 0,0,-178,0,0,0,-246,-350,0,0, + 0,0,0,0,0,0,0,-394,0,0, + -132,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,-59,0, + 0,-8,0,-9,0,0,0,0,-51,0, + 0,0,0,-195,0,0,0,-60,0,-54, + 0,-87,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,-66,-65, + 0,-223,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,-306,0,0,0,0,-182, + -358,0,0,0,0,0,0,-292,0,0, + 0,0,0,0,-234,0,0,-508,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + -288,0,0,0,0,0,0,0,0,0, + -146,0,0,0,0,-242,0,0,0,-510, + 0,0,0,0,0,0,0,0,0,0, + 0,0,-337,0,0,-352,0,0,0,0, + 0,0,0,0,0,0,0,-10,-225,-264, + -518,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,-355,0,0,0,0,0,0,-289,0, + 0,0,0,-11,0,0,0,-52,-61,0, + -13,0,0,0,0,0,-335,0,-4,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,-14,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,-16,0,0,-277,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,-17,0,0,0,0,-117,0,0, + 0,0,0,0,0,0,-312,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,-130, + 0,0,0,0,-431,0,0,0,0,0, + 0,0,0,0,0,-245,0,0,-151,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,-313,0,0,0,-137,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,-30,0,0,0,0, + 0,0,0,-31,0,0,0,0,0,0, + 0,0,0,0,-470,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,-395,0,0, + 0,0,0,0,0,0,0,-416,0,0, + 0,0,-365,0,0,0,-41,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,-429, + 0,0,0,0,0,0,0,-32,0,-108, + 0,0,0,0,-366,0,0,0,0,-43, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,-33,0,0,0,0,-109,-131,0, + 0,0,-95,0,0,0,-138,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,-34,0,-142,0,0,0,0, + -153,-35,0,0,-96,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,-199,0,0,0,0,0,0,0, + 0,0,-324,-36,0,0,-97,0,0,0, + -280,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,-37, + 0,0,0,0,0,0,0,-261,0,0, + 0,0,0,0,-281,-38,0,0,-98,0, + 0,0,-39,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,-346,-40,0,0, + -99,0,0,0,-42,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,-450,0, + 0,-330,0,-456,0,0,0,0,0,-56, + 0,0,-100,0,0,0,-57,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,-67,0,0,0,0, + 0,0,0,-348,0,0,0,0,0,0, + -68,-70,0,0,-101,0,0,0,-71,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,-110,0,0, + 0,0,0,0,0,-367,0,-490,0,0, + 0,0,-111,-112,0,0,-102,0,0,0, + -113,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,-120, + 0,0,0,0,0,0,0,-404,0,-127, + 0,0,0,0,-139,-154,0,0,-103,0, + 0,0,-155,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,-156,0,0,0,0,0,0,0,-412, + 0,-157,0,0,0,0,-158,0,0,0, + -104,0,0,0,-159,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,-413,0,-160,0,0,0,0,-161,-162, + 0,0,-105,0,0,0,-339,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,-114,0,0,0,0, + 0,0,0,-163,0,-164,0,0,0,0, + -165,-166,0,0,-135,0,0,0,-167,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,-134,0,0, + 0,0,0,0,0,-168,0,-169,0,0, + 0,0,-115,-440,-216,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,-170,0,0, + 0,0,-205,0,0,0,0,-171,0,0, + 0,0,0,0,0,0,-18,0,0,0, + -172,0,0,0,-359,-147,0,-503,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,-500,0,0,0,0, + 0,0,0,0,0,0,-173,0,0,-309, + 0,0,0,-174,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,-175,0,0,0,0,-152,0,0, + -176,0,-201,0,0,0,0,-323,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,-229,0, + -179,0,0,0,0,-72,0,0,0,0, + 0,0,0,0,0,0,0,-1,0,-180, + -210,0,-333,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + -181,0,0,0,0,0,0,0,0,0, + -353,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,-231,0,0,0,0,-190,0, + 0,-191,0,-196,0,0,0,0,-73,0, + 0,0,-197,0,0,0,0,0,0,0, + -75,-200,0,0,0,-354,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,-211,0,0,0, + 0,0,0,-402,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,-215,0,0,0, + 0,-221,0,0,-222,0,0,0,0,0, + 0,-177,-58,0,0,-184,0,0,0,0, + -149,0,0,0,-236,-224,0,0,-107,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,-106,0,0,-237,0,-94,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,-238,0,0,0,0,0, + 0,-92,0,0,0,-244,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,-251,0,0,0,0,-267, + 0,0,-240,0,-93,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,-249,0,0,-53,0,0,0,-198, + 0,-284,-310,-262,0,-185,0,0,0,0, + -304,0,0,0,0,0,0,0,0,0, + 0,0,-89,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,-501,0,0,0,0, + -263,0,0,-144,-479,0,-400,0,-217,-252, + 0,-273,0,0,-243,0,0,0,0,0, + 0,0,-441,0,0,0,-209,0,0,0, + 0,0,0,0,0,-274,0,-278,0,0, + 0,0,0,-478,0,0,0,0,0,0, + 0,0,0,-279,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,-250, + -469,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,-90,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,-91,0,0,0,-290,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,-293,0,0,0,0, + -84,0,0,0,-294,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,-268,0,0,0,-85,0,0, + 0,-299,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,-86,0,0,0,-247,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,-303,0,0, + 0,-239,0,0,0,0,0,0,0,0, + 0,0,0,-88,0,0,0,-298,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,-15,0,0,-187, + 0,0,-253,0,-283,0,0,0,0,0, + 0,0,0,0,0,0,-305,0,0,0, + 0,0,0,-321,-230,0,-326,-119,0,0, + 0,-270,-332,0,0,0,-122,0,0,0, + 0,0,0,-453,0,-259,-241,0,-334,-258, + 0,-214,0,0,0,-340,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + -363,0,0,0,0,0,-364,-254,0,0, + 0,0,0,0,0,0,0,0,-275,0, + 0,0,0,0,0,0,0,0,-235,0, + -370,-372,0,0,0,0,0,0,0,0, + 0,0,-62,0,-468,-369,0,-286,0,0, + 0,0,0,-272,-376,0,0,0,0,0, + -374,0,0,0,0,0,-189,0,0,0, + 0,0,0,-269,-129,0,0,0,0,0, + 0,0,0,0,0,-380,0,0,0,-118, + 0,0,0,0,0,0,0,0,0,-192, + -45,0,0,0,0,0,-295,0,-475,0, + 0,0,0,0,0,0,0,0,0,0, + -381,0,-287,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,-390,-296,0, + 0,0,0,0,-317,-297,0,-349,0,0, + -316,0,0,0,0,0,-345,0,0,0, + 0,0,0,-356,-368,-20,0,0,0,-393, + 0,0,-476,0,0,-338,0,0,0,0, + 0,-266,0,0,0,0,0,-401,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,-411,0,0,0,0,-445,0,0,0, + 0,-342,0,0,-361,0,0,0,0,0, + 0,0,0,0,0,0,0,0,-203,0, + 0,-208,0,0,0,0,-403,0,0,0, + 0,-227,0,0,-228,0,0,0,0,0, + 0,0,-405,-406,0,0,0,0,0,0, + -407,0,0,0,0,-502,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,-78,0,0,0,-496,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,-232,-233, + 0,-50,0,-409,0,0,-257,0,0,-410, + 0,0,0,0,0,0,0,-415,0,0, + 0,0,0,0,0,0,-417,0,0,0, + 0,-422,-21,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,-424,-79,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,-383,0,-360,-426,0,-265,0,0,0, + 0,0,0,0,0,0,0,0,-212,0, + 0,0,-308,0,0,-385,0,0,0,0, + -276,-302,-357,0,0,0,0,0,-418,0, + 0,-427,0,0,-314,0,-428,0,0,0, + 0,0,0,0,0,0,0,0,-430,-432, + 0,0,0,0,-433,0,0,0,0,0, + -438,0,0,0,0,0,0,0,0,0, + -80,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,-81,0,0,0,-311,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,-82,0,0,0, + -442,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,-319, + 0,0,0,-451,0,0,0,0,0,0, + 0,-320,-384,0,0,0,-328,0,-419,-136, + 0,-458,-399,0,-378,-74,-396,0,0,0, + 0,-452,-392,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,-388,0, + -473,0,0,0,-248,0,0,0,0,0, + 0,0,0,0,0,-336,0,0,0,0, + 0,0,-449,0,0,0,0,0,0,-391, + -341,0,-331,0,0,0,-121,0,0,0, + 0,0,0,0,0,-465,0,0,0,0, + 0,-377,0,0,-467,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,-484,0,-498,0,0,0,0,0,0, + 0,0,0,0,0,-362,-143,-499,0,0, + 0,0,0,0,0,0,0,-375,-379,0, + -408,0,0,-464,0,-504,-382,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,-285,-414,0,0,0,0,0,0, + -420,-434,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,-49,0, + 0,0,0,0,0,-315,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,-446,0,0,-472,0,-491,0,0,0, + 0,0,0,0,0,0,0,0,-486,0, + 0,0,0,0,0,0,-46,-421,0,0, + 0,0,0,0,0,0,0,0,0,0, + -202,-494,-255,0,0,0,0,0,0,0, + 0,0,0,0,0,0,-448,0,-495,0, + 0,-123,-344,0,-271,0,0,0,0,0, + 0,0,0,0,0,-389,-47,0,-425,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,-443,0,-125,-218,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,-474,-447,-454,0,0,0,0,0,0, + 0,0,0,0,0,0,0,-141,0,0, + 0,0,0,-455,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,-460, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,-462,0, + 0,0,-483,-466,-480,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,-387,0,0,0, + 0,0,-481,0,0,-482,0,0,-493,0, + 0,0,0,-485,0,0,-497,0,0,0, + -492,0,0,0,0,0,0,0,0,-183, + 0,0,0,-459,0,0,0,0,0,-506, + -509,0,-507,0,0,0,0,0,0,0, + 0,0,0,0,-489,0,0,-514,0,0, + 0,-512,0,0,0,0,0,0,-517,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,-511,0,0,-515,0, + 0,0,0,0,0,0,0,0,0,0, + 0,-194,0,0,0,-256,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,-516,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,-519,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,-204,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,-22,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,-24,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + -25,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,-26,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,-27,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,-28,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,-29,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + -64,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,-76,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,-77,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,-126,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,-133,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,-206, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,-463,-487,0,0,0,0,0,0,0, + 0,0,-301,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,-423,0,0,0,0, + 0,0,0,0,0,0,0,-351,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,-48,0,0,0,0,0, + 0,-471,0,0,0,0,0,0,0,0, + 0,0,0,0,0,-219,0,0,-226,0, + 0,0,0,0,0,0,0,0,0,0, + 0,-322,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,-150,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + -461,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,-325,0, + 0,0,0,0,0,0,0,0,-188,0, + 0,0,0,0,-193,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,-347,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,-282,0,0, + 0,0,0,-307,0,0,0,0,0,0, + 0,0,0,0,-207,0,0,0,0,0, + 0,0,0,-329,0,0,0,0,0,-343, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,-371,0,0, + 0,0,0,-373,0,0,0,0,0,0, + 0,0,0,0,0,-220,0,0,0,0, + -457,0,0,0,0,0,0,0,0,-477, + 0,0,0,-318,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,-397,0,0,0,0,0, + 0,0,0,0,0,0,-291,0,0,0, + 0,0,0,0,0,0,0,0,0,-213, + 0,0,0,0,0,0,0,0,-260,0, + 0,0,0,0,0,0,0,0,0,-386, + 0,0,0,0,0,0,0,0,0,0, + 0,-437,0,0,-19,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,-44,0,0, + -69,0,0,0,0,0,-435,0,0,-436, + 0,0,0,0,0,0,0,-398,-439,0, + 0,0,0,0,0,0,-444,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,-505,-513, + -488,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0 + }; + }; + public final static short baseCheck[] = BaseCheck.baseCheck; + public final int baseCheck(int index) { return baseCheck[index]; } + public final static short rhs[] = baseCheck; + public final int rhs(int index) { return rhs[index]; }; + + public interface BaseAction { + public final static char baseAction[] = { + 169,4,192,193,194,135,79,33,62,39, + 195,195,15,15,15,15,15,15,15,15, + 16,16,16,14,10,10,8,8,8,8, + 8,1,63,63,5,5,11,11,11,11, + 47,47,136,136,137,58,58,45,45,17, + 17,17,17,17,17,17,17,17,17,17, + 17,17,17,17,17,17,17,17,17,138, + 138,138,18,18,18,18,18,18,18,18, + 18,18,18,18,18,19,19,173,170,170, + 171,171,174,140,140,175,175,172,172,141, + 139,139,20,20,21,21,22,22,22,24, + 24,24,24,25,25,25,26,26,26,27, + 27,27,27,27,29,29,29,30,30,32, + 32,34,34,35,35,36,36,37,37,41, + 41,40,40,40,40,40,40,40,40,40, + 40,40,40,40,38,38,28,142,142,102, + 102,106,106,97,196,196,71,71,71,71, + 71,71,71,71,71,72,72,72,73,73, + 56,56,176,176,74,74,74,117,117,75, + 75,75,75,76,76,76,76,76,77,82, + 82,82,82,82,82,82,51,51,51,51, + 51,108,108,109,109,50,23,23,23,23, + 23,46,46,93,93,93,93,93,148,148, + 143,143,143,143,144,144,144,145,145,145, + 146,146,146,147,147,147,94,94,94,94, + 94,95,95,95,87,12,13,13,13,13, + 13,13,13,13,13,13,13,80,80,80, + 121,121,121,121,121,119,119,119,88,120, + 120,150,150,149,149,123,123,124,43,43, + 42,86,86,89,89,91,92,90,44,53, + 49,151,151,54,52,85,85,178,178,177, + 177,152,152,81,81,67,67,67,59,59, + 60,68,68,69,69,64,64,64,103,103, + 105,104,104,57,57,61,61,55,55,48, + 107,107,107,98,98,98,99,100,100,100, + 101,101,110,110,110,112,112,111,111,197, + 197,96,96,180,180,180,180,180,126,65, + 65,154,179,179,127,127,127,127,181,181, + 31,31,118,128,128,128,128,198,198,113, + 113,122,122,122,156,157,157,157,157,157, + 157,157,157,184,184,182,182,183,183,158, + 158,158,158,159,185,115,114,114,186,186, + 160,160,130,130,129,129,129,199,199,9, + 187,187,188,161,153,153,162,162,163,164, + 164,6,6,7,166,166,166,166,166,166, + 166,166,166,166,166,166,166,166,166,166, + 166,166,166,166,166,166,166,166,166,166, + 166,166,166,166,166,166,166,166,166,166, + 166,166,166,166,166,166,66,70,70,167, + 167,131,131,132,132,132,132,132,132,2, + 3,168,168,165,165,133,133,133,83,84, + 78,155,155,116,116,189,189,189,134,134, + 125,125,190,190,169,169,1438,1569,1562,1027, + 755,3618,27,1042,24,28,23,25,1645,255, + 22,20,49,1166,104,73,74,106,1174,583, + 1303,1258,1352,1344,3469,1420,1394,267,1443,1563, + 1436,1478,1485,141,4465,1431,157,142,2583,26, + 29,1027,1217,583,27,1042,36,28,3812,3172, + 26,29,1027,225,2886,27,1042,24,28,23, + 25,991,255,22,20,49,1166,104,73,74, + 106,1174,583,1303,1258,1695,270,3894,146,2583, + 26,29,1027,269,268,27,1042,1554,28,228, + 223,224,3172,1569,1562,1027,1433,2886,27,1042, + 24,28,23,25,991,255,22,20,49,1166, + 104,73,74,81,234,237,240,243,2687,1864, + 2965,2962,1027,30,1630,2145,26,29,1027,484, + 4680,27,1042,24,28,58,25,1479,572,2810, + 2678,3347,3552,3587,4177,2103,26,29,1027,2326, + 2886,27,1042,24,28,2000,25,991,255,22, + 20,49,1166,104,73,74,106,1174,339,1303, + 1258,1352,1344,583,1420,1394,524,1443,4544,1436, + 1478,1485,141,2437,2165,505,142,239,2583,26, + 29,1027,3730,2763,27,1042,1596,28,3258,3152, + 506,2103,26,29,1027,2326,2886,27,1042,24, + 28,2000,25,991,255,22,20,49,1166,104, + 73,74,106,1174,339,1303,1258,1352,1344,2748, + 1420,1394,243,1443,1369,1436,1478,1485,141,46, + 3115,505,142,675,2564,380,381,1027,1433,2763, + 132,858,3172,26,29,1027,506,2886,27,1042, + 24,28,23,25,991,255,22,20,49,1166, + 104,73,74,106,1174,267,1303,1764,501,1509, + 674,4204,2482,26,29,1027,2326,2886,27,1042, + 24,28,2000,25,991,255,22,20,49,1166, + 104,73,74,106,1174,339,1303,1258,1352,1344, + 1981,1420,1394,2031,1443,761,1436,1478,1485,141, + 1619,583,505,142,271,3730,4604,92,2160,485, + 2763,269,268,3730,501,2437,277,506,2524,26, + 29,1027,568,2886,27,1042,24,28,23,25, + 991,255,22,20,49,1166,104,73,74,106, + 1174,2904,1303,1258,1352,1344,2083,1420,1394,2031, + 1443,2055,1436,1478,1485,141,2709,273,374,142, + 2574,26,29,1027,329,4680,27,1042,24,28, + 23,25,858,3421,498,443,891,26,29,1027, + 377,4550,27,1042,24,28,335,25,1482,2642, + 1956,2596,26,29,1027,502,2886,27,1042,24, + 28,23,25,991,255,22,20,49,1166,104, + 73,74,106,1174,3129,1303,1258,1352,1344,2843, + 1420,1394,3421,1443,1737,1436,1478,1485,141,2904, + 3397,374,142,88,1556,1435,316,318,918,1433, + 329,232,1078,314,1401,378,2700,3446,94,2919, + 26,29,1027,375,2886,27,1042,24,28,23, + 25,991,255,22,20,49,1166,104,73,74, + 106,1174,21,1303,1258,1352,1344,1575,1420,1394, + 86,1443,100,1436,1478,1485,141,40,2127,157, + 142,713,1576,325,331,2919,26,29,1027,3799, + 2886,27,1042,24,28,23,25,991,255,22, + 20,49,1166,104,73,74,106,1174,379,1303, + 1258,1352,1344,1950,1420,1394,2884,1443,239,1436, + 1478,1485,141,3730,434,368,142,2919,26,29, + 1027,703,2886,27,1042,24,28,23,25,991, + 255,22,20,49,1166,104,73,74,106,1174, + 132,1303,1258,1352,1344,3524,1420,1394,85,1443, + 100,1436,1478,1485,141,2885,2842,368,142,2145, + 26,29,1027,434,4680,27,1042,24,28,57, + 25,572,328,2919,26,29,1027,2770,2886,27, + 1042,24,28,23,25,991,255,22,20,49, + 1166,104,73,74,106,1174,3562,1303,1258,1352, + 1344,367,1420,1394,2581,1443,430,1436,1478,1485, + 141,850,410,368,142,2860,26,29,1027,447, + 2886,27,1042,24,28,23,25,991,255,22, + 20,49,1166,104,73,74,106,1174,2576,1303, + 1258,1352,1344,366,1420,1394,348,1443,3389,1436, + 1478,1485,141,2999,389,374,142,2440,26,29, + 1027,512,2886,27,1042,24,28,23,25,991, + 255,22,20,49,1166,104,73,74,106,1174, + 583,1303,1258,1352,1344,4621,1420,1394,62,1443, + 1433,1436,1478,1485,141,2999,389,140,142,364, + 2919,26,29,1027,3585,2886,27,1042,24,28, + 23,25,991,255,22,20,49,1166,104,73, + 74,106,1174,68,1303,1258,1352,1344,979,1420, + 1394,2507,1443,69,1436,1478,1485,141,1433,132, + 158,142,372,2919,26,29,1027,1496,2886,27, + 1042,24,28,23,25,991,255,22,20,49, + 1166,104,73,74,106,1174,2806,1303,1258,1352, + 1344,67,1420,1394,3285,1443,132,1436,1478,1485, + 141,132,413,153,142,2919,26,29,1027,703, + 2886,27,1042,24,28,23,25,991,255,22, + 20,49,1166,104,73,74,106,1174,2841,1303, + 1258,1352,1344,132,1420,1394,349,1443,446,1436, + 1478,1485,141,132,411,152,142,2919,26,29, + 1027,3348,2886,27,1042,24,28,23,25,991, + 255,22,20,49,1166,104,73,74,106,1174, + 60,1303,1258,1352,1344,4230,1420,1394,2790,1443, + 50,1436,1478,1485,141,3254,406,151,142,2919, + 26,29,1027,578,2886,27,1042,24,28,23, + 25,991,255,22,20,49,1166,104,73,74, + 106,1174,323,1303,1258,1352,1344,397,1420,1394, + 321,1443,95,1436,1478,1485,141,132,748,150, + 142,2919,26,29,1027,1545,2886,27,1042,24, + 28,23,25,991,255,22,20,49,1166,104, + 73,74,106,1174,322,1303,1258,1352,1344,1298, + 1420,1394,2751,1443,583,1436,1478,1485,141,4630, + 1523,149,142,2919,26,29,1027,2766,2886,27, + 1042,24,28,23,25,991,255,22,20,49, + 1166,104,73,74,106,1174,843,1303,1258,1352, + 1344,395,1420,1394,1479,1443,96,1436,1478,1485, + 141,157,1499,148,142,2919,26,29,1027,1572, + 2886,27,1042,24,28,23,25,991,255,22, + 20,49,1166,104,73,74,106,1174,1021,1303, + 1258,1352,1344,399,1420,1394,1479,1443,3525,1436, + 1478,1485,141,1168,1171,147,142,2919,26,29, + 1027,1283,2886,27,1042,24,28,23,25,991, + 255,22,20,49,1166,104,73,74,106,1174, + 762,1303,1258,1352,1344,300,1420,1394,1479,1443, + 861,1436,1478,1485,141,924,325,146,142,2919, + 26,29,1027,327,2886,27,1042,24,28,23, + 25,991,255,22,20,49,1166,104,73,74, + 106,1174,2698,1303,1258,1352,1344,178,1420,1394, + 1479,1443,2699,1436,1478,1485,141,2730,312,145, + 142,2919,26,29,1027,501,2886,27,1042,24, + 28,23,25,991,255,22,20,49,1166,104, + 73,74,106,1174,512,1303,1258,1352,1344,194, + 1420,1394,1479,1443,503,1436,1478,1485,141,585, + 673,144,142,2919,26,29,1027,3439,2886,27, + 1042,24,28,23,25,991,255,22,20,49, + 1166,104,73,74,106,1174,899,1303,1258,1352, + 1344,193,1420,1394,320,1443,836,1436,1478,1485, + 141,662,3422,143,142,3019,26,29,1027,3468, + 2886,27,1042,24,28,23,25,991,255,22, + 20,49,1166,104,73,74,106,1174,239,1303, + 1258,1352,1344,3730,1420,1394,2594,1443,841,1436, + 1478,2092,163,1433,1479,2919,26,29,1027,2172, + 2886,27,1042,24,28,23,25,991,255,22, + 20,49,1166,104,73,74,106,1174,1548,1303, + 1258,1352,1344,2257,1420,1394,52,1443,492,1436, + 1478,1485,141,197,324,138,142,1512,37,39, + 1027,1774,328,38,1042,3255,1433,851,3058,26, + 29,1027,1383,2886,27,1042,24,28,23,25, + 991,255,22,20,49,1166,104,73,74,106, + 1174,713,1303,1258,1352,1344,3389,1420,1394,84, + 1443,2330,1436,1478,1485,141,568,1415,188,142, + 3172,26,29,1027,1963,2886,27,1042,24,28, + 23,25,991,255,22,20,49,1166,104,73, + 74,106,1174,2150,1303,1258,1352,1344,1433,1420, + 1394,2162,1443,1433,1436,1478,2092,163,3172,26, + 29,1027,514,2886,27,1042,24,28,23,25, + 991,255,22,20,49,1166,104,73,74,106, + 1174,51,1303,1258,1352,1344,346,1420,1394,2758, + 1443,2147,1436,1478,2092,163,2656,26,29,1027, + 351,4395,27,1042,24,28,56,25,1968,520, + 1034,1433,999,3172,26,29,1027,286,2886,27, + 1042,24,28,23,25,991,255,22,20,49, + 1166,104,73,74,106,1174,154,1303,1258,1352, + 1344,2590,1420,1394,87,1443,667,1436,1478,2092, + 163,3172,26,29,1027,1477,2886,27,1042,24, + 28,23,25,991,255,22,20,49,1166,104, + 73,74,106,1174,2758,1303,1258,1352,1344,2670, + 1420,1394,1819,1443,3288,1436,1478,2092,163,2761, + 26,29,1027,2841,4395,27,1042,24,28,55, + 25,2013,390,383,416,999,3172,26,29,1027, + 412,2886,27,1042,24,28,23,25,991,255, + 22,20,49,1166,104,73,74,106,1174,154, + 1303,1258,1352,1344,60,1420,1394,2693,1443,1351, + 1436,1478,2092,163,3211,26,29,1027,411,2886, + 27,1042,24,28,23,25,991,255,22,20, + 49,1166,104,73,74,106,1174,2768,1303,1258, + 1352,1344,2166,1420,1394,2591,1443,530,1436,1478, + 2092,163,1948,46,2162,1027,46,731,384,416, + 939,1864,380,381,1027,1948,664,272,1027,3172, + 26,29,1027,414,2886,27,1042,24,28,23, + 25,991,255,22,20,49,1166,104,73,74, + 106,1174,30,1303,1258,1352,1344,59,1420,1394, + 568,1443,2058,1436,1861,1433,999,3172,26,29, + 1027,3175,2886,27,1042,24,28,23,25,991, + 255,22,20,49,1166,104,73,74,106,1174, + 154,1303,1258,1352,1344,2579,1420,1394,3141,1443, + 1848,1838,3172,26,29,1027,1433,2886,27,1042, + 24,28,23,25,991,255,22,20,49,1166, + 104,73,74,106,1174,1433,1303,1258,1352,1344, + 2758,1420,1394,2706,1806,3172,26,29,1027,891, + 2886,27,1042,24,28,23,25,991,255,22, + 20,49,1166,104,73,74,106,1174,66,1303, + 1258,1352,1344,2700,1420,1808,3250,380,381,1027, + 1514,2795,239,2826,2830,3730,46,3730,230,255, + 4359,934,26,29,1027,3343,4518,27,1042,24, + 28,335,25,3172,26,29,1027,267,2886,27, + 1042,24,28,23,25,991,255,22,20,49, + 1166,104,73,74,106,1174,3389,1303,1258,1352, + 1344,3349,1771,225,46,2999,389,1,999,2170, + 1433,526,3310,999,329,2822,328,272,1027,347, + 1435,316,318,1479,386,416,270,1627,313,1401, + 221,717,2001,269,268,154,3252,154,3343,228, + 223,224,2865,65,3113,1638,179,2285,342,1317, + 1147,345,513,3444,3368,3260,209,206,198,207, + 208,210,195,168,234,237,240,243,2687,180, + 2822,46,2535,1027,1630,999,282,2392,183,166, + 167,169,170,171,172,173,288,3717,289,2810, + 2678,3347,3552,3587,4177,3172,26,29,1027,3721, + 2886,27,1042,24,28,23,25,991,255,22, + 20,49,1166,104,73,74,106,1174,3398,1303, + 1258,1352,1772,3172,26,29,1027,3436,2886,27, + 1042,24,28,23,25,991,255,22,20,49, + 1166,104,73,74,106,1174,2908,1303,1258,1352, + 1779,3172,26,29,1027,2910,2886,27,1042,24, + 28,23,25,991,255,22,20,49,1166,104, + 73,74,106,1174,2758,1303,1258,1724,3172,26, + 29,1027,3374,2886,27,1042,24,28,23,25, + 991,255,22,20,49,1166,104,73,74,106, + 1174,91,1303,1258,1729,3172,26,29,1027,3352, + 2886,27,1042,24,28,23,25,991,255,22, + 20,49,1166,104,73,74,106,1174,2909,1303, + 1258,1730,1878,26,29,1027,2332,4518,27,1042, + 24,28,335,25,3172,26,29,1027,1509,2886, + 27,1042,24,28,23,25,991,255,22,20, + 49,1166,104,73,74,106,1174,2636,1303,1766, + 46,2326,3129,1433,1979,1951,26,29,1027,4634, + 4518,27,1042,24,28,335,25,3409,385,416, + 339,1435,316,318,2914,2347,275,2998,834,313, + 1401,347,1948,3401,276,1027,64,2663,2069,2787, + 1027,609,4459,2434,3413,988,2831,404,2326,3404, + 2642,2326,1035,380,381,1027,1864,380,381,1027, + 340,1317,1147,345,1435,316,318,221,47,2418, + 2612,1037,313,1401,347,42,2127,3467,1433,288, + 48,289,1546,267,649,225,2865,420,2682,1948, + 3293,274,1027,209,206,199,207,208,210,2347, + 273,3449,2915,340,1317,1147,345,2700,382,200, + 201,63,1943,1557,2381,3427,3425,1798,1433,2326, + 3112,236,223,224,2831,3255,211,202,203,204, + 205,3001,2323,291,292,293,294,2668,221,269, + 268,2064,361,355,3286,1561,380,381,1027,4524, + 2650,3272,3602,3311,330,331,3492,2768,2255,2293, + 2665,3293,2739,443,209,206,199,207,208,210, + 46,46,232,255,3030,2326,47,1433,181,3505, + 200,201,347,2326,429,2381,279,288,48,289, + 1546,3497,2074,1948,339,2674,1027,211,202,203, + 204,205,221,774,291,292,293,294,3098,1433, + 54,340,1317,1147,345,1433,2642,225,3393,2763, + 338,3398,2326,3602,3497,3293,1588,1433,209,206, + 199,207,208,210,3389,3389,901,380,381,1027, + 3004,2612,53,3537,200,201,3286,2326,319,2381, + 350,4524,3335,233,223,224,2326,4689,3475,520, + 99,211,202,203,204,205,221,47,291,292, + 293,294,1687,2700,845,221,999,3255,288,48, + 289,1546,404,809,568,3366,2326,3602,3532,3293, + 371,371,209,206,199,207,208,210,3117,46, + 154,400,46,2697,418,2612,1126,3479,200,201, + 2403,196,46,2381,492,46,2290,1428,401,2554, + 327,331,2381,3007,3008,211,202,203,204,205, + 2667,3011,291,292,293,294,2153,26,29,1027, + 2332,4518,27,1042,24,28,335,25,568,489, + 491,3602,3549,3172,26,29,1027,3113,2886,27, + 1042,24,28,23,25,991,255,22,20,49, + 1166,104,73,74,106,1174,845,1646,355,46, + 2810,2334,576,3555,3012,2721,999,46,369,3417, + 3015,2866,3114,2255,2293,1435,316,318,3099,288, + 3741,289,320,313,1401,347,419,3478,402,404, + 159,520,3503,3133,26,29,1027,515,2886,27, + 1042,24,28,23,25,991,255,22,20,49, + 1166,83,73,74,340,1317,1147,345,3101,3172, + 26,29,1027,516,2886,27,1042,24,28,23, + 25,991,255,22,20,49,1166,104,73,74, + 106,1174,87,1653,1433,3533,526,1535,26,29, + 1027,4273,4518,27,1042,24,28,335,25,1365, + 380,381,1027,2831,1813,221,1864,380,381,1027, + 154,46,3295,1166,440,3218,923,3408,4598,1433, + 1638,179,3595,281,2392,46,396,2763,3444,2932, + 47,209,206,198,207,208,210,439,168,1085, + 3102,288,48,289,44,3493,2608,3142,318,2774, + 2416,3527,438,182,166,167,169,170,171,172, + 173,3172,26,29,1027,280,2886,27,1042,24, + 28,23,25,991,255,22,20,49,1166,104, + 73,74,106,1672,3172,26,29,1027,2642,2886, + 27,1042,24,28,23,25,991,255,22,20, + 49,1166,104,73,74,106,1682,3172,26,29, + 1027,3536,2886,27,1042,24,28,23,25,991, + 255,22,20,49,1166,104,73,74,106,1687, + 1886,26,29,1027,3531,4550,27,1042,24,28, + 335,25,46,1232,440,2700,3553,46,4598,871, + 1481,2868,2101,3005,3531,3551,576,3400,2387,2326, + 999,2326,1433,1940,26,29,1027,4306,4518,27, + 1042,24,28,335,25,433,2751,2752,221,3499, + 2612,2831,518,2326,159,2564,380,381,1027,1435, + 316,318,3341,331,329,3495,46,314,1401,347, + 972,3293,339,1479,209,206,199,207,208,210, + 3381,46,519,239,2326,1865,267,1478,3730,347, + 200,201,2608,3142,318,2381,3107,2763,342,1317, + 1147,345,3393,221,522,3005,2326,486,202,203, + 204,205,215,297,291,292,293,294,340,1317, + 1147,345,3546,492,3570,2612,3293,1943,1938,209, + 206,199,207,208,210,71,46,1299,3575,511, + 2775,2326,269,268,225,200,201,328,46,46, + 2381,173,3566,3287,1479,526,3282,46,489,491, + 339,3283,508,202,203,204,205,5141,5141,291, + 292,293,294,5141,221,437,2751,2752,1115,154, + 239,223,224,2812,46,2407,926,2326,4306,1638, + 179,46,259,4263,3169,2927,526,3444,492,5141, + 209,206,198,207,208,210,2612,168,5141,1365, + 380,381,1027,5141,5141,221,2564,380,381,1027, + 154,511,3181,166,167,169,170,171,172,173, + 1638,179,3583,490,491,1479,2326,2831,3444,3279, + 47,209,206,198,207,208,210,267,168,1479, + 5141,288,48,289,1546,221,1756,46,3523,5141, + 1598,2326,3492,175,166,167,169,170,171,172, + 173,1546,2831,576,304,2326,3730,999,3293,356, + 339,209,206,199,207,208,210,3629,4809,2831, + 5141,2326,2729,2642,2612,2810,336,200,201,305, + 5141,159,2381,269,268,2763,2642,46,2952,46, + 221,2326,1603,2694,306,202,203,204,205,5141, + 5141,291,292,293,294,46,5141,2749,2215,3365, + 339,5141,999,3293,296,328,209,206,199,207, + 208,210,3459,46,46,5141,2326,2765,2829,225, + 2700,295,200,201,5141,2763,154,2381,905,380, + 381,1027,1604,2700,46,221,2390,355,2893,509, + 202,203,204,205,2330,2827,291,292,293,294, + 5141,2225,2255,2293,225,242,223,224,3293,47, + 1433,209,206,199,207,208,210,3396,331,5141, + 288,48,289,1546,5141,1843,5141,200,201,1433, + 3451,331,2381,345,1433,1433,774,526,281,2392, + 245,223,224,3673,212,202,203,204,205,5141, + 5141,291,292,293,294,5141,221,1864,380,381, + 1027,154,3714,1433,3133,2416,3520,3755,1896,46, + 2986,1638,179,868,431,5141,5141,1479,526,3444, + 5141,1433,209,206,198,207,208,210,421,168, + 1365,380,381,1027,3017,5141,2376,221,2326,5141, + 1479,1479,154,1433,186,166,167,169,170,171, + 172,173,1638,179,373,517,303,339,1479,526, + 3444,47,1433,209,206,198,207,208,210,1433, + 168,5141,288,48,289,1546,3758,2186,221,4810, + 299,5141,3706,154,5141,3416,166,167,169,170, + 171,172,173,1638,179,3837,603,190,5141,1364, + 526,3444,3878,5141,209,206,198,207,208,210, + 5141,168,1365,380,381,1027,576,5141,5141,221, + 999,5141,5141,5141,154,5141,189,166,167,169, + 170,171,172,173,1638,179,5141,689,5141,5141, + 5141,526,3444,47,159,209,206,198,207,208, + 210,5141,168,5141,288,48,289,1546,5141,2749, + 221,376,5141,5141,5141,154,5141,185,166,167, + 169,170,171,172,173,1638,179,5141,775,5141, + 5141,5141,526,3444,5141,5141,209,206,198,207, + 208,210,5141,168,1365,380,381,1027,5141,5141, + 5141,221,5141,5141,5141,5141,154,5141,192,166, + 167,169,170,171,172,173,1638,179,2859,5141, + 5141,5141,5141,3703,3444,47,5141,209,206,198, + 207,208,210,5141,168,5141,288,48,289,1546, + 5141,906,5141,5141,5141,5141,5141,5141,5141,191, + 166,167,169,170,171,172,173,3172,26,29, + 1027,5141,2886,27,1042,24,28,23,25,991, + 255,22,20,49,1166,104,73,74,82,3172, + 26,29,1027,5141,2886,27,1042,24,28,23, + 25,991,255,22,20,49,1166,104,73,74, + 80,3172,26,29,1027,5141,2886,27,1042,24, + 28,23,25,991,255,22,20,49,1166,104, + 73,74,79,3172,26,29,1027,5141,2886,27, + 1042,24,28,23,25,991,255,22,20,49, + 1166,104,73,74,78,3172,26,29,1027,5141, + 2886,27,1042,24,28,23,25,991,255,22, + 20,49,1166,104,73,74,77,3172,26,29, + 1027,5141,2886,27,1042,24,28,23,25,991, + 255,22,20,49,1166,104,73,74,76,3172, + 26,29,1027,5141,2886,27,1042,24,28,23, + 25,991,255,22,20,49,1166,104,73,74, + 75,2959,26,29,1027,5141,2886,27,1042,24, + 28,23,25,991,255,22,20,49,1166,104, + 73,74,102,3172,26,29,1027,5141,2886,27, + 1042,24,28,23,25,991,255,22,20,49, + 1166,104,73,74,108,3172,26,29,1027,5141, + 2886,27,1042,24,28,23,25,991,255,22, + 20,49,1166,104,73,74,107,3308,380,381, + 1027,5141,2795,5141,5141,5141,5141,5141,5141,231, + 255,5141,5141,5141,5141,5141,5141,5141,5141,5141, + 5141,5141,5141,5141,3172,26,29,1027,267,2886, + 27,1042,24,28,23,25,991,255,22,20, + 49,1166,104,73,74,105,5141,5141,5141,5141, + 3172,26,29,1027,225,2886,27,1042,24,28, + 23,25,991,255,22,20,49,1166,104,73, + 74,103,5141,5141,5141,5141,5141,270,5141,5141, + 5141,5141,1732,1777,269,268,999,999,5141,5141, + 229,223,224,1868,2683,29,1027,3343,4518,27, + 1042,24,28,335,25,5141,5141,5141,5141,5141, + 154,154,5141,5141,5141,235,238,241,244,2687, + 161,161,5141,5141,5141,1630,2649,26,29,1027, + 3343,4518,27,1042,24,28,335,25,2567,2683, + 29,1027,3343,4518,27,1042,24,28,335,25, + 5141,5141,1435,316,318,46,5141,5141,5141,2326, + 313,1401,1958,26,29,1027,3343,4518,27,1042, + 24,28,335,25,997,5141,2260,5141,339,3274, + 999,5141,5141,2326,4689,1435,316,318,3509,3740, + 5141,5141,576,313,1401,5141,999,1435,316,318, + 5141,5141,221,2763,154,313,1401,1509,5141,5141, + 1611,5141,5141,5141,2653,1875,380,381,1027,997, + 159,1435,316,318,5141,3117,5141,5141,400,313, + 1401,934,26,29,1027,3343,4518,27,1042,24, + 28,335,25,1509,1428,401,47,5141,5141,2381, + 5141,407,2699,5141,5141,5141,5141,288,48,289, + 1546,5141,2157,5141,5141,5141,5141,5141,5141,2564, + 380,381,1027,2702,5141,5141,1512,5141,307,1875, + 380,381,1027,5141,5141,1561,380,381,1027,5141, + 1435,316,318,5141,2877,5141,408,2699,313,1401, + 267,5141,5141,3333,3264,5141,5141,5141,2334,5141, + 47,5141,3382,5141,308,5141,47,2564,380,381, + 1027,288,48,289,1546,5141,45,288,48,289, + 1546,5141,45,5141,5141,402,403,2675,1561,380, + 381,1027,5141,865,1561,380,381,1027,267,69, + 5141,5141,5141,5141,5141,46,269,268,5141,2326, + 5141,2696,5141,2902,1875,380,381,1027,5141,47, + 1561,380,381,1027,5141,47,5141,5141,339,5141, + 288,48,289,1546,5141,2871,288,48,289,1546, + 5141,45,5141,5141,5141,47,3476,70,5141,5141, + 5141,47,2706,2763,269,268,288,48,289,1546, + 2266,45,288,48,289,1546,5141,2935,1561,380, + 381,1027,718,5141,1561,380,381,1027,3476,5141, + 5141,5141,5141,5141,5141,5141,2305,5141,5141,5141, + 999,3105,380,381,1027,5141,5141,5141,5141,47, + 3111,380,381,1027,1546,47,5141,5141,2326,3730, + 288,48,289,1546,154,45,288,48,289,1546, + 5141,45,47,5141,2728,46,3136,2612,5141,2326, + 5141,47,3697,288,48,289,1546,2350,45,5141, + 5141,999,288,48,289,1546,5141,45,339,2424, + 1365,380,381,1027,5141,5141,5141,5141,3007,1365, + 380,381,1027,5141,5141,154,5141,5141,328,5141, + 576,5141,5141,2763,999,1393,5141,5141,5141,5141, + 496,47,976,5141,5141,1042,526,5141,5141,526, + 47,5141,288,48,289,1546,5141,809,159,5141, + 355,288,48,289,1546,221,2628,3260,339,5141, + 154,5141,5141,154,2225,2255,2293,5141,1108,5141, + 161,1174,526,989,5141,526,5141,1240,3444,5141, + 1306,526,4262,2763,526,5141,5141,5141,46,1372, + 778,339,2326,526,339,5141,154,46,5141,154, + 339,2326,5141,339,5141,154,1308,5141,154,989, + 5141,339,339,5141,5141,187,2763,154,187,2763, + 339,5141,3149,1260,5141,4411,1866,187,4411,1822, + 1895,2395,5141,999,999,999,2763,4411,3414,5141, + 5141,5141,5141,494,5141,2763,5141,5141,5141,5141, + 5141,5141,523,5141,5141,5141,5141,154,154,154, + 5141,5141,5141,5141,5141,5141,5141,161,161,3743, + 5141,5141,5141,5141,5141,5141,5141,5141,5141,5141, + 5141,5141,5141,5141,5141,5141,5141,5141,5141,5141, + 5141,5141,5141,5141,3650,5141,5141,3669,5141,5141, + 5141,5141,5141,5141,5141,5141,3674,5141,5141,5141, + 5141,5141,5141,5141,5141,5141,5141,5141,5141,5141, + 5141,5141,5141,5141,5141,5141,5141,5141,5141,5141, + 5141,5141,5141,5141,5141,3762,3769,5141,0,1073, + 35,0,441,2173,0,31,500,0,1073,34, + 0,2558,124,0,1,431,0,1640,35,0, + 445,1110,0,444,1309,0,2384,89,0,31, + 290,298,0,29,381,0,26,380,0,2181, + 35,0,1,549,0,1,5407,0,1,5406, + 0,1,5405,0,1,5404,0,1,5403,0, + 1,5402,0,1,5401,0,1,5400,0,1, + 5399,0,1,5398,0,1,5397,0,1,1073, + 35,0,1,1857,0,1561,35,0,31,278, + 254,0,31,500,278,254,0,1561,46,0, + 3032,230,0,41,5173,0,41,33,0,2558, + 126,0,2558,125,0,23,507,0,5467,432, + 0,2176,432,0,1,5175,0,1,35,0, + 45,33,0,1,90,0,1,5175,222,0, + 1,35,222,0,5172,33,0,5172,5,33, + 0,5641,32,0,5173,43,0,33,43,0, + 5150,398,0,1,2181,0,1,2647,0,1, + 2341,0,3155,315,0,5467,93,0,2176,93, + 0,3533,274,0,1,1223,0,1,1265,0, + 5172,35,0,488,3340,0,1,222,0,1, + 222,2957,0,5150,222,0,155,174,0,31, + 290,0,222,162,0,290,298,0,184,3796, + 0 + }; + }; + public final static char baseAction[] = BaseAction.baseAction; + public final int baseAction(int index) { return baseAction[index]; } + public final static char lhs[] = baseAction; + public final int lhs(int index) { return lhs[index]; }; + + public interface TermCheck { + public final static byte termCheck[] = {0, + 0,1,2,3,4,5,6,7,8,9, + 10,11,12,13,14,15,16,17,18,19, + 20,21,22,23,24,25,26,27,28,29, + 30,31,32,33,34,35,36,37,38,39, + 40,41,42,43,44,0,46,47,48,49, + 50,51,52,53,54,55,56,57,58,0, + 60,0,62,63,64,65,0,67,0,8, + 9,71,0,5,74,75,76,77,78,79, + 80,81,82,83,84,85,0,1,2,3, + 4,5,6,7,8,9,10,11,12,13, + 14,15,16,17,18,19,20,21,22,23, + 24,25,26,27,28,29,30,31,32,33, + 34,35,36,37,38,39,40,41,42,43, + 44,0,46,47,48,49,50,51,52,53, + 54,55,56,57,58,0,60,2,62,63, + 64,65,0,67,95,96,0,89,90,3, + 74,75,76,77,78,79,80,81,82,83, + 84,85,0,1,2,3,4,5,6,7, + 8,9,10,11,12,13,14,15,16,17, + 18,19,20,21,22,23,24,25,26,27, + 28,29,30,31,32,33,34,35,36,37, + 38,39,40,41,42,43,44,61,46,47, + 48,49,50,51,52,53,54,55,56,57, + 58,0,60,2,62,63,64,65,0,67, + 0,3,0,5,113,7,74,75,76,77, + 78,79,80,81,82,83,84,85,0,1, + 2,3,4,5,6,7,8,9,10,11, + 12,13,14,15,16,17,18,19,20,21, + 22,23,24,25,26,27,28,29,30,31, + 32,33,34,35,36,37,38,39,40,41, + 42,43,44,61,46,47,48,49,50,51, + 52,53,54,55,56,57,58,0,60,0, + 62,63,64,65,0,67,0,8,9,5, + 0,5,74,75,76,77,78,79,80,81, + 82,83,84,85,0,1,2,3,4,5, + 6,7,8,9,10,11,12,13,14,15, + 16,17,18,19,20,21,22,23,24,25, + 26,27,28,29,30,31,32,33,34,35, + 36,37,38,39,40,41,42,43,44,0, + 46,47,48,49,50,51,52,53,54,55, + 56,57,58,0,60,0,62,63,64,65, + 0,67,0,89,90,89,90,7,74,75, + 76,77,78,79,80,81,82,83,84,85, + 0,1,2,3,4,5,6,7,8,9, + 10,11,12,13,14,15,16,17,18,19, + 20,21,22,23,24,25,26,27,28,29, + 30,31,32,33,34,35,36,37,38,39, + 40,41,42,43,44,72,46,47,48,49, + 50,51,52,53,54,55,56,57,58,100, + 60,0,62,63,64,65,93,67,86,87, + 0,112,0,98,74,75,76,77,78,79, + 80,81,82,83,84,85,0,1,2,3, + 4,5,6,7,8,9,10,11,12,13, + 14,15,16,17,18,19,20,21,22,23, + 24,25,26,27,28,29,30,31,32,33, + 34,35,36,37,38,39,40,41,42,43, + 44,70,46,47,48,49,50,51,52,53, + 54,55,56,57,58,0,60,0,62,63, + 64,65,0,67,0,3,86,87,86,87, + 74,75,76,77,78,79,80,81,82,83, + 84,85,0,1,2,3,4,5,6,7, + 8,9,10,11,12,13,14,15,16,17, + 18,19,20,21,22,23,24,25,26,27, + 28,29,30,31,32,33,34,35,36,37, + 38,39,40,41,42,43,44,72,46,47, + 48,49,50,51,52,53,54,55,56,57, + 58,0,60,0,62,63,64,65,5,67, + 86,87,0,0,97,2,74,75,76,77, + 78,79,80,81,82,83,84,85,0,1, + 2,3,4,5,6,7,8,9,10,11, + 12,13,14,15,16,17,18,19,20,21, + 22,23,24,25,26,27,28,29,30,31, + 32,33,34,35,36,37,38,39,40,41, + 42,43,44,0,46,47,48,49,50,51, + 52,53,54,55,56,57,58,0,60,0, + 62,63,64,65,0,67,95,96,86,87, + 0,0,74,75,76,77,78,79,80,81, + 82,83,84,85,0,1,2,3,4,5, + 6,7,8,9,10,11,12,13,14,15, + 16,17,18,19,20,21,22,23,24,25, + 26,27,28,29,30,31,32,33,34,35, + 36,37,38,39,40,41,42,43,44,58, + 46,47,48,49,50,51,52,53,54,55, + 56,57,58,0,60,0,62,63,64,65, + 0,67,0,8,9,3,99,7,74,75, + 76,77,78,79,80,81,82,83,84,85, + 0,1,2,3,4,5,6,7,8,9, + 0,11,12,119,0,42,116,117,118,46, + 47,48,49,50,51,52,53,54,55,56, + 0,1,2,3,4,5,6,7,0,1, + 0,1,42,43,0,1,46,47,48,49, + 50,51,52,53,54,55,56,0,1,59, + 3,61,5,0,7,2,66,0,68,69, + 70,71,72,0,1,2,3,4,68,6, + 40,41,72,45,40,41,86,87,88,89, + 90,91,92,93,94,95,96,97,98,99, + 100,101,102,103,104,105,106,107,108,109, + 110,111,112,113,114,0,1,2,3,4, + 5,6,7,8,9,10,11,12,13,14, + 15,16,17,18,19,20,21,22,23,24, + 25,26,27,28,29,30,31,32,33,34, + 35,36,37,38,39,40,41,42,43,44, + 0,46,47,48,49,50,51,52,53,54, + 55,56,57,0,0,1,0,62,4,64, + 65,0,1,2,3,4,5,6,7,8, + 9,10,11,12,13,14,15,16,17,18, + 19,20,21,22,23,24,25,26,27,28, + 29,30,31,32,33,34,35,36,37,38, + 39,40,41,42,0,44,66,46,47,48, + 49,50,51,52,53,54,55,56,57,66, + 0,68,66,62,68,64,65,0,1,2, + 3,4,5,6,7,8,9,10,11,12, + 13,14,15,16,17,18,19,20,21,22, + 23,24,25,26,27,28,29,30,31,32, + 33,34,35,36,37,38,39,40,41,42, + 66,44,68,46,47,48,49,50,51,52, + 53,54,55,56,57,0,1,0,3,62, + 0,64,65,0,1,2,3,4,5,6, + 7,8,9,10,11,12,13,14,15,16, + 17,18,19,20,21,22,23,24,25,26, + 27,28,29,30,31,32,33,34,35,36, + 37,38,39,40,41,42,0,44,0,46, + 47,48,49,50,51,52,53,54,55,56, + 57,0,1,66,3,62,66,64,65,0, + 1,2,3,4,5,6,7,8,9,10, + 11,12,13,14,15,16,17,18,19,20, + 21,22,23,24,25,26,27,28,29,30, + 31,32,33,34,35,36,37,38,39,40, + 41,42,0,44,68,46,47,48,49,50, + 51,52,53,54,55,56,57,0,0,2, + 2,62,0,64,65,0,1,2,3,4, + 5,6,7,8,9,10,11,12,13,14, + 15,16,17,18,19,20,21,22,23,24, + 25,26,27,28,29,30,31,32,33,34, + 35,36,37,38,39,40,41,42,66,44, + 0,46,47,48,49,50,51,52,53,54, + 55,56,57,0,0,1,69,62,0,64, + 65,0,1,2,3,4,5,6,7,8, + 9,10,11,12,13,14,15,16,17,18, + 19,20,21,22,23,24,25,26,27,28, + 29,30,31,32,33,34,35,36,37,38, + 39,40,41,42,0,44,2,46,47,48, + 49,50,51,52,53,54,55,56,57,61, + 0,68,0,62,71,64,65,0,1,2, + 3,4,5,6,7,8,9,10,11,12, + 13,14,15,16,17,18,19,20,21,22, + 23,24,25,26,27,28,29,30,31,32, + 33,34,35,36,37,38,39,0,0,42, + 0,0,2,46,47,48,49,50,51,52, + 53,54,55,56,57,0,0,2,0,62, + 2,64,65,5,72,7,8,9,0,11, + 12,0,1,0,1,2,3,6,5,42, + 7,43,0,46,47,48,49,50,51,52, + 53,54,55,56,0,1,2,3,4,59, + 6,43,61,0,0,0,1,0,3,119, + 5,0,7,45,59,0,0,59,2,61, + 0,1,0,1,66,3,68,69,70,71, + 72,0,59,2,0,0,5,43,7,8, + 9,59,11,12,86,87,88,89,90,91, + 92,93,94,95,96,97,98,99,100,101, + 102,103,104,105,106,107,108,109,110,111, + 112,113,114,69,43,59,61,72,0,1, + 58,3,66,5,68,7,0,1,72,3, + 59,5,61,7,0,61,61,66,93,68, + 69,70,71,72,100,98,102,103,104,105, + 106,107,108,109,110,111,112,86,87,88, + 89,90,91,92,93,94,95,96,97,98, + 99,100,101,102,103,104,105,106,107,108, + 109,110,111,112,113,114,0,1,2,3, + 4,5,6,7,8,9,10,11,12,13, + 14,15,16,17,18,19,20,21,22,23, + 24,25,26,27,28,29,30,31,32,33, + 34,35,36,37,38,39,40,41,0,43, + 44,0,1,2,3,4,5,6,7,8, + 9,10,11,12,13,14,15,16,17,18, + 19,20,21,22,23,24,25,26,27,28, + 29,30,31,32,33,34,35,36,37,38, + 39,40,41,0,43,44,0,1,2,3, + 4,5,6,7,8,9,10,11,12,13, + 14,15,16,17,18,19,20,21,22,23, + 24,25,26,27,28,29,30,31,32,33, + 34,35,36,37,38,39,40,41,0,43, + 44,0,1,2,3,4,5,6,7,8, + 9,10,11,12,13,14,15,16,17,18, + 19,20,21,22,23,24,25,26,27,28, + 29,30,31,32,33,34,35,36,37,38, + 39,40,41,0,1,44,0,0,1,2, + 3,4,99,6,0,1,58,0,1,2, + 3,4,5,6,7,0,1,2,3,4, + 5,6,7,72,0,1,2,3,4,5, + 6,7,8,9,10,11,12,13,14,15, + 16,17,18,19,20,21,22,23,24,25, + 26,27,28,29,30,31,32,33,34,35, + 36,37,38,39,40,41,59,70,44,0, + 1,2,3,4,59,6,69,0,1,0, + 0,1,2,3,4,0,6,0,1,2, + 3,4,0,6,2,10,72,0,1,2, + 3,4,5,6,7,8,9,10,11,12, + 13,14,15,16,17,18,19,20,21,22, + 23,24,25,26,27,28,29,30,31,32, + 33,34,35,36,37,38,39,40,41,59, + 61,44,0,1,2,3,4,5,6,7, + 8,9,10,11,12,13,14,15,16,17, + 18,19,20,21,22,23,24,25,26,27, + 28,29,30,31,32,33,34,35,36,37, + 38,39,40,41,0,1,44,0,1,2, + 3,4,5,6,7,8,9,10,11,12, + 13,14,15,16,17,18,19,20,21,22, + 23,24,25,26,27,28,29,30,31,32, + 33,34,35,36,37,38,39,40,41,45, + 0,44,0,1,2,3,4,5,6,7, + 8,9,10,11,12,13,14,15,16,17, + 18,19,20,21,22,23,24,25,26,27, + 28,29,30,31,32,33,34,35,36,37, + 38,39,40,41,0,1,0,3,4,0, + 6,2,0,1,2,3,4,57,6,0, + 1,0,3,2,5,0,7,2,66,0, + 1,2,3,4,5,6,7,8,9,10, + 11,12,13,14,15,16,17,18,19,20, + 21,22,23,24,25,26,27,28,29,30, + 31,32,33,34,35,36,37,38,39,40, + 41,59,66,44,0,1,2,3,4,5, + 6,7,8,9,10,11,12,13,14,15, + 16,17,18,19,20,21,22,23,24,25, + 26,27,28,29,30,31,32,33,34,35, + 36,37,38,39,40,41,0,1,44,0, + 1,2,3,4,5,6,7,8,9,10, + 11,12,13,14,15,16,17,18,19,20, + 21,22,23,24,25,26,27,28,29,30, + 31,32,33,34,35,36,37,38,39,40, + 41,45,0,44,0,1,2,3,4,5, + 6,7,8,9,10,11,12,13,14,15, + 16,17,18,19,20,21,22,23,24,25, + 26,27,28,29,30,31,32,33,34,35, + 36,37,38,39,40,41,0,1,44,0, + 1,2,3,4,5,6,7,8,9,10, + 11,12,13,14,15,16,17,18,19,20, + 21,22,23,24,25,26,27,28,29,30, + 31,32,33,34,35,36,37,38,39,40, + 41,45,0,44,0,1,2,3,4,5, + 6,7,8,9,10,11,12,13,14,15, + 16,17,18,19,20,21,22,23,24,25, + 26,27,28,29,30,31,32,33,34,35, + 36,37,38,39,40,41,0,1,44,0, + 1,2,3,4,5,6,7,8,9,10, + 11,12,13,14,15,16,17,18,19,20, + 21,22,23,24,25,26,27,28,29,30, + 31,32,33,34,35,36,37,38,39,40, + 41,0,1,2,3,4,5,6,7,8, + 9,10,11,12,13,14,15,16,17,18, + 19,20,21,22,23,24,25,26,27,28, + 29,30,31,32,33,34,35,36,37,38, + 39,40,41,0,1,2,3,4,5,6, + 7,8,9,10,11,12,13,14,15,16, + 17,18,19,20,21,22,23,24,25,26, + 27,28,29,30,31,32,33,34,35,36, + 37,38,39,0,1,0,0,1,2,3, + 4,0,6,0,1,0,3,4,0,6, + 0,58,0,1,0,10,4,3,6,0, + 0,0,2,0,71,0,1,2,3,4, + 5,6,7,8,9,10,11,12,13,14, + 15,16,17,18,19,20,21,22,23,24, + 25,26,27,28,29,30,31,32,33,34, + 35,36,37,38,39,0,70,2,63,4, + 5,0,7,8,9,61,11,12,0,1, + 2,3,4,58,6,0,1,68,3,4, + 25,6,0,1,0,3,71,0,88,0, + 3,93,3,0,94,40,41,13,14,15, + 16,17,18,19,20,21,22,23,47,48, + 97,43,0,0,59,3,61,0,0,0, + 45,66,3,68,69,0,42,45,0,1, + 46,47,48,49,50,51,52,53,54,55, + 56,86,87,88,89,90,91,92,0,0, + 95,96,97,98,99,100,101,102,103,104, + 105,106,107,108,109,110,111,0,0,2, + 0,4,5,45,7,8,9,0,11,12, + 0,1,0,3,4,0,6,0,1,0, + 42,4,25,68,46,47,48,49,50,51, + 52,53,54,55,56,88,88,40,41,0, + 42,94,94,43,46,47,48,49,50,51, + 52,53,54,55,56,45,59,0,61,0, + 1,0,45,66,0,68,69,88,68,0, + 58,0,1,94,59,0,1,70,59,0, + 0,69,43,86,87,88,89,90,91,92, + 0,0,95,96,97,98,99,100,101,102, + 103,104,105,106,107,108,109,110,111,0, + 1,2,3,4,5,6,7,8,9,10, + 11,12,13,14,15,16,17,18,19,20, + 21,22,23,24,25,26,27,28,29,30, + 31,32,33,34,35,36,37,38,39,70, + 59,71,0,0,93,2,66,0,0,0, + 2,4,3,0,0,2,2,58,0,1, + 2,3,4,5,6,7,8,9,10,11, + 12,13,14,15,16,17,18,19,20,21, + 22,23,24,25,26,27,28,29,30,31, + 32,33,34,35,36,37,38,39,0,1, + 2,3,4,5,6,7,8,9,10,11, + 12,13,14,15,16,17,18,19,20,21, + 22,23,24,25,26,27,28,29,30,31, + 32,33,34,35,36,37,38,0,0,1, + 0,4,2,0,0,2,0,0,2,2, + 0,0,2,2,0,1,0,59,0,1, + 2,3,4,5,6,7,8,9,10,11, + 12,13,14,15,16,17,18,19,20,21, + 22,23,24,25,26,27,28,29,30,31, + 32,33,34,35,36,37,38,0,1,2, + 3,4,5,6,7,8,9,10,11,12, + 13,14,15,16,17,18,19,20,21,22, + 23,24,25,26,27,28,29,30,31,32, + 33,34,35,36,37,38,39,0,0,1, + 0,0,0,2,0,1,0,0,2,93, + 0,1,0,1,0,0,0,0,0,115, + 0,24,0,0,24,0,24,0,0,0, + 0,113,0,1,2,3,4,5,6,7, + 8,9,10,11,12,13,14,15,16,17, + 18,19,20,21,22,23,24,25,26,27, + 28,29,30,31,32,33,34,35,36,37, + 38,0,1,2,3,4,5,6,7,8, + 9,10,11,12,13,14,15,16,17,18, + 19,20,21,22,23,24,25,26,27,28, + 29,30,31,32,33,34,35,36,37,38, + 0,1,2,3,4,5,6,7,8,9, + 10,11,12,13,14,15,16,17,18,19, + 20,21,22,23,24,25,26,27,28,29, + 30,31,32,33,34,35,36,37,38,0, + 1,0,3,0,0,2,0,0,1,10, + 0,0,13,14,15,16,17,18,19,20, + 21,22,23,0,1,2,3,4,5,6, + 7,0,0,0,0,0,1,0,3,0, + 0,42,0,39,0,46,47,48,49,50, + 51,52,53,54,55,56,57,0,1,0, + 3,62,59,64,65,58,43,10,45,68, + 13,14,15,16,17,18,19,20,21,22, + 23,46,45,60,0,1,2,3,4,5, + 6,7,0,70,71,61,73,0,0,42, + 66,0,1,46,47,48,49,50,51,52, + 53,54,55,56,57,0,1,0,74,62, + 5,64,65,0,0,91,92,43,69,45, + 0,1,2,3,4,5,6,7,0,116, + 117,118,0,45,60,0,45,0,1,0, + 0,120,10,0,70,71,59,73,0,10, + 45,69,0,1,2,3,4,5,6,7, + 0,0,42,43,0,45,0,1,2,3, + 4,5,6,7,61,0,69,45,0,0, + 60,61,45,63,45,0,58,67,0,57, + 116,117,118,73,42,43,57,45,0,1, + 2,3,4,5,6,7,0,0,42,43, + 70,45,60,70,0,63,68,0,0,67, + 0,0,61,71,46,73,60,66,0,63, + 70,0,0,67,59,71,0,71,0,73, + 42,43,0,45,0,1,2,3,4,5, + 6,7,91,92,69,0,68,0,60,0, + 43,63,0,0,0,67,0,61,61,71, + 0,73,0,66,0,0,0,1,2,3, + 4,5,6,7,70,0,42,43,70,45, + 0,1,2,3,4,5,6,7,91,92, + 69,0,70,2,60,69,0,63,66,0, + 72,67,11,12,0,71,61,73,42,43, + 58,45,0,1,2,3,4,5,6,7, + 58,72,42,43,0,45,60,0,68,63, + 0,75,0,67,69,0,0,71,0,73, + 60,0,43,63,69,0,0,67,0,0, + 59,0,0,73,42,43,0,45,0,1, + 2,3,4,5,6,7,0,0,115,115, + 0,0,60,69,0,63,0,0,0,67, + 0,0,58,0,0,73,0,0,58,0, + 0,0,101,0,0,0,0,0,0,0, + 42,43,0,45,0,114,0,0,0,0, + 0,0,0,0,0,0,0,0,60,0, + 0,63,0,0,0,67,0,0,0,0, + 0,73,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0 + }; + }; + public final static byte termCheck[] = TermCheck.termCheck; + public final int termCheck(int index) { return termCheck[index]; } + + public interface TermAction { + public final static char termAction[] = {0, + 5141,5119,5116,5116,5116,5116,5116,5116,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,5123,3057,1,1,1,1,1, + 1,1,1,1,1,1,1,1,2766,127, + 1208,116,1,3048,1,1,5141,2890,113,3089, + 3003,5149,5141,3237,1218,3034,1722,2134,1680,2908, + 3411,2981,3040,2974,2922,2973,5141,5119,5116,5116, + 5116,5116,5116,5116,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,5123, + 3057,5141,1,1,1,1,1,1,1,1, + 1,1,1,1,2766,5141,1208,4748,1,3048, + 1,1,5141,2890,2503,2475,31,3214,3191,4949, + 1218,3034,1722,2134,1680,2908,3411,2981,3040,2974, + 2922,2973,5141,5119,5116,5116,5116,5116,5116,5116, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,5123,3057,500,1,1, + 1,1,1,1,1,1,1,1,1,1, + 2766,5141,1208,3032,1,3048,1,1,35,2890, + 5141,5175,5141,2176,5147,5467,1218,3034,1722,2134, + 1680,2908,3411,2981,3040,2974,2922,2973,5141,5119, + 5116,5116,5116,5116,5116,5116,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,5123,3057,2821,1,1,1,1,1,1, + 1,1,1,1,1,1,2766,5141,1208,118, + 1,3048,1,1,115,2890,114,3089,3003,3237, + 5141,3237,1218,3034,1722,2134,1680,2908,3411,2981, + 3040,2974,2922,2973,5141,5119,5116,5116,5116,5116, + 5116,5116,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,5123,3057,137, + 1,1,1,1,1,1,1,1,1,1, + 1,1,2766,1,1208,133,1,3048,1,1, + 129,2890,119,3214,3191,3214,3191,2353,1218,3034, + 1722,2134,1680,2908,3411,2981,3040,2974,2922,2973, + 5141,5119,5116,5116,5116,5116,5116,5116,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,5123,3057,358,1,1,1,1, + 1,1,1,1,1,1,1,1,2766,2189, + 1208,5141,1,3048,1,1,358,2890,782,2624, + 123,2222,122,2262,1218,3034,1722,2134,1680,2908, + 3411,2981,3040,2974,2922,2973,5141,5119,5116,5116, + 5116,5116,5116,5116,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,5123, + 3057,1815,1,1,1,1,1,1,1,1, + 1,1,1,1,2766,1,1208,131,1,3048, + 1,1,35,2890,121,5175,782,2624,782,2624, + 1218,3034,1722,2134,1680,2908,3411,2981,3040,2974, + 2922,2973,5141,5119,5116,5116,5116,5116,5116,5116, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,5123,3057,160,1,1, + 1,1,1,1,1,1,1,1,1,1, + 2766,128,1208,5141,1,3048,1,1,3037,2890, + 782,2624,120,89,2295,4946,1218,3034,1722,2134, + 1680,2908,3411,2981,3040,2974,2922,2973,5141,5119, + 5116,5116,5116,5116,5116,5116,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,5123,3057,5141,1,1,1,1,1,1, + 1,1,1,1,1,1,2766,135,1208,5141, + 1,3048,1,1,5141,2890,2503,2475,782,2624, + 5141,5141,1218,3034,1722,2134,1680,2908,3411,2981, + 3040,2974,2922,2973,5141,2957,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,5150,3057,2336, + 1,1,1,1,1,1,1,1,1,1, + 1,1,2766,217,1208,117,1,3048,1,1, + 130,2890,5141,3089,3003,901,2227,2353,1218,3034, + 1722,2134,1680,2908,3411,2981,3040,2974,2922,2973, + 5141,5008,5008,5008,5008,5008,5008,5008,5008,5008, + 5141,5008,5008,4918,5141,5390,5565,5566,5567,5393, + 5474,5475,5387,5394,5367,5392,5391,5388,5389,5368, + 5141,4919,2341,1857,2181,2176,2647,5467,5141,9182, + 5141,1561,5008,5008,5141,5017,5008,5008,5008,5008, + 5008,5008,5008,5008,5008,5008,5008,431,1,5008, + 1,5012,4934,230,4934,5020,5008,5141,5008,5008, + 5008,5008,5008,1,4998,2341,5002,2181,4777,2647, + 4111,810,5148,5173,4111,810,5008,5008,5008,5008, + 5008,5008,5008,5008,5008,5008,5008,5008,5008,5008, + 5008,5008,5008,5008,5008,5008,5008,5008,5008,5008, + 5008,5008,5008,5008,5008,5141,5116,5116,5116,5116, + 5116,5116,5116,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,5132,5296, + 5141,1,1,1,1,1,1,1,1,1, + 1,1,1,23,5141,1640,5141,1,3315,1, + 1,5141,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,5141,5296,1907,1,1,1, + 1,1,1,1,1,1,1,1,1,5035, + 5141,5035,3285,1,3362,1,1,5141,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 3282,5296,3362,1,1,1,1,1,1,1, + 1,1,1,1,1,5141,5110,5141,5175,1, + 5141,1,1,5141,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,156,5296,5141,1, + 1,1,1,1,1,1,1,1,1,1, + 1,5141,5110,1914,5175,1,1933,1,1,5141, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,5141,5296,1270,1,1,1,1,1, + 1,1,1,1,1,1,1,311,1,2451, + 4535,1,5141,1,1,5141,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1941,5296, + 5141,1,1,1,1,1,1,1,1,1, + 1,1,1,5141,5141,1561,1185,1,5141,1, + 1,5141,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,5141,5296,2389,1,1,1, + 1,1,1,1,1,1,1,1,1,3517, + 155,941,5141,1,5149,1,1,35,4937,4715, + 1857,622,4023,2647,4045,4001,3979,602,4089,4067, + 5399,5397,5406,5405,5401,5402,5400,5403,5404,5407, + 5398,5157,3957,762,984,5159,764,3063,938,5160, + 5158,608,5153,5155,5156,5154,1227,218,5141,5390, + 1,5141,3280,5393,5474,5475,5387,5394,5367,5392, + 5391,5388,5389,5368,5532,343,5141,2949,381,559, + 4953,5533,5534,4953,5148,4953,4953,4953,33,4953, + 4953,34,4928,341,35,3280,5175,759,2176,5390, + 5467,5150,445,5393,5474,5475,5387,5394,5367,5392, + 5391,5388,5389,5368,1,4998,5089,5002,5083,1775, + 5086,4953,3567,5141,137,1,5047,134,5044,525, + 2176,5141,5467,5173,1775,5141,1,4953,3280,4953, + 5141,5017,5141,9267,4953,5175,4953,4953,4953,4953, + 4953,380,1775,4956,5141,441,4956,5150,4956,4956, + 4956,4940,4956,4956,4953,4953,4953,4953,4953,4953, + 4953,4953,4953,4953,4953,4953,4953,4953,4953,4953, + 4953,4953,4953,4953,4953,4953,4953,4953,4953,4953, + 4953,4953,4953,1733,4956,1775,4335,358,432,35, + 2820,5175,337,5041,337,5038,90,1,337,1, + 4956,5053,4956,5053,5141,769,4922,4956,358,4956, + 4956,4956,4956,4956,2189,2262,1691,1649,1607,1565, + 1523,1481,1439,1397,1355,1313,2222,4956,4956,4956, + 4956,4956,4956,4956,4956,4956,4956,4956,4956,4956, + 4956,4956,4956,4956,4956,4956,4956,4956,4956,4956, + 4956,4956,4956,4956,4956,4956,5141,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,5141,5150, + 5296,5141,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,136,162,5296,5141,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,5141,162, + 5296,5141,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,5141,1073,5296,5141,1,4998,2341, + 5002,2181,2227,2647,46,5017,3029,362,4998,2655, + 5002,2181,1,2647,1,341,4919,2655,1857,2181, + 2176,2647,5467,162,5141,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1775,2003,5296,1, + 4998,5089,5002,5083,1775,5086,1045,5141,5641,31, + 1,4998,2655,5002,2181,302,2647,1,4998,2341, + 5002,2181,5141,2647,3588,5442,162,5141,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1775, + 4925,565,5141,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,41,5026,5296,5141,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,5023, + 5141,5296,1,4998,4715,5002,622,4023,2647,4045, + 4001,3979,4962,4089,4067,4989,4995,4968,4971,4983, + 4980,4986,4977,4974,4965,4992,5157,3957,762,984, + 5159,764,3063,938,5160,5158,608,5153,5155,5156, + 5154,1227,35,35,5141,4919,5141,1857,2181,5141, + 2647,4356,1,4998,2655,5002,2181,2385,2647,93, + 35,5141,5175,4616,5098,5141,5095,3533,504,5141, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1775,5640,5296,5141,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,33,5050,5296,5141, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,2395,5141,5296,5141,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,5141,5064,5296,5141, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,5173,5141,5296,5141,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,5141,5172,5296,139, + 4919,4715,1857,622,4023,2647,4045,4001,3979,549, + 4089,4067,5399,5397,5406,5405,5401,5402,5400,5403, + 5404,5407,5398,5157,3957,762,984,5159,764,3063, + 938,5160,5158,608,5153,5155,5156,5154,1227,35, + 35,1,4998,4715,5002,622,4023,2647,4045,4001, + 3979,4962,4089,4067,4989,4995,4968,4971,4983,4980, + 4986,4977,4974,4965,4992,5157,3957,762,984,5159, + 764,3063,938,5160,5158,608,5153,5155,5156,5154, + 1227,35,35,35,4919,4715,1857,622,4023,2647, + 4045,4001,3979,549,4089,4067,5399,5397,5406,5405, + 5401,5402,5400,5403,5404,5407,5398,5157,3957,762, + 984,5159,764,3063,938,5160,5158,608,5153,5155, + 5156,5154,1227,5141,1640,5141,1,4998,2341,5002, + 2181,5141,2647,5141,4919,302,1857,2181,353,2647, + 109,3709,5141,1073,46,5442,2181,1561,2647,503, + 5141,5141,3816,132,5149,35,4919,4715,1857,622, + 4023,2647,4045,4001,3979,549,4089,4067,5399,5397, + 5406,5405,5401,5402,5400,5403,5404,5407,5398,5157, + 3957,762,984,5159,764,3063,938,5160,5158,608, + 5153,5155,5156,5154,1227,1,2003,626,1250,5597, + 5591,332,5595,5589,5590,1561,5620,5621,1,4998, + 2341,5002,2181,3709,2647,5141,4919,812,1857,4959, + 5598,2647,390,5005,216,5175,5149,1,4133,389, + 381,5493,380,5141,4155,1520,1527,5399,5397,5406, + 5405,5401,5402,5400,5403,5404,5407,5398,5474,5475, + 2295,310,5141,5141,780,2589,5600,112,111,5141, + 655,5601,2526,5622,5599,357,5390,35,5141,5067, + 5393,5474,5475,5387,5394,5367,5392,5391,5388,5389, + 5368,5611,5610,5623,5592,5593,5616,5617,219,110, + 5614,5615,5594,5596,5618,5619,5624,5604,5605,5606, + 5602,5603,5612,5613,5608,5607,5609,5141,220,626, + 5141,5597,5591,5173,5595,5589,5590,417,5620,5621, + 5141,4919,5141,1857,4959,444,2647,33,5050,344, + 5390,5050,5598,3443,5393,5474,5475,5387,5394,5367, + 5392,5391,5388,5389,5368,4133,4133,1520,1527,398, + 5390,4155,4155,5150,5393,5474,5475,5387,5394,5367, + 5392,5391,5388,5389,5368,1129,780,5141,5600,284, + 5428,1,2450,5601,5141,5622,5599,4133,4318,5141, + 5129,32,5071,4155,4943,5141,5428,2794,1775,5141, + 5141,1514,5080,5611,5610,5623,5592,5593,5616,5617, + 5141,98,5614,5615,5594,5596,5618,5619,5624,5604, + 5605,5606,5602,5603,5612,5613,5608,5607,5609,35, + 4919,4715,1857,622,4023,2647,4045,4001,3979,549, + 4089,4067,5399,5397,5406,5405,5401,5402,5400,5403, + 5404,5407,5398,5157,3957,762,984,5159,764,3063, + 938,5160,5158,608,5153,5155,5156,5154,1227,5535, + 4667,5149,5141,101,5495,4372,5583,5141,5141,5141, + 3155,4449,2677,274,5141,5101,4700,3709,35,4919, + 4715,1857,622,4023,2647,4045,4001,3979,549,4089, + 4067,5399,5397,5406,5405,5401,5402,5400,5403,5404, + 5407,5398,5157,3957,762,984,5159,764,3063,938, + 5160,5158,608,5153,5155,5156,5154,1227,35,4919, + 4715,1857,622,4023,2647,4045,4001,3979,549,4089, + 4067,5399,5397,5406,5405,5401,5402,5400,5403,5404, + 5407,5398,5157,3957,762,984,5159,764,3063,938, + 5160,5158,608,5153,5155,5156,5154,5141,390,5172, + 5141,4497,3309,5141,5141,3088,5141,5141,4757,4760, + 5141,5141,4712,4769,5141,1814,1,1346,35,4919, + 4715,1857,622,4023,2647,4045,4001,3979,549,4089, + 4067,5399,5397,5406,5405,5401,5402,5400,5403,5404, + 5407,5398,5157,3957,762,984,5159,764,3063,938, + 5160,5158,608,5153,5155,5156,5154,35,4919,4715, + 1857,622,4023,2647,4045,4001,3979,549,4089,4067, + 5399,5397,5406,5405,5401,5402,5400,5403,5404,5407, + 5398,5157,3957,762,984,5159,764,3063,938,5160, + 5158,608,5153,5155,5156,5154,1227,5141,5141,3241, + 5141,5141,1,3734,5141,8251,5141,5141,4811,3675, + 5141,8251,5141,3384,5141,5141,5141,5141,5141,3170, + 5141,3518,5141,5141,3292,5141,2858,5141,5141,5141, + 5141,5147,35,4919,4751,1857,622,4023,2647,4045, + 4001,3979,549,4089,4067,5399,5397,5406,5405,5401, + 5402,5400,5403,5404,5407,5398,5157,3957,762,984, + 5159,764,3063,938,5160,5158,608,5153,5155,5156, + 5154,35,4919,4715,1857,622,4023,2647,4045,4001, + 3979,549,4089,4067,5399,5397,5406,5405,5401,5402, + 5400,5403,5404,5407,5398,5157,3957,762,984,5159, + 764,3063,938,5160,5158,608,5153,5155,5156,5154, + 35,4919,4715,1857,622,4023,2647,4045,4001,3979, + 549,4089,4067,5399,5397,5406,5405,5401,5402,5400, + 5403,5404,5407,5398,5157,3957,762,984,5159,764, + 3063,938,5160,5158,608,5153,5155,5156,5154,5141, + 4937,283,5175,315,521,5092,5141,5141,3157,573, + 5141,5141,5399,5397,5406,5405,5401,5402,5400,5403, + 5404,5407,5398,1,5060,222,5056,222,222,222, + 222,184,5141,5141,124,423,35,45,5175,5141, + 5141,5390,5141,2781,1,5393,5474,5475,5387,5394, + 5367,5392,5391,5388,5389,5368,5532,5141,4937,285, + 5175,559,1775,5533,5534,3569,222,573,488,2333, + 5399,5397,5406,5405,5401,5402,5400,5403,5404,5407, + 5398,5563,2185,940,1,5060,222,5056,222,222, + 222,222,365,222,406,2585,5628,317,5141,5390, + 4931,43,5077,5393,5474,5475,5387,5394,5367,5392, + 5391,5388,5389,5368,5532,33,5050,363,3326,559, + 3037,5533,5534,5141,5141,2531,579,222,1910,488, + 1,5116,222,5116,222,222,222,222,5141,5565, + 5566,5567,1,2562,940,5141,5074,33,5050,1, + 26,5138,5104,5141,222,405,1775,5628,415,5104, + 5173,1087,1,5116,222,5116,222,222,222,222, + 435,126,8769,222,1,5113,1,5116,222,5116, + 222,222,222,222,3277,97,1143,2727,423,5141, + 1208,3062,5173,728,2727,409,2766,2890,436,5107, + 5565,5566,5567,5628,8769,222,5107,5113,1,5116, + 222,5116,222,222,222,222,5141,125,8769,222, + 413,5113,1208,2041,5141,728,2896,174,5141,2890, + 5141,5141,2585,214,5563,5628,1208,5029,5141,728, + 3143,495,5141,2890,1948,5149,493,214,1,5628, + 8769,222,5141,5113,1,5116,222,5116,222,222, + 222,222,2531,579,2096,5,3273,5141,1208,1, + 5126,728,1,370,510,2890,5141,3409,2585,213, + 309,5628,5141,5032,5141,5141,1,5116,222,5116, + 222,222,222,222,5318,5141,8769,222,3452,5113, + 1,5116,222,5116,222,222,222,222,2531,579, + 4655,72,5317,3286,1208,4768,5141,728,3547,5141, + 5148,2890,5202,5203,497,214,33,5628,8769,222, + 3603,5113,1,5116,222,5116,222,222,222,222, + 3604,517,8769,222,5141,5113,1208,5141,4342,728, + 35,3356,5141,2890,1514,5141,5141,214,5141,5628, + 1208,5141,5135,728,1868,5141,5141,2890,5141,5141, + 2091,5141,5141,5628,8769,222,5141,5113,1,5116, + 222,5116,222,222,222,222,5141,5141,3170,3170, + 5141,5141,1208,910,5141,728,5141,5141,5141,2890, + 5141,5141,3624,5141,5141,5628,5141,5141,2072,5141, + 5141,5141,1986,5141,5141,5141,5141,5141,5141,5141, + 8769,222,5141,5113,5141,2079,5141,5141,5141,5141, + 5141,5141,5141,5141,5141,5141,5141,5141,1208,5141, + 5141,728,5141,5141,5141,2890,5141,5141,5141,5141, + 5141,5628 + }; + }; + public final static char termAction[] = TermAction.termAction; + public final int termAction(int index) { return termAction[index]; } + + public interface Asb { + public final static char asb[] = {0, + 1007,6,666,227,5,8,713,188,188,188, + 188,70,713,188,407,622,541,1044,210,1046, + 228,228,228,228,228,228,228,228,228,622, + 628,633,630,637,635,642,640,644,643,645, + 126,646,227,210,42,42,42,42,174,133, + 14,620,42,12,391,622,622,14,437,391, + 391,383,211,964,41,872,71,185,210,606, + 606,780,780,133,1007,228,228,228,228,228, + 228,228,228,228,228,228,228,228,228,228, + 228,228,228,228,227,227,227,227,227,227, + 227,227,227,227,227,1007,228,391,391,476, + 476,476,476,118,391,14,959,595,606,531, + 606,527,606,1,606,42,606,70,174,12, + 12,14,228,959,303,480,400,399,269,70, + 1046,12,41,227,265,871,391,264,174,266, + 264,391,12,630,630,628,628,628,635,635, + 635,635,633,633,640,637,637,643,642,644, + 723,645,713,713,713,713,174,174,476,548, + 475,620,174,616,76,174,530,118,529,529, + 531,668,174,174,174,118,476,383,12,660, + 391,482,484,174,872,228,42,626,349,391, + 71,174,174,266,872,227,1007,1007,1007,1007, + 713,713,211,962,616,76,530,530,530,118, + 530,668,668,174,118,174,391,797,393,796, + 484,118,265,391,626,959,871,174,71,265, + 391,391,391,391,133,133,616,533,347,174, + 76,723,119,170,715,76,530,530,588,174, + 668,347,345,346,174,725,227,794,794,176, + 176,174,478,959,802,391,174,627,627,626, + 1007,349,267,71,391,391,616,872,188,264, + 716,734,713,261,517,591,174,347,228,174, + 725,227,227,484,174,872,391,482,393,725, + 280,133,228,12,174,267,265,89,265,665, + 959,520,228,723,181,530,530,588,69,174, + 793,484,174,725,391,12,174,666,89,265, + 716,261,228,228,530,531,70,70,793,391, + 871,793,475,188,121,121,666,531,192,517, + 174,713,174,713,786,793,89,878,89,474, + 474,800,193,70,174,133,174,485,786,343, + 743,706,713,2,913,89,42,42,800,192, + 723,228,723,666,713,713,713,193,713,174, + 671,666,666,706,174,531,191,391,390,788, + 834,476,706,343,877,531,531,738,70,475, + 73,713,723,193,210,210,209,741,210,666, + 666,586,800,42,788,878,877,878,666,180, + 665,391,877,877,877,70,174,515,802,391, + 261,391,671,666,713,391,800,877,227,921, + 261,666,347,877,877,877,174,174,121,391, + 391,293,193,586,193,666,671,1007,193,190, + 347,391,920,347,347,174,666,666,474,531, + 531,997,227,191,1006,666,391,920,666,264, + 193,391,1006,666,346,193,391,920,193 + }; + }; + public final static char asb[] = Asb.asb; + public final int asb(int index) { return asb[index]; } + + public interface Asr { + public final static byte asr[] = {0, + 3,1,58,0,43,119,0,70,72,43, + 68,113,0,26,40,27,28,41,6,29, + 30,31,32,39,33,34,35,36,37,24, + 11,12,7,5,8,9,4,25,66,38, + 2,49,13,14,57,47,15,62,50,42, + 16,51,52,17,18,53,54,19,20,55, + 64,56,10,65,21,22,48,23,46,1, + 3,0,67,63,115,73,6,116,117,118, + 60,2,7,5,4,70,71,43,49,13, + 14,57,47,15,62,50,42,16,51,52, + 17,18,53,54,19,20,55,64,56,10, + 65,21,46,22,48,23,3,1,45,0, + 66,69,68,1,0,66,70,93,68,113, + 71,43,72,13,14,26,40,15,27,28, + 16,17,18,41,29,19,20,30,31,32, + 39,33,34,21,22,23,35,36,37,24, + 2,11,12,7,5,8,9,25,38,6, + 4,3,10,1,0,66,93,72,59,2, + 68,43,69,0,58,70,3,61,0,115, + 120,71,74,60,63,67,76,78,84,82, + 75,80,81,83,85,58,77,79,43,44, + 62,57,64,65,49,54,55,42,53,52, + 46,50,47,48,51,56,39,40,41,10, + 27,31,29,26,34,14,23,13,19,17, + 18,20,21,16,15,22,35,38,36,37, + 24,33,28,32,11,12,8,9,25,30, + 7,5,2,3,6,1,4,0,13,14, + 15,16,17,18,19,20,21,22,23,49, + 47,50,42,51,52,53,54,55,56,46, + 48,43,72,6,1,59,2,7,5,4, + 3,0,40,41,113,2,10,27,31,29, + 26,34,14,23,13,19,17,18,20,21, + 16,15,22,35,38,36,37,33,28,32, + 4,6,3,11,12,7,5,8,9,25, + 30,1,24,0,69,68,71,0,94,88, + 8,9,89,90,86,87,61,91,92,95, + 96,97,98,99,100,112,70,93,69,102, + 103,104,105,106,107,108,109,110,111,113, + 71,43,66,1,7,5,3,2,59,68, + 72,0,7,5,6,4,3,1,2,66, + 93,69,68,72,59,0,49,13,14,57, + 47,15,62,50,42,16,51,52,17,18, + 53,54,19,20,55,64,56,10,65,21, + 46,22,48,23,1,3,41,40,8,9, + 5,89,90,97,7,98,4,25,61,105, + 106,102,103,104,110,109,111,87,86,107, + 108,95,96,91,92,99,100,11,12,88, + 101,2,59,69,68,66,0,4,6,2, + 59,5,7,93,49,13,14,47,15,62, + 50,42,16,51,52,17,18,53,54,19, + 20,55,64,56,10,65,21,46,22,48, + 23,1,3,72,57,0,58,68,0,70, + 59,2,69,68,43,0,45,1,3,70, + 58,0,6,39,74,1,4,3,47,48, + 58,70,93,113,72,71,43,59,2,114, + 94,101,88,11,12,7,5,8,9,89, + 90,86,87,61,91,92,95,96,97,98, + 99,100,112,102,103,104,105,106,107,108, + 109,110,111,66,68,69,0,1,46,3, + 116,117,118,0,14,23,13,19,17,18, + 20,21,16,15,22,46,56,55,54,53, + 52,51,42,50,49,47,6,48,4,1, + 3,114,101,11,12,59,2,94,88,5, + 89,90,8,9,87,86,61,91,92,95, + 96,7,97,98,99,66,93,72,69,102, + 103,104,105,106,107,108,109,110,111,70, + 113,71,100,112,68,43,0,1,71,0, + 13,14,26,40,15,27,28,16,17,18, + 41,29,19,20,30,31,32,39,33,34, + 10,21,22,23,35,36,37,24,11,12, + 8,9,25,38,44,7,5,43,4,1, + 6,3,2,0,43,7,5,4,6,2, + 1,3,70,0,47,39,48,66,93,69, + 68,72,0,58,70,74,0,69,58,0, + 75,0,14,57,47,15,62,50,16,51, + 52,17,18,53,54,19,20,55,64,56, + 10,65,21,46,22,48,23,13,49,2, + 7,5,43,60,63,67,73,42,61,6, + 3,45,4,1,0,47,48,74,2,58, + 70,43,39,66,69,68,72,93,0,115, + 0,49,13,14,57,47,15,62,50,42, + 16,51,52,17,18,53,54,19,20,55, + 64,56,10,65,21,46,22,48,23,1, + 3,93,0,67,49,13,14,57,47,15, + 62,50,73,42,16,51,52,17,18,53, + 63,54,19,20,55,64,56,10,65,21, + 60,46,22,48,23,2,7,3,43,58, + 5,6,1,4,45,0,71,14,57,47, + 15,62,50,16,51,52,17,18,53,54, + 19,20,55,64,56,65,21,46,22,48, + 23,13,49,2,7,5,43,60,67,73, + 42,45,6,1,4,3,10,63,0,71, + 40,41,39,11,12,8,9,4,25,30, + 2,6,35,38,36,37,24,33,28,32, + 14,23,13,19,17,18,20,21,16,15, + 22,10,27,31,29,26,34,58,1,7, + 3,5,0,40,41,11,12,8,9,25, + 30,35,38,36,37,24,33,28,32,14, + 23,13,19,17,18,20,21,16,15,22, + 10,27,31,29,26,34,7,5,2,59, + 4,6,1,3,0,72,13,14,26,15, + 27,28,16,17,18,29,19,20,30,31, + 32,39,33,34,10,21,22,23,35,36, + 37,24,2,11,12,7,5,8,9,25, + 3,38,44,4,6,1,41,40,0 + }; + }; + public final static byte asr[] = Asr.asr; + public final int asr(int index) { return asr[index]; } + + public interface Nasb { + public final static char nasb[] = {0, + 88,12,170,15,12,12,12,12,12,12, + 12,103,12,12,132,12,12,8,250,160, + 15,15,6,15,15,15,15,15,15,12, + 12,12,12,12,12,12,12,12,12,12, + 15,12,15,250,255,255,255,255,160,174, + 130,50,95,77,210,12,12,130,134,210, + 210,147,1,15,26,42,12,12,250,12, + 12,83,83,174,116,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,116,15,210,210,12, + 12,12,12,70,210,13,55,224,225,12, + 225,136,225,103,225,217,12,103,160,77, + 77,13,15,55,73,147,62,62,12,103, + 160,77,255,110,198,36,210,197,92,160, + 197,210,77,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,10,232,12,12, + 12,107,160,130,130,9,130,241,130,12, + 12,130,241,160,23,12,12,105,77,12, + 210,212,130,160,42,15,255,130,119,210, + 12,242,160,23,42,15,116,116,116,116, + 12,12,13,12,46,234,130,130,81,41, + 81,130,172,232,41,10,210,12,124,12, + 214,40,10,210,60,107,36,23,12,10, + 210,210,210,210,174,174,130,46,32,160, + 170,12,12,48,182,234,81,81,154,10, + 172,32,12,12,10,130,15,12,12,62, + 62,160,124,55,214,210,10,34,34,12, + 116,107,12,12,210,210,46,42,12,103, + 227,130,12,126,12,239,241,32,15,172, + 46,15,15,130,23,42,210,212,193,130, + 12,174,15,77,23,12,198,130,241,170, + 55,12,15,12,53,130,44,164,166,92, + 130,214,160,46,210,77,23,170,214,198, + 227,195,15,15,44,158,189,103,79,210, + 42,130,12,12,66,66,170,158,151,12, + 241,12,241,12,130,79,214,203,130,12, + 12,130,177,189,92,174,92,208,46,12, + 203,183,12,20,48,214,255,255,201,113, + 12,15,12,170,12,12,12,114,12,12, + 168,170,170,130,12,64,12,210,210,130, + 130,12,126,12,130,12,12,12,103,12, + 58,12,12,114,254,254,245,12,254,170, + 170,12,130,255,79,203,130,203,170,68, + 12,210,142,130,130,103,241,12,255,210, + 126,210,247,170,12,210,201,142,110,15, + 126,170,32,203,142,142,241,122,66,210, + 210,130,114,12,114,170,247,116,114,58, + 32,210,130,32,32,122,170,12,12,64, + 64,124,15,12,247,170,210,28,170,197, + 114,210,247,170,32,114,210,28,114 + }; + }; + public final static char nasb[] = Nasb.nasb; + public final int nasb(int index) { return nasb[index]; } + + public interface Nasr { + public final static char nasr[] = {0, + 148,146,122,145,144,5,12,7,1,3, + 2,0,48,4,5,7,3,12,0,1, + 42,0,3,80,0,170,0,12,3,7, + 5,62,0,139,0,63,137,136,0,135, + 1,63,0,153,0,57,0,151,0,4, + 188,0,185,0,5,103,0,116,0,175, + 0,69,0,56,0,113,0,179,0,135, + 63,0,12,3,7,5,79,0,125,0, + 114,0,5,3,7,138,0,4,38,169, + 0,3,31,0,3,148,147,146,122,145, + 144,143,5,0,100,99,5,64,0,4, + 28,0,62,46,71,4,38,0,4,174, + 0,43,0,100,99,68,5,3,7,4, + 0,4,48,166,0,1,2,3,5,47, + 0,108,4,46,70,0,99,100,4,0, + 4,62,0,5,130,186,0,154,0,3, + 45,47,0,5,160,130,0,4,38,39, + 0,124,0,4,102,0,4,46,38,176, + 0,39,5,7,3,4,60,0,164,5, + 163,0,100,99,68,64,5,7,3,0, + 155,0,4,46,70,82,0,48,4,33, + 0,5,103,23,4,0,3,5,122,118, + 119,120,121,12,93,0,68,5,3,7, + 4,1,0,4,46,70,65,5,129,0, + 58,3,45,0,46,50,4,106,0,4, + 48,38,0,117,4,48,0 + }; + }; + public final static char nasr[] = Nasr.nasr; + public final int nasr(int index) { return nasr[index]; } + + public interface TerminalIndex { + public final static char terminalIndex[] = {0, + 115,2,32,14,11,81,10,12,13,102, + 8,9,50,54,62,70,76,77,88,89, + 104,107,109,114,15,57,63,69,86,90, + 92,96,99,101,111,112,113,46,97,60, + 80,68,122,123,95,106,56,108,49,66, + 72,75,78,85,91,100,55,3,1,105, + 20,65,79,93,103,21,48,45,34,31, + 121,120,67,98,110,51,52,58,59,61, + 71,73,74,87,94,18,19,7,16,17, + 22,23,33,5,24,25,26,27,28,29, + 6,35,36,37,38,39,40,41,42,43, + 44,30,119,4,53,82,83,84,124,64, + 116,117,118 + }; + }; + public final static char terminalIndex[] = TerminalIndex.terminalIndex; + public final int terminalIndex(int index) { return terminalIndex[index]; } + + public interface NonterminalIndex { + public final static char nonterminalIndex[] = {0, + 135,137,238,0,0,136,234,134,0,133, + 0,145,0,132,0,0,144,149,0,0, + 150,159,180,160,161,162,163,152,164,165, + 138,166,127,167,168,169,0,131,129,170, + 0,197,143,0,140,0,139,153,0,177, + 0,0,0,0,147,173,187,0,203,204, + 0,128,0,156,179,0,201,205,206,0, + 172,0,0,0,0,0,0,0,126,148, + 176,178,0,0,0,0,0,0,0,0, + 0,0,186,0,0,212,158,208,209,210, + 0,0,202,0,0,0,207,130,0,0, + 0,211,0,0,0,241,175,189,190,191, + 192,193,195,196,0,214,217,219,220,0, + 237,0,240,0,0,141,142,146,0,155, + 0,171,181,182,183,184,185,188,0,194, + 0,199,0,215,216,0,221,224,226,228, + 0,231,232,233,0,235,236,239,125,0, + 151,0,0,154,157,174,0,198,200,213, + 218,0,222,223,225,227,229,230,242,243, + 0,0,0,0,0,0,0,0,0 + }; + }; + public final static char nonterminalIndex[] = NonterminalIndex.nonterminalIndex; + public final int nonterminalIndex(int index) { return nonterminalIndex[index]; } + + public interface ScopePrefix { + public final static char scopePrefix[] = { + 138,580,599,359,531,547,558,569,339,71, + 244,258,280,286,292,42,269,384,422,474, + 146,588,367,20,51,77,114,174,275,298, + 309,320,250,264,27,499,349,320,607,27, + 196,223,1,14,61,93,128,303,316,325, + 332,440,467,492,523,527,617,621,625,84, + 7,84,128,402,418,431,451,514,431,483, + 538,554,565,576,186,373,56,56,135,201, + 204,56,218,239,204,56,336,446,464,471, + 135,640,97,211,406,458,56,103,103,211, + 56,393,211,156,91,444,629,636,629,636, + 65,412,121,91,91,228 + }; + }; + public final static char scopePrefix[] = ScopePrefix.scopePrefix; + public final int scopePrefix(int index) { return scopePrefix[index]; } + + public interface ScopeSuffix { + public final static char scopeSuffix[] = { + 18,5,5,346,5,5,5,5,346,59, + 119,82,119,119,119,48,255,390,428,480, + 152,67,354,25,25,82,119,179,119,119, + 314,314,255,88,38,504,354,594,612,32, + 190,190,5,18,5,82,119,307,307,307, + 82,119,221,5,5,5,5,5,221,638, + 11,88,132,346,346,346,455,504,435,487, + 542,542,542,542,190,377,59,59,5,5, + 207,209,221,5,242,209,82,449,5,221, + 5,5,100,329,409,461,496,106,110,214, + 518,396,508,159,82,82,631,631,633,633, + 67,414,123,181,166,230 + }; + }; + public final static char scopeSuffix[] = ScopeSuffix.scopeSuffix; + public final int scopeSuffix(int index) { return scopeSuffix[index]; } + + public interface ScopeLhs { + public final static char scopeLhs[] = { + 65,17,17,75,17,17,17,17,75,160, + 85,49,92,91,120,66,53,75,74,19, + 65,17,75,2,6,157,118,65,90,120, + 119,121,54,49,132,138,75,17,17,132, + 101,60,134,78,163,157,127,119,119,121, + 50,56,175,18,17,17,17,17,17,11, + 116,157,127,75,74,74,37,138,74,19, + 17,17,17,17,101,75,164,160,179,99, + 107,61,69,59,81,121,76,72,141,175, + 173,16,157,121,117,21,138,128,128,64, + 138,75,138,65,157,73,136,47,136,47, + 163,117,118,65,65,60 + }; + }; + public final static char scopeLhs[] = ScopeLhs.scopeLhs; + public final int scopeLhs(int index) { return scopeLhs[index]; } + + public interface ScopeLa { + public final static byte scopeLa[] = { + 115,72,72,72,72,72,72,72,72,1, + 71,43,71,71,71,66,1,72,120,72, + 58,2,43,66,66,43,71,58,71,71, + 1,1,1,1,66,3,43,1,1,66, + 72,72,72,115,72,43,71,1,1,1, + 43,71,113,72,72,72,72,72,113,1, + 72,1,68,72,72,72,70,3,72,2, + 66,66,66,66,72,43,1,1,72,72, + 2,1,113,72,1,1,43,70,72,113, + 72,72,1,45,69,72,4,1,1,5, + 1,75,45,74,43,43,3,3,3,3, + 2,1,58,1,1,2 + }; + }; + public final static byte scopeLa[] = ScopeLa.scopeLa; + public final int scopeLa(int index) { return scopeLa[index]; } + + public interface ScopeStateSet { + public final static char scopeStateSet[] = { + 82,239,239,105,239,239,239,239,105,63, + 23,94,23,23,149,82,96,105,105,239, + 82,239,105,175,217,91,149,82,23,149, + 149,149,96,94,56,132,105,239,239,56, + 141,68,33,105,37,91,301,149,149,149, + 12,40,66,239,239,239,239,239,239,221, + 7,91,301,105,105,105,271,132,105,239, + 239,239,239,239,141,105,37,63,1,141, + 143,68,137,68,72,149,105,105,60,66, + 135,239,91,149,3,240,132,149,149,119, + 132,105,132,82,91,105,116,153,116,153, + 37,3,149,82,82,68 + }; + }; + public final static char scopeStateSet[] = ScopeStateSet.scopeStateSet; + public final int scopeStateSet(int index) { return scopeStateSet[index]; } + + public interface ScopeRhs { + public final static char scopeRhs[] = {0, + 313,2,39,0,127,0,312,2,115,0, + 127,173,0,127,179,74,0,216,0,288, + 127,61,126,0,21,0,290,127,61,45, + 0,21,55,0,34,132,0,21,55,0, + 0,290,127,61,45,193,0,21,178,0, + 288,127,61,130,0,181,128,0,138,0, + 225,2,287,0,287,0,2,0,127,0, + 181,128,253,252,253,0,131,186,170,128, + 0,129,0,186,170,128,0,134,129,0, + 169,0,306,127,169,0,127,169,0,222, + 129,0,170,245,0,137,0,0,0,135, + 0,0,0,305,127,58,251,0,128,0, + 251,0,3,0,0,128,0,304,127,58, + 0,45,128,0,151,2,0,127,277,276, + 127,74,183,169,0,276,127,74,183,169, + 0,215,0,216,0,183,169,0,98,0, + 0,215,0,216,0,204,98,0,0,215, + 0,216,0,276,127,183,169,0,215,0, + 204,0,0,215,0,233,127,2,0,127, + 0,0,0,0,0,233,127,2,222,0, + 230,2,0,226,127,0,208,0,148,0, + 170,128,0,11,0,0,0,220,59,0, + 126,0,233,127,2,182,0,182,0,2, + 0,0,127,0,0,0,0,0,204,2, + 0,201,0,232,127,58,24,42,0,181, + 128,63,60,0,143,129,0,131,181,128, + 274,60,0,181,128,274,60,0,181,128, + 69,1,63,0,232,127,58,63,0,232, + 127,58,165,63,0,232,127,58,124,63, + 0,272,127,58,1,62,0,272,127,58, + 62,0,181,128,62,0,135,0,186,181, + 128,245,0,137,0,181,128,245,0,186, + 170,128,10,0,170,128,10,0,95,137, + 0,300,127,169,0,161,84,0,229,162, + 229,173,2,81,0,127,172,0,229,173, + 2,81,0,129,0,127,172,0,229,162, + 229,162,229,2,81,0,229,162,229,2, + 81,0,229,2,81,0,129,0,129,0, + 127,172,0,161,2,75,194,80,0,127, + 129,0,194,80,0,110,2,131,127,129, + 0,240,2,75,0,204,171,0,34,170, + 0,171,0,176,34,170,0,240,2,85, + 0,194,156,240,2,83,0,64,172,0, + 240,2,83,0,127,172,64,172,0,299, + 127,58,0,161,0,220,77,0,31,0, + 161,112,159,0,31,170,0,178,2,0, + 127,150,0,225,2,0,220,59,298,0, + 161,59,0,178,2,293,41,128,0,127, + 0,0,293,41,128,0,2,147,127,0, + 0,178,2,30,0,14,148,0,125,45, + 170,128,0,32,14,148,0,95,137,32, + 14,148,0,203,181,128,0,148,32,14, + 148,0,178,2,34,0,161,2,34,0, + 161,2,66,178,61,26,0,178,61,26, + 0,21,2,131,127,0,161,2,66,178, + 61,29,0,178,61,29,0,161,2,66, + 178,61,31,0,178,61,31,0,161,2, + 66,178,61,27,0,178,61,27,0,225, + 2,125,186,170,128,10,0,125,186,170, + 128,10,0,137,2,0,127,0,225,2, + 124,258,170,128,10,0,258,170,128,10, + 0,135,2,0,127,0,225,2,135,0, + 225,2,140,0,161,59,140,0,260,0, + 32,0,32,141,0,168,0,134,0,161, + 2,0 + }; + }; + public final static char scopeRhs[] = ScopeRhs.scopeRhs; + public final int scopeRhs(int index) { return scopeRhs[index]; } + + public interface ScopeState { + public final static char scopeState[] = {0, + 1509,0,4769,4760,4757,0,1598,3365,1115,3283, + 0,3878,3837,3796,3755,3714,3673,4712,3452,3411, + 2387,3112,2893,2829,3602,2765,2694,3547,3492,3340, + 3285,0,2927,2775,1865,0,3273,3143,0,3878, + 3837,3796,2376,1896,3755,3714,3673,3452,1218,3411, + 2387,3112,2885,2884,0,3287,3362,2868,0,979, + 891,0,2896,2794,0,1126,0,3293,926,3260, + 3117,2986,4342,4411,4306,4318,2341,4273,2655,2612, + 0,2893,2829,3602,2765,2694,3547,3492,3340,3285, + 2902,4359,0,2902,4359,2893,2829,3602,2765,2694, + 3547,3492,3340,3285,3878,3837,3796,3755,3714,3673, + 3452,3411,2387,3112,0,2589,901,0,926,3343, + 3260,4634,858,2332,717,3531,2330,850,1798,1078, + 0,2079,1986,0,810,0,1435,1401,1317,1147, + 3260,2330,2986,2655,2612,3280,2763,0,4177,526, + 2326,0,4630,4621,4604,4598,4550,4544,4524,4518, + 4689,4680,3894,3812,4465,4459,3730,4395,3618,2795, + 2687,3469,2886,0,4630,4621,3697,3136,4604,4598, + 4497,4550,2706,4544,4449,3476,4524,2843,4518,2739, + 2682,4689,2450,3315,2395,2185,2702,4680,3129,3894, + 774,3812,4465,4459,649,3730,2172,4395,2181,3618, + 2795,4177,2687,2326,3469,2886,718,609,568,1857, + 910,2986,4342,4411,4306,3293,926,4318,3260,2341, + 4273,2655,3117,2612,1129,655,2079,1986,3063,4230, + 4204,2189,2227,2295,2262,2503,2475,2353,2624,782, + 2585,2558,2531,579,3237,3214,3191,3089,3003,4155, + 4133,4111,4089,4067,4045,4023,4001,3979,622,3957, + 1868,2134,2096,2041,2003,1948,1143,1087,1910,1045, + 812,1815,1775,731,675,1733,1691,1649,1607,1565, + 1523,1481,1439,1397,1355,1313,526,1270,1227,999, + 941,868,1185,0 + }; + }; + public final static char scopeState[] = ScopeState.scopeState; + public final int scopeState(int index) { return scopeState[index]; } + + public interface InSymb { + public final static char inSymb[] = {0, + 0,292,161,127,44,265,34,26,29,31, + 27,10,135,126,6,130,1,3,2,128, + 30,25,4,9,8,5,7,12,11,140, + 145,148,147,150,149,153,152,157,155,158, + 39,159,68,2,61,61,61,61,128,2, + 61,171,127,59,2,40,41,61,6,178, + 161,171,127,40,41,170,168,1,2,125, + 124,101,114,2,59,88,94,9,8,90, + 89,5,92,91,66,61,86,87,7,96, + 95,98,97,99,111,110,109,108,107,106, + 105,104,103,102,69,112,100,178,161,178, + 178,178,178,170,225,127,127,266,267,251, + 268,245,269,62,270,271,1,10,128,59, + 59,127,156,127,59,2,223,222,135,10, + 128,59,293,2,186,3,178,45,4,128, + 45,225,161,147,147,145,145,145,149,149, + 149,149,148,148,152,150,150,155,153,157, + 161,158,66,66,66,66,186,258,288,133, + 291,226,128,5,58,170,236,128,125,124, + 1,58,128,128,181,170,288,226,220,159, + 230,127,2,128,170,202,2,294,171,151, + 260,186,128,181,170,70,2,2,2,2, + 125,124,68,170,127,127,125,124,127,181, + 127,58,127,181,170,45,233,234,146,235, + 127,170,45,178,127,127,3,4,203,45, + 161,161,161,161,2,2,5,180,305,128, + 188,252,193,60,169,307,127,127,70,186, + 127,272,247,273,186,156,69,230,204,191, + 182,128,2,127,68,233,186,156,295,298, + 59,187,3,125,225,225,127,170,45,274, + 127,183,182,2,309,253,128,272,69,68, + 127,69,69,2,181,170,204,127,226,156, + 125,2,59,161,4,3,186,61,128,306, + 127,124,70,282,204,74,127,68,252,181, + 227,127,128,127,225,220,4,131,127,181, + 68,226,70,69,127,276,70,253,127,233, + 170,227,290,45,10,57,131,276,58,286, + 128,287,128,39,156,127,68,66,61,236, + 236,277,127,68,181,2,181,2,127,42, + 45,169,67,63,60,127,69,69,127,299, + 79,77,1,161,85,83,81,80,75,82, + 84,78,76,169,63,74,44,225,313,227, + 24,61,127,2,58,165,124,1,63,290, + 278,115,220,70,2,2,2,194,2,1, + 161,1,179,68,127,127,58,66,300,204, + 301,24,127,58,58,69,128,66,2,240, + 171,240,173,229,75,240,127,127,2,69, + 68,156,232,231,127,127,128,181,57,93, + 312,171,156,204,156,229,162,2,156,278, + 232,151,58,232,232,181,166,1,236,156, + 156,127,69,194,162,229,161,127,166,69, + 120,229,162,156,304,156,229,68,156 + }; + }; + public final static char inSymb[] = InSymb.inSymb; + public final int inSymb(int index) { return inSymb[index]; } + + public interface Name { + public final static String name[] = { + "", + "[", + "(", + "{", + ".", + ".*", + "->", + "->*", + "++", + "--", + "&", + "*", + "+", + "-", + "~", + "!", + "/", + "%", + ">>", + "<<", + "<", + ">", + "<=", + ">=", + "==", + "!=", + "^", + "|", + "&&", + "||", + "?", + ":", + "::", + "...", + "=", + "*=", + "/=", + "%=", + "+=", + "-=", + ">>=", + "<<=", + "&=", + "^=", + "|=", + ",", + "0", + "$empty", + "asm", + "auto", + "bool", + "break", + "case", + "catch", + "char", + "class", + "const", + "const_cast", + "continue", + "default", + "delete", + "do", + "double", + "dynamic_cast", + "else", + "enum", + "explicit", + "export", + "extern", + "false", + "float", + "for", + "friend", + "goto", + "if", + "inline", + "int", + "long", + "mutable", + "namespace", + "new", + "operator", + "private", + "protected", + "public", + "register", + "reinterpret_cast", + "return", + "short", + "signed", + "sizeof", + "static", + "static_cast", + "struct", + "switch", + "template", + "this", + "throw", + "try", + "true", + "typedef", + "typeid", + "typename", + "union", + "unsigned", + "using", + "virtual", + "void", + "volatile", + "wchar_t", + "while", + "integer", + "floating", + "charconst", + "stringlit", + "identifier", + "Completion", + "EndOfCompletion", + "Invalid", + "RightBracket", + "RightParen", + "RightBrace", + "SemiColon", + "ERROR_TOKEN", + "EOF_TOKEN", + "expression_parser_start", + "]", + ")", + "}", + ";", + "declaration_seq", + "expression", + "id_expression", + "qualified_or_unqualified_name", + "unqualified_id_name", + "identifier_name", + "operator_function_id_name", + "template_id_name", + "class_name", + "nested_name_specifier", + "class_or_namespace_name", + "nested_name_specifier_with_tem" + + "plate", + "class_or_namespace_name_with_t" + + "emplate", + "namespace_name", + "postfix_expression", + "simple_type_specifier", + "pseudo_destructor_name", + "type_id", + "type_name", + "unary_expression", + "cast_expression", + "new_type_id", + "expression_list", + "type_specifier_seq", + "new_declarator", + "new_pointer_operators", + "ptr_operator", + "new_array_expressions", + "constant_expression", + "pm_expression", + "multiplicative_expression", + "additive_expression", + "shift_expression", + "relational_expression", + "equality_expression", + "and_expression", + "exclusive_or_expression", + "inclusive_or_expression", + "logical_and_expression", + "logical_or_expression", + "assignment_expression", + "expression_list_actual", + "statement", + "compound_statement", + "statement_seq", + "condition", + "declarator", + "simple_declaration", + "declaration", + "function_definition", + "declaration_specifiers", + "simple_declaration_specifiers", + "class_declaration_specifiers", + "elaborated_declaration_specifi" + + "ers", + "enum_declaration_specifiers", + "type_name_declaration_specifie" + + "rs", + "no_type_declaration_specifier", + "cv_qualifier", + "no_type_declaration_specifiers", + "class_specifier", + "elaborated_type_specifier", + "enum_specifier", + "type_name_specifier", + "class_keyword", + "enumerator_list", + "enumerator_definition", + "enumerator", + "original_namespace_name", + "init_declarator_list", + "init_declarator", + "initializer", + "direct_declarator", + "ptr_operator_seq", + "basic_direct_declarator", + "function_direct_declarator", + "array_direct_declarator", + "array_modifier", + "abstract_declarator", + "direct_abstract_declarator", + "basic_direct_abstract_declarat" + + "or", + "array_direct_abstract_declarat" + + "or", + "parameter_declaration_list", + "parameter_declaration", + "parameter_init_declarator", + "parameter_initializer", + "function_body", + "handler_seq", + "initializer_clause", + "initializer_list", + "class_head", + "access_specifier_keyword", + "member_declaration", + "member_declarator_list", + "member_declaration_list", + "member_declarator", + "constant_initializer", + "bit_field_declarator", + "base_specifier_list", + "base_specifier", + "conversion_type_id", + "conversion_declarator", + "mem_initializer_list", + "mem_initializer", + "mem_initializer_name", + "operator_id_name", + "overloadable_operator", + "template_parameter_list", + "template_parameter", + "template_identifier", + "template_argument_list", + "template_argument", + "handler", + "exception_declaration", + "type_id_list" + }; + }; + public final static String name[] = Name.name; + public final String name(int index) { return name[index]; } + + public final static int + ERROR_SYMBOL = 44, + SCOPE_UBOUND = 115, + SCOPE_SIZE = 116, + MAX_NAME_LENGTH = 37; + + public final int getErrorSymbol() { return ERROR_SYMBOL; } + public final int getScopeUbound() { return SCOPE_UBOUND; } + public final int getScopeSize() { return SCOPE_SIZE; } + public final int getMaxNameLength() { return MAX_NAME_LENGTH; } + + public final static int + NUM_STATES = 519, + NT_OFFSET = 123, + LA_STATE_OFFSET = 5666, + MAX_LA = 2147483647, + NUM_RULES = 525, + NUM_NONTERMINALS = 199, + NUM_SYMBOLS = 322, + SEGMENT_SIZE = 8192, + START_STATE = 1998, + IDENTIFIER_SYMBOL = 0, + EOFT_SYMBOL = 119, + EOLT_SYMBOL = 119, + ACCEPT_ACTION = 4918, + ERROR_ACTION = 5141; + + public final static boolean BACKTRACK = true; + + public final int getNumStates() { return NUM_STATES; } + public final int getNtOffset() { return NT_OFFSET; } + public final int getLaStateOffset() { return LA_STATE_OFFSET; } + public final int getMaxLa() { return MAX_LA; } + public final int getNumRules() { return NUM_RULES; } + public final int getNumNonterminals() { return NUM_NONTERMINALS; } + public final int getNumSymbols() { return NUM_SYMBOLS; } + public final int getSegmentSize() { return SEGMENT_SIZE; } + public final int getStartState() { return START_STATE; } + public final int getStartSymbol() { return lhs[0]; } + public final int getIdentifierSymbol() { return IDENTIFIER_SYMBOL; } + public final int getEoftSymbol() { return EOFT_SYMBOL; } + public final int getEoltSymbol() { return EOLT_SYMBOL; } + public final int getAcceptAction() { return ACCEPT_ACTION; } + public final int getErrorAction() { return ERROR_ACTION; } + public final boolean isValidForParser() { return isValidForParser; } + public final boolean getBacktrack() { return BACKTRACK; } + + public final int originalState(int state) { + return -baseCheck[state]; + } + public final int asi(int state) { + return asb[originalState(state)]; + } + public final int nasi(int state) { + return nasb[originalState(state)]; + } + public final int inSymbol(int state) { + return inSymb[originalState(state)]; + } + + public final int ntAction(int state, int sym) { + return baseAction[state + sym]; + } + + public final int tAction(int state, int sym) { + int i = baseAction[state], + k = i + sym; + return termAction[termCheck[k] == sym ? k : i]; + } + public final int lookAhead(int la_state, int sym) { + int k = la_state + sym; + return termAction[termCheck[k] == sym ? k : la_state]; + } +} diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPExpressionStatementParsersym.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPExpressionStatementParsersym.java new file mode 100644 index 00000000000..96f5cd5e87e --- /dev/null +++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPExpressionStatementParsersym.java @@ -0,0 +1,270 @@ +/******************************************************************************* +* Copyright (c) 2006, 2008 IBM Corporation and others. +* All rights reserved. This program and the accompanying materials +* are made available under the terms of the Eclipse Public License v1.0 +* which accompanies this distribution, and is available at +* http://www.eclipse.org/legal/epl_v10.html +* +* Contributors: +* IBM Corporation - initial API and implementation +*********************************************************************************/ + +// This file was generated by LPG + +package org.eclipse.cdt.internal.core.dom.lrparser.cpp; + +public interface CPPExpressionStatementParsersym { + public final static int + TK_asm = 67, + TK_auto = 49, + TK_bool = 13, + TK_break = 76, + TK_case = 77, + TK_catch = 115, + TK_char = 14, + TK_class = 57, + TK_const = 47, + TK_const_cast = 26, + TK_continue = 78, + TK_default = 79, + TK_delete = 40, + TK_do = 80, + TK_double = 15, + TK_dynamic_cast = 27, + TK_else = 120, + TK_enum = 62, + TK_explicit = 50, + TK_export = 73, + TK_extern = 42, + TK_false = 28, + TK_float = 16, + TK_for = 81, + TK_friend = 51, + TK_goto = 82, + TK_if = 83, + TK_inline = 52, + TK_int = 17, + TK_long = 18, + TK_mutable = 53, + TK_namespace = 63, + TK_new = 41, + TK_operator = 6, + TK_private = 116, + TK_protected = 117, + TK_public = 118, + TK_register = 54, + TK_reinterpret_cast = 29, + TK_return = 84, + TK_short = 19, + TK_signed = 20, + TK_sizeof = 30, + TK_static = 55, + TK_static_cast = 31, + TK_struct = 64, + TK_switch = 85, + TK_template = 45, + TK_this = 32, + TK_throw = 39, + TK_try = 74, + TK_true = 33, + TK_typedef = 56, + TK_typeid = 34, + TK_typename = 10, + TK_union = 65, + TK_unsigned = 21, + TK_using = 60, + TK_virtual = 46, + TK_void = 22, + TK_volatile = 48, + TK_wchar_t = 23, + TK_while = 75, + TK_integer = 35, + TK_floating = 36, + TK_charconst = 37, + TK_stringlit = 24, + TK_identifier = 1, + TK_Completion = 121, + TK_EndOfCompletion = 122, + TK_Invalid = 123, + TK_LeftBracket = 59, + TK_LeftParen = 2, + TK_LeftBrace = 58, + TK_Dot = 114, + TK_DotStar = 94, + TK_Arrow = 101, + TK_ArrowStar = 88, + TK_PlusPlus = 11, + TK_MinusMinus = 12, + TK_And = 7, + TK_Star = 5, + TK_Plus = 8, + TK_Minus = 9, + TK_Tilde = 4, + TK_Bang = 25, + TK_Slash = 89, + TK_Percent = 90, + TK_RightShift = 86, + TK_LeftShift = 87, + TK_LT = 61, + TK_GT = 66, + TK_LE = 91, + TK_GE = 92, + TK_EQ = 95, + TK_NE = 96, + TK_Caret = 97, + TK_Or = 98, + TK_AndAnd = 99, + TK_OrOr = 100, + TK_Question = 112, + TK_Colon = 70, + TK_ColonColon = 3, + TK_DotDotDot = 93, + TK_Assign = 69, + TK_StarAssign = 102, + TK_SlashAssign = 103, + TK_PercentAssign = 104, + TK_PlusAssign = 105, + TK_MinusAssign = 106, + TK_RightShiftAssign = 107, + TK_LeftShiftAssign = 108, + TK_AndAssign = 109, + TK_CaretAssign = 110, + TK_OrAssign = 111, + TK_Comma = 68, + TK_zero = 38, + TK_RightBracket = 113, + TK_RightParen = 72, + TK_RightBrace = 71, + TK_SemiColon = 43, + TK_ERROR_TOKEN = 44, + TK_EOF_TOKEN = 119; + + public final static String orderedTerminalSymbols[] = { + "", + "identifier", + "LeftParen", + "ColonColon", + "Tilde", + "Star", + "operator", + "And", + "Plus", + "Minus", + "typename", + "PlusPlus", + "MinusMinus", + "bool", + "char", + "double", + "float", + "int", + "long", + "short", + "signed", + "unsigned", + "void", + "wchar_t", + "stringlit", + "Bang", + "const_cast", + "dynamic_cast", + "false", + "reinterpret_cast", + "sizeof", + "static_cast", + "this", + "true", + "typeid", + "integer", + "floating", + "charconst", + "zero", + "throw", + "delete", + "new", + "extern", + "SemiColon", + "ERROR_TOKEN", + "template", + "virtual", + "const", + "volatile", + "auto", + "explicit", + "friend", + "inline", + "mutable", + "register", + "static", + "typedef", + "class", + "LeftBrace", + "LeftBracket", + "using", + "LT", + "enum", + "namespace", + "struct", + "union", + "GT", + "asm", + "Comma", + "Assign", + "Colon", + "RightBrace", + "RightParen", + "export", + "try", + "while", + "break", + "case", + "continue", + "default", + "do", + "for", + "goto", + "if", + "return", + "switch", + "RightShift", + "LeftShift", + "ArrowStar", + "Slash", + "Percent", + "LE", + "GE", + "DotDotDot", + "DotStar", + "EQ", + "NE", + "Caret", + "Or", + "AndAnd", + "OrOr", + "Arrow", + "StarAssign", + "SlashAssign", + "PercentAssign", + "PlusAssign", + "MinusAssign", + "RightShiftAssign", + "LeftShiftAssign", + "AndAssign", + "CaretAssign", + "OrAssign", + "Question", + "RightBracket", + "Dot", + "catch", + "private", + "protected", + "public", + "EOF_TOKEN", + "else", + "Completion", + "EndOfCompletion", + "Invalid" + }; + + public final static boolean isValidForParser = true; +} diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPParser.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPParser.java index 5ddde1317bb..bb951d5dd9d 100644 --- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPParser.java +++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/cpp/CPPParser.java @@ -25,6 +25,9 @@ import org.eclipse.cdt.core.dom.lrparser.IParser; import org.eclipse.cdt.core.dom.lrparser.IParserActionTokenProvider; import org.eclipse.cdt.core.dom.lrparser.util.DebugUtil; +import org.eclipse.cdt.core.dom.lrparser.action.ITokenMap; +import org.eclipse.cdt.core.dom.lrparser.action.TokenMap; + public class CPPParser extends PrsStream implements RuleAction , IParserActionTokenProvider, IParser { private static ParseTable prs = new CPPParserprs(); @@ -186,13 +189,6 @@ public void addToken(IToken token) { } -public void setTokens(List tokens) { - resetTokenStream(); - for(IToken token : tokens) { - addToken(token); - } -} - public IASTCompletionNode parse(IASTTranslationUnit tu) { // this has to be done, or... kaboom! setStreamLength(getSize()); @@ -205,7 +201,7 @@ public IASTCompletionNode parse(IASTTranslationUnit tu) { // the completion node may be null IASTCompletionNode compNode = action.builder.getASTCompletionNode(); - action = null; + //action = null; // causes getSecondaryParseResult() to fail // Comment this line to use with backtracking parser //parserAction = null; @@ -240,6 +236,28 @@ public List getRuleTokens() { } +public IASTNode getSecondaryParseResult() { + return action.builder.getSecondaryParseResult(); +} + + +private ITokenMap tokenMap = null; + +public void setTokens(List tokens) { + resetTokenStream(); + addToken(new Token(null, 0, 0, 0)); // dummy token + for(IToken token : tokens) { + token.setKind(tokenMap.mapKind(token.getKind())); + addToken(token); + } + addToken(new Token(null, 0, 0, CPPParsersym.TK_EOF_TOKEN)); +} + +public CPPParser(String[] mapFrom) { // constructor + tokenMap = new TokenMap(CPPParsersym.orderedTerminalSymbols, mapFrom); +} + + public void ruleAction(int ruleNumber) {