From 80485fce8a4c7f4d063a1bb113bcf770c51b8f76 Mon Sep 17 00:00:00 2001
From: Mike Kucera
Date: Tue, 5 Feb 2008 15:44:08 +0000
Subject: multi-parser approach applied to C99
---
.../grammar/build.xml | 19 +
.../grammar/c99/C99ExpressionStatementParser.g | 47 +
.../grammar/c99/C99Grammar.g | 1002 ++++++
.../grammar/c99/C99NoCastExpressionParser.g | 57 +
.../grammar/c99/C99Parser.g | 1250 +------
.../grammar/c99/C99SizeofExpressionParser.g | 54 +
.../grammar/c99tu/C99Parser.g | 1265 +++++++
.../org.eclipse.cdt.core.lrparser/grammar/common.g | 107 +-
.../grammar/cpp/CPPParser.g | 3 +-
.../dom/lrparser/action/BuildASTParserAction.java | 40 +-
.../core/dom/lrparser/action/IASTNodeFactory.java | 7 +
.../dom/lrparser/action/c99/C99ASTNodeFactory.java | 8 +-
.../action/c99/C99BuildASTParserAction.java | 143 +-
.../dom/lrparser/action/cpp/CPPASTNodeFactory.java | 18 +
.../lrparser/action/cpp/ICPPASTNodeFactory.java | 4 +
.../lrparser/c99/C99ExpressionStatementParser.java | 1250 +++++++
.../c99/C99ExpressionStatementParserprs.java | 1092 ++++++
.../c99/C99ExpressionStatementParsersym.java | 210 ++
.../lrparser/c99/C99NoCastExpressionParser.java | 1244 +++++++
.../lrparser/c99/C99NoCastExpressionParserprs.java | 1079 ++++++
.../lrparser/c99/C99NoCastExpressionParsersym.java | 210 ++
.../internal/core/dom/lrparser/c99/C99Parser.java | 3542 +++++++-------------
.../core/dom/lrparser/c99/C99Parserprs.java | 1756 +++++-----
.../core/dom/lrparser/c99/C99Parsersym.java | 150 +-
.../lrparser/c99/C99SizeofExpressionParser.java | 1244 +++++++
.../lrparser/c99/C99SizeofExpressionParserprs.java | 1085 ++++++
.../lrparser/c99/C99SizeofExpressionParsersym.java | 210 ++
27 files changed, 12413 insertions(+), 4683 deletions(-)
create mode 100644 lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99ExpressionStatementParser.g
create mode 100644 lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99Grammar.g
create mode 100644 lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99NoCastExpressionParser.g
create mode 100644 lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99SizeofExpressionParser.g
create mode 100644 lrparser/org.eclipse.cdt.core.lrparser/grammar/c99tu/C99Parser.g
create mode 100644 lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99ExpressionStatementParser.java
create mode 100644 lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99ExpressionStatementParserprs.java
create mode 100644 lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99ExpressionStatementParsersym.java
create mode 100644 lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99NoCastExpressionParser.java
create mode 100644 lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99NoCastExpressionParserprs.java
create mode 100644 lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99NoCastExpressionParsersym.java
create mode 100644 lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99SizeofExpressionParser.java
create mode 100644 lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99SizeofExpressionParserprs.java
create mode 100644 lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99SizeofExpressionParsersym.java
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/grammar/build.xml b/lrparser/org.eclipse.cdt.core.lrparser/grammar/build.xml
index fe2e4397f70..7733b3ce90b 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/grammar/build.xml
+++ b/lrparser/org.eclipse.cdt.core.lrparser/grammar/build.xml
@@ -41,11 +41,30 @@
Generate the C99 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
new file mode 100644
index 00000000000..b77d2f19054
--- /dev/null
+++ b/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99ExpressionStatementParser.g
@@ -0,0 +1,47 @@
+-----------------------------------------------------------------------------------
+-- 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.c99
+%options template=btParserTemplateD.g
+
+-- All we need to do is import the main parser and redefine the start symbol.
+
+$Define
+ $sym_class /. C99ExpressionStatementParsersym ./
+$End
+
+$Import
+ C99Grammar.g
+$End
+
+$Start
+ expression_parser_start
+$End
+
+
+
+$Headers
+/.
+ public IASTExpression getParseResult() {
+ return (IASTExpression) action.getSecondaryParseResult();
+ }
+./
+$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/c99/C99Grammar.g b/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99Grammar.g
new file mode 100644
index 00000000000..d0ce8c53fd4
--- /dev/null
+++ b/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99Grammar.g
@@ -0,0 +1,1002 @@
+-----------------------------------------------------------------------------------
+-- 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
+-----------------------------------------------------------------------------------
+
+-- TODO "complete" rules can be removed
+
+$Include
+../common.g
+$End
+
+
+$Terminals
+
+ -- Keywords
+
+ auto break case char const continue default do
+ double else enum extern float for goto if
+ inline int long register restrict return short signed
+ sizeof static struct switch typedef union unsigned void
+ volatile while _Bool _Complex _Imaginary
+
+ -- Literals
+
+ integer floating charconst stringlit
+
+ -- identifiers
+ -- Special token that represents identifiers that have been declared as typedefs (lexer feedback hack)
+
+ 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 ::= '.'
+ Arrow ::= '->'
+ PlusPlus ::= '++'
+ MinusMinus ::= '--'
+ And ::= '&'
+ Star ::= '*'
+ Plus ::= '+'
+ Minus ::= '-'
+ Tilde ::= '~'
+ Bang ::= '!'
+ Slash ::= '/'
+ Percent ::= '%'
+ RightShift ::= '>>'
+ LeftShift ::= '<<'
+ LT ::= '<'
+ GT ::= '>'
+ LE ::= '<='
+ GE ::= '>='
+ EQ ::= '=='
+ NE ::= '!='
+ Caret ::= '^'
+ Or ::= '|'
+ AndAnd ::= '&&'
+ OrOr ::= '||'
+ Question ::= '?'
+ Colon ::= ':'
+ DotDotDot ::= '...'
+ Assign ::= '='
+ StarAssign ::= '*='
+ SlashAssign ::= '/='
+ PercentAssign ::= '%='
+ PlusAssign ::= '+='
+ MinusAssign ::= '-='
+ RightShiftAssign ::= '>>='
+ LeftShiftAssign ::= '<<='
+ AndAssign ::= '&='
+ CaretAssign ::= '^='
+ OrAssign ::= '|='
+ Comma ::= ','
+
+ RightBracket -- these four have special rules for content assist
+ RightParen
+ RightBrace
+ SemiColon
+
+
+$End
+
+
+$Globals
+/.
+ 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;
+./
+$End
+
+-- TODO move this code into a common template
+
+$Define
+ $build_action_class /. C99BuildASTParserAction ./
+ $resolve_action_class /. C99TypedefTrackerParserAction ./
+ $node_factory_create_expression /. C99ASTNodeFactory.DEFAULT_INSTANCE ./
+$End
+
+
+
+
+--$Start
+-- translation_unit
+--$End
+
+
+
+$Rules
+
+-------------------------------------------------------------------------------------------
+-- AST and Symbol Table Scoping
+-------------------------------------------------------------------------------------------
+
+
+
+ ::= $empty
+ /. $Build openASTScope(); $EndBuild ./
+
+
+-------------------------------------------------------------------------------------------
+-- 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'
+
+
+
+-------------------------------------------------------------------------------------------
+-- Expressions
+-------------------------------------------------------------------------------------------
+
+
+literal
+ ::= 'integer'
+ /. $Build consumeExpressionLiteral(IASTLiteralExpression.lk_integer_constant); $EndBuild ./
+ | 'floating'
+ /. $Build consumeExpressionLiteral(IASTLiteralExpression.lk_float_constant); $EndBuild ./
+ | 'charconst'
+ /. $Build consumeExpressionLiteral(IASTLiteralExpression.lk_char_constant); $EndBuild ./
+ | 'stringlit'
+ /. $Build consumeExpressionLiteral(IASTLiteralExpression.lk_string_literal); $EndBuild ./
+
+
+primary_expression
+ ::= literal
+ | primary_expression_id
+ /. $Build consumeExpressionID(); $EndBuild ./
+ | '(' expression ')'
+ /. $Build consumeExpressionBracketed(); $EndBuild ./
+
+
+primary_expression_id -- Typedefname not allowed as a variable name.
+ ::= 'identifier'
+ | 'Completion'
+
+
+postfix_expression
+ ::= primary_expression
+ | postfix_expression '[' expression ']'
+ /. $Build consumeExpressionArraySubscript(); $EndBuild ./
+ | postfix_expression '(' expression_list_opt ')'
+ /. $Build consumeExpressionFunctionCall(); $EndBuild ./
+ | postfix_expression '.' member_name
+ /. $Build consumeExpressionFieldReference(false); $EndBuild ./
+ | postfix_expression '->' member_name
+ /. $Build consumeExpressionFieldReference(true); $EndBuild ./
+ | postfix_expression '++'
+ /. $Build consumeExpressionUnaryOperator(IASTUnaryExpression.op_postFixIncr); $EndBuild ./
+ | postfix_expression '--'
+ /. $Build consumeExpressionUnaryOperator(IASTUnaryExpression.op_postFixDecr); $EndBuild ./
+ | '(' type_name ')' '{' initializer_list comma_opt '}'
+ /. $Build consumeExpressionTypeIdInitializer(); $EndBuild ./
+
+
+comma_opt
+ ::= ',' | $empty
+
+
+member_name
+ ::= 'identifier'
+ -- | 'TypedefName'
+ | 'Completion'
+
+
+unary_expression
+ ::= postfix_expression
+ | '++' unary_expression
+ /. $Build consumeExpressionUnaryOperator(IASTUnaryExpression.op_prefixIncr); $EndBuild ./
+ | '--' unary_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_name ')'
+ /. $Build consumeExpressionSizeofTypeId(); $EndBuild ./
+
+
+cast_expression
+ ::= unary_expression
+ | '(' type_name ')' cast_expression
+ /. $Build consumeExpressionCast(IASTCastExpression.op_cast); $EndBuild ./
+
+
+multiplicative_expression
+ ::= cast_expression
+ | multiplicative_expression '*' cast_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_multiply); $EndBuild ./
+ | multiplicative_expression '/' cast_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_divide); $EndBuild ./
+ | multiplicative_expression '%' cast_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_modulo); $EndBuild ./
+
+
+additive_expression
+ ::= multiplicative_expression
+ | additive_expression '+' multiplicative_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_plus); $EndBuild ./
+ | additive_expression '-' multiplicative_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_minus); $EndBuild ./
+
+
+shift_expression
+ ::= additive_expression
+ | shift_expression '<<' additive_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_shiftLeft); $EndBuild ./
+ | shift_expression '>>' additive_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_shiftRight); $EndBuild ./
+
+
+relational_expression
+ ::= shift_expression
+ | relational_expression '<' shift_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_lessThan); $EndBuild ./
+ | relational_expression '>' shift_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_greaterThan); $EndBuild ./
+ | relational_expression '<=' shift_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_lessEqual); $EndBuild ./
+ | relational_expression '>=' shift_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_greaterEqual); $EndBuild ./
+
+
+equality_expression
+ ::= relational_expression
+ | equality_expression '==' relational_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_equals); $EndBuild ./
+ | equality_expression '!=' relational_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_notequals); $EndBuild ./
+
+
+AND_expression
+ ::= equality_expression
+ | AND_expression '&' equality_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_binaryAnd); $EndBuild ./
+
+
+exclusive_OR_expression
+ ::= AND_expression
+ | exclusive_OR_expression '^' AND_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_binaryXor); $EndBuild ./
+
+
+inclusive_OR_expression
+ ::= exclusive_OR_expression
+ | inclusive_OR_expression '|' exclusive_OR_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_binaryOr); $EndBuild ./
+
+
+logical_AND_expression
+ ::= inclusive_OR_expression
+ | logical_AND_expression '&&' inclusive_OR_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_logicalAnd); $EndBuild ./
+
+
+logical_OR_expression
+ ::= logical_AND_expression
+ | logical_OR_expression '||' logical_AND_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_logicalOr); $EndBuild ./
+
+
+conditional_expression
+ ::= logical_OR_expression
+ | logical_OR_expression '?' expression ':' conditional_expression
+ /. $Build consumeExpressionConditional(); $EndBuild ./
+
+
+assignment_expression
+ ::= conditional_expression
+ | unary_expression '=' assignment_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_assign); $EndBuild ./
+ | unary_expression '*=' assignment_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_multiplyAssign); $EndBuild ./
+ | unary_expression '/=' assignment_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_divideAssign); $EndBuild ./
+ | unary_expression '%=' assignment_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_moduloAssign); $EndBuild ./
+ | unary_expression '+=' assignment_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_plusAssign); $EndBuild ./
+ | unary_expression '-=' assignment_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_minusAssign); $EndBuild ./
+ | unary_expression '<<=' assignment_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_shiftLeftAssign); $EndBuild ./
+ | unary_expression '>>=' assignment_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_shiftRightAssign); $EndBuild ./
+ | unary_expression '&=' assignment_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_binaryAndAssign); $EndBuild ./
+ | unary_expression '^=' assignment_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_binaryXorAssign); $EndBuild ./
+ | unary_expression '|=' assignment_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_binaryOrAssign); $EndBuild ./
+
+
+-- special rule to avoid conflict between problem statements and problem expressions
+expression_in_statement
+ ::= expression_list
+
+
+expression
+ ::= expression_list
+
+
+expression_list
+ ::= expression_list_actual
+ /. $Build consumeExpressionList(); $EndBuild ./
+
+
+expression_list_opt
+ ::= expression_list
+ | $empty
+ /. $Build consumeEmpty(); $EndBuild ./
+
+
+expression_list_actual
+ ::= assignment_expression
+ | expression_list_actual ',' assignment_expression
+
+
+constant_expression
+ ::= conditional_expression
+
+
+-------------------------------------------------------------------------------------------
+-- Statements
+-------------------------------------------------------------------------------------------
+
+
+
+statement
+ ::= labeled_statement
+ | compound_statement
+ | expression_statement
+ | selection_statement
+ | iteration_statement
+ | jump_statement
+ | ERROR_TOKEN
+ /. $Build consumeStatementProblem(); $EndBuild ./
+
+
+labeled_statement
+ ::= identifier_or_typedefname ':' statement
+ /. $Build consumeStatementLabeled(); $EndBuild ./
+ | 'case' constant_expression ':'
+ /. $Build consumeStatementCase(); $EndBuild ./
+ | 'default' ':'
+ /. $Build consumeStatementDefault(); $EndBuild ./
+
+
+compound_statement
+ ::= '{' '}'
+ /. $Build consumeStatementCompoundStatement(false); $EndBuild ./
+ | '{' block_item_list '}'
+ /. $Build consumeStatementCompoundStatement(true); $EndBuild ./
+
+
+block_item_list
+ ::= block_item
+ | block_item_list block_item
+
+
+block_item
+ ::= statement
+ | declaration
+ /. $Build consumeStatementDeclaration(); $EndBuild ./
+
+
+expression_statement
+ ::= ';'
+ /. $Build consumeStatementNull(); $EndBuild ./
+ | expression_in_statement ';'
+ /. $Build consumeStatementExpression(); $EndBuild ./
+
+
+selection_statement
+ ::= 'if' '(' expression ')' statement
+ /. $Build consumeStatementIf(false); $EndBuild ./
+ | 'if' '(' expression ')' statement 'else' statement
+ /. $Build consumeStatementIf(true); $EndBuild ./
+ | 'switch' '(' expression ')' statement
+ /. $Build consumeStatementSwitch(); $EndBuild ./
+
+
+expression_opt
+ ::= expression
+ | $empty
+ /. $Build consumeEmpty(); $EndBuild ./
+
+
+iteration_statement
+ ::= 'do' statement 'while' '(' expression ')' ';'
+ /. $Build consumeStatementDoLoop(); $EndBuild ./
+ | 'while' '(' expression ')' statement
+ /. $Build consumeStatementWhileLoop(); $EndBuild ./
+ | 'for' '(' expression_opt ';' expression_opt ';' expression_opt ')' statement
+ /. $Build consumeStatementForLoop(); $EndBuild ./
+ | 'for' '(' declaration expression_opt ';' expression_opt ')' statement
+ /. $Build consumeStatementForLoop(); $EndBuild ./
+
+
+jump_statement
+ ::= 'goto' identifier_or_typedefname ';'
+ /. $Build consumeStatementGoto(); $EndBuild ./
+ | 'continue' ';'
+ /. $Build consumeStatementContinue(); $EndBuild ./
+ | 'break' ';'
+ /. $Build consumeStatementBreak(); $EndBuild ./
+ | 'return' ';'
+ /. $Build consumeStatementReturn(false); $EndBuild ./
+ | 'return' expression ';'
+ /. $Build consumeStatementReturn(true); $EndBuild ./
+
+
+
+-------------------------------------------------------------------------------------------
+-- Declarations
+-------------------------------------------------------------------------------------------
+
+
+
+declaration
+ ::= declaration_specifiers ';'
+ /. $Build consumeDeclarationSimple(false); $EndBuild ./
+ | declaration_specifiers init_declarator_list ';'
+ /. $Build consumeDeclarationSimple(true); $EndBuild ./
+
+
+declaration_specifiers
+ ::= simple_declaration_specifiers
+ /. $Build consumeDeclarationSpecifiersSimple(); $EndBuild ./
+ | struct_or_union_declaration_specifiers
+ /. $Build consumeDeclarationSpecifiersStructUnionEnum(); $EndBuild ./
+ | elaborated_declaration_specifiers
+ /. $Build consumeDeclarationSpecifiersStructUnionEnum(); $EndBuild ./
+ | enum_declaration_specifiers
+ /. $Build consumeDeclarationSpecifiersStructUnionEnum(); $EndBuild ./
+ | typdef_name_declaration_specifiers
+ /. $Build consumeDeclarationSpecifiersTypedefName(); $EndBuild ./
+
+
+no_type_declaration_specifier
+ ::= storage_class_specifier
+ | type_qualifier
+ | function_specifier
+
+
+no_type_declaration_specifiers
+ ::= no_type_declaration_specifier
+ | no_type_declaration_specifiers no_type_declaration_specifier
+
+
+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_or_union_declaration_specifiers
+ ::= struct_or_union_specifier
+ | no_type_declaration_specifiers struct_or_union_specifier
+ | struct_or_union_declaration_specifiers no_type_declaration_specifier
+
+
+elaborated_declaration_specifiers
+ ::= elaborated_specifier
+ | no_type_declaration_specifiers elaborated_specifier
+ | elaborated_declaration_specifiers no_type_declaration_specifier
+
+
+enum_declaration_specifiers
+ ::= enum_specifier
+ | no_type_declaration_specifiers enum_specifier
+ | enum_declaration_specifiers no_type_declaration_specifier
+
+
+typdef_name_declaration_specifiers
+ ::= typedef_name_in_declspec
+ | no_type_declaration_specifiers typedef_name_in_declspec
+ | typdef_name_declaration_specifiers no_type_declaration_specifier
+
+
+init_declarator_list
+ ::= init_declarator
+ | init_declarator_list ',' init_declarator
+
+
+init_declarator
+ ::= complete_declarator
+ | complete_declarator '=' initializer
+ /. $Build consumeDeclaratorWithInitializer(true); $EndBuild ./
+
+
+complete_declarator
+ ::= declarator
+
+
+storage_class_specifier
+ ::= storage_class_specifier_token
+ /. $Build consumeDeclSpecToken(); $EndBuild ./
+
+
+storage_class_specifier_token
+ ::= 'typedef'
+ | 'extern'
+ | 'static'
+ | 'auto'
+ | 'register'
+
+
+simple_type_specifier
+ ::= simple_type_specifier_token
+ /. $Build consumeDeclSpecToken(); $EndBuild ./
+
+simple_type_specifier_token
+ ::= 'void'
+ | 'char'
+ | 'short'
+ | 'int'
+ | 'long'
+ | 'float'
+ | 'double'
+ | 'signed'
+ | 'unsigned'
+ | '_Bool'
+ | '_Complex'
+ | '_Imaginary'
+
+
+typedef_name_in_declspec
+ ::= 'Completion'
+ /. $Build consumeDeclSpecToken(); $EndBuild ./
+ | 'identifier'
+ /. $Build consumeDeclSpecToken(); $EndBuild ./
+ -- | 'TypedefName' -- remove identifier if this is uncommented
+
+
+
+identifier_or_typedefname
+ ::= 'identifier'
+ | 'Completion'
+ -- | 'TypedefName'
+
+
+struct_or_union_specifier
+ ::= 'struct' '{' struct_declaration_list_opt '}'
+ /. $Build consumeTypeSpecifierComposite(false, IASTCompositeTypeSpecifier.k_struct); $EndBuild ./
+ | 'union' '{' struct_declaration_list_opt '}'
+ /. $Build consumeTypeSpecifierComposite(false, IASTCompositeTypeSpecifier.k_union); $EndBuild ./
+ | 'struct' identifier_or_typedefname '{' struct_declaration_list_opt '}'
+ /. $Build consumeTypeSpecifierComposite(true, IASTCompositeTypeSpecifier.k_struct); $EndBuild ./
+ | 'union' identifier_or_typedefname '{' struct_declaration_list_opt '}'
+ /. $Build consumeTypeSpecifierComposite(true, IASTCompositeTypeSpecifier.k_union); $EndBuild ./
+
+
+elaborated_specifier
+ ::= 'struct' identifier_or_typedefname
+ /. $Build consumeTypeSpecifierElaborated(IASTCompositeTypeSpecifier.k_struct); $EndBuild ./
+ | 'union' identifier_or_typedefname
+ /. $Build consumeTypeSpecifierElaborated(IASTCompositeTypeSpecifier.k_union); $EndBuild ./
+ | 'enum' identifier_or_typedefname
+ /. $Build consumeTypeSpecifierElaborated(IASTElaboratedTypeSpecifier.k_enum); $EndBuild ./
+
+
+struct_declaration_list_opt
+ ::= struct_declaration_list
+ | $empty
+
+struct_declaration_list
+ ::= struct_declaration
+ | struct_declaration_list struct_declaration
+
+
+struct_declaration
+ ::= specifier_qualifier_list struct_declarator_list ';' -- regular declarators plus bit fields
+ /. $Build consumeStructDeclaration(true); $EndBuild ./
+ | specifier_qualifier_list ';'
+ /. $Build consumeStructDeclaration(false); $EndBuild ./
+
+
+-- just reuse declaration_specifiers, makes grammar a bit more lenient but thats OK
+specifier_qualifier_list
+ ::= declaration_specifiers
+
+
+struct_declarator_list
+ ::= complete_struct_declarator
+ | struct_declarator_list ',' complete_struct_declarator
+
+
+complete_struct_declarator
+ ::= struct_declarator
+
+
+struct_declarator
+ ::= declarator
+ | ':' constant_expression
+ /. $Build consumeBitField(false); $EndBuild ./
+ | declarator ':' constant_expression
+ /. $Build consumeBitField(true); $EndBuild ./
+
+
+enum_specifier
+ ::= 'enum' '{' enumerator_list_opt comma_opt '}'
+ /. $Build consumeTypeSpecifierEnumeration(false); $EndBuild ./
+ | 'enum' identifier_or_typedefname '{' enumerator_list_opt comma_opt '}'
+ /. $Build consumeTypeSpecifierEnumeration(true); $EndBuild ./
+
+
+enumerator_list_opt
+ ::= enumerator_list
+ | $empty
+
+
+enumerator_list
+ ::= enumerator
+ | enumerator_list ',' enumerator
+
+
+enumerator
+ ::= identifier_or_typedefname
+ /. $Build consumeEnumerator(false); $EndBuild ./
+ | identifier_or_typedefname '=' constant_expression
+ /. $Build consumeEnumerator(true); $EndBuild ./
+
+
+type_qualifier
+ ::= type_qualifier_token
+ /. $Build consumeDeclSpecToken(); $EndBuild ./
+
+
+type_qualifier_token
+ ::= 'const'
+ | 'restrict'
+ | 'volatile'
+
+
+function_specifier
+ ::= 'inline'
+ /. $Build consumeDeclSpecToken(); $EndBuild ./
+
+
+declarator
+ ::= direct_declarator
+ | pointer_seq direct_declarator
+ /. $Build consumeDeclaratorWithPointer(true); $EndBuild ./
+
+
+direct_declarator
+ ::= array_direct_declarator
+ | function_prototype_direct_declarator
+ | basic_direct_declarator
+ | knr_direct_declarator
+
+
+basic_direct_declarator
+ ::= declarator_id_name
+ /. $Build consumeDirectDeclaratorIdentifier(); $EndBuild ./
+ | '(' declarator ')'
+ /. $Build consumeDirectDeclaratorBracketed(); $EndBuild ./
+
+
+declarator_id_name
+ ::= 'identifier'
+ /. $Build consumeIdentifierName(); $EndBuild ./
+
+
+array_direct_declarator
+ ::= basic_direct_declarator array_modifier
+ /. $Build consumeDirectDeclaratorArrayDeclarator(true); $EndBuild ./
+ | array_direct_declarator array_modifier
+ /. $Build consumeDirectDeclaratorArrayDeclarator(true); $EndBuild ./
+
+
+function_prototype_direct_declarator
+ ::= function_direct_declarator
+
+
+function_direct_declarator
+ ::= basic_direct_declarator '(' parameter_type_list ')'
+ /. $Build consumeDirectDeclaratorFunctionDeclarator(true, true); $EndBuild ./
+ | basic_direct_declarator '(' ')'
+ /. $Build consumeDirectDeclaratorFunctionDeclarator(true, false); $EndBuild ./
+
+
+function_declarator
+ ::= function_direct_declarator
+ | pointer_seq function_direct_declarator
+ /. $Build consumeDeclaratorWithPointer(true); $EndBuild ./
+
+
+-- This is a hack because the parser cannot tell the difference between
+-- plain identifiers and types. Because of this an identifier_list would
+-- always be parsed as a parameter_type_list instead. In a KnR funciton
+-- definition we can use the extra list of declarators to disambiguate.
+-- This rule should be merged back into direct_declarator if type info is
+-- added to the parser.
+
+knr_direct_declarator
+ ::= basic_direct_declarator '(' identifier_list ')'
+ /. $Build consumeDirectDeclaratorFunctionDeclaratorKnR(); $EndBuild ./
+
+
+knr_function_declarator
+ ::= knr_direct_declarator
+ | pointer_seq knr_direct_declarator
+ /. $Build consumeDeclaratorWithPointer(true); $EndBuild ./
+
+
+identifier_list
+ ::= 'identifier'
+ /. $Build consumeIdentifierKnR(); $EndBuild ./
+ | identifier_list ',' 'identifier'
+ /. $Build consumeIdentifierKnR(); $EndBuild ./
+
+
+array_modifier
+ ::= '[' ']'
+ /. $Build consumeDirectDeclaratorArrayModifier(false); $EndBuild ./
+ | '[' array_modifier_type_qualifiers ']'
+ /. $Build consumeDirectDeclaratorModifiedArrayModifier(false, false, true, false); $EndBuild ./
+ | '[' assignment_expression ']'
+ /. $Build consumeDirectDeclaratorArrayModifier(true); $EndBuild ./
+ | '[' array_modifier_type_qualifiers assignment_expression ']'
+ /. $Build consumeDirectDeclaratorModifiedArrayModifier(false, false, true, true); $EndBuild ./
+ | '[' 'static' assignment_expression ']'
+ /. $Build consumeDirectDeclaratorModifiedArrayModifier(true, false, false, true); $EndBuild ./
+ | '[' 'static' array_modifier_type_qualifiers assignment_expression ']'
+ /. $Build consumeDirectDeclaratorModifiedArrayModifier(true, false, true, true); $EndBuild ./
+ | '[' array_modifier_type_qualifiers 'static' assignment_expression ']'
+ /. $Build consumeDirectDeclaratorModifiedArrayModifier(true, false, true, true); $EndBuild ./
+ | '[' '*' ']'
+ /. $Build consumeDirectDeclaratorModifiedArrayModifier(false, true, false, false); $EndBuild ./
+ | '[' array_modifier_type_qualifiers '*' ']'
+ /. $Build consumeDirectDeclaratorModifiedArrayModifier(false, true, true, false); $EndBuild ./
+
+
+array_modifier_type_qualifiers
+ ::= type_qualifier_list
+
+
+pointer_seq
+ ::= '*'
+ /. $Build consumePointer(); $EndBuild ./
+ | pointer_seq '*'
+ /. $Build consumePointer(); $EndBuild ./
+ | '*' type_qualifier_list
+ /. $Build consumePointerTypeQualifierList(); $EndBuild ./
+ | pointer_seq '*' type_qualifier_list
+ /. $Build consumePointerTypeQualifierList(); $EndBuild ./
+
+
+type_qualifier_list
+ ::= type_qualifier
+ | type_qualifier_list type_qualifier
+
+
+parameter_type_list
+ ::= parameter_list
+ /. $Build consumeEmpty(); $EndBuild ./
+ | parameter_list ',' '...'
+ /. $Build consumePlaceHolder(); $EndBuild ./
+ | '...' -- not spec
+ /. $Build consumePlaceHolder(); $EndBuild ./
+
+
+parameter_list
+ ::= parameter_declaration
+ | parameter_list ',' parameter_declaration
+
+
+parameter_declaration
+ ::= declaration_specifiers complete_parameter_declarator
+ /. $Build consumeParameterDeclaration(); $EndBuild ./
+ | declaration_specifiers
+ /. $Build consumeParameterDeclarationWithoutDeclarator(); $EndBuild ./
+
+
+complete_parameter_declarator
+ ::= declarator
+ | abstract_declarator
+
+
+
+-- only used in expressions, eg) sizeof, casts etc...
+type_name
+ ::= specifier_qualifier_list
+ /. $Build consumeTypeId(false); $EndBuild ./
+ | specifier_qualifier_list abstract_declarator
+ /. $Build consumeTypeId(true); $EndBuild ./
+
+
+abstract_declarator -- a declarator that does not include an identifier
+ ::= direct_abstract_declarator
+ | pointer_seq
+ /. $Build consumeDeclaratorWithPointer(false); $EndBuild ./
+ | pointer_seq direct_abstract_declarator
+ /. $Build consumeDeclaratorWithPointer(false); $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
+ ::= '(' ')'
+ /. $Build consumeDirectDeclaratorFunctionDeclarator(false, false); $EndBuild ./
+ | basic_direct_abstract_declarator '(' ')'
+ /. $Build consumeDirectDeclaratorFunctionDeclarator(true, false); $EndBuild ./
+ | '(' parameter_type_list ')'
+ /. $Build consumeDirectDeclaratorFunctionDeclarator(false, true); $EndBuild ./
+ | basic_direct_abstract_declarator '(' parameter_type_list ')'
+ /. $Build consumeDirectDeclaratorFunctionDeclarator(true, true); $EndBuild ./
+
+
+initializer
+ ::= assignment_expression
+ /. $Build consumeInitializer(); $EndBuild ./
+ | '{' initializer_list comma_opt '}'
+ /. $Build consumeInitializerList(); $EndBuild ./
+
+
+initializer_list
+ ::= initializer
+ | designated_initializer
+ | initializer_list ',' initializer
+ | initializer_list ',' designated_initializer
+
+
+designated_initializer
+ ::= designation '=' initializer
+ /. $Build consumeInitializerDesignated(); $EndBuild ./
+
+
+designation
+ ::= designator_list
+
+
+designator_list
+ ::= designator_base
+ | designator_list designator
+
+
+designator_base
+ ::= '[' constant_expression ']'
+ /. $Build consumeDesignatorArray(); $EndBuild ./
+ | '.' identifier_or_typedefname
+ /. $Build consumeDesignatorField(); $EndBuild ./
+
+designator
+ ::= '[' constant_expression ']'
+ /. $Build consumeDesignatorArray(); $EndBuild ./
+ | '.' identifier_or_typedefname
+ /. $Build consumeDesignatorField(); $EndBuild ./
+
+
+-------------------------------------------------------------------------------------------
+-- External Definitions
+-------------------------------------------------------------------------------------------
+
+translation_unit
+ ::= external_declaration_list
+ /. $Build consumeTranslationUnit(); $EndBuild ./
+ | $empty
+ /. $Build consumeTranslationUnit(); $EndBuild ./
+
+
+external_declaration_list
+ ::= external_declaration
+ | external_declaration_list external_declaration
+
+
+external_declaration
+ ::= function_definition
+ | declaration
+ | ';'
+ /. $Build consumeDeclarationEmpty(); $EndBuild ./
+ | ERROR_TOKEN
+ /. $Build consumeDeclarationProblem(); $EndBuild ./
+
+
+-- Used by KnR
+declaration_list
+ ::= declaration
+ | declaration_list declaration
+
+
+-- The extra nonterminal before declarator in this rule is only there
+-- to avoid a shift/reduce error with the rule for declaration.
+-- The symbol table scoped is opened in the rule for function_direct_declarator
+function_definition
+ ::= declaration_specifiers function_declarator function_body
+ /. $Build consumeFunctionDefinition(true); $EndBuild ./
+ -- this rule is here as a special case (its not C99 spec) just to support implicit int in function definitions
+ | function_declarator function_body
+ /. $Build consumeFunctionDefinition(false); $EndBuild ./
+ | declaration_specifiers knr_function_declarator declaration_list compound_statement
+ /. $Build consumeFunctionDefinitionKnR(); $EndBuild ./
+
+
+-- same syntax as compound_statement but a symbol table scope isn't opened
+function_body
+ ::= '{' '}'
+ /. $Build consumeStatementCompoundStatement(false); $EndBuild ./
+ | '{' block_item_list '}'
+ /. $Build consumeStatementCompoundStatement(true); $EndBuild ./
+
+$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
new file mode 100644
index 00000000000..2d7c6f51ff4
--- /dev/null
+++ b/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99NoCastExpressionParser.g
@@ -0,0 +1,57 @@
+-----------------------------------------------------------------------------------
+-- 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.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
+
+$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 ./
+
+$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 e313c24b6e6..79573ff2a26 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99Parser.g
+++ b/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99Parser.g
@@ -11,1255 +11,17 @@
%options la=2
%options package=org.eclipse.cdt.internal.core.dom.lrparser.c99
-%options template=TrialUndoParserTemplate.g
-
---$Include
---../common.g
---$End
-
-$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
-
- auto break case char const continue default do
- double else enum extern float for goto if
- inline int long register restrict return short signed
- sizeof static struct switch typedef union unsigned void
- volatile while _Bool _Complex _Imaginary
-
- -- Literals
-
- integer floating charconst stringlit
-
- -- identifiers
- -- Special token that represents identifiers that have been declared as typedefs (lexer feedback hack)
-
- 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 ::= '.'
- Arrow ::= '->'
- PlusPlus ::= '++'
- MinusMinus ::= '--'
- And ::= '&'
- Star ::= '*'
- Plus ::= '+'
- Minus ::= '-'
- Tilde ::= '~'
- Bang ::= '!'
- Slash ::= '/'
- Percent ::= '%'
- RightShift ::= '>>'
- LeftShift ::= '<<'
- LT ::= '<'
- GT ::= '>'
- LE ::= '<='
- GE ::= '>='
- EQ ::= '=='
- NE ::= '!='
- Caret ::= '^'
- Or ::= '|'
- AndAnd ::= '&&'
- OrOr ::= '||'
- Question ::= '?'
- Colon ::= ':'
- DotDotDot ::= '...'
- Assign ::= '='
- StarAssign ::= '*='
- SlashAssign ::= '/='
- PercentAssign ::= '%='
- PlusAssign ::= '+='
- MinusAssign ::= '-='
- RightShiftAssign ::= '>>='
- LeftShiftAssign ::= '<<='
- AndAssign ::= '&='
- CaretAssign ::= '^='
- OrAssign ::= '|='
- Comma ::= ','
-
- 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.lrparser.IParser;
- import org.eclipse.cdt.core.dom.lrparser.IParserActionTokenProvider;
- import org.eclipse.cdt.core.dom.lrparser.action.c99.C99ASTNodeFactory;
- import org.eclipse.cdt.core.dom.lrparser.action.c99.C99BuildASTParserAction;
- import org.eclipse.cdt.core.dom.lrparser.action.c99.C99TypedefTrackerParserAction;
- import org.eclipse.cdt.core.dom.lrparser.util.DebugUtil;
-./
-$End
-
--- TODO move this code into a common template
+%options template=btParserTemplateD.g
+-- All we need to do is import the main parser and redefine the start symbol.
$Define
- $build_action_class /. C99BuildASTParserAction ./
- $resolve_action_class /. C99TypedefTrackerParserAction ./
- $node_factory_create_expression /. C99ASTNodeFactory.DEFAULT_INSTANCE ./
$sym_class /. C99Parsersym ./
- $lexer_class /. C99Lexer ./
- $action_class /. C99ParserAction ./
$End
-
-
-
-
-$Define
- -- These macros allow the template and header code to be customized by an extending parser.
- $ast_class /.Object./
- $data_class /. Object ./ -- allow anything to be passed between actions
-
- --$additional_interfaces /. , IParserActionTokenProvider, IParser ./
- $additional_interfaces /. ./
- --$build_action_class /. ./
- --$resolve_action_class /. ./
- --$node_factory_create_expression /. ./
-
-
- --$lexer_class /. ./
- --$action_class /. ./
-
-
- $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 /. /*$builder.getASTStack().print();*/ $EndFinal ./
-
- $Build /. $Action $Builder ./
- $EndBuild /. $EndBuilder $EndAction ./
-
- $resolve /. action.resolver./
- $builder /. action.builder./
-
-
--- comment out when using trial/undo
- --$Action /. $BeginAction ./
- --$BeginFinal /. ./
- --$EndFinal /. ./
- --$BeginTrial /. ./
- --$EndTrial /. ./
- --$Undo /. ./
- --$EndUndo /. ./
-$End
-
-
-$Headers
-/.
- private $action_class action;
-
- //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($sym_class.orderedTerminalSymbols);
- 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;
- parserAction = null;
- return compNode;
- }
-
-
- public int getKind(int i) {
- int kind = super.getKind(i);
- // lexer feedback hack!
- if(kind == $sym_class.TK_identifier && action.resolver.isTypedef(getTokenText(i))) {
- kind = $sym_class.TK_TypedefName;
- }
- return kind;
- }
-
-./
+$Import
+ C99Grammar.g
$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./
-
--------------------------------------------------------------------------------------------
--- 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'
-
-
-
--------------------------------------------------------------------------------------------
--- Expressions
--------------------------------------------------------------------------------------------
-
-
-literal
- ::= 'integer'
- /. $Build consumeExpressionLiteral(IASTLiteralExpression.lk_integer_constant); $EndBuild ./
- | 'floating'
- /. $Build consumeExpressionLiteral(IASTLiteralExpression.lk_float_constant); $EndBuild ./
- | 'charconst'
- /. $Build consumeExpressionLiteral(IASTLiteralExpression.lk_char_constant); $EndBuild ./
- | 'stringlit'
- /. $Build consumeExpressionLiteral(IASTLiteralExpression.lk_string_literal); $EndBuild ./
-
-
-primary_expression
- ::= literal
- | primary_expression_id
- /. $Build consumeExpressionID(); $EndBuild ./
- | '(' expression ')'
- /. $Build consumeExpressionBracketed(); $EndBuild ./
-
-
-primary_expression_id -- Typedefname not allowed as a variable name.
- ::= 'identifier'
- | 'Completion'
-
-
-postfix_expression
- ::= primary_expression
- | postfix_expression '[' expression ']'
- /. $Build consumeExpressionArraySubscript(); $EndBuild ./
- | postfix_expression '(' expression_list_opt ')'
- /. $Build consumeExpressionFunctionCall(); $EndBuild ./
- | postfix_expression '.' member_name
- /. $Build consumeExpressionFieldReference(false); $EndBuild ./
- | postfix_expression '->' member_name
- /. $Build consumeExpressionFieldReference(true); $EndBuild ./
- | postfix_expression '++'
- /. $Build consumeExpressionUnaryOperator(IASTUnaryExpression.op_postFixIncr); $EndBuild ./
- | postfix_expression '--'
- /. $Build consumeExpressionUnaryOperator(IASTUnaryExpression.op_postFixDecr); $EndBuild ./
- | '(' type_name ')' '{' initializer_list comma_opt '}'
- /. $Build consumeExpressionTypeIdInitializer(); $EndBuild ./
-
-
-comma_opt
- ::= ',' | $empty
-
-
-member_name
- ::= 'identifier'
- | 'TypedefName'
- | 'Completion'
-
-
-unary_expression
- ::= postfix_expression
- | '++' unary_expression
- /. $Build consumeExpressionUnaryOperator(IASTUnaryExpression.op_prefixIncr); $EndBuild ./
- | '--' unary_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_name ')'
- /. $Build consumeExpressionTypeId(IASTTypeIdExpression.op_sizeof); $EndBuild ./
-
-
-cast_expression
- ::= unary_expression
- | '(' type_name ')' cast_expression
- /. $Build consumeExpressionCast(IASTCastExpression.op_cast); $EndBuild ./
-
-
-multiplicative_expression
- ::= cast_expression
- | multiplicative_expression '*' cast_expression
- /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_multiply); $EndBuild ./
- | multiplicative_expression '/' cast_expression
- /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_divide); $EndBuild ./
- | multiplicative_expression '%' cast_expression
- /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_modulo); $EndBuild ./
-
-
-additive_expression
- ::= multiplicative_expression
- | additive_expression '+' multiplicative_expression
- /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_plus); $EndBuild ./
- | additive_expression '-' multiplicative_expression
- /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_minus); $EndBuild ./
-
-
-shift_expression
- ::= additive_expression
- | shift_expression '<<' additive_expression
- /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_shiftLeft); $EndBuild ./
- | shift_expression '>>' additive_expression
- /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_shiftRight); $EndBuild ./
-
-
-relational_expression
- ::= shift_expression
- | relational_expression '<' shift_expression
- /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_lessThan); $EndBuild ./
- | relational_expression '>' shift_expression
- /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_greaterThan); $EndBuild ./
- | relational_expression '<=' shift_expression
- /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_lessEqual); $EndBuild ./
- | relational_expression '>=' shift_expression
- /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_greaterEqual); $EndBuild ./
-
-
-equality_expression
- ::= relational_expression
- | equality_expression '==' relational_expression
- /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_equals); $EndBuild ./
- | equality_expression '!=' relational_expression
- /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_notequals); $EndBuild ./
-
-
-AND_expression
- ::= equality_expression
- | AND_expression '&' equality_expression
- /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_binaryAnd); $EndBuild ./
-
-
-exclusive_OR_expression
- ::= AND_expression
- | exclusive_OR_expression '^' AND_expression
- /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_binaryXor); $EndBuild ./
-
-
-inclusive_OR_expression
- ::= exclusive_OR_expression
- | inclusive_OR_expression '|' exclusive_OR_expression
- /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_binaryOr); $EndBuild ./
-
-
-logical_AND_expression
- ::= inclusive_OR_expression
- | logical_AND_expression '&&' inclusive_OR_expression
- /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_logicalAnd); $EndBuild ./
-
-
-logical_OR_expression
- ::= logical_AND_expression
- | logical_OR_expression '||' logical_AND_expression
- /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_logicalOr); $EndBuild ./
-
-
-conditional_expression
- ::= logical_OR_expression
- | logical_OR_expression '?' expression ':' conditional_expression
- /. $Build consumeExpressionConditional(); $EndBuild ./
-
-
-assignment_expression
- ::= conditional_expression
- | unary_expression '=' assignment_expression
- /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_assign); $EndBuild ./
- | unary_expression '*=' assignment_expression
- /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_multiplyAssign); $EndBuild ./
- | unary_expression '/=' assignment_expression
- /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_divideAssign); $EndBuild ./
- | unary_expression '%=' assignment_expression
- /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_moduloAssign); $EndBuild ./
- | unary_expression '+=' assignment_expression
- /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_plusAssign); $EndBuild ./
- | unary_expression '-=' assignment_expression
- /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_minusAssign); $EndBuild ./
- | unary_expression '<<=' assignment_expression
- /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_shiftLeftAssign); $EndBuild ./
- | unary_expression '>>=' assignment_expression
- /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_shiftRightAssign); $EndBuild ./
- | unary_expression '&=' assignment_expression
- /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_binaryAndAssign); $EndBuild ./
- | unary_expression '^=' assignment_expression
- /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_binaryXorAssign); $EndBuild ./
- | unary_expression '|=' assignment_expression
- /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_binaryOrAssign); $EndBuild ./
-
-
--- special rule to avoid conflict between problem statements and problem expressions
-expression_in_statement
- ::= expression_list
-
-
-expression
- ::= expression_list
-
-
-expression_list
- ::= expression_list_actual
- /. $Build consumeExpressionList(); $EndBuild ./
-
-
-expression_list_opt
- ::= expression_list
- | $empty
- /. $Build consumeEmpty(); $EndBuild ./
-
-
-expression_list_actual
- ::= assignment_expression
- | expression_list_actual ',' assignment_expression
-
-
-constant_expression
- ::= conditional_expression
-
-
--------------------------------------------------------------------------------------------
--- Statements
--------------------------------------------------------------------------------------------
-
-
-
-statement
- ::= labeled_statement
- | compound_statement
- | expression_statement
- | selection_statement
- | iteration_statement
- | jump_statement
- | ERROR_TOKEN
- /. $Build consumeStatementProblem(); $EndBuild ./
-
-
-labeled_statement
- ::= identifier_or_typedefname ':' statement
- /. $Build consumeStatementLabeled(); $EndBuild ./
- | 'case' constant_expression ':'
- /. $Build consumeStatementCase(); $EndBuild ./
- | 'default' ':'
- /. $Build consumeStatementDefault(); $EndBuild ./
-
-
-compound_statement
- ::= '{' '}'
- /.
- $Action
- $Resolve closeSymbolScope(); $EndResolve
- $Builder consumeStatementCompoundStatement(false); $EndBuilder
- $EndAction
- ./
- | '{' block_item_list '}'
- /.
- $Action
- $Resolve closeSymbolScope(); $EndResolve
- $Builder consumeStatementCompoundStatement(true); $EndBuilder
- $EndAction
- ./
-
-
-block_item_list
- ::= block_item
- | block_item_list block_item
-
-
-block_item
- ::= statement
- | declaration
- /. $Build consumeStatementDeclaration(); $EndBuild ./
-
-
-expression_statement
- ::= ';'
- /. $Build consumeStatementNull(); $EndBuild ./
- | expression_in_statement ';'
- /. $Build consumeStatementExpression(); $EndBuild ./
-
-
-selection_statement
- ::= 'if' '(' expression ')' statement
- /. $Build consumeStatementIf(false); $EndBuild ./
- | 'if' '(' expression ')' statement 'else' statement
- /. $Build consumeStatementIf(true); $EndBuild ./
- | 'switch' '(' expression ')' statement
- /. $Build consumeStatementSwitch(); $EndBuild ./
-
-
-expression_opt
- ::= expression
- | $empty
- /. $Build consumeEmpty(); $EndBuild ./
-
-
-iteration_statement
- ::= 'do' statement 'while' '(' expression ')' ';'
- /. $Build consumeStatementDoLoop(); $EndBuild ./
- | 'while' '(' expression ')' statement
- /. $Build consumeStatementWhileLoop(); $EndBuild ./
- | 'for' '(' expression_opt ';' expression_opt ';' expression_opt ')' statement
- /.
- $Action
- $Resolve closeSymbolScope(); $EndResolve
- $Builder consumeStatementForLoop(); $EndBuilder
- $EndAction
- ./
- | 'for' '(' declaration expression_opt ';' expression_opt ')' statement
- /.
- $Action
- $Resolve closeSymbolScope(); $EndResolve
- $Builder consumeStatementForLoop(); $EndBuilder
- $EndAction
- ./
-
-
-jump_statement
- ::= 'goto' identifier_or_typedefname ';'
- /. $Build consumeStatementGoto(); $EndBuild ./
- | 'continue' ';'
- /. $Build consumeStatementContinue(); $EndBuild ./
- | 'break' ';'
- /. $Build consumeStatementBreak(); $EndBuild ./
- | 'return' ';'
- /. $Build consumeStatementReturn(false); $EndBuild ./
- | 'return' expression ';'
- /. $Build consumeStatementReturn(true); $EndBuild ./
-
-
-
--------------------------------------------------------------------------------------------
--- Declarations
--------------------------------------------------------------------------------------------
-
-
-
-declaration
- ::= declaration_specifiers ';'
- /.
- $Action
- $Resolve closeDeclarationScope(); $EndResolve
- $Builder consumeDeclarationSimple(false); $EndBuilder
- $EndAction
- ./
- | declaration_specifiers init_declarator_list ';'
- /.
- $Action
- $Resolve closeDeclarationScope(); $EndResolve
- $Builder consumeDeclarationSimple(true); $EndBuilder
- $EndAction
- ./
-
-
-declaration_specifiers
- ::= simple_declaration_specifiers
- /. $Build consumeDeclarationSpecifiersSimple(); $EndBuild ./
- | struct_or_union_declaration_specifiers
- /. $Build consumeDeclarationSpecifiersStructUnionEnum(); $EndBuild ./
- | elaborated_declaration_specifiers
- /. $Build consumeDeclarationSpecifiersStructUnionEnum(); $EndBuild ./
- | enum_declaration_specifiers
- /. $Build consumeDeclarationSpecifiersStructUnionEnum(); $EndBuild ./
- | typdef_name_declaration_specifiers
- /. $Build consumeDeclarationSpecifiersTypedefName(); $EndBuild ./
-
-
-no_type_declaration_specifier
- ::= storage_class_specifier
- | type_qualifier
- | function_specifier
-
-
-no_type_declaration_specifiers
- ::= no_type_declaration_specifier
- | no_type_declaration_specifiers no_type_declaration_specifier
-
-
-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_or_union_declaration_specifiers
- ::= struct_or_union_specifier
- | no_type_declaration_specifiers struct_or_union_specifier
- | struct_or_union_declaration_specifiers no_type_declaration_specifier
-
-
-elaborated_declaration_specifiers
- ::= elaborated_specifier
- | no_type_declaration_specifiers elaborated_specifier
- | elaborated_declaration_specifiers no_type_declaration_specifier
-
-
-enum_declaration_specifiers
- ::= enum_specifier
- | no_type_declaration_specifiers enum_specifier
- | enum_declaration_specifiers no_type_declaration_specifier
-
-
-typdef_name_declaration_specifiers
- ::= typedef_name_in_declspec
- | no_type_declaration_specifiers typedef_name_in_declspec
- | typdef_name_declaration_specifiers no_type_declaration_specifier
-
-
-init_declarator_list
- ::= init_declarator
- | init_declarator_list ',' init_declarator
-
-
-init_declarator
- ::= complete_declarator
- | complete_declarator '=' initializer
- /. $Build consumeDeclaratorWithInitializer(true); $EndBuild ./
-
-
-complete_declarator
- ::= declarator
- /.
- $Action
- $Resolve consumeDeclaratorComplete(); $EndResolve
- $EndAction
- ./
-
-
-storage_class_specifier
- ::= storage_class_specifier_token
- /.
- $Action
- $Resolve consumeDeclSpecToken(); $EndResolve
- $Builder consumeDeclSpecToken(); $EndBuilder
- $EndAction
- ./
-
-
-storage_class_specifier_token
- ::= 'typedef'
- | 'extern'
- | 'static'
- | 'auto'
- | 'register'
-
-
-simple_type_specifier
- ::= simple_type_specifier_token
- /.
- $Action
- $Resolve consumeDeclSpecToken(); $EndResolve
- $Builder consumeDeclSpecToken(); $EndBuilder
- $EndAction
- ./
-
-simple_type_specifier_token
- ::= 'void'
- | 'char'
- | 'short'
- | 'int'
- | 'long'
- | 'float'
- | 'double'
- | 'signed'
- | 'unsigned'
- | '_Bool'
- | '_Complex'
- | '_Imaginary'
-
-
-typedef_name_in_declspec
- ::= 'TypedefName'
- /.
- $Action
- $Resolve consumeDeclSpecToken(); $EndResolve
- $Builder consumeDeclSpecToken(); $EndBuilder
- $EndAction
- ./
- | 'Completion'
- /.
- $Action
- $Resolve consumeDeclSpecToken(); $EndResolve
- $Builder consumeDeclSpecToken(); $EndBuilder
- $EndAction
- ./
-
-
-identifier_or_typedefname
- ::= 'identifier'
- | 'TypedefName'
- | 'Completion'
-
-
-struct_or_union_specifier
- ::= 'struct' '{' struct_declaration_list_opt '}'
- /. $Build consumeTypeSpecifierComposite(false, IASTCompositeTypeSpecifier.k_struct); $EndBuild ./
- | 'union' '{' struct_declaration_list_opt '}'
- /. $Build consumeTypeSpecifierComposite(false, IASTCompositeTypeSpecifier.k_union); $EndBuild ./
- | 'struct' identifier_or_typedefname '{' struct_declaration_list_opt '}'
- /. $Build consumeTypeSpecifierComposite(true, IASTCompositeTypeSpecifier.k_struct); $EndBuild ./
- | 'union' identifier_or_typedefname '{' struct_declaration_list_opt '}'
- /. $Build consumeTypeSpecifierComposite(true, IASTCompositeTypeSpecifier.k_union); $EndBuild ./
-
-
-elaborated_specifier
- ::= 'struct' identifier_or_typedefname
- /. $Build consumeTypeSpecifierElaborated(IASTCompositeTypeSpecifier.k_struct); $EndBuild ./
- | 'union' identifier_or_typedefname
- /. $Build consumeTypeSpecifierElaborated(IASTCompositeTypeSpecifier.k_union); $EndBuild ./
- | 'enum' identifier_or_typedefname
- /. $Build consumeTypeSpecifierElaborated(IASTElaboratedTypeSpecifier.k_enum); $EndBuild ./
-
-
-struct_declaration_list_opt
- ::= struct_declaration_list
- | $empty
-
-struct_declaration_list
- ::= struct_declaration
- | struct_declaration_list struct_declaration
-
-
-struct_declaration
- ::= specifier_qualifier_list struct_declarator_list ';' -- regular declarators plus bit fields
- /.
- $Action
- $Resolve closeDeclarationScope(); $EndResolve
- $Builder consumeStructDeclaration(true); $EndBuilder
- $EndAction
- ./
- | specifier_qualifier_list ';'
- /.
- $Action
- $Resolve closeDeclarationScope(); $EndResolve
- $Builder consumeStructDeclaration(false); $EndBuilder
- $EndAction
- ./
-
-
--- just reuse declaration_specifiers, makes grammar a bit more lenient but thats OK
-specifier_qualifier_list
- ::= declaration_specifiers
-
-
-struct_declarator_list
- ::= complete_struct_declarator
- | struct_declarator_list ',' complete_struct_declarator
-
-
-complete_struct_declarator
- ::= struct_declarator
- /.
- $Action
- $Resolve consumeDeclaratorCompleteField(); $EndResolve
- $EndAction
- ./
-
-
-struct_declarator
- ::= declarator
- | ':' constant_expression
- /. $Build consumeBitField(false); $EndBuild ./
- | declarator ':' constant_expression
- /. $Build consumeBitField(true); $EndBuild ./
-
-
-enum_specifier
- ::= 'enum' '{' enumerator_list_opt comma_opt '}'
- /. $Build consumeTypeSpecifierEnumeration(false); $EndBuild ./
- | 'enum' identifier_or_typedefname '{' enumerator_list_opt comma_opt '}'
- /. $Build consumeTypeSpecifierEnumeration(true); $EndBuild ./
-
-
-enumerator_list_opt
- ::= enumerator_list
- | $empty
-
-
-enumerator_list
- ::= enumerator
- | enumerator_list ',' enumerator
-
-
-enumerator
- ::= identifier_or_typedefname
- /. $Build consumeEnumerator(false); $EndBuild ./
- | identifier_or_typedefname '=' constant_expression
- /. $Build consumeEnumerator(true); $EndBuild ./
-
-
-type_qualifier
- ::= type_qualifier_token
- /.
- $Action
- $Resolve consumeDeclSpecToken(); $EndResolve
- $Builder consumeDeclSpecToken(); $EndBuilder
- $EndAction
- ./
-
-
-type_qualifier_token
- ::= 'const'
- | 'restrict'
- | 'volatile'
-
-
-function_specifier
- ::= 'inline'
- /.$Action
- $Resolve consumeDeclSpecToken(); $EndResolve
- $Builder consumeDeclSpecToken(); $EndBuilder
- $EndAction
- ./
-
-
-declarator
- ::= direct_declarator
- | pointer_seq direct_declarator
- /. $Build consumeDeclaratorWithPointer(true); $EndBuild ./
-
-
-direct_declarator
- ::= array_direct_declarator
- | function_prototype_direct_declarator
- | basic_direct_declarator
- | knr_direct_declarator
-
-
-basic_direct_declarator
- ::= declarator_id_name
- /.
- $Action
- $Resolve consumeDirectDeclaratorIdentifier(); $EndResolve
- $Builder consumeDirectDeclaratorIdentifier(); $EndBuilder
- $EndAction
- ./
- | '(' declarator ')'
- /. $Build consumeDirectDeclaratorBracketed(); $EndBuild ./
-
-
-declarator_id_name
- ::= 'identifier'
- /. $Build consumeIdentifierName(); $EndBuild ./
-
-
-array_direct_declarator
- ::= basic_direct_declarator array_modifier
- /. $Build consumeDirectDeclaratorArrayDeclarator(true); $EndBuild ./
- | array_direct_declarator array_modifier
- /. $Build consumeDirectDeclaratorArrayDeclarator(true); $EndBuild ./
-
-
-function_prototype_direct_declarator
- ::= function_direct_declarator
- /.$Action $Resolve closeSymbolScope(); $EndResolve $EndAction./
-
-
-function_direct_declarator
- ::= basic_direct_declarator '(' parameter_type_list ')'
- /. $Build consumeDirectDeclaratorFunctionDeclarator(true, true); $EndBuild ./
- | basic_direct_declarator '(' ')'
- /. $Build consumeDirectDeclaratorFunctionDeclarator(true, false); $EndBuild ./
-
-
-function_declarator
- ::= function_direct_declarator
- | pointer_seq function_direct_declarator
- /. $Build consumeDeclaratorWithPointer(true); $EndBuild ./
-
-
--- This is a hack because the parser cannot tell the difference between
--- plain identifiers and types. Because of this an identifier_list would
--- always be parsed as a parameter_type_list instead. In a KnR funciton
--- definition we can use the extra list of declarators to disambiguate.
--- This rule should be merged back into direct_declarator if type info is
--- added to the parser.
-
-knr_direct_declarator
- ::= basic_direct_declarator '(' identifier_list ')'
- /. $Build consumeDirectDeclaratorFunctionDeclaratorKnR(); $EndBuild ./
-
-
-knr_function_declarator
- ::= knr_direct_declarator
- | pointer_seq knr_direct_declarator
- /. $Build consumeDeclaratorWithPointer(true); $EndBuild ./
-
-
-identifier_list
- ::= 'identifier'
- /. $Build consumeIdentifierKnR(); $EndBuild ./
- | identifier_list ',' 'identifier'
- /. $Build consumeIdentifierKnR(); $EndBuild ./
-
-
-array_modifier
- ::= '[' ']'
- /. $Build consumeDirectDeclaratorArrayModifier(false); $EndBuild ./
- | '[' array_modifier_type_qualifiers ']'
- /. $Build consumeDirectDeclaratorModifiedArrayModifier(false, false, true, false); $EndBuild ./
- | '[' assignment_expression ']'
- /. $Build consumeDirectDeclaratorArrayModifier(true); $EndBuild ./
- | '[' array_modifier_type_qualifiers assignment_expression ']'
- /. $Build consumeDirectDeclaratorModifiedArrayModifier(false, false, true, true); $EndBuild ./
- | '[' 'static' assignment_expression ']'
- /. $Build consumeDirectDeclaratorModifiedArrayModifier(true, false, false, true); $EndBuild ./
- | '[' 'static' array_modifier_type_qualifiers assignment_expression ']'
- /. $Build consumeDirectDeclaratorModifiedArrayModifier(true, false, true, true); $EndBuild ./
- | '[' array_modifier_type_qualifiers 'static' assignment_expression ']'
- /. $Build consumeDirectDeclaratorModifiedArrayModifier(true, false, true, true); $EndBuild ./
- | '[' '*' ']'
- /. $Build consumeDirectDeclaratorModifiedArrayModifier(false, true, false, false); $EndBuild ./
- | '[' array_modifier_type_qualifiers '*' ']'
- /. $Build consumeDirectDeclaratorModifiedArrayModifier(false, true, true, false); $EndBuild ./
-
-
-array_modifier_type_qualifiers
- ::= type_qualifier_list
-
-
-pointer_seq
- ::= '*'
- /. $Build consumePointer(); $EndBuild ./
- | pointer_seq '*'
- /. $Build consumePointer(); $EndBuild ./
- | '*' type_qualifier_list
- /. $Build consumePointerTypeQualifierList(); $EndBuild ./
- | pointer_seq '*' type_qualifier_list
- /. $Build consumePointerTypeQualifierList(); $EndBuild ./
-
-
-type_qualifier_list
- ::= type_qualifier
- | type_qualifier_list type_qualifier
-
-
-parameter_type_list
- ::= parameter_list
- /. $Build consumeEmpty(); $EndBuild ./
- | parameter_list ',' '...'
- /. $Build consumePlaceHolder(); $EndBuild ./
- | '...' -- not spec
- /. $Build consumePlaceHolder(); $EndBuild ./
-
-
-parameter_list
- ::= parameter_declaration
- | parameter_list ',' parameter_declaration
-
-
-parameter_declaration
- ::= declaration_specifiers complete_parameter_declarator
- /. $Build consumeParameterDeclaration(); $EndBuild ./
- | declaration_specifiers
- /.
- $Action
- $Resolve consumeParameterDeclarationWithoutDeclarator(); $EndResolve
- $Builder consumeParameterDeclarationWithoutDeclarator(); $EndBuilder
- $EndAction
- ./
-
-
-complete_parameter_declarator
- ::= declarator
- /.
- $Action
- $Resolve consumeDeclaratorCompleteParameter(); $EndResolve
- $EndAction
- ./
- | abstract_declarator
- /.
- $Action
- $Resolve consumeDeclaratorCompleteParameter(); $EndResolve
- $EndAction
- ./
-
-
--- only used in expressions, eg) sizeof, casts etc...
-type_name
- ::= specifier_qualifier_list
- /.
- $Action
- $Resolve consumeTypeId(); $EndResolve
- $Builder consumeTypeId(false); $EndBuilder
- $EndAction
- ./
- | specifier_qualifier_list abstract_declarator
- /.
- $Action
- $Resolve consumeTypeId(); $EndResolve
- $Builder consumeTypeId(true); $EndBuilder
- $EndAction
- ./
-
-
-abstract_declarator -- a declarator that does not include an identifier
- ::= direct_abstract_declarator
- | pointer_seq
- /. $Build consumeDeclaratorWithPointer(false); $EndBuild ./
- | pointer_seq direct_abstract_declarator
- /. $Build consumeDeclaratorWithPointer(false); $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
- ::= '(' ')'
- /. $Build consumeDirectDeclaratorFunctionDeclarator(false, false); $EndBuild ./
- | basic_direct_abstract_declarator '(' ')'
- /. $Build consumeDirectDeclaratorFunctionDeclarator(true, false); $EndBuild ./
- | '(' parameter_type_list ')'
- /. $Build consumeDirectDeclaratorFunctionDeclarator(false, true); $EndBuild ./
- | basic_direct_abstract_declarator '(' parameter_type_list ')'
- /. $Build consumeDirectDeclaratorFunctionDeclarator(true, true); $EndBuild ./
-
-
-initializer
- ::= assignment_expression
- /. $Build consumeInitializer(); $EndBuild ./
- | '{' initializer_list comma_opt '}'
- /. $Build consumeInitializerList(); $EndBuild ./
-
-initializer_list
- ::= initializer
- | designated_initializer
- | initializer_list ',' initializer
- | initializer_list ',' designated_initializer
-
-
-designated_initializer
- ::= designation '=' initializer
- /. $Build consumeInitializerDesignated(); $EndBuild ./
-
-
-designation
- ::= designator_list
-
-
-designator_list
- ::= designator_base
- | designator_list designator
-
-
-designator_base
- ::= '[' constant_expression ']'
- /. $Build consumeDesignatorArray(); $EndBuild ./
- | '.' identifier_or_typedefname
- /. $Build consumeDesignatorField(); $EndBuild ./
-
-designator
- ::= '[' constant_expression ']'
- /. $Build consumeDesignatorArray(); $EndBuild ./
- | '.' identifier_or_typedefname
- /. $Build consumeDesignatorField(); $EndBuild ./
-
-
--------------------------------------------------------------------------------------------
--- External Definitions
--------------------------------------------------------------------------------------------
-
-translation_unit
- ::= external_declaration_list
- /. $Build consumeTranslationUnit(); $EndBuild ./
- | $empty
- /. $Build consumeTranslationUnit(); $EndBuild ./
-
-
-external_declaration_list
- ::= external_declaration
- | external_declaration_list external_declaration
-
-
-external_declaration
- ::= function_definition
- | declaration
- | ';'
- /. $Build consumeDeclarationEmpty(); $EndBuild ./
- | ERROR_TOKEN
- /. $Build consumeDeclarationProblem(); $EndBuild ./
-
-
--- Used by KnR
-declaration_list
- ::= declaration
- | declaration_list declaration
-
-
--- The extra nonterminal before declarator in this rule is only there
--- to avoid a shift/reduce error with the rule for declaration.
--- The symbol table scoped is opened in the rule for function_direct_declarator
-function_definition
- ::= declaration_specifiers function_declarator function_body
- /.
- $Action
- $Resolve consumeFunctionDefinition(); $EndResolve
- $Builder consumeFunctionDefinition(true); $EndBuilder
- $EndAction
- ./
-
- -- this rule is here as a special case (its not C99 spec) just to support implicit int in function definitions
- | function_declarator function_body
- /.
- $Action
- $Resolve consumeFunctionDefinition(); $EndResolve
- $Builder consumeFunctionDefinition(false); $EndBuilder
- $EndAction
- ./
-
- | declaration_specifiers knr_function_declarator declaration_list compound_statement
- /.
- $Action
- $Resolve consumeFunctionDefinition(); $EndResolve
- $Builder consumeFunctionDefinitionKnR(); $EndBuilder
- $EndAction
- ./
-
-
--- same syntax as compound_statement but a symbol table scope isn't opened
-function_body
- ::= '{' '}'
- /. $Build consumeStatementCompoundStatement(false); $EndBuild ./
- | '{' block_item_list '}'
- /. $Build consumeStatementCompoundStatement(true); $EndBuild ./
-
-$End
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ translation_unit
+$End
\ No newline at end of file
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99SizeofExpressionParser.g b/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99SizeofExpressionParser.g
new file mode 100644
index 00000000000..f5708ce8e0d
--- /dev/null
+++ b/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99SizeofExpressionParser.g
@@ -0,0 +1,54 @@
+-----------------------------------------------------------------------------------
+-- 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.c99
+%options template=btParserTemplateD.g
+
+
+$Define
+ $sym_class /. C99SizeofExpressionParsersym ./
+$End
+
+$Import
+ C99Grammar.g
+
+$DropRules
+
+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 ./
+
+$End
\ No newline at end of file
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99tu/C99Parser.g b/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99tu/C99Parser.g
new file mode 100644
index 00000000000..e313c24b6e6
--- /dev/null
+++ b/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99tu/C99Parser.g
@@ -0,0 +1,1265 @@
+-----------------------------------------------------------------------------------
+-- 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.c99
+%options template=TrialUndoParserTemplate.g
+
+--$Include
+--../common.g
+--$End
+
+$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
+
+ auto break case char const continue default do
+ double else enum extern float for goto if
+ inline int long register restrict return short signed
+ sizeof static struct switch typedef union unsigned void
+ volatile while _Bool _Complex _Imaginary
+
+ -- Literals
+
+ integer floating charconst stringlit
+
+ -- identifiers
+ -- Special token that represents identifiers that have been declared as typedefs (lexer feedback hack)
+
+ 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 ::= '.'
+ Arrow ::= '->'
+ PlusPlus ::= '++'
+ MinusMinus ::= '--'
+ And ::= '&'
+ Star ::= '*'
+ Plus ::= '+'
+ Minus ::= '-'
+ Tilde ::= '~'
+ Bang ::= '!'
+ Slash ::= '/'
+ Percent ::= '%'
+ RightShift ::= '>>'
+ LeftShift ::= '<<'
+ LT ::= '<'
+ GT ::= '>'
+ LE ::= '<='
+ GE ::= '>='
+ EQ ::= '=='
+ NE ::= '!='
+ Caret ::= '^'
+ Or ::= '|'
+ AndAnd ::= '&&'
+ OrOr ::= '||'
+ Question ::= '?'
+ Colon ::= ':'
+ DotDotDot ::= '...'
+ Assign ::= '='
+ StarAssign ::= '*='
+ SlashAssign ::= '/='
+ PercentAssign ::= '%='
+ PlusAssign ::= '+='
+ MinusAssign ::= '-='
+ RightShiftAssign ::= '>>='
+ LeftShiftAssign ::= '<<='
+ AndAssign ::= '&='
+ CaretAssign ::= '^='
+ OrAssign ::= '|='
+ Comma ::= ','
+
+ 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.lrparser.IParser;
+ import org.eclipse.cdt.core.dom.lrparser.IParserActionTokenProvider;
+ import org.eclipse.cdt.core.dom.lrparser.action.c99.C99ASTNodeFactory;
+ import org.eclipse.cdt.core.dom.lrparser.action.c99.C99BuildASTParserAction;
+ import org.eclipse.cdt.core.dom.lrparser.action.c99.C99TypedefTrackerParserAction;
+ import org.eclipse.cdt.core.dom.lrparser.util.DebugUtil;
+./
+$End
+
+-- TODO move this code into a common template
+
+$Define
+ $build_action_class /. C99BuildASTParserAction ./
+ $resolve_action_class /. C99TypedefTrackerParserAction ./
+ $node_factory_create_expression /. C99ASTNodeFactory.DEFAULT_INSTANCE ./
+ $sym_class /. C99Parsersym ./
+ $lexer_class /. C99Lexer ./
+ $action_class /. C99ParserAction ./
+$End
+
+
+
+
+$Define
+ -- These macros allow the template and header code to be customized by an extending parser.
+ $ast_class /.Object./
+ $data_class /. Object ./ -- allow anything to be passed between actions
+
+ --$additional_interfaces /. , IParserActionTokenProvider, IParser ./
+ $additional_interfaces /. ./
+
+ --$build_action_class /. ./
+ --$resolve_action_class /. ./
+ --$node_factory_create_expression /. ./
+
+
+ --$lexer_class /. ./
+ --$action_class /. ./
+
+
+ $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 /. /*$builder.getASTStack().print();*/ $EndFinal ./
+
+ $Build /. $Action $Builder ./
+ $EndBuild /. $EndBuilder $EndAction ./
+
+ $resolve /. action.resolver./
+ $builder /. action.builder./
+
+
+-- comment out when using trial/undo
+ --$Action /. $BeginAction ./
+ --$BeginFinal /. ./
+ --$EndFinal /. ./
+ --$BeginTrial /. ./
+ --$EndTrial /. ./
+ --$Undo /. ./
+ --$EndUndo /. ./
+$End
+
+
+$Headers
+/.
+ private $action_class action;
+
+ //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($sym_class.orderedTerminalSymbols);
+ 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;
+ parserAction = null;
+ return compNode;
+ }
+
+
+ public int getKind(int i) {
+ int kind = super.getKind(i);
+ // lexer feedback hack!
+ if(kind == $sym_class.TK_identifier && action.resolver.isTypedef(getTokenText(i))) {
+ kind = $sym_class.TK_TypedefName;
+ }
+ return kind;
+ }
+
+./
+$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./
+
+-------------------------------------------------------------------------------------------
+-- 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'
+
+
+
+-------------------------------------------------------------------------------------------
+-- Expressions
+-------------------------------------------------------------------------------------------
+
+
+literal
+ ::= 'integer'
+ /. $Build consumeExpressionLiteral(IASTLiteralExpression.lk_integer_constant); $EndBuild ./
+ | 'floating'
+ /. $Build consumeExpressionLiteral(IASTLiteralExpression.lk_float_constant); $EndBuild ./
+ | 'charconst'
+ /. $Build consumeExpressionLiteral(IASTLiteralExpression.lk_char_constant); $EndBuild ./
+ | 'stringlit'
+ /. $Build consumeExpressionLiteral(IASTLiteralExpression.lk_string_literal); $EndBuild ./
+
+
+primary_expression
+ ::= literal
+ | primary_expression_id
+ /. $Build consumeExpressionID(); $EndBuild ./
+ | '(' expression ')'
+ /. $Build consumeExpressionBracketed(); $EndBuild ./
+
+
+primary_expression_id -- Typedefname not allowed as a variable name.
+ ::= 'identifier'
+ | 'Completion'
+
+
+postfix_expression
+ ::= primary_expression
+ | postfix_expression '[' expression ']'
+ /. $Build consumeExpressionArraySubscript(); $EndBuild ./
+ | postfix_expression '(' expression_list_opt ')'
+ /. $Build consumeExpressionFunctionCall(); $EndBuild ./
+ | postfix_expression '.' member_name
+ /. $Build consumeExpressionFieldReference(false); $EndBuild ./
+ | postfix_expression '->' member_name
+ /. $Build consumeExpressionFieldReference(true); $EndBuild ./
+ | postfix_expression '++'
+ /. $Build consumeExpressionUnaryOperator(IASTUnaryExpression.op_postFixIncr); $EndBuild ./
+ | postfix_expression '--'
+ /. $Build consumeExpressionUnaryOperator(IASTUnaryExpression.op_postFixDecr); $EndBuild ./
+ | '(' type_name ')' '{' initializer_list comma_opt '}'
+ /. $Build consumeExpressionTypeIdInitializer(); $EndBuild ./
+
+
+comma_opt
+ ::= ',' | $empty
+
+
+member_name
+ ::= 'identifier'
+ | 'TypedefName'
+ | 'Completion'
+
+
+unary_expression
+ ::= postfix_expression
+ | '++' unary_expression
+ /. $Build consumeExpressionUnaryOperator(IASTUnaryExpression.op_prefixIncr); $EndBuild ./
+ | '--' unary_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_name ')'
+ /. $Build consumeExpressionTypeId(IASTTypeIdExpression.op_sizeof); $EndBuild ./
+
+
+cast_expression
+ ::= unary_expression
+ | '(' type_name ')' cast_expression
+ /. $Build consumeExpressionCast(IASTCastExpression.op_cast); $EndBuild ./
+
+
+multiplicative_expression
+ ::= cast_expression
+ | multiplicative_expression '*' cast_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_multiply); $EndBuild ./
+ | multiplicative_expression '/' cast_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_divide); $EndBuild ./
+ | multiplicative_expression '%' cast_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_modulo); $EndBuild ./
+
+
+additive_expression
+ ::= multiplicative_expression
+ | additive_expression '+' multiplicative_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_plus); $EndBuild ./
+ | additive_expression '-' multiplicative_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_minus); $EndBuild ./
+
+
+shift_expression
+ ::= additive_expression
+ | shift_expression '<<' additive_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_shiftLeft); $EndBuild ./
+ | shift_expression '>>' additive_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_shiftRight); $EndBuild ./
+
+
+relational_expression
+ ::= shift_expression
+ | relational_expression '<' shift_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_lessThan); $EndBuild ./
+ | relational_expression '>' shift_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_greaterThan); $EndBuild ./
+ | relational_expression '<=' shift_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_lessEqual); $EndBuild ./
+ | relational_expression '>=' shift_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_greaterEqual); $EndBuild ./
+
+
+equality_expression
+ ::= relational_expression
+ | equality_expression '==' relational_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_equals); $EndBuild ./
+ | equality_expression '!=' relational_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_notequals); $EndBuild ./
+
+
+AND_expression
+ ::= equality_expression
+ | AND_expression '&' equality_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_binaryAnd); $EndBuild ./
+
+
+exclusive_OR_expression
+ ::= AND_expression
+ | exclusive_OR_expression '^' AND_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_binaryXor); $EndBuild ./
+
+
+inclusive_OR_expression
+ ::= exclusive_OR_expression
+ | inclusive_OR_expression '|' exclusive_OR_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_binaryOr); $EndBuild ./
+
+
+logical_AND_expression
+ ::= inclusive_OR_expression
+ | logical_AND_expression '&&' inclusive_OR_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_logicalAnd); $EndBuild ./
+
+
+logical_OR_expression
+ ::= logical_AND_expression
+ | logical_OR_expression '||' logical_AND_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_logicalOr); $EndBuild ./
+
+
+conditional_expression
+ ::= logical_OR_expression
+ | logical_OR_expression '?' expression ':' conditional_expression
+ /. $Build consumeExpressionConditional(); $EndBuild ./
+
+
+assignment_expression
+ ::= conditional_expression
+ | unary_expression '=' assignment_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_assign); $EndBuild ./
+ | unary_expression '*=' assignment_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_multiplyAssign); $EndBuild ./
+ | unary_expression '/=' assignment_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_divideAssign); $EndBuild ./
+ | unary_expression '%=' assignment_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_moduloAssign); $EndBuild ./
+ | unary_expression '+=' assignment_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_plusAssign); $EndBuild ./
+ | unary_expression '-=' assignment_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_minusAssign); $EndBuild ./
+ | unary_expression '<<=' assignment_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_shiftLeftAssign); $EndBuild ./
+ | unary_expression '>>=' assignment_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_shiftRightAssign); $EndBuild ./
+ | unary_expression '&=' assignment_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_binaryAndAssign); $EndBuild ./
+ | unary_expression '^=' assignment_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_binaryXorAssign); $EndBuild ./
+ | unary_expression '|=' assignment_expression
+ /. $Build consumeExpressionBinaryOperator(IASTBinaryExpression.op_binaryOrAssign); $EndBuild ./
+
+
+-- special rule to avoid conflict between problem statements and problem expressions
+expression_in_statement
+ ::= expression_list
+
+
+expression
+ ::= expression_list
+
+
+expression_list
+ ::= expression_list_actual
+ /. $Build consumeExpressionList(); $EndBuild ./
+
+
+expression_list_opt
+ ::= expression_list
+ | $empty
+ /. $Build consumeEmpty(); $EndBuild ./
+
+
+expression_list_actual
+ ::= assignment_expression
+ | expression_list_actual ',' assignment_expression
+
+
+constant_expression
+ ::= conditional_expression
+
+
+-------------------------------------------------------------------------------------------
+-- Statements
+-------------------------------------------------------------------------------------------
+
+
+
+statement
+ ::= labeled_statement
+ | compound_statement
+ | expression_statement
+ | selection_statement
+ | iteration_statement
+ | jump_statement
+ | ERROR_TOKEN
+ /. $Build consumeStatementProblem(); $EndBuild ./
+
+
+labeled_statement
+ ::= identifier_or_typedefname ':' statement
+ /. $Build consumeStatementLabeled(); $EndBuild ./
+ | 'case' constant_expression ':'
+ /. $Build consumeStatementCase(); $EndBuild ./
+ | 'default' ':'
+ /. $Build consumeStatementDefault(); $EndBuild ./
+
+
+compound_statement
+ ::= '{' '}'
+ /.
+ $Action
+ $Resolve closeSymbolScope(); $EndResolve
+ $Builder consumeStatementCompoundStatement(false); $EndBuilder
+ $EndAction
+ ./
+ | '{' block_item_list '}'
+ /.
+ $Action
+ $Resolve closeSymbolScope(); $EndResolve
+ $Builder consumeStatementCompoundStatement(true); $EndBuilder
+ $EndAction
+ ./
+
+
+block_item_list
+ ::= block_item
+ | block_item_list block_item
+
+
+block_item
+ ::= statement
+ | declaration
+ /. $Build consumeStatementDeclaration(); $EndBuild ./
+
+
+expression_statement
+ ::= ';'
+ /. $Build consumeStatementNull(); $EndBuild ./
+ | expression_in_statement ';'
+ /. $Build consumeStatementExpression(); $EndBuild ./
+
+
+selection_statement
+ ::= 'if' '(' expression ')' statement
+ /. $Build consumeStatementIf(false); $EndBuild ./
+ | 'if' '(' expression ')' statement 'else' statement
+ /. $Build consumeStatementIf(true); $EndBuild ./
+ | 'switch' '(' expression ')' statement
+ /. $Build consumeStatementSwitch(); $EndBuild ./
+
+
+expression_opt
+ ::= expression
+ | $empty
+ /. $Build consumeEmpty(); $EndBuild ./
+
+
+iteration_statement
+ ::= 'do' statement 'while' '(' expression ')' ';'
+ /. $Build consumeStatementDoLoop(); $EndBuild ./
+ | 'while' '(' expression ')' statement
+ /. $Build consumeStatementWhileLoop(); $EndBuild ./
+ | 'for' '(' expression_opt ';' expression_opt ';' expression_opt ')' statement
+ /.
+ $Action
+ $Resolve closeSymbolScope(); $EndResolve
+ $Builder consumeStatementForLoop(); $EndBuilder
+ $EndAction
+ ./
+ | 'for' '(' declaration expression_opt ';' expression_opt ')' statement
+ /.
+ $Action
+ $Resolve closeSymbolScope(); $EndResolve
+ $Builder consumeStatementForLoop(); $EndBuilder
+ $EndAction
+ ./
+
+
+jump_statement
+ ::= 'goto' identifier_or_typedefname ';'
+ /. $Build consumeStatementGoto(); $EndBuild ./
+ | 'continue' ';'
+ /. $Build consumeStatementContinue(); $EndBuild ./
+ | 'break' ';'
+ /. $Build consumeStatementBreak(); $EndBuild ./
+ | 'return' ';'
+ /. $Build consumeStatementReturn(false); $EndBuild ./
+ | 'return' expression ';'
+ /. $Build consumeStatementReturn(true); $EndBuild ./
+
+
+
+-------------------------------------------------------------------------------------------
+-- Declarations
+-------------------------------------------------------------------------------------------
+
+
+
+declaration
+ ::= declaration_specifiers ';'
+ /.
+ $Action
+ $Resolve closeDeclarationScope(); $EndResolve
+ $Builder consumeDeclarationSimple(false); $EndBuilder
+ $EndAction
+ ./
+ | declaration_specifiers init_declarator_list ';'
+ /.
+ $Action
+ $Resolve closeDeclarationScope(); $EndResolve
+ $Builder consumeDeclarationSimple(true); $EndBuilder
+ $EndAction
+ ./
+
+
+declaration_specifiers
+ ::= simple_declaration_specifiers
+ /. $Build consumeDeclarationSpecifiersSimple(); $EndBuild ./
+ | struct_or_union_declaration_specifiers
+ /. $Build consumeDeclarationSpecifiersStructUnionEnum(); $EndBuild ./
+ | elaborated_declaration_specifiers
+ /. $Build consumeDeclarationSpecifiersStructUnionEnum(); $EndBuild ./
+ | enum_declaration_specifiers
+ /. $Build consumeDeclarationSpecifiersStructUnionEnum(); $EndBuild ./
+ | typdef_name_declaration_specifiers
+ /. $Build consumeDeclarationSpecifiersTypedefName(); $EndBuild ./
+
+
+no_type_declaration_specifier
+ ::= storage_class_specifier
+ | type_qualifier
+ | function_specifier
+
+
+no_type_declaration_specifiers
+ ::= no_type_declaration_specifier
+ | no_type_declaration_specifiers no_type_declaration_specifier
+
+
+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_or_union_declaration_specifiers
+ ::= struct_or_union_specifier
+ | no_type_declaration_specifiers struct_or_union_specifier
+ | struct_or_union_declaration_specifiers no_type_declaration_specifier
+
+
+elaborated_declaration_specifiers
+ ::= elaborated_specifier
+ | no_type_declaration_specifiers elaborated_specifier
+ | elaborated_declaration_specifiers no_type_declaration_specifier
+
+
+enum_declaration_specifiers
+ ::= enum_specifier
+ | no_type_declaration_specifiers enum_specifier
+ | enum_declaration_specifiers no_type_declaration_specifier
+
+
+typdef_name_declaration_specifiers
+ ::= typedef_name_in_declspec
+ | no_type_declaration_specifiers typedef_name_in_declspec
+ | typdef_name_declaration_specifiers no_type_declaration_specifier
+
+
+init_declarator_list
+ ::= init_declarator
+ | init_declarator_list ',' init_declarator
+
+
+init_declarator
+ ::= complete_declarator
+ | complete_declarator '=' initializer
+ /. $Build consumeDeclaratorWithInitializer(true); $EndBuild ./
+
+
+complete_declarator
+ ::= declarator
+ /.
+ $Action
+ $Resolve consumeDeclaratorComplete(); $EndResolve
+ $EndAction
+ ./
+
+
+storage_class_specifier
+ ::= storage_class_specifier_token
+ /.
+ $Action
+ $Resolve consumeDeclSpecToken(); $EndResolve
+ $Builder consumeDeclSpecToken(); $EndBuilder
+ $EndAction
+ ./
+
+
+storage_class_specifier_token
+ ::= 'typedef'
+ | 'extern'
+ | 'static'
+ | 'auto'
+ | 'register'
+
+
+simple_type_specifier
+ ::= simple_type_specifier_token
+ /.
+ $Action
+ $Resolve consumeDeclSpecToken(); $EndResolve
+ $Builder consumeDeclSpecToken(); $EndBuilder
+ $EndAction
+ ./
+
+simple_type_specifier_token
+ ::= 'void'
+ | 'char'
+ | 'short'
+ | 'int'
+ | 'long'
+ | 'float'
+ | 'double'
+ | 'signed'
+ | 'unsigned'
+ | '_Bool'
+ | '_Complex'
+ | '_Imaginary'
+
+
+typedef_name_in_declspec
+ ::= 'TypedefName'
+ /.
+ $Action
+ $Resolve consumeDeclSpecToken(); $EndResolve
+ $Builder consumeDeclSpecToken(); $EndBuilder
+ $EndAction
+ ./
+ | 'Completion'
+ /.
+ $Action
+ $Resolve consumeDeclSpecToken(); $EndResolve
+ $Builder consumeDeclSpecToken(); $EndBuilder
+ $EndAction
+ ./
+
+
+identifier_or_typedefname
+ ::= 'identifier'
+ | 'TypedefName'
+ | 'Completion'
+
+
+struct_or_union_specifier
+ ::= 'struct' '{' struct_declaration_list_opt '}'
+ /. $Build consumeTypeSpecifierComposite(false, IASTCompositeTypeSpecifier.k_struct); $EndBuild ./
+ | 'union' '{' struct_declaration_list_opt '}'
+ /. $Build consumeTypeSpecifierComposite(false, IASTCompositeTypeSpecifier.k_union); $EndBuild ./
+ | 'struct' identifier_or_typedefname '{' struct_declaration_list_opt '}'
+ /. $Build consumeTypeSpecifierComposite(true, IASTCompositeTypeSpecifier.k_struct); $EndBuild ./
+ | 'union' identifier_or_typedefname '{' struct_declaration_list_opt '}'
+ /. $Build consumeTypeSpecifierComposite(true, IASTCompositeTypeSpecifier.k_union); $EndBuild ./
+
+
+elaborated_specifier
+ ::= 'struct' identifier_or_typedefname
+ /. $Build consumeTypeSpecifierElaborated(IASTCompositeTypeSpecifier.k_struct); $EndBuild ./
+ | 'union' identifier_or_typedefname
+ /. $Build consumeTypeSpecifierElaborated(IASTCompositeTypeSpecifier.k_union); $EndBuild ./
+ | 'enum' identifier_or_typedefname
+ /. $Build consumeTypeSpecifierElaborated(IASTElaboratedTypeSpecifier.k_enum); $EndBuild ./
+
+
+struct_declaration_list_opt
+ ::= struct_declaration_list
+ | $empty
+
+struct_declaration_list
+ ::= struct_declaration
+ | struct_declaration_list struct_declaration
+
+
+struct_declaration
+ ::= specifier_qualifier_list struct_declarator_list ';' -- regular declarators plus bit fields
+ /.
+ $Action
+ $Resolve closeDeclarationScope(); $EndResolve
+ $Builder consumeStructDeclaration(true); $EndBuilder
+ $EndAction
+ ./
+ | specifier_qualifier_list ';'
+ /.
+ $Action
+ $Resolve closeDeclarationScope(); $EndResolve
+ $Builder consumeStructDeclaration(false); $EndBuilder
+ $EndAction
+ ./
+
+
+-- just reuse declaration_specifiers, makes grammar a bit more lenient but thats OK
+specifier_qualifier_list
+ ::= declaration_specifiers
+
+
+struct_declarator_list
+ ::= complete_struct_declarator
+ | struct_declarator_list ',' complete_struct_declarator
+
+
+complete_struct_declarator
+ ::= struct_declarator
+ /.
+ $Action
+ $Resolve consumeDeclaratorCompleteField(); $EndResolve
+ $EndAction
+ ./
+
+
+struct_declarator
+ ::= declarator
+ | ':' constant_expression
+ /. $Build consumeBitField(false); $EndBuild ./
+ | declarator ':' constant_expression
+ /. $Build consumeBitField(true); $EndBuild ./
+
+
+enum_specifier
+ ::= 'enum' '{' enumerator_list_opt comma_opt '}'
+ /. $Build consumeTypeSpecifierEnumeration(false); $EndBuild ./
+ | 'enum' identifier_or_typedefname '{' enumerator_list_opt comma_opt '}'
+ /. $Build consumeTypeSpecifierEnumeration(true); $EndBuild ./
+
+
+enumerator_list_opt
+ ::= enumerator_list
+ | $empty
+
+
+enumerator_list
+ ::= enumerator
+ | enumerator_list ',' enumerator
+
+
+enumerator
+ ::= identifier_or_typedefname
+ /. $Build consumeEnumerator(false); $EndBuild ./
+ | identifier_or_typedefname '=' constant_expression
+ /. $Build consumeEnumerator(true); $EndBuild ./
+
+
+type_qualifier
+ ::= type_qualifier_token
+ /.
+ $Action
+ $Resolve consumeDeclSpecToken(); $EndResolve
+ $Builder consumeDeclSpecToken(); $EndBuilder
+ $EndAction
+ ./
+
+
+type_qualifier_token
+ ::= 'const'
+ | 'restrict'
+ | 'volatile'
+
+
+function_specifier
+ ::= 'inline'
+ /.$Action
+ $Resolve consumeDeclSpecToken(); $EndResolve
+ $Builder consumeDeclSpecToken(); $EndBuilder
+ $EndAction
+ ./
+
+
+declarator
+ ::= direct_declarator
+ | pointer_seq direct_declarator
+ /. $Build consumeDeclaratorWithPointer(true); $EndBuild ./
+
+
+direct_declarator
+ ::= array_direct_declarator
+ | function_prototype_direct_declarator
+ | basic_direct_declarator
+ | knr_direct_declarator
+
+
+basic_direct_declarator
+ ::= declarator_id_name
+ /.
+ $Action
+ $Resolve consumeDirectDeclaratorIdentifier(); $EndResolve
+ $Builder consumeDirectDeclaratorIdentifier(); $EndBuilder
+ $EndAction
+ ./
+ | '(' declarator ')'
+ /. $Build consumeDirectDeclaratorBracketed(); $EndBuild ./
+
+
+declarator_id_name
+ ::= 'identifier'
+ /. $Build consumeIdentifierName(); $EndBuild ./
+
+
+array_direct_declarator
+ ::= basic_direct_declarator array_modifier
+ /. $Build consumeDirectDeclaratorArrayDeclarator(true); $EndBuild ./
+ | array_direct_declarator array_modifier
+ /. $Build consumeDirectDeclaratorArrayDeclarator(true); $EndBuild ./
+
+
+function_prototype_direct_declarator
+ ::= function_direct_declarator
+ /.$Action $Resolve closeSymbolScope(); $EndResolve $EndAction./
+
+
+function_direct_declarator
+ ::= basic_direct_declarator '(' parameter_type_list ')'
+ /. $Build consumeDirectDeclaratorFunctionDeclarator(true, true); $EndBuild ./
+ | basic_direct_declarator '(' ')'
+ /. $Build consumeDirectDeclaratorFunctionDeclarator(true, false); $EndBuild ./
+
+
+function_declarator
+ ::= function_direct_declarator
+ | pointer_seq function_direct_declarator
+ /. $Build consumeDeclaratorWithPointer(true); $EndBuild ./
+
+
+-- This is a hack because the parser cannot tell the difference between
+-- plain identifiers and types. Because of this an identifier_list would
+-- always be parsed as a parameter_type_list instead. In a KnR funciton
+-- definition we can use the extra list of declarators to disambiguate.
+-- This rule should be merged back into direct_declarator if type info is
+-- added to the parser.
+
+knr_direct_declarator
+ ::= basic_direct_declarator '(' identifier_list ')'
+ /. $Build consumeDirectDeclaratorFunctionDeclaratorKnR(); $EndBuild ./
+
+
+knr_function_declarator
+ ::= knr_direct_declarator
+ | pointer_seq knr_direct_declarator
+ /. $Build consumeDeclaratorWithPointer(true); $EndBuild ./
+
+
+identifier_list
+ ::= 'identifier'
+ /. $Build consumeIdentifierKnR(); $EndBuild ./
+ | identifier_list ',' 'identifier'
+ /. $Build consumeIdentifierKnR(); $EndBuild ./
+
+
+array_modifier
+ ::= '[' ']'
+ /. $Build consumeDirectDeclaratorArrayModifier(false); $EndBuild ./
+ | '[' array_modifier_type_qualifiers ']'
+ /. $Build consumeDirectDeclaratorModifiedArrayModifier(false, false, true, false); $EndBuild ./
+ | '[' assignment_expression ']'
+ /. $Build consumeDirectDeclaratorArrayModifier(true); $EndBuild ./
+ | '[' array_modifier_type_qualifiers assignment_expression ']'
+ /. $Build consumeDirectDeclaratorModifiedArrayModifier(false, false, true, true); $EndBuild ./
+ | '[' 'static' assignment_expression ']'
+ /. $Build consumeDirectDeclaratorModifiedArrayModifier(true, false, false, true); $EndBuild ./
+ | '[' 'static' array_modifier_type_qualifiers assignment_expression ']'
+ /. $Build consumeDirectDeclaratorModifiedArrayModifier(true, false, true, true); $EndBuild ./
+ | '[' array_modifier_type_qualifiers 'static' assignment_expression ']'
+ /. $Build consumeDirectDeclaratorModifiedArrayModifier(true, false, true, true); $EndBuild ./
+ | '[' '*' ']'
+ /. $Build consumeDirectDeclaratorModifiedArrayModifier(false, true, false, false); $EndBuild ./
+ | '[' array_modifier_type_qualifiers '*' ']'
+ /. $Build consumeDirectDeclaratorModifiedArrayModifier(false, true, true, false); $EndBuild ./
+
+
+array_modifier_type_qualifiers
+ ::= type_qualifier_list
+
+
+pointer_seq
+ ::= '*'
+ /. $Build consumePointer(); $EndBuild ./
+ | pointer_seq '*'
+ /. $Build consumePointer(); $EndBuild ./
+ | '*' type_qualifier_list
+ /. $Build consumePointerTypeQualifierList(); $EndBuild ./
+ | pointer_seq '*' type_qualifier_list
+ /. $Build consumePointerTypeQualifierList(); $EndBuild ./
+
+
+type_qualifier_list
+ ::= type_qualifier
+ | type_qualifier_list type_qualifier
+
+
+parameter_type_list
+ ::= parameter_list
+ /. $Build consumeEmpty(); $EndBuild ./
+ | parameter_list ',' '...'
+ /. $Build consumePlaceHolder(); $EndBuild ./
+ | '...' -- not spec
+ /. $Build consumePlaceHolder(); $EndBuild ./
+
+
+parameter_list
+ ::= parameter_declaration
+ | parameter_list ',' parameter_declaration
+
+
+parameter_declaration
+ ::= declaration_specifiers complete_parameter_declarator
+ /. $Build consumeParameterDeclaration(); $EndBuild ./
+ | declaration_specifiers
+ /.
+ $Action
+ $Resolve consumeParameterDeclarationWithoutDeclarator(); $EndResolve
+ $Builder consumeParameterDeclarationWithoutDeclarator(); $EndBuilder
+ $EndAction
+ ./
+
+
+complete_parameter_declarator
+ ::= declarator
+ /.
+ $Action
+ $Resolve consumeDeclaratorCompleteParameter(); $EndResolve
+ $EndAction
+ ./
+ | abstract_declarator
+ /.
+ $Action
+ $Resolve consumeDeclaratorCompleteParameter(); $EndResolve
+ $EndAction
+ ./
+
+
+-- only used in expressions, eg) sizeof, casts etc...
+type_name
+ ::= specifier_qualifier_list
+ /.
+ $Action
+ $Resolve consumeTypeId(); $EndResolve
+ $Builder consumeTypeId(false); $EndBuilder
+ $EndAction
+ ./
+ | specifier_qualifier_list abstract_declarator
+ /.
+ $Action
+ $Resolve consumeTypeId(); $EndResolve
+ $Builder consumeTypeId(true); $EndBuilder
+ $EndAction
+ ./
+
+
+abstract_declarator -- a declarator that does not include an identifier
+ ::= direct_abstract_declarator
+ | pointer_seq
+ /. $Build consumeDeclaratorWithPointer(false); $EndBuild ./
+ | pointer_seq direct_abstract_declarator
+ /. $Build consumeDeclaratorWithPointer(false); $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
+ ::= '(' ')'
+ /. $Build consumeDirectDeclaratorFunctionDeclarator(false, false); $EndBuild ./
+ | basic_direct_abstract_declarator '(' ')'
+ /. $Build consumeDirectDeclaratorFunctionDeclarator(true, false); $EndBuild ./
+ | '(' parameter_type_list ')'
+ /. $Build consumeDirectDeclaratorFunctionDeclarator(false, true); $EndBuild ./
+ | basic_direct_abstract_declarator '(' parameter_type_list ')'
+ /. $Build consumeDirectDeclaratorFunctionDeclarator(true, true); $EndBuild ./
+
+
+initializer
+ ::= assignment_expression
+ /. $Build consumeInitializer(); $EndBuild ./
+ | '{' initializer_list comma_opt '}'
+ /. $Build consumeInitializerList(); $EndBuild ./
+
+initializer_list
+ ::= initializer
+ | designated_initializer
+ | initializer_list ',' initializer
+ | initializer_list ',' designated_initializer
+
+
+designated_initializer
+ ::= designation '=' initializer
+ /. $Build consumeInitializerDesignated(); $EndBuild ./
+
+
+designation
+ ::= designator_list
+
+
+designator_list
+ ::= designator_base
+ | designator_list designator
+
+
+designator_base
+ ::= '[' constant_expression ']'
+ /. $Build consumeDesignatorArray(); $EndBuild ./
+ | '.' identifier_or_typedefname
+ /. $Build consumeDesignatorField(); $EndBuild ./
+
+designator
+ ::= '[' constant_expression ']'
+ /. $Build consumeDesignatorArray(); $EndBuild ./
+ | '.' identifier_or_typedefname
+ /. $Build consumeDesignatorField(); $EndBuild ./
+
+
+-------------------------------------------------------------------------------------------
+-- External Definitions
+-------------------------------------------------------------------------------------------
+
+translation_unit
+ ::= external_declaration_list
+ /. $Build consumeTranslationUnit(); $EndBuild ./
+ | $empty
+ /. $Build consumeTranslationUnit(); $EndBuild ./
+
+
+external_declaration_list
+ ::= external_declaration
+ | external_declaration_list external_declaration
+
+
+external_declaration
+ ::= function_definition
+ | declaration
+ | ';'
+ /. $Build consumeDeclarationEmpty(); $EndBuild ./
+ | ERROR_TOKEN
+ /. $Build consumeDeclarationProblem(); $EndBuild ./
+
+
+-- Used by KnR
+declaration_list
+ ::= declaration
+ | declaration_list declaration
+
+
+-- The extra nonterminal before declarator in this rule is only there
+-- to avoid a shift/reduce error with the rule for declaration.
+-- The symbol table scoped is opened in the rule for function_direct_declarator
+function_definition
+ ::= declaration_specifiers function_declarator function_body
+ /.
+ $Action
+ $Resolve consumeFunctionDefinition(); $EndResolve
+ $Builder consumeFunctionDefinition(true); $EndBuilder
+ $EndAction
+ ./
+
+ -- this rule is here as a special case (its not C99 spec) just to support implicit int in function definitions
+ | function_declarator function_body
+ /.
+ $Action
+ $Resolve consumeFunctionDefinition(); $EndResolve
+ $Builder consumeFunctionDefinition(false); $EndBuilder
+ $EndAction
+ ./
+
+ | declaration_specifiers knr_function_declarator declaration_list compound_statement
+ /.
+ $Action
+ $Resolve consumeFunctionDefinition(); $EndResolve
+ $Builder consumeFunctionDefinitionKnR(); $EndBuilder
+ $EndAction
+ ./
+
+
+-- same syntax as compound_statement but a symbol table scope isn't opened
+function_body
+ ::= '{' '}'
+ /. $Build consumeStatementCompoundStatement(false); $EndBuild ./
+ | '{' block_item_list '}'
+ /. $Build consumeStatementCompoundStatement(true); $EndBuild ./
+
+$End
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/grammar/common.g b/lrparser/org.eclipse.cdt.core.lrparser/grammar/common.g
index 481c93ff24a..530e744f92f 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/grammar/common.g
+++ b/lrparser/org.eclipse.cdt.core.lrparser/grammar/common.g
@@ -33,76 +33,49 @@ $Define
$ast_class /.Object./
$data_class /. Object ./ -- allow anything to be passed between actions
- --$additional_interfaces /. , IParserActionTokenProvider, IParser ./
- $additional_interfaces /. ./
+ $additional_interfaces /. , IParserActionTokenProvider, IParser ./
$build_action_class /. ./
$resolve_action_class /. ./
$node_factory_create_expression /. ./
-
$lexer_class /. ./
$action_class /. ./
-
- $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 /. /*$builder.getASTStack().print();*/ $EndFinal ./
+ $Build /. $BeginAction action. ./
+ $EndBuild /. $EndAction ./
+$End
- $Build /. $Action $Builder ./
- $EndBuild /. $EndBuilder $EndAction ./
-
- $resolve /. action.resolver./
- $builder /. action.builder./
--- comment out when using trial/undo
- --$Action /. $BeginAction ./
- --$BeginFinal /. ./
- --$EndFinal /. ./
- --$BeginTrial /. ./
- --$EndTrial /. ./
- --$Undo /. ./
- --$EndUndo /. ./
+$Globals
+/.
+ import java.util.*;
+ import org.eclipse.cdt.core.dom.ast.*;
+ 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
-
$Headers
/.
- private $action_class action;
+ private $build_action_class action;
- //public $action_type() { // constructor
- //}
+ 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($sym_class.orderedTerminalSymbols);
- //setParserAction(action);
+ action = new $build_action_class($node_factory_create_expression, this, tu);
+ action.setTokenMap($sym_class.orderedTerminalSymbols);
}
public void addToken(IToken token) {
- token.setKind(mapKind(token.getKind()));
+ token.setKind(mapKind(token.getKind())); // TODO does mapKind need to be called?
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!
@@ -114,22 +87,46 @@ $Headers
super.resetTokenStream(); // allow tokens to be garbage collected
// the completion node may be null
- IASTCompletionNode compNode = action.builder.getASTCompletionNode();
+ IASTCompletionNode compNode = action.getASTCompletionNode();
- action = null;
- parserAction = null;
+ //action = null;
+ //parserAction = null;
return compNode;
}
+ // uncomment this method to use with backtracking parser
+ public List getRuleTokens() {
+ return Collections.unmodifiableList(getTokens().subList(getLeftSpan(), getRightSpan() + 1));
+ }
+
+./
+$End
+
+$Globals
+/.
+ import org.eclipse.cdt.core.dom.lrparser.action.ITokenMap;
+ import org.eclipse.cdt.core.dom.lrparser.action.TokenMap;
+./
+$End
+
+$Headers
+/.
- public int getKind(int i) {
- int kind = super.getKind(i);
- // lexer feedback hack!
- //if(kind == $sym_class.TK_identifier && action.resolver.isTypedef(getTokenText(i))) {
- // kind = $sym_class.TK_TypedefName;
- //}
- return kind;
+ 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_class.TK_EOF_TOKEN));
}
+ public $action_type(String[] mapFrom) { // constructor
+ tokenMap = new TokenMap($sym_class.orderedTerminalSymbols, mapFrom);
+ }
+
./
$End
\ 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 ae717847991..c306206738f 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/grammar/cpp/CPPParser.g
+++ b/lrparser/org.eclipse.cdt.core.lrparser/grammar/cpp/CPPParser.g
@@ -1587,7 +1587,8 @@ conversion_declarator
::= ptr_operator_seq
/. $Build consumeDeclaratorWithPointer(false); $EndBuild ./
-
+
+
--conversion_declarator_opt
-- ::= conversion_declarator
-- | $empty
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 47e7dbe55c2..ad3cd0a8418 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
@@ -15,6 +15,7 @@ import java.util.List;
import lpg.lpgjavaruntime.IToken;
+import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
import org.eclipse.cdt.core.dom.ast.IASTArraySubscriptExpression;
@@ -52,9 +53,9 @@ import org.eclipse.cdt.core.dom.ast.IASTNullStatement;
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTPointerOperator;
import org.eclipse.cdt.core.dom.ast.IASTProblem;
+import org.eclipse.cdt.core.dom.ast.IASTProblemExpression;
import org.eclipse.cdt.core.dom.ast.IASTProblemHolder;
import org.eclipse.cdt.core.dom.ast.IASTReturnStatement;
-import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTStatement;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
@@ -65,13 +66,13 @@ import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator;
import org.eclipse.cdt.core.dom.ast.c.ICASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.c.ICASTPointer;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCastExpression;
-import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLiteralExpression;
-import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSimpleDeclSpecifier;
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;
+import org.eclipse.cdt.internal.core.dom.lrparser.c99.C99Parsersym;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
-import org.eclipse.cdt.internal.core.dom.parser.c.CASTNode;
+import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguousExpression;
/**
@@ -117,6 +118,11 @@ public abstract class BuildASTParserAction {
private final IASTNodeFactory nodeFactory;
+ protected static final ASTVisitor EMPTY_VISITOR = new ASTVisitor() {
+ { shouldVisitStatements = true; }
+ };
+
+
/**
* Completion tokens are represented by different kinds by different parsers.
@@ -165,6 +171,13 @@ public abstract class BuildASTParserAction {
}
+ /**
+ * Used to get the result of secondary parsers.
+ */
+ public Object getSecondaryParseResult() {
+ return astStack.pop();
+ }
+
protected static int offset(IToken token) {
@@ -297,6 +310,9 @@ public abstract class BuildASTParserAction {
IASTNode d = declarations[declarations.length-1];
setOffsetAndLength(tu, 0, offset(d) + length(d));
}
+
+ // resolve ambiguities
+ tu.accept(EMPTY_VISITOR);
if(TRACE_AST_STACK) System.out.println(astStack);
}
@@ -439,6 +455,8 @@ public abstract class BuildASTParserAction {
/**
* @param operator constant for {@link ICPPASTCastExpression}
+ *
+ * TODO Remove C99 specific code
*/
public void consumeExpressionCast(int operator) {
if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
@@ -447,7 +465,18 @@ public abstract class BuildASTParserAction {
IASTTypeId typeId = (IASTTypeId) astStack.pop();
IASTCastExpression expr = nodeFactory.newCastExpression(operator, typeId, operand);
setOffsetAndLength(expr);
- astStack.push(expr);
+
+ // try parsing as non-cast to resolve ambiguities
+ C99NoCastExpressionParser alternateParser = new C99NoCastExpressionParser(C99Parsersym.orderedTerminalSymbols);
+ alternateParser.setTokens(parser.getRuleTokens());
+ alternateParser.parse(tu);
+ IASTExpression alternateExpr = alternateParser.getParseResult();
+
+ if(alternateExpr == null || alternateExpr instanceof IASTProblemExpression)
+ astStack.push(expr);
+ else
+ astStack.push(nodeFactory.newAmbiguousExpression(expr, alternateExpr));
+
if(TRACE_AST_STACK) System.out.println(astStack);
}
@@ -598,6 +627,7 @@ public abstract class BuildASTParserAction {
}
+
/**
* compound_statement ::= '{' block_item_list '}'
*
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 276749f52f2..55325fa08ac 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
@@ -62,6 +62,8 @@ import org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression;
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
import org.eclipse.cdt.core.dom.ast.IASTWhileStatement;
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator;
+import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguousExpression;
+import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguousStatement;
/**
@@ -69,6 +71,7 @@ import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator;
*
* @author Mike Kucera
*/
+@SuppressWarnings("restriction")
public interface IASTNodeFactory {
public IASTName newName(char[] name);
@@ -172,4 +175,8 @@ public interface IASTNodeFactory {
public IASTFieldDeclarator newFieldDeclarator(IASTName name, IASTExpression bitFieldSize);
+ public IASTAmbiguousStatement newAmbiguousStatement(IASTStatement... statements);
+
+ public IASTAmbiguousExpression newAmbiguousExpression(IASTExpression... expressions);
+
}
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 1dadbed0429..d6eca72242c 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
@@ -384,12 +384,12 @@ public class C99ASTNodeFactory implements IC99ASTNodeFactory {
return new CASTProblem(id, arg, warn, error);
}
- public IASTAmbiguousExpression newAmbiguousExpression() {
- return new CASTAmbiguousExpression();
+ public IASTAmbiguousExpression newAmbiguousExpression(IASTExpression... expressions) {
+ return new CASTAmbiguousExpression(expressions);
}
- public IASTAmbiguousStatement newAmbiguousStatement() {
- return new CASTAmbiguousStatement();
+ public IASTAmbiguousStatement newAmbiguousStatement(IASTStatement... statements) {
+ return new CASTAmbiguousStatement(statements);
}
public IASTTranslationUnit newTranslationUnit() {
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 d7786b9037f..f2bed3655b4 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
@@ -42,20 +42,19 @@ import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
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.IASTElaboratedTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTExpressionStatement;
import org.eclipse.cdt.core.dom.ast.IASTFieldReference;
import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
-import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
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.IASTParameterDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTPointer;
+import org.eclipse.cdt.core.dom.ast.IASTProblemExpression;
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTStandardFunctionDeclarator;
@@ -63,6 +62,8 @@ import org.eclipse.cdt.core.dom.ast.IASTStatement;
import org.eclipse.cdt.core.dom.ast.IASTSwitchStatement;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
+import org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression;
+import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
import org.eclipse.cdt.core.dom.ast.IASTWhileStatement;
import org.eclipse.cdt.core.dom.ast.c.ICASTArrayDesignator;
import org.eclipse.cdt.core.dom.ast.c.ICASTArrayModifier;
@@ -82,8 +83,14 @@ import org.eclipse.cdt.core.dom.lrparser.action.ITokenMap;
import org.eclipse.cdt.core.dom.lrparser.action.TokenMap;
import org.eclipse.cdt.core.dom.lrparser.util.CollectionUtils;
import org.eclipse.cdt.core.dom.lrparser.util.DebugUtil;
+import org.eclipse.cdt.internal.core.dom.lrparser.c99.C99ExpressionStatementParser;
+import org.eclipse.cdt.internal.core.dom.lrparser.c99.C99NoCastExpressionParser;
import org.eclipse.cdt.internal.core.dom.lrparser.c99.C99Parsersym;
+import org.eclipse.cdt.internal.core.dom.lrparser.c99.C99SizeofExpressionParser;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
+import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguousExpression;
+import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguousStatement;
+import org.eclipse.cdt.internal.core.dom.parser.c.CASTAmbiguousExpression;
/**
* Semantic actions called by the C99 parser to build an AST.
@@ -171,6 +178,31 @@ public class C99BuildASTParserAction extends BuildASTParserAction {
if(TRACE_AST_STACK) System.out.println(astStack);
}
+ /**
+ * Lots of rules, no need to list them.
+ * @param operator From IASTUnaryExpression
+ */
+ public void consumeExpressionSizeofTypeId() {
+ if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
+
+ IASTTypeId typeId = (IASTTypeId) astStack.pop();
+ IASTTypeIdExpression expr = nodeFactory.newTypeIdExpression(IASTTypeIdExpression.op_sizeof, typeId);
+ setOffsetAndLength(expr);
+
+ // try parsing as an expression to resolve ambiguities
+ C99SizeofExpressionParser alternateParser = new C99SizeofExpressionParser(C99Parsersym.orderedTerminalSymbols);
+ alternateParser.setTokens(parser.getRuleTokens());
+ alternateParser.parse(tu);
+ IASTExpression alternateExpr = alternateParser.getParseResult();
+
+ if(alternateExpr == null || alternateExpr instanceof IASTProblemExpression)
+ astStack.push(expr);
+ else
+ astStack.push(nodeFactory.newAmbiguousExpression(expr, alternateExpr));
+
+ if(TRACE_AST_STACK) System.out.println(astStack);
+ }
+
/**
* Sets a token specifier.
@@ -648,13 +680,30 @@ public class C99BuildASTParserAction extends BuildASTParserAction {
if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
IASTDeclaration decl = (IASTDeclaration) astStack.pop();
+ IASTDeclarationStatement declarationStatement = nodeFactory.newDeclarationStatement(decl);
+ setOffsetAndLength(declarationStatement);
- if(disambiguateHackIdentifierExpression(decl))
- return;
+ // 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
+ expressionParser.parse(tu);
+ IASTExpression expr = expressionParser.getParseResult();
+
+ if(expr != null && !(expr instanceof IASTProblemExpression)) { // the parse may fail
+ expressionStatement = nodeFactory.newExpressionStatement(expr);
+ setOffsetAndLength(expressionStatement);
+ }
+ }
- IASTDeclarationStatement stat = nodeFactory.newDeclarationStatement(decl);
- setOffsetAndLength(stat);
- astStack.push(stat);
+ if(expressionStatement == null)
+ astStack.push(declarationStatement);
+ else
+ astStack.push(nodeFactory.newAmbiguousStatement(declarationStatement, expressionStatement));
+
if(TRACE_AST_STACK) System.out.println(astStack);
}
@@ -662,46 +711,46 @@ public class C99BuildASTParserAction extends BuildASTParserAction {
-
- /**
- * 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;
- }
+//
+// /**
+// * 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;
+// }
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 2117e077e99..51f15475d5f 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
@@ -96,7 +96,13 @@ 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.action.ASTCompletionNode;
+import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguousDeclaration;
+import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguousExpression;
+import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguousStatement;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTASMDeclaration;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTAmbiguousDeclaration;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTAmbiguousExpression;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTAmbiguousStatement;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTArrayDeclarator;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTArrayModifier;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTArraySubscriptExpression;
@@ -533,4 +539,16 @@ public class CPPASTNodeFactory implements ICPPASTNodeFactory {
return new CPPASTTemplatedTypeTemplateParameter(name, idExpression);
}
+ public IASTAmbiguousDeclaration newAmbiguousDeclaration(IASTDeclaration... declarations) {
+ return new CPPASTAmbiguousDeclaration(declarations);
+ }
+
+ public IASTAmbiguousExpression newAmbiguousExpression(IASTExpression... expressions) {
+ return new CPPASTAmbiguousExpression(expressions);
+ }
+
+ public IASTAmbiguousStatement newAmbiguousStatement(IASTStatement... statements) {
+ return new CPPASTAmbiguousStatement(statements);
+ }
+
}
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/cpp/ICPPASTNodeFactory.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/cpp/ICPPASTNodeFactory.java
index 3c8d8293d21..f1a1ebf0348 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/cpp/ICPPASTNodeFactory.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/cpp/ICPPASTNodeFactory.java
@@ -52,12 +52,14 @@ 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.action.IASTNodeFactory;
+import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguousDeclaration;
/**
* TODO remove CPP from method names.
*
* @author Mike Kucera
*/
+@SuppressWarnings("restriction")
public interface ICPPASTNodeFactory extends IASTNodeFactory {
public ICPPASTOperatorName newCPPOperatorName(char[] name);
@@ -131,4 +133,6 @@ public interface ICPPASTNodeFactory extends IASTNodeFactory {
public ICPPASTSimpleTypeTemplateParameter newSimpleTypeTemplateParameter(int type, IASTName name, IASTTypeId typeId);
public ICPPASTTemplatedTypeTemplateParameter newTemplatedTypeTemplateParameter(IASTName name, IASTExpression idExpression);
+
+ public IASTAmbiguousDeclaration newAmbiguousDeclaration(IASTDeclaration... declarations);
}
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
new file mode 100644
index 00000000000..62caf961668
--- /dev/null
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99ExpressionStatementParser.java
@@ -0,0 +1,1250 @@
+/*******************************************************************************
+* 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.c99;
+
+import lpg.lpgjavaruntime.*;
+
+import java.util.*;
+import org.eclipse.cdt.core.dom.ast.*;
+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;
+
+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
+{
+ private static ParseTable prs = new C99ExpressionStatementParserprs();
+ 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 C99ExpressionStatementParser(LexStream lexStream)
+ {
+ super(lexStream);
+
+ try
+ {
+ super.remapTerminalSymbols(orderedTerminalSymbols(), C99ExpressionStatementParserprs.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(" " + C99ExpressionStatementParsersym.orderedTerminalSymbols[id.intValue()]);
+ }
+ System.out.println();
+ }
+ catch(UndefinedEofSymbolException e)
+ {
+ throw new Error(new UndefinedEofSymbolException
+ ("The Lexer does not implement the Eof symbol " +
+ C99ExpressionStatementParsersym.orderedTerminalSymbols[C99ExpressionStatementParserprs.EOFT_SYMBOL]));
+ }
+ }
+
+ public String[] orderedTerminalSymbols() { return C99ExpressionStatementParsersym.orderedTerminalSymbols; }
+ public String getTokenKindName(int kind) { return C99ExpressionStatementParsersym.orderedTerminalSymbols[kind]; }
+ public int getEOFTokenKind() { return C99ExpressionStatementParserprs.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 C99ExpressionStatementParserprs.java with -BACKTRACK option"));
+ }
+ catch (BadParseSymFileException e)
+ {
+ throw new Error(new BadParseSymFileException("Bad Parser Symbol File -- C99ExpressionStatementParsersym.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 C99BuildASTParserAction action;
+
+public C99ExpressionStatementParser() { // constructor
+}
+
+private void initActions(IASTTranslationUnit tu) {
+ action = new C99BuildASTParserAction ( C99ASTNodeFactory.DEFAULT_INSTANCE , this, tu);
+ action.setTokenMap( C99ExpressionStatementParsersym .orderedTerminalSymbols);
+}
+
+
+public void addToken(IToken token) {
+ token.setKind(mapKind(token.getKind())); // TODO does mapKind need to be called?
+ 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.getASTCompletionNode();
+
+ //action = null;
+ //parserAction = null;
+ return compNode;
+}
+
+// uncomment this method to use with backtracking parser
+public List getRuleTokens() {
+ return Collections.unmodifiableList(getTokens().subList(getLeftSpan(), getRightSpan() + 1));
+}
+
+
+
+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, C99ExpressionStatementParsersym .TK_EOF_TOKEN));
+}
+
+public C99ExpressionStatementParser(String[] mapFrom) { // constructor
+ tokenMap = new TokenMap( C99ExpressionStatementParsersym .orderedTerminalSymbols, mapFrom);
+}
+
+
+public IASTExpression getParseResult() {
+ return (IASTExpression) action.getSecondaryParseResult();
+}
+
+ public void ruleAction(int ruleNumber)
+ {
+ switch (ruleNumber)
+ {
+
+ //
+ // Rule 1: ::= $Empty
+ //
+ case 1: { action. openASTScope(); break;
+ }
+
+ //
+ // Rule 10: literal ::= integer
+ //
+ case 10: { action. consumeExpressionLiteral(IASTLiteralExpression.lk_integer_constant); break;
+ }
+
+ //
+ // Rule 11: literal ::= floating
+ //
+ case 11: { action. consumeExpressionLiteral(IASTLiteralExpression.lk_float_constant); break;
+ }
+
+ //
+ // Rule 12: literal ::= charconst
+ //
+ case 12: { action. consumeExpressionLiteral(IASTLiteralExpression.lk_char_constant); break;
+ }
+
+ //
+ // Rule 13: literal ::= stringlit
+ //
+ case 13: { action. consumeExpressionLiteral(IASTLiteralExpression.lk_string_literal); break;
+ }
+
+ //
+ // Rule 15: primary_expression ::= primary_expression_id
+ //
+ case 15: { action. consumeExpressionID(); break;
+ }
+
+ //
+ // Rule 16: primary_expression ::= ( expression )
+ //
+ case 16: { action. consumeExpressionBracketed(); break;
+ }
+
+ //
+ // Rule 20: postfix_expression ::= postfix_expression [ expression ]
+ //
+ case 20: { action. consumeExpressionArraySubscript(); break;
+ }
+
+ //
+ // Rule 21: postfix_expression ::= postfix_expression ( expression_list_opt )
+ //
+ case 21: { action. consumeExpressionFunctionCall(); break;
+ }
+
+ //
+ // Rule 22: postfix_expression ::= postfix_expression . member_name
+ //
+ case 22: { action. consumeExpressionFieldReference(false); break;
+ }
+
+ //
+ // Rule 23: postfix_expression ::= postfix_expression -> member_name
+ //
+ case 23: { action. consumeExpressionFieldReference(true); break;
+ }
+
+ //
+ // Rule 24: postfix_expression ::= postfix_expression ++
+ //
+ case 24: { action. consumeExpressionUnaryOperator(IASTUnaryExpression.op_postFixIncr); break;
+ }
+
+ //
+ // Rule 25: postfix_expression ::= postfix_expression --
+ //
+ case 25: { action. consumeExpressionUnaryOperator(IASTUnaryExpression.op_postFixDecr); break;
+ }
+
+ //
+ // Rule 26: postfix_expression ::= ( type_name ) { initializer_list comma_opt }
+ //
+ case 26: { action. consumeExpressionTypeIdInitializer(); break;
+ }
+
+ //
+ // Rule 32: unary_expression ::= ++ unary_expression
+ //
+ case 32: { action. consumeExpressionUnaryOperator(IASTUnaryExpression.op_prefixIncr); break;
+ }
+
+ //
+ // Rule 33: unary_expression ::= -- unary_expression
+ //
+ case 33: { action. consumeExpressionUnaryOperator(IASTUnaryExpression.op_prefixDecr); break;
+ }
+
+ //
+ // Rule 34: unary_expression ::= & cast_expression
+ //
+ case 34: { action. consumeExpressionUnaryOperator(IASTUnaryExpression.op_amper); break;
+ }
+
+ //
+ // Rule 35: unary_expression ::= * cast_expression
+ //
+ case 35: { action. consumeExpressionUnaryOperator(IASTUnaryExpression.op_star); break;
+ }
+
+ //
+ // Rule 36: unary_expression ::= + cast_expression
+ //
+ case 36: { action. consumeExpressionUnaryOperator(IASTUnaryExpression.op_plus); break;
+ }
+
+ //
+ // Rule 37: unary_expression ::= - cast_expression
+ //
+ case 37: { action. consumeExpressionUnaryOperator(IASTUnaryExpression.op_minus); break;
+ }
+
+ //
+ // Rule 38: unary_expression ::= ~ cast_expression
+ //
+ case 38: { action. consumeExpressionUnaryOperator(IASTUnaryExpression.op_tilde); break;
+ }
+
+ //
+ // Rule 39: unary_expression ::= ! cast_expression
+ //
+ case 39: { action. consumeExpressionUnaryOperator(IASTUnaryExpression.op_not); break;
+ }
+
+ //
+ // Rule 40: unary_expression ::= sizeof unary_expression
+ //
+ case 40: { action. consumeExpressionUnaryOperator(IASTUnaryExpression.op_sizeof); break;
+ }
+
+ //
+ // Rule 41: unary_expression ::= sizeof ( type_name )
+ //
+ case 41: { action. consumeExpressionSizeofTypeId(); break;
+ }
+
+ //
+ // Rule 43: cast_expression ::= ( type_name ) cast_expression
+ //
+ case 43: { action. consumeExpressionCast(IASTCastExpression.op_cast); break;
+ }
+
+ //
+ // Rule 45: multiplicative_expression ::= multiplicative_expression * cast_expression
+ //
+ case 45: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_multiply); break;
+ }
+
+ //
+ // Rule 46: multiplicative_expression ::= multiplicative_expression / cast_expression
+ //
+ case 46: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_divide); break;
+ }
+
+ //
+ // Rule 47: multiplicative_expression ::= multiplicative_expression % cast_expression
+ //
+ case 47: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_modulo); break;
+ }
+
+ //
+ // Rule 49: additive_expression ::= additive_expression + multiplicative_expression
+ //
+ case 49: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_plus); break;
+ }
+
+ //
+ // Rule 50: additive_expression ::= additive_expression - multiplicative_expression
+ //
+ case 50: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_minus); break;
+ }
+
+ //
+ // Rule 52: shift_expression ::= shift_expression << additive_expression
+ //
+ case 52: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_shiftLeft); break;
+ }
+
+ //
+ // Rule 53: shift_expression ::= shift_expression >> additive_expression
+ //
+ case 53: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_shiftRight); break;
+ }
+
+ //
+ // Rule 55: relational_expression ::= relational_expression < shift_expression
+ //
+ case 55: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_lessThan); break;
+ }
+
+ //
+ // Rule 56: relational_expression ::= relational_expression > shift_expression
+ //
+ case 56: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_greaterThan); break;
+ }
+
+ //
+ // Rule 57: relational_expression ::= relational_expression <= shift_expression
+ //
+ case 57: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_lessEqual); break;
+ }
+
+ //
+ // Rule 58: relational_expression ::= relational_expression >= shift_expression
+ //
+ case 58: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_greaterEqual); break;
+ }
+
+ //
+ // Rule 60: equality_expression ::= equality_expression == relational_expression
+ //
+ case 60: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_equals); break;
+ }
+
+ //
+ // Rule 61: equality_expression ::= equality_expression != relational_expression
+ //
+ case 61: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_notequals); break;
+ }
+
+ //
+ // Rule 63: AND_expression ::= AND_expression & equality_expression
+ //
+ case 63: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_binaryAnd); break;
+ }
+
+ //
+ // Rule 65: exclusive_OR_expression ::= exclusive_OR_expression ^ AND_expression
+ //
+ case 65: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_binaryXor); break;
+ }
+
+ //
+ // Rule 67: inclusive_OR_expression ::= inclusive_OR_expression | exclusive_OR_expression
+ //
+ case 67: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_binaryOr); break;
+ }
+
+ //
+ // Rule 69: logical_AND_expression ::= logical_AND_expression && inclusive_OR_expression
+ //
+ case 69: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_logicalAnd); break;
+ }
+
+ //
+ // Rule 71: logical_OR_expression ::= logical_OR_expression || logical_AND_expression
+ //
+ case 71: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_logicalOr); break;
+ }
+
+ //
+ // Rule 73: conditional_expression ::= logical_OR_expression ? expression : conditional_expression
+ //
+ case 73: { action. consumeExpressionConditional(); break;
+ }
+
+ //
+ // Rule 75: assignment_expression ::= unary_expression = assignment_expression
+ //
+ case 75: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_assign); break;
+ }
+
+ //
+ // Rule 76: assignment_expression ::= unary_expression *= assignment_expression
+ //
+ case 76: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_multiplyAssign); break;
+ }
+
+ //
+ // Rule 77: assignment_expression ::= unary_expression /= assignment_expression
+ //
+ case 77: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_divideAssign); break;
+ }
+
+ //
+ // Rule 78: assignment_expression ::= unary_expression %= assignment_expression
+ //
+ case 78: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_moduloAssign); break;
+ }
+
+ //
+ // Rule 79: assignment_expression ::= unary_expression += assignment_expression
+ //
+ case 79: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_plusAssign); break;
+ }
+
+ //
+ // Rule 80: assignment_expression ::= unary_expression -= assignment_expression
+ //
+ case 80: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_minusAssign); break;
+ }
+
+ //
+ // Rule 81: assignment_expression ::= unary_expression <<= assignment_expression
+ //
+ case 81: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_shiftLeftAssign); break;
+ }
+
+ //
+ // Rule 82: assignment_expression ::= unary_expression >>= assignment_expression
+ //
+ case 82: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_shiftRightAssign); break;
+ }
+
+ //
+ // Rule 83: assignment_expression ::= unary_expression &= assignment_expression
+ //
+ case 83: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_binaryAndAssign); break;
+ }
+
+ //
+ // Rule 84: assignment_expression ::= unary_expression ^= assignment_expression
+ //
+ case 84: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_binaryXorAssign); break;
+ }
+
+ //
+ // Rule 85: assignment_expression ::= unary_expression |= assignment_expression
+ //
+ case 85: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_binaryOrAssign); break;
+ }
+
+ //
+ // Rule 88: expression_list ::= expression_list_actual
+ //
+ case 88: { action. consumeExpressionList(); break;
+ }
+
+ //
+ // Rule 90: expression_list_opt ::= $Empty
+ //
+ case 90: { action. consumeEmpty(); break;
+ }
+
+ //
+ // Rule 100: statement ::= ERROR_TOKEN
+ //
+ case 100: { action. consumeStatementProblem(); break;
+ }
+
+ //
+ // Rule 101: labeled_statement ::= identifier_or_typedefname : statement
+ //
+ case 101: { action. consumeStatementLabeled(); break;
+ }
+
+ //
+ // Rule 102: labeled_statement ::= case constant_expression :
+ //
+ case 102: { action. consumeStatementCase(); break;
+ }
+
+ //
+ // Rule 103: labeled_statement ::= default :
+ //
+ case 103: { action. consumeStatementDefault(); break;
+ }
+
+ //
+ // Rule 104: compound_statement ::= { }
+ //
+ case 104: { action. consumeStatementCompoundStatement(false); break;
+ }
+
+ //
+ // Rule 105: compound_statement ::= { block_item_list }
+ //
+ case 105: { action. consumeStatementCompoundStatement(true); break;
+ }
+
+ //
+ // Rule 109: block_item ::= declaration
+ //
+ case 109: { action. consumeStatementDeclaration(); break;
+ }
+
+ //
+ // Rule 110: expression_statement ::= ;
+ //
+ case 110: { action. consumeStatementNull(); break;
+ }
+
+ //
+ // Rule 111: expression_statement ::= expression_in_statement ;
+ //
+ case 111: { action. consumeStatementExpression(); break;
+ }
+
+ //
+ // Rule 112: selection_statement ::= if ( expression ) statement
+ //
+ case 112: { action. consumeStatementIf(false); break;
+ }
+
+ //
+ // Rule 113: selection_statement ::= if ( expression ) statement else statement
+ //
+ case 113: { action. consumeStatementIf(true); break;
+ }
+
+ //
+ // Rule 114: selection_statement ::= switch ( expression ) statement
+ //
+ case 114: { action. consumeStatementSwitch(); break;
+ }
+
+ //
+ // Rule 116: expression_opt ::= $Empty
+ //
+ case 116: { action. consumeEmpty(); break;
+ }
+
+ //
+ // Rule 117: iteration_statement ::= do statement while ( expression ) ;
+ //
+ case 117: { action. consumeStatementDoLoop(); break;
+ }
+
+ //
+ // Rule 118: iteration_statement ::= while ( expression ) statement
+ //
+ case 118: { action. consumeStatementWhileLoop(); break;
+ }
+
+ //
+ // Rule 119: iteration_statement ::= for ( expression_opt ; expression_opt ; expression_opt ) statement
+ //
+ case 119: { action. consumeStatementForLoop(); break;
+ }
+
+ //
+ // Rule 120: iteration_statement ::= for ( declaration expression_opt ; expression_opt ) statement
+ //
+ case 120: { action. consumeStatementForLoop(); break;
+ }
+
+ //
+ // Rule 121: jump_statement ::= goto identifier_or_typedefname ;
+ //
+ case 121: { action. consumeStatementGoto(); break;
+ }
+
+ //
+ // Rule 122: jump_statement ::= continue ;
+ //
+ case 122: { action. consumeStatementContinue(); break;
+ }
+
+ //
+ // Rule 123: jump_statement ::= break ;
+ //
+ case 123: { action. consumeStatementBreak(); break;
+ }
+
+ //
+ // Rule 124: jump_statement ::= return ;
+ //
+ case 124: { action. consumeStatementReturn(false); break;
+ }
+
+ //
+ // Rule 125: jump_statement ::= return expression ;
+ //
+ case 125: { action. consumeStatementReturn(true); break;
+ }
+
+ //
+ // Rule 126: declaration ::= declaration_specifiers ;
+ //
+ case 126: { action. consumeDeclarationSimple(false); break;
+ }
+
+ //
+ // Rule 127: declaration ::= declaration_specifiers init_declarator_list ;
+ //
+ case 127: { action. consumeDeclarationSimple(true); break;
+ }
+
+ //
+ // Rule 128: declaration_specifiers ::= simple_declaration_specifiers
+ //
+ case 128: { action. consumeDeclarationSpecifiersSimple(); break;
+ }
+
+ //
+ // Rule 129: declaration_specifiers ::= struct_or_union_declaration_specifiers
+ //
+ case 129: { action. consumeDeclarationSpecifiersStructUnionEnum(); break;
+ }
+
+ //
+ // Rule 130: declaration_specifiers ::= elaborated_declaration_specifiers
+ //
+ case 130: { action. consumeDeclarationSpecifiersStructUnionEnum(); break;
+ }
+
+ //
+ // Rule 131: declaration_specifiers ::= enum_declaration_specifiers
+ //
+ case 131: { action. consumeDeclarationSpecifiersStructUnionEnum(); break;
+ }
+
+ //
+ // Rule 132: declaration_specifiers ::= typdef_name_declaration_specifiers
+ //
+ case 132: { action. consumeDeclarationSpecifiersTypedefName(); break;
+ }
+
+ //
+ // Rule 157: init_declarator ::= complete_declarator = initializer
+ //
+ case 157: { action. consumeDeclaratorWithInitializer(true); break;
+ }
+
+ //
+ // Rule 159: storage_class_specifier ::= storage_class_specifier_token
+ //
+ case 159: { action. consumeDeclSpecToken(); break;
+ }
+
+ //
+ // Rule 165: simple_type_specifier ::= simple_type_specifier_token
+ //
+ case 165: { action. consumeDeclSpecToken(); break;
+ }
+
+ //
+ // Rule 178: typedef_name_in_declspec ::= Completion
+ //
+ case 178: { action. consumeDeclSpecToken(); break;
+ }
+
+ //
+ // Rule 179: typedef_name_in_declspec ::= identifier
+ //
+ case 179: { action. consumeDeclSpecToken(); break;
+ }
+
+ //
+ // Rule 182: struct_or_union_specifier ::= struct { struct_declaration_list_opt }
+ //
+ case 182: { action. consumeTypeSpecifierComposite(false, IASTCompositeTypeSpecifier.k_struct); break;
+ }
+
+ //
+ // Rule 183: struct_or_union_specifier ::= union { struct_declaration_list_opt }
+ //
+ case 183: { action. consumeTypeSpecifierComposite(false, IASTCompositeTypeSpecifier.k_union); break;
+ }
+
+ //
+ // Rule 184: struct_or_union_specifier ::= struct identifier_or_typedefname { struct_declaration_list_opt }
+ //
+ case 184: { action. consumeTypeSpecifierComposite(true, IASTCompositeTypeSpecifier.k_struct); break;
+ }
+
+ //
+ // Rule 185: struct_or_union_specifier ::= union identifier_or_typedefname { struct_declaration_list_opt }
+ //
+ case 185: { action. consumeTypeSpecifierComposite(true, IASTCompositeTypeSpecifier.k_union); break;
+ }
+
+ //
+ // Rule 186: elaborated_specifier ::= struct identifier_or_typedefname
+ //
+ case 186: { action. consumeTypeSpecifierElaborated(IASTCompositeTypeSpecifier.k_struct); break;
+ }
+
+ //
+ // Rule 187: elaborated_specifier ::= union identifier_or_typedefname
+ //
+ case 187: { action. consumeTypeSpecifierElaborated(IASTCompositeTypeSpecifier.k_union); break;
+ }
+
+ //
+ // Rule 188: elaborated_specifier ::= enum identifier_or_typedefname
+ //
+ case 188: { action. consumeTypeSpecifierElaborated(IASTElaboratedTypeSpecifier.k_enum); break;
+ }
+
+ //
+ // Rule 193: struct_declaration ::= specifier_qualifier_list struct_declarator_list ;
+ //
+ case 193: { action. consumeStructDeclaration(true); break;
+ }
+
+ //
+ // Rule 194: struct_declaration ::= specifier_qualifier_list ;
+ //
+ case 194: { action. consumeStructDeclaration(false); break;
+ }
+
+ //
+ // Rule 200: struct_declarator ::= : constant_expression
+ //
+ case 200: { action. consumeBitField(false); break;
+ }
+
+ //
+ // Rule 201: struct_declarator ::= declarator : constant_expression
+ //
+ case 201: { action. consumeBitField(true); break;
+ }
+
+ //
+ // Rule 202: enum_specifier ::= enum { enumerator_list_opt comma_opt }
+ //
+ case 202: { action. consumeTypeSpecifierEnumeration(false); break;
+ }
+
+ //
+ // Rule 203: enum_specifier ::= enum identifier_or_typedefname { enumerator_list_opt comma_opt }
+ //
+ case 203: { action. consumeTypeSpecifierEnumeration(true); break;
+ }
+
+ //
+ // Rule 208: enumerator ::= identifier_or_typedefname
+ //
+ case 208: { action. consumeEnumerator(false); break;
+ }
+
+ //
+ // Rule 209: enumerator ::= identifier_or_typedefname = constant_expression
+ //
+ case 209: { action. consumeEnumerator(true); break;
+ }
+
+ //
+ // Rule 210: type_qualifier ::= type_qualifier_token
+ //
+ case 210: { action. consumeDeclSpecToken(); break;
+ }
+
+ //
+ // Rule 214: function_specifier ::= inline
+ //
+ case 214: { action. consumeDeclSpecToken(); break;
+ }
+
+ //
+ // Rule 216: declarator ::= pointer_seq direct_declarator
+ //
+ case 216: { action. consumeDeclaratorWithPointer(true); break;
+ }
+
+ //
+ // Rule 221: basic_direct_declarator ::= declarator_id_name
+ //
+ case 221: { action. consumeDirectDeclaratorIdentifier(); break;
+ }
+
+ //
+ // Rule 222: basic_direct_declarator ::= ( declarator )
+ //
+ case 222: { action. consumeDirectDeclaratorBracketed(); break;
+ }
+
+ //
+ // Rule 223: declarator_id_name ::= identifier
+ //
+ case 223: { action. consumeIdentifierName(); break;
+ }
+
+ //
+ // Rule 224: array_direct_declarator ::= basic_direct_declarator array_modifier
+ //
+ case 224: { action. consumeDirectDeclaratorArrayDeclarator(true); break;
+ }
+
+ //
+ // Rule 225: array_direct_declarator ::= array_direct_declarator array_modifier
+ //
+ case 225: { action. consumeDirectDeclaratorArrayDeclarator(true); break;
+ }
+
+ //
+ // Rule 227: function_direct_declarator ::= basic_direct_declarator ( parameter_type_list )
+ //
+ case 227: { action. consumeDirectDeclaratorFunctionDeclarator(true, true); break;
+ }
+
+ //
+ // Rule 228: function_direct_declarator ::= basic_direct_declarator ( )
+ //
+ case 228: { action. consumeDirectDeclaratorFunctionDeclarator(true, false); break;
+ }
+
+ //
+ // Rule 230: function_declarator ::= pointer_seq function_direct_declarator
+ //
+ case 230: { action. consumeDeclaratorWithPointer(true); break;
+ }
+
+ //
+ // Rule 231: knr_direct_declarator ::= basic_direct_declarator ( identifier_list )
+ //
+ case 231: { action. consumeDirectDeclaratorFunctionDeclaratorKnR(); break;
+ }
+
+ //
+ // Rule 233: knr_function_declarator ::= pointer_seq knr_direct_declarator
+ //
+ case 233: { action. consumeDeclaratorWithPointer(true); break;
+ }
+
+ //
+ // Rule 234: identifier_list ::= identifier
+ //
+ case 234: { action. consumeIdentifierKnR(); break;
+ }
+
+ //
+ // Rule 235: identifier_list ::= identifier_list , identifier
+ //
+ case 235: { action. consumeIdentifierKnR(); break;
+ }
+
+ //
+ // Rule 236: array_modifier ::= [ ]
+ //
+ case 236: { action. consumeDirectDeclaratorArrayModifier(false); break;
+ }
+
+ //
+ // Rule 237: array_modifier ::= [ array_modifier_type_qualifiers ]
+ //
+ case 237: { action. consumeDirectDeclaratorModifiedArrayModifier(false, false, true, false); break;
+ }
+
+ //
+ // Rule 238: array_modifier ::= [ assignment_expression ]
+ //
+ case 238: { action. consumeDirectDeclaratorArrayModifier(true); break;
+ }
+
+ //
+ // Rule 239: array_modifier ::= [ array_modifier_type_qualifiers assignment_expression ]
+ //
+ case 239: { action. consumeDirectDeclaratorModifiedArrayModifier(false, false, true, true); break;
+ }
+
+ //
+ // Rule 240: array_modifier ::= [ static assignment_expression ]
+ //
+ case 240: { action. consumeDirectDeclaratorModifiedArrayModifier(true, false, false, true); break;
+ }
+
+ //
+ // Rule 241: array_modifier ::= [ static array_modifier_type_qualifiers assignment_expression ]
+ //
+ case 241: { action. consumeDirectDeclaratorModifiedArrayModifier(true, false, true, true); break;
+ }
+
+ //
+ // Rule 242: array_modifier ::= [ array_modifier_type_qualifiers static assignment_expression ]
+ //
+ case 242: { action. consumeDirectDeclaratorModifiedArrayModifier(true, false, true, true); break;
+ }
+
+ //
+ // Rule 243: array_modifier ::= [ * ]
+ //
+ case 243: { action. consumeDirectDeclaratorModifiedArrayModifier(false, true, false, false); break;
+ }
+
+ //
+ // Rule 244: array_modifier ::= [ array_modifier_type_qualifiers * ]
+ //
+ case 244: { action. consumeDirectDeclaratorModifiedArrayModifier(false, true, true, false); break;
+ }
+
+ //
+ // Rule 246: pointer_seq ::= *
+ //
+ case 246: { action. consumePointer(); break;
+ }
+
+ //
+ // Rule 247: pointer_seq ::= pointer_seq *
+ //
+ case 247: { action. consumePointer(); break;
+ }
+
+ //
+ // Rule 248: pointer_seq ::= * type_qualifier_list
+ //
+ case 248: { action. consumePointerTypeQualifierList(); break;
+ }
+
+ //
+ // Rule 249: pointer_seq ::= pointer_seq * type_qualifier_list
+ //
+ case 249: { action. consumePointerTypeQualifierList(); break;
+ }
+
+ //
+ // Rule 252: parameter_type_list ::= parameter_list
+ //
+ case 252: { action. consumeEmpty(); break;
+ }
+
+ //
+ // Rule 253: parameter_type_list ::= parameter_list , ...
+ //
+ case 253: { action. consumePlaceHolder(); break;
+ }
+
+ //
+ // Rule 254: parameter_type_list ::= ...
+ //
+ case 254: { action. consumePlaceHolder(); break;
+ }
+
+ //
+ // Rule 257: parameter_declaration ::= declaration_specifiers complete_parameter_declarator
+ //
+ case 257: { action. consumeParameterDeclaration(); break;
+ }
+
+ //
+ // Rule 258: parameter_declaration ::= declaration_specifiers
+ //
+ case 258: { action. consumeParameterDeclarationWithoutDeclarator(); break;
+ }
+
+ //
+ // Rule 261: type_name ::= specifier_qualifier_list
+ //
+ case 261: { action. consumeTypeId(false); break;
+ }
+
+ //
+ // Rule 262: type_name ::= specifier_qualifier_list abstract_declarator
+ //
+ case 262: { action. consumeTypeId(true); break;
+ }
+
+ //
+ // Rule 264: abstract_declarator ::= pointer_seq
+ //
+ case 264: { action. consumeDeclaratorWithPointer(false); break;
+ }
+
+ //
+ // Rule 265: abstract_declarator ::= pointer_seq direct_abstract_declarator
+ //
+ case 265: { action. consumeDeclaratorWithPointer(false); break;
+ }
+
+ //
+ // Rule 269: basic_direct_abstract_declarator ::= ( abstract_declarator )
+ //
+ case 269: { action. consumeDirectDeclaratorBracketed(); break;
+ }
+
+ //
+ // Rule 270: array_direct_abstract_declarator ::= array_modifier
+ //
+ case 270: { action. consumeDirectDeclaratorArrayDeclarator(false); break;
+ }
+
+ //
+ // Rule 271: array_direct_abstract_declarator ::= array_direct_abstract_declarator array_modifier
+ //
+ case 271: { action. consumeDirectDeclaratorArrayDeclarator(true); break;
+ }
+
+ //
+ // Rule 272: array_direct_abstract_declarator ::= basic_direct_abstract_declarator array_modifier
+ //
+ case 272: { action. consumeDirectDeclaratorArrayDeclarator(true); break;
+ }
+
+ //
+ // Rule 273: function_direct_abstract_declarator ::= ( )
+ //
+ case 273: { action. consumeDirectDeclaratorFunctionDeclarator(false, false); break;
+ }
+
+ //
+ // Rule 274: function_direct_abstract_declarator ::= basic_direct_abstract_declarator ( )
+ //
+ case 274: { action. consumeDirectDeclaratorFunctionDeclarator(true, false); break;
+ }
+
+ //
+ // Rule 275: function_direct_abstract_declarator ::= ( parameter_type_list )
+ //
+ case 275: { action. consumeDirectDeclaratorFunctionDeclarator(false, true); break;
+ }
+
+ //
+ // Rule 276: function_direct_abstract_declarator ::= basic_direct_abstract_declarator ( parameter_type_list )
+ //
+ case 276: { action. consumeDirectDeclaratorFunctionDeclarator(true, true); break;
+ }
+
+ //
+ // Rule 277: initializer ::= assignment_expression
+ //
+ case 277: { action. consumeInitializer(); break;
+ }
+
+ //
+ // Rule 278: initializer ::= { initializer_list comma_opt }
+ //
+ case 278: { action. consumeInitializerList(); break;
+ }
+
+ //
+ // Rule 283: designated_initializer ::= designation = initializer
+ //
+ case 283: { action. consumeInitializerDesignated(); break;
+ }
+
+ //
+ // Rule 287: designator_base ::= [ constant_expression ]
+ //
+ case 287: { action. consumeDesignatorArray(); break;
+ }
+
+ //
+ // Rule 288: designator_base ::= . identifier_or_typedefname
+ //
+ case 288: { action. consumeDesignatorField(); break;
+ }
+
+ //
+ // Rule 289: designator ::= [ constant_expression ]
+ //
+ case 289: { action. consumeDesignatorArray(); break;
+ }
+
+ //
+ // Rule 290: designator ::= . identifier_or_typedefname
+ //
+ case 290: { action. consumeDesignatorField(); break;
+ }
+
+ //
+ // Rule 291: translation_unit ::= external_declaration_list
+ //
+ case 291: { action. consumeTranslationUnit(); break;
+ }
+
+ //
+ // Rule 292: translation_unit ::= $Empty
+ //
+ case 292: { action. consumeTranslationUnit(); break;
+ }
+
+ //
+ // Rule 297: external_declaration ::= ;
+ //
+ case 297: { action. consumeDeclarationEmpty(); break;
+ }
+
+ //
+ // Rule 298: external_declaration ::= ERROR_TOKEN
+ //
+ case 298: { action. consumeDeclarationProblem(); break;
+ }
+
+ //
+ // Rule 301: function_definition ::= declaration_specifiers function_declarator function_body
+ //
+ case 301: { action. consumeFunctionDefinition(true); break;
+ }
+
+ //
+ // Rule 302: function_definition ::= function_declarator function_body
+ //
+ case 302: { action. consumeFunctionDefinition(false); break;
+ }
+
+ //
+ // Rule 303: function_definition ::= declaration_specifiers knr_function_declarator declaration_list compound_statement
+ //
+ case 303: { action. consumeFunctionDefinitionKnR(); break;
+ }
+
+ //
+ // Rule 304: function_body ::= { }
+ //
+ case 304: { action. consumeStatementCompoundStatement(false); break;
+ }
+
+ //
+ // Rule 305: function_body ::= { block_item_list }
+ //
+ case 305: { action. consumeStatementCompoundStatement(true); break;
+ }
+
+ //
+ // Rule 307: expression_parser_start ::= ERROR_TOKEN
+ //
+ case 307: { action. consumeExpressionProblem(); break;
+ }
+
+
+ default:
+ break;
+ }
+ return;
+ }
+}
+
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99ExpressionStatementParserprs.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99ExpressionStatementParserprs.java
new file mode 100644
index 00000000000..9daa5d2a4ad
--- /dev/null
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99ExpressionStatementParserprs.java
@@ -0,0 +1,1092 @@
+/*******************************************************************************
+* 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.c99;
+
+public class C99ExpressionStatementParserprs implements lpg.lpgjavaruntime.ParseTable, C99ExpressionStatementParsersym {
+
+ 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
+ };
+ };
+ 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,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,3,1,1,1,4,
+ 4,3,3,2,2,8,1,0,1,1,
+ 1,2,2,2,2,2,2,2,2,2,
+ 4,1,4,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,3,3,3,3,3,3,
+ 3,3,3,3,3,1,1,2,1,0,
+ 1,3,1,1,1,1,1,1,1,1,
+ 3,3,2,2,4,1,2,1,1,1,
+ 2,5,7,5,1,0,7,5,9,8,
+ 3,2,2,2,3,2,4,2,2,2,
+ 2,2,1,1,1,1,2,1,2,2,
+ 2,1,2,2,1,2,2,1,2,2,
+ 1,2,2,1,3,1,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,5,5,6,6,2,2,2,1,0,
+ 1,2,4,2,1,1,3,1,1,2,
+ 3,6,7,1,0,1,3,1,3,1,
+ 1,1,1,1,1,3,1,1,1,1,
+ 1,3,1,2,2,1,5,3,1,3,
+ 5,1,3,1,3,2,4,3,5,4,
+ 6,6,3,5,1,1,2,3,4,1,
+ 2,1,3,1,1,3,2,1,1,1,
+ 1,2,1,2,3,1,1,1,3,1,
+ 2,2,2,3,4,5,1,5,1,1,
+ 3,3,4,1,1,2,3,2,3,2,
+ 1,0,1,2,1,1,1,1,1,2,
+ 4,3,6,2,4,2,1,-38,0,0,
+ 0,0,0,0,0,-3,0,0,0,0,
+ 0,0,0,0,0,0,0,-2,0,0,
+ -5,-15,-31,-82,-17,0,0,0,0,-125,
+ 0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,
+ 0,0,-39,0,0,0,0,0,0,0,
+ 0,0,0,0,-18,-19,0,-20,0,0,
+ 0,0,0,0,0,-7,0,0,0,0,
+ 0,0,0,-54,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,-32,0,
+ -174,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,
+ -169,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,
+ -181,-21,-22,-23,-187,-4,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,-35,0,0,-144,
+ 0,0,-24,0,0,0,0,0,0,0,
+ 0,-25,0,0,0,0,0,-77,0,-75,
+ 0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,-143,
+ -26,0,0,0,-173,-27,0,-111,0,0,
+ 0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,-130,0,0,
+ 0,0,0,0,0,-195,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,
+ 0,0,-189,0,0,0,0,0,0,0,
+ -36,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,-88,-89,-90,0,0,-58,0,0,
+ 0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,-59,0,0,
+ 0,0,0,0,0,-69,0,0,0,0,
+ 0,0,0,0,0,0,0,-60,0,0,
+ 0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,-61,0,0,
+ 0,0,0,0,0,-70,0,0,0,0,
+ 0,0,0,0,0,0,0,-62,0,0,
+ 0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,-63,0,0,
+ 0,0,0,0,0,-71,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,-65,0,0,
+ 0,0,0,0,0,-115,0,0,0,0,
+ 0,0,0,0,0,0,0,-66,0,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,-91,0,0,0,0,
+ 0,0,0,0,0,0,0,-68,0,0,
+ 0,0,0,0,0,-134,0,0,0,0,
+ 0,0,0,0,0,0,0,-40,0,0,
+ 0,0,0,0,0,-74,0,0,-92,-93,
+ -94,-83,-95,0,0,0,0,-148,0,0,
+ 0,0,0,0,0,-85,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,
+ -8,0,0,0,0,0,0,-72,0,0,
+ 0,0,0,-96,0,-97,-98,0,0,0,
+ 0,0,0,-149,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,-172,0,0,0,0,0,0,
+ 0,-99,0,0,0,0,0,0,0,0,
+ 0,0,-186,0,0,0,0,0,0,0,
+ -100,0,0,0,0,0,0,0,0,0,
+ 0,-192,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,
+ -196,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,-124,0,
+ 0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,-101,-133,-6,
+ 0,0,0,0,0,0,0,-57,0,0,
+ 0,0,0,0,0,-102,0,0,0,0,
+ 0,0,0,0,-114,0,0,0,0,0,
+ 0,-152,0,0,0,0,0,0,0,0,
+ 0,0,0,0,-117,0,-108,-78,0,-110,
+ -171,0,0,-33,0,-112,0,0,0,-80,
+ -103,0,-131,-104,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,
+ 0,0,-105,0,0,0,0,0,0,0,
+ 0,0,-56,0,0,0,0,0,0,0,
+ -129,0,0,0,0,0,0,0,0,-53,
+ 0,0,0,0,0,0,0,-87,0,0,
+ 0,0,0,0,0,-183,-9,0,0,0,
+ 0,0,0,0,-119,-121,-122,0,0,0,
+ -191,-153,0,0,0,0,0,0,0,-48,
+ 0,0,0,0,0,0,0,-164,0,0,
+ 0,0,0,0,0,0,0,0,-106,0,
+ -107,0,0,-151,0,0,0,0,0,0,
+ 0,0,0,0,-50,0,0,0,0,0,
+ 0,0,-205,0,0,0,0,0,-126,-180,
+ 0,-137,-127,0,0,-132,0,0,0,0,
+ 0,-51,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,-13,0,0,0,0,0,0,
+ -52,0,0,0,0,0,0,0,-118,0,
+ 0,0,-44,0,0,0,0,0,0,0,
+ 0,0,0,-10,0,0,0,0,0,0,
+ 0,0,-45,0,0,0,0,0,0,0,
+ -154,0,0,-46,0,0,0,0,0,0,
+ 0,-120,0,0,-47,0,0,0,0,0,
+ 0,0,-198,0,0,0,-123,-155,-150,-135,
+ 0,-49,0,0,0,0,0,0,0,-37,
+ 0,-159,-139,-76,-79,-142,-145,0,-165,-81,
+ 0,0,0,0,0,-207,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,-188,0,0,
+ -166,-157,-146,0,-11,0,0,0,0,0,
+ 0,-12,0,0,0,0,0,0,-16,-178,
+ -29,0,-30,0,0,-147,0,-170,0,-197,
+ 0,-41,0,0,0,0,0,0,-176,0,
+ -208,0,0,0,0,0,0,0,0,-160,
+ 0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,-42,0,0,0,0,0,
+ 0,-43,0,0,0,0,0,0,-84,-193,
+ 0,0,0,-86,0,-73,0,0,0,0,
+ 0,0,-199,-116,-163,-1,-168,-113,-182,0,
+ 0,0,-177,0,0,0,0,0,0,0,
+ 0,0,0,0,0,-138,0,-140,0,0,
+ 0,-158,0,0,0,0,0,0,0,0,
+ 0,-179,-184,0,0,-128,0,-194,0,0,
+ 0,0,0,0,0,0,-175,0,-141,0,
+ 0,-162,0,0,0,0,0,0,0,0,
+ 0,-190,-201,0,-203,0,-109,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,-136,
+ 0,0,-167,0,0,0,0,0,0,0,
+ -14,0,0,0,0,0,0,0,0,0,
+ 0,0,0,-161,-34,0,-55,0,-156,0,
+ -204,0,0,0,0,-185,0,-200,0,0,
+ -202,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,
+ 0,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[] = {
+ 83,8,24,24,20,20,26,26,61,61,
+ 1,1,1,1,2,2,2,3,3,4,
+ 4,4,4,4,4,4,4,51,51,69,
+ 69,5,5,5,5,5,5,5,5,5,
+ 5,5,6,6,7,7,7,7,9,9,
+ 9,10,10,10,11,11,11,11,11,12,
+ 12,12,13,13,14,14,15,15,16,16,
+ 17,17,18,18,19,19,19,19,19,19,
+ 19,19,19,19,19,19,93,41,33,84,
+ 84,71,71,46,94,94,94,94,94,94,
+ 94,95,95,95,96,96,101,101,102,102,
+ 97,97,98,98,98,104,104,99,99,99,
+ 99,100,100,100,100,100,103,103,23,23,
+ 23,23,23,28,28,28,77,77,72,72,
+ 72,72,73,73,73,74,74,74,75,75,
+ 75,76,76,76,105,105,106,106,107,29,
+ 31,31,31,31,31,52,54,54,54,54,
+ 54,54,54,54,54,54,54,54,66,66,
+ 27,27,63,63,63,63,64,64,64,55,
+ 55,56,56,48,48,32,85,85,78,79,
+ 79,79,65,65,80,80,81,81,67,67,
+ 21,22,22,22,30,47,47,34,34,34,
+ 34,37,37,39,35,35,36,40,40,108,
+ 108,38,109,109,86,86,25,25,25,25,
+ 25,25,25,25,25,82,49,49,49,49,
+ 58,58,57,57,57,59,59,50,50,87,
+ 87,62,62,60,60,60,42,42,42,43,
+ 44,44,44,45,45,45,45,53,53,70,
+ 70,70,70,68,88,89,89,90,90,91,
+ 91,110,110,111,111,112,112,112,112,114,
+ 114,113,113,113,115,115,83,83,1,14,
+ 19,15,332,526,44,375,539,335,378,376,
+ 453,452,483,454,521,492,74,91,480,134,
+ 210,6,433,570,30,465,136,133,135,159,
+ 295,14,19,15,332,526,44,375,480,335,
+ 378,376,453,452,483,454,521,492,74,277,
+ 138,1289,165,341,14,19,15,332,42,44,
+ 615,142,145,148,151,53,32,306,249,331,
+ 1365,1100,1370,1499,1504,1158,341,14,19,15,
+ 332,42,39,279,341,14,19,15,332,42,
+ 44,375,23,335,378,376,453,1056,280,570,
+ 520,295,14,19,15,332,526,44,375,480,
+ 335,378,376,453,452,483,454,521,492,74,
+ 277,203,14,19,15,332,526,44,375,480,
+ 335,378,376,453,452,483,454,521,492,74,
+ 277,552,23,104,137,649,341,14,19,15,
+ 332,526,44,375,279,335,378,376,453,452,
+ 483,454,521,492,74,91,270,323,22,280,
+ 619,1500,1369,163,281,216,1182,218,1321,220,
+ 221,226,259,265,1088,498,268,1506,177,282,
+ 155,14,19,15,332,526,44,375,1518,335,
+ 378,376,453,452,483,454,521,492,74,1096,
+ 645,235,207,271,236,647,49,331,407,14,
+ 19,15,332,526,44,375,1556,335,378,376,
+ 453,452,483,454,521,492,74,1141,179,14,
+ 19,15,332,526,44,375,443,335,378,376,
+ 453,452,483,454,521,492,74,1349,1448,525,
+ 285,1517,237,318,14,19,15,332,526,44,
+ 375,323,335,378,376,453,452,483,454,521,
+ 492,74,277,341,14,19,15,332,526,44,
+ 375,16,335,378,376,453,452,483,454,521,
+ 492,74,92,429,459,187,286,193,341,14,
+ 19,15,332,526,44,375,283,335,378,376,
+ 453,452,483,454,521,492,74,85,341,14,
+ 19,15,332,526,44,375,323,335,378,376,
+ 453,452,483,454,521,492,74,84,341,14,
+ 19,15,332,526,44,375,1209,335,378,376,
+ 453,452,483,454,521,492,74,83,341,14,
+ 19,15,332,526,44,375,323,335,378,376,
+ 453,452,483,454,521,492,74,82,341,14,
+ 19,15,332,526,44,375,1211,335,378,376,
+ 453,452,483,454,521,492,74,81,341,14,
+ 19,15,332,526,44,375,323,335,378,376,
+ 453,452,483,454,521,492,74,80,341,14,
+ 19,15,332,526,44,375,21,335,378,376,
+ 453,452,483,454,521,492,74,79,341,14,
+ 19,15,332,526,44,375,323,335,378,376,
+ 453,452,483,454,521,492,74,78,341,14,
+ 19,15,332,526,44,375,269,335,378,376,
+ 453,452,483,454,521,492,74,77,341,14,
+ 19,15,332,526,44,375,255,335,378,376,
+ 453,452,483,454,521,492,74,76,341,14,
+ 19,15,332,526,44,375,54,335,378,376,
+ 453,452,483,454,521,492,74,75,341,14,
+ 19,15,332,42,44,806,211,134,210,591,
+ 601,606,441,608,136,133,135,159,341,14,
+ 19,15,332,526,44,375,558,335,378,376,
+ 453,452,483,454,521,492,74,1459,138,1332,
+ 165,341,14,19,15,332,42,38,597,142,
+ 145,148,151,1347,506,1587,607,416,1365,1100,
+ 1370,1499,1504,1158,341,14,19,15,332,526,
+ 44,375,20,335,378,376,453,452,483,454,
+ 521,492,74,1523,341,14,19,15,332,42,
+ 44,375,57,335,378,376,453,452,483,454,
+ 521,492,93,341,14,19,15,332,42,44,
+ 375,87,335,378,376,453,452,483,454,521,
+ 492,93,341,14,19,15,332,42,44,375,
+ 1582,335,378,376,453,452,483,454,521,492,
+ 93,341,14,19,15,332,42,44,375,209,
+ 335,378,376,453,452,483,454,521,492,93,
+ 341,14,19,15,332,42,44,375,1583,335,
+ 378,376,453,452,483,454,521,492,93,341,
+ 14,19,15,332,42,44,375,200,335,378,
+ 376,453,452,483,454,521,492,73,283,65,
+ 363,14,19,15,332,40,201,1348,341,14,
+ 19,15,332,42,44,375,496,335,378,376,
+ 453,452,483,1123,270,227,14,19,15,332,
+ 42,35,536,215,1182,218,1321,220,221,226,
+ 1552,263,1088,498,268,615,259,12,449,243,
+ 568,649,273,1610,277,340,597,270,1243,260,
+ 466,33,456,584,303,274,215,1182,218,1321,
+ 220,221,226,272,263,1088,498,268,288,1440,
+ 238,134,210,372,251,210,257,89,144,133,
+ 135,159,766,341,14,19,15,332,42,44,
+ 375,597,335,378,376,453,452,483,454,1104,
+ 341,14,19,15,332,42,44,375,54,335,
+ 378,376,453,452,1038,240,73,341,14,19,
+ 15,332,42,37,1513,12,12,12,726,134,
+ 210,649,654,1536,1538,1569,137,133,135,159,
+ 341,14,19,15,332,42,44,375,656,894,
+ 215,1182,218,1321,220,221,226,225,290,142,
+ 139,371,165,1450,227,14,19,15,332,42,
+ 35,143,146,149,152,341,14,19,15,332,
+ 42,44,375,73,335,378,376,897,244,579,
+ 615,1513,12,573,196,198,323,1423,1558,1646,
+ 1542,556,341,14,19,15,332,42,44,375,
+ 228,335,378,932,250,210,275,215,1182,218,
+ 1321,220,221,226,385,14,19,15,332,33,
+ 1450,341,14,19,15,332,42,44,375,373,
+ 335,378,951,341,14,19,15,332,42,44,
+ 375,1446,335,849,341,14,19,15,332,42,
+ 36,197,198,341,14,19,15,332,42,44,
+ 375,624,335,850,341,14,19,15,332,42,
+ 44,375,374,335,851,341,14,19,15,332,
+ 42,44,375,349,335,853,224,390,211,597,
+ 106,1513,341,14,19,15,332,42,44,375,
+ 546,896,629,12,540,107,12,12,846,610,
+ 495,1572,1514,239,1613,411,69,215,1182,218,
+ 1321,220,221,226,273,270,134,210,183,270,
+ 1440,134,210,141,133,135,159,451,147,133,
+ 135,159,263,1088,498,268,263,1088,498,268,
+ 216,1182,218,1321,220,221,226,140,656,165,
+ 262,657,323,573,766,341,14,19,15,332,
+ 42,35,341,14,19,15,332,42,34,12,
+ 323,12,276,12,250,210,590,308,625,308,
+ 659,308,341,14,19,15,332,42,47,597,
+ 222,50,195,1709,195,1709,195,251,210,1648,
+ 636,1360,87,1360,87,1360,87,1709,1166,1709,
+ 581,1567,581,241,581,341,14,19,15,332,
+ 42,46,341,14,19,15,332,42,45,501,
+ 645,477,1709,646,507,686,272,14,19,15,
+ 332,42,43,211,609,629,250,629,573,629,
+ 134,210,826,597,456,134,210,150,133,135,
+ 159,194,153,133,135,159,611,1039,611,250,
+ 210,182,611,26,826,185,826,242,1709,87,
+ 826,1651,609,629,1709,1709,573,316,417,195,
+ 826,195,1376,1587,255,195,826,595,1470,617,
+ 1470,1246,611,1350,1470,1039,1103,250,210,184,
+ 826,1039,597,597,191,323,191,564,251,210,
+ 191,1362,1634,1515,1634,195,1369,1519,1634,328,
+ 548,451,255,1709,1470,227,287,289,255,1246,
+ 627,1350,270,617,1103,1585,1709,1350,826,1709,
+ 191,385,14,19,15,332,32,1553,1634,265,
+ 1088,498,268,1039,643,12,206,12,858,628,
+ 1369,556,826,456,1641,456,629,826,629,1198,
+ 1421,629,1709,1709,1709,1709,1709,195,1709,1709,
+ 255,231,1039,1709,1709,1709,1470,1422,87,1350,
+ 87,1709,202,1709,203,1709,888,278,1101,1709,
+ 206,1709,192,1709,1709,1709,1709,1709,1709,256,
+ 1709,1709,1709,1418,1421,1709,0,17,179,0,
+ 18,178,0,1,1932,0,1,1943,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,0,6,7,8,9,
+ 10,0,12,13,14,15,16,17,18,19,
+ 20,21,0,23,24,25,26,27,28,0,
+ 1,0,0,4,12,30,36,37,38,39,
+ 40,41,42,43,44,45,46,47,0,0,
+ 1,22,0,0,1,3,0,4,58,59,
+ 60,8,9,10,0,1,2,3,0,1,
+ 2,3,0,1,2,11,23,24,25,26,
+ 27,28,51,52,53,54,0,55,0,36,
+ 37,38,39,40,41,42,43,44,45,46,
+ 47,49,50,0,56,0,0,51,52,53,
+ 54,58,59,60,8,9,10,69,70,71,
+ 72,73,74,75,76,77,78,55,0,23,
+ 24,25,26,27,28,30,0,51,52,53,
+ 54,0,36,37,38,39,40,41,42,43,
+ 44,45,46,47,0,1,2,3,4,5,
+ 6,7,0,22,61,62,12,13,14,15,
+ 16,17,18,19,20,21,0,23,0,1,
+ 2,3,4,5,6,7,0,11,34,3,
+ 12,13,14,15,16,17,18,19,20,21,
+ 64,23,0,1,2,3,4,5,6,7,
+ 0,0,34,3,12,13,14,15,16,17,
+ 18,19,20,21,22,63,0,1,2,3,
+ 4,5,6,7,0,49,50,35,12,13,
+ 14,15,16,17,18,19,20,21,0,0,
+ 1,2,3,4,0,6,7,3,0,0,
+ 34,12,13,14,15,16,17,18,19,20,
+ 21,0,1,2,3,4,0,6,7,31,
+ 32,5,0,12,13,14,15,16,17,18,
+ 19,20,21,22,0,1,2,3,4,65,
+ 6,7,0,49,50,29,12,13,14,15,
+ 16,17,18,19,20,21,22,0,1,2,
+ 3,4,0,6,7,67,68,5,79,12,
+ 13,14,15,16,17,18,19,20,21,22,
+ 0,1,2,3,4,63,6,7,0,1,
+ 2,29,12,13,14,15,16,17,18,19,
+ 20,21,0,1,2,3,4,65,6,7,
+ 0,0,0,0,12,13,14,15,16,17,
+ 18,19,20,21,0,1,2,3,4,0,
+ 6,7,22,0,22,22,12,13,14,15,
+ 16,17,18,19,20,21,0,1,2,3,
+ 4,22,6,7,0,0,0,1,12,13,
+ 14,15,16,17,18,19,20,21,0,0,
+ 2,3,0,5,2,64,8,9,10,11,
+ 0,1,0,11,4,13,14,5,0,33,
+ 2,23,24,25,26,27,28,29,0,11,
+ 2,3,22,5,0,0,8,9,10,11,
+ 6,7,30,8,9,10,61,62,0,0,
+ 48,23,24,25,26,27,28,29,23,24,
+ 25,26,27,28,0,0,0,0,66,57,
+ 0,0,8,9,10,0,0,12,8,9,
+ 10,6,7,0,8,9,10,23,24,25,
+ 26,27,28,23,24,25,26,27,28,23,
+ 24,25,26,27,28,0,1,2,0,0,
+ 5,2,0,5,5,0,11,2,3,0,
+ 11,0,1,2,3,0,11,0,1,80,
+ 5,4,11,0,29,2,3,0,29,0,
+ 1,0,0,4,11,8,9,10,0,22,
+ 8,9,10,0,29,30,8,9,10,0,
+ 0,8,9,10,0,57,0,8,9,10,
+ 0,5,8,9,10,0,0,0,0,0,
+ 0,3,6,7,0,5,0,1,0,5,
+ 4,31,32,0,0,2,0,0,0,11,
+ 34,31,32,5,11,0,31,32,31,32,
+ 5,33,0,29,0,35,0,5,0,1,
+ 0,1,4,0,4,0,0,11,0,33,
+ 33,0,0,35,11,56,48,0,0,0,
+ 0,0,0,0,30,0,0,35,0,0,
+ 56,0,0,0,0,30,30,0,0,0,
+ 0,0,57,0,48,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,
+ 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,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,
+ 1709,613,1439,1425,614,88,1304,1167,1920,1921,
+ 1922,1,1432,1621,1274,1040,1719,1720,1721,1722,
+ 881,386,64,1871,1872,1870,1923,1873,1869,1709,
+ 1889,59,1709,1890,1225,593,1876,1881,1880,1878,
+ 1879,1877,1882,1883,1875,1884,1885,1886,42,1709,
+ 1944,1175,48,1709,1888,1492,61,1887,866,852,
+ 334,1920,1921,1922,258,1932,1072,1,1709,1932,
+ 1343,1239,1,1932,1343,500,1871,1872,1870,1923,
+ 1873,1869,1335,1324,1313,1293,60,1019,1709,1876,
+ 1881,1880,1878,1879,1877,1882,1883,1875,1884,1885,
+ 1886,1485,1452,62,818,252,128,1335,1324,1313,
+ 1293,866,852,334,1920,1921,1922,798,778,758,
+ 738,718,678,698,658,638,618,981,1709,1871,
+ 1872,1870,1923,1873,1869,1639,68,1335,1324,1313,
+ 1293,41,1876,1881,1880,1878,1879,1877,1882,1883,
+ 1875,1884,1885,1886,1,1726,1439,1065,1727,1712,
+ 1304,1167,66,1087,1281,1252,1432,1621,1274,1040,
+ 1719,1720,1721,1722,881,386,267,528,1709,1726,
+ 1439,1214,1727,1712,1304,1167,50,500,1711,1492,
+ 1432,1621,1274,1040,1719,1720,1721,1722,881,386,
+ 1150,904,1,1726,1439,1425,1727,27,1304,1167,
+ 1709,1709,1711,1090,1432,1621,1274,1040,1719,1720,
+ 1721,1722,881,386,1367,394,1709,1726,1439,1425,
+ 1727,1712,1304,1167,70,1485,1452,27,1432,1621,
+ 1274,1040,1719,1720,1721,1722,881,386,54,1709,
+ 1,1,1,1,49,1,1,1492,72,1709,
+ 1711,1,1,1,1,1,1,1,1,1,
+ 1,1709,1726,1439,1425,1727,1,1304,1167,1190,
+ 1352,90,67,1432,1621,1274,1040,1719,1720,1721,
+ 1722,881,386,1087,1,1726,1439,1425,1727,1048,
+ 1304,1167,71,1485,1452,90,1432,1621,1274,1040,
+ 1719,1720,1721,1722,881,386,1367,1709,1726,1439,
+ 1425,1727,1709,1304,1167,1133,1637,1714,2016,1432,
+ 1621,1274,1040,1719,1720,1721,1722,881,386,1367,
+ 1709,1726,1439,1425,1727,394,1304,1167,1,1932,
+ 1343,1713,1432,1621,1274,1040,1719,1720,1721,1722,
+ 881,386,1709,1726,1441,1425,1727,1048,1304,1167,
+ 1709,69,187,186,1432,1621,1274,1040,1719,1720,
+ 1721,1722,881,386,1709,1726,1443,1425,1727,188,
+ 1304,1167,1087,1709,1242,1363,1432,1621,1274,1040,
+ 1719,1720,1721,1722,881,386,1,1726,1439,1425,
+ 1727,1366,1304,1167,1709,63,1,1706,1432,1621,
+ 1274,1040,1719,1720,1721,1722,881,386,17,1709,
+ 1697,1697,31,1697,1094,1150,179,179,179,1697,
+ 1709,1889,1709,1635,1890,1733,1734,1718,266,1963,
+ 1085,179,179,179,179,179,179,1697,18,500,
+ 1700,1700,1176,1700,51,129,178,178,178,1700,
+ 838,363,1233,1920,1921,1922,1281,1252,1709,1709,
+ 409,178,178,178,178,178,178,1700,1871,1872,
+ 1870,1923,1873,1869,130,65,1709,1709,333,1717,
+ 131,1709,1920,1921,1922,53,132,1225,1920,1921,
+ 1922,838,363,1709,1920,1921,1922,1871,1872,1870,
+ 1923,1873,1869,1871,1872,1870,1923,1873,1869,1871,
+ 1872,1870,1923,1873,1869,1,1703,1072,1709,1,
+ 1714,1364,1709,1718,1714,261,500,1364,1,1709,
+ 500,264,1932,1072,1239,1709,500,1709,1889,1696,
+ 1714,1890,500,264,1713,1364,1239,246,1713,1709,
+ 1738,1709,1709,1739,500,1,1,1,247,1177,
+ 1920,1921,1922,245,1713,1461,1,1,1,248,
+ 58,1920,1921,1922,249,1717,1709,1920,1921,1922,
+ 57,1712,1920,1921,1922,56,52,55,1,208,
+ 1,1090,838,363,1,190,205,1889,1709,1714,
+ 1890,1190,1352,219,1709,1240,1,1,1709,924,
+ 1711,1190,1352,1716,500,1,1190,1352,1190,1352,
+ 1718,1963,1,1713,28,190,284,189,1709,1889,
+ 204,455,1890,217,455,28,204,962,199,1963,
+ 1962,1709,1709,1715,500,943,1091,1709,1709,1709,
+ 1709,1709,1709,1709,431,1709,1709,189,1709,1709,
+ 573,1709,1709,1709,1709,1736,2667,1709,1709,1709,
+ 1709,1709,1717,1709,1181,1709,1709,1709,1709,1709,
+ 1709,1709,1709,1709,1709,1709,1709,1709,1709,1709,
+ 1709,1709,1709,1000
+ };
+ };
+ 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,
+ 424,1,44,75,40,75,75,75,75,75,
+ 75,75,75,75,3,345,23,20,27,25,
+ 33,31,35,34,37,36,9,75,345,345,
+ 311,311,168,75,162,162,339,345,75,75,
+ 75,75,75,75,75,75,75,75,75,75,
+ 75,75,75,75,75,75,75,75,75,75,
+ 75,75,75,75,75,75,75,75,162,162,
+ 162,165,51,343,69,281,160,159,314,326,
+ 326,65,65,326,65,326,359,116,116,20,
+ 20,25,25,25,25,23,23,31,27,27,
+ 34,33,279,36,35,222,67,49,339,334,
+ 96,165,382,73,162,395,284,261,187,261,
+ 187,216,261,75,49,334,382,382,165,72,
+ 69,162,337,359,161,286,187,187,187,187,
+ 216,216,257,93,49,382,334,75,75,165,
+ 73,281,274,273,343,286,162,187,258,388,
+ 187,187,258,257,256,257,216,258,47,386,
+ 311,75,92,49,334,165,165,162,395,284,
+ 337,258,390,258,258,75,311,257,51,165,
+ 311,75,257,286,43,75,42,88,343,258,
+ 165,258,162,161,390,75,88,312
+ };
+ };
+ 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,
+ 80,0,11,2,48,66,13,14,56,69,
+ 70,71,72,73,75,74,76,77,78,3,
+ 49,50,6,7,32,31,51,52,53,54,
+ 61,62,12,63,64,65,35,67,68,34,
+ 29,55,30,57,5,0,5,35,11,48,
+ 13,14,12,3,6,7,20,21,15,2,
+ 16,17,18,19,1,4,22,0,8,9,
+ 10,23,34,5,16,17,18,19,4,13,
+ 14,12,6,7,20,21,15,3,2,1,
+ 0,56,11,48,0,8,9,10,2,16,
+ 17,18,19,1,4,13,14,12,3,6,
+ 7,20,21,15,0,9,23,28,10,27,
+ 26,25,8,24,48,66,13,14,12,6,
+ 7,49,50,31,32,51,52,53,54,61,
+ 62,63,64,65,67,68,56,69,70,71,
+ 72,73,74,75,76,77,78,3,2,11,
+ 30,29,5,0,34,5,0,5,29,15,
+ 16,17,18,19,1,4,2,13,14,12,
+ 3,6,7,20,21,0,24,36,8,37,
+ 58,25,38,26,39,40,27,9,41,42,
+ 23,59,28,60,43,44,10,45,46,47,
+ 1,4,5,35,0,1,4,5,30,35,
+ 0,12,3,6,7,49,50,31,32,51,
+ 52,53,54,61,62,63,64,65,67,68,
+ 55,69,70,71,72,73,74,75,76,77,
+ 78,34,29,57,22,56,30,35,5,0,
+ 24,8,25,26,27,9,23,28,10,1,
+ 3,22,2,5,30,29,57,11,55,0,
+ 3,2,11,29,5,24,36,8,37,58,
+ 25,38,26,39,40,27,9,41,42,23,
+ 59,28,60,43,44,10,45,46,47,33,
+ 4,1,0,44,36,41,39,40,38,37,
+ 42,43,45,46,47,55,57,28,25,23,
+ 24,27,26,8,9,10,30,1,5,29,
+ 2,11,3,0,15,16,17,18,19,2,
+ 13,14,12,3,6,7,20,21,4,1,
+ 58,59,60,44,36,41,39,40,38,37,
+ 42,43,45,46,47,28,25,23,24,27,
+ 26,8,9,10,0,56,0,57,5,3,
+ 1,2,55,0,24,36,8,37,58,25,
+ 38,26,39,40,27,9,41,42,23,59,
+ 28,60,43,44,10,45,46,47,1,4,
+ 33,3,0,15,16,17,18,19,1,4,
+ 2,13,14,12,3,6,7,20,21,79,
+ 0
+ };
+ };
+ public final static byte asr[] = Asr.asr;
+ public final int asr(int index) { return asr[index]; }
+
+ public interface Nasb {
+ public final static byte nasb[] = {0,
+ 73,8,67,15,8,15,15,15,15,15,
+ 15,15,15,15,8,62,8,8,8,8,
+ 8,8,8,8,8,8,8,15,62,62,
+ 9,9,39,63,37,37,58,1,15,15,
+ 15,15,15,15,15,15,15,15,15,15,
+ 15,15,15,15,63,15,15,15,15,15,
+ 15,15,15,15,15,15,15,15,37,37,
+ 37,23,15,71,21,57,19,19,48,49,
+ 49,11,11,49,11,49,44,8,8,8,
+ 8,8,8,8,8,8,8,8,8,8,
+ 8,8,8,8,8,8,8,85,59,85,
+ 14,23,77,22,37,69,36,8,85,8,
+ 85,85,8,15,14,85,77,77,23,22,
+ 42,37,30,2,8,84,85,79,85,79,
+ 11,85,25,17,85,77,42,15,15,23,
+ 22,29,19,19,71,84,37,79,55,66,
+ 87,79,55,25,8,8,11,55,13,8,
+ 11,15,27,14,42,23,23,37,69,36,
+ 31,55,51,55,55,15,11,25,15,23,
+ 11,15,25,83,67,15,8,51,71,55,
+ 23,55,37,37,51,15,33,8
+ };
+ };
+ public final static byte nasb[] = Nasb.nasb;
+ public final int nasb(int index) { return nasb[index]; }
+
+ public interface Nasr {
+ public final static char nasr[] = {0,
+ 4,77,76,75,74,73,72,0,69,0,
+ 27,0,68,8,4,0,89,0,25,0,
+ 8,4,24,0,51,0,91,0,20,8,
+ 44,43,37,35,0,8,20,0,8,84,
+ 0,21,0,63,64,65,66,52,28,0,
+ 8,37,35,0,26,0,20,8,44,43,
+ 0,32,8,41,0,8,61,0,8,23,
+ 49,0,8,41,83,0,58,0,56,8,
+ 32,0,86,23,8,0,8,32,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,
+ 85,2,9,86,87,10,11,48,64,76,
+ 1,8,6,7,68,81,82,83,84,12,
+ 13,3,69,44,55,60,63,72,90,42,
+ 16,17,30,89,91,47,52,56,61,62,
+ 66,67,74,75,78,79,80,4,14,15,
+ 18,19,20,21,29,31,92,54,70,73,
+ 22,23,24,25,26,5,27,28,32,33,
+ 34,35,36,37,38,39,40,41,93,94,
+ 45,46,49,50,51,53,57,58,59,65,
+ 71,77,88
+ };
+ };
+ 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,
+ 0,0,0,101,105,106,107,0,108,109,
+ 110,111,112,113,114,115,116,117,118,97,
+ 129,0,122,96,149,98,121,128,0,0,
+ 0,140,0,145,147,0,148,0,0,0,
+ 100,158,159,160,0,120,137,139,146,155,
+ 0,131,136,0,0,138,150,153,154,157,
+ 99,103,132,133,134,135,144,161,102,104,
+ 119,123,124,125,126,127,130,142,0,0,
+ 143,152,95,0,141,151,156,162,163,0,
+ 164,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 char nonterminalIndex[] = NonterminalIndex.nonterminalIndex;
+ public final int nonterminalIndex(int index) { return nonterminalIndex[index]; }
+
+ public interface ScopePrefix {
+ public final static char scopePrefix[] = {
+ 164,80,33,39,87,107,113,138,12,19,
+ 49,67,119,124,26,45,97,160,179,183,
+ 147,1,1,30,54,77,187,6,101,154,
+ 129,154,93,57,57,57
+ };
+ };
+ public final static char scopePrefix[] = ScopePrefix.scopePrefix;
+ public final int scopePrefix(int index) { return scopePrefix[index]; }
+
+ public interface ScopeSuffix {
+ public final static char scopeSuffix[] = {
+ 17,17,4,4,17,17,17,144,17,24,
+ 4,24,17,17,24,4,95,24,24,4,
+ 151,4,4,24,4,24,24,9,104,157,
+ 132,172,95,64,59,72
+ };
+ };
+ public final static char scopeSuffix[] = ScopeSuffix.scopeSuffix;
+ public final int scopeSuffix(int index) { return scopeSuffix[index]; }
+
+ public interface ScopeLhs {
+ public final static char scopeLhs[] = {
+ 4,65,25,25,65,63,63,98,53,45,
+ 25,40,63,63,45,25,48,5,4,4,
+ 18,91,90,43,25,37,2,68,48,6,
+ 99,4,48,40,38,40
+ };
+ };
+ public final static char scopeLhs[] = ScopeLhs.scopeLhs;
+ public final int scopeLhs(int index) { return scopeLhs[index]; }
+
+ public interface ScopeLa {
+ public final static byte scopeLa[] = {
+ 35,35,34,34,35,35,35,86,35,29,
+ 34,29,35,35,29,34,57,29,29,34,
+ 55,34,34,29,34,29,29,56,1,29,
+ 92,29,57,2,2,2
+ };
+ };
+ public final static byte scopeLa[] = ScopeLa.scopeLa;
+ public final int scopeLa(int index) { return scopeLa[index]; }
+
+ public interface ScopeStateSet {
+ public final static byte scopeStateSet[] = {
+ 34,19,23,23,19,19,19,-1,89,27,
+ 23,11,19,19,27,23,5,34,34,34,
+ 64,1,3,27,23,11,34,90,5,37,
+ -1,34,5,11,11,11
+ };
+ };
+ public final static byte scopeStateSet[] = ScopeStateSet.scopeStateSet;
+ public final int scopeStateSet(int index) { return scopeStateSet[index]; }
+
+ public interface ScopeRhs {
+ public final static char scopeRhs[] = {0,
+ 139,11,0,96,0,181,101,0,31,136,
+ 0,144,163,101,22,0,98,0,150,101,
+ 2,136,0,97,0,150,101,2,0,153,
+ 2,0,112,23,175,101,11,0,112,175,
+ 101,23,11,0,112,23,11,0,112,175,
+ 101,11,0,112,11,0,130,0,2,0,
+ 151,97,0,2,97,0,150,101,2,130,
+ 0,2,0,150,97,0,140,2,0,144,
+ 173,101,22,120,58,0,144,173,101,22,
+ 58,0,125,0,99,0,178,101,125,0,
+ 101,125,0,141,99,0,148,101,22,120,
+ 60,0,148,101,22,120,59,0,148,101,
+ 22,60,0,148,101,22,59,0,187,85,
+ 0,77,2,100,97,99,0,187,113,134,
+ 2,89,0,53,0,0,134,68,110,0,
+ 29,117,0,155,2,0,97,106,0,155,
+ 2,15,0,144,163,101,22,113,155,2,
+ 0,97,3,0,104,0,98,0,177,2,
+ 97,0,134,11,97,0,134,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,
+ 525,0,480,0,1572,1634,1542,1538,1536,0,
+ 1376,1233,1343,1166,451,1072,1039,0,826,1158,
+ 308,0,1321,1182,1088,498,451,1072,1039,1587,
+ 1364,1360,0,1621,1274,1040,1214,1065,1506,1048,
+ 1133,394,1150,1281,1252,1225,1352,1190,1335,1324,
+ 1313,1293,1492,1485,1452,838,363,1432,1425,1304,
+ 1167,881,386,1000,981,962,943,924,904,858,
+ 548,1019,528,500,818,798,778,758,738,718,
+ 698,678,658,638,618,308,593,456,573,411,
+ 431,340,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,176,134,101,164,15,21,20,7,6,
+ 3,12,14,13,97,2,102,100,104,103,
+ 106,105,108,107,110,109,98,30,2,2,
+ 66,48,2,11,155,134,125,101,7,6,
+ 50,49,3,54,53,52,51,31,32,12,
+ 62,61,64,63,68,67,65,78,77,76,
+ 74,75,73,72,71,70,69,56,155,155,
+ 177,134,113,101,11,2,137,136,165,166,
+ 167,60,59,168,58,169,170,1,4,100,
+ 100,103,103,103,103,102,102,105,104,104,
+ 107,106,134,109,108,113,113,22,142,3,
+ 23,112,101,3,153,101,2,120,22,120,
+ 22,22,120,55,101,3,101,101,112,175,
+ 151,150,116,101,152,101,22,101,22,101,
+ 101,22,163,101,22,101,151,175,23,112,
+ 3,2,128,130,101,30,150,101,148,125,
+ 149,101,148,173,120,174,101,144,30,181,
+ 48,11,182,101,151,112,112,140,101,2,
+ 142,148,101,148,144,56,30,173,56,139,
+ 48,11,163,101,178,55,140,2,101,144,
+ 139,144,150,179,30,55,142,30
+ };
+ };
+ public final static char inSymb[] = InSymb.inSymb;
+ public final int inSymb(int index) { return inSymb[index]; }
+
+ public interface Name {
+ public final static String name[] = {
+ "",
+ "[",
+ "(",
+ "{",
+ ".",
+ "->",
+ "++",
+ "--",
+ "&",
+ "*",
+ "+",
+ "-",
+ "~",
+ "!",
+ "/",
+ "%",
+ ">>",
+ "<<",
+ "<",
+ ">",
+ "<=",
+ ">=",
+ "==",
+ "!=",
+ "^",
+ "|",
+ "&&",
+ "||",
+ "?",
+ ":",
+ "...",
+ "=",
+ "*=",
+ "/=",
+ "%=",
+ "+=",
+ "-=",
+ ">>=",
+ "<<=",
+ "&=",
+ "^=",
+ "|=",
+ ",",
+ "$empty",
+ "auto",
+ "break",
+ "case",
+ "char",
+ "const",
+ "continue",
+ "default",
+ "do",
+ "double",
+ "else",
+ "enum",
+ "extern",
+ "float",
+ "for",
+ "goto",
+ "if",
+ "inline",
+ "int",
+ "long",
+ "register",
+ "restrict",
+ "return",
+ "short",
+ "signed",
+ "sizeof",
+ "static",
+ "struct",
+ "switch",
+ "typedef",
+ "union",
+ "unsigned",
+ "void",
+ "volatile",
+ "while",
+ "_Bool",
+ "_Complex",
+ "_Imaginary",
+ "integer",
+ "floating",
+ "charconst",
+ "stringlit",
+ "identifier",
+ "Completion",
+ "EndOfCompletion",
+ "Invalid",
+ "RightBracket",
+ "RightParen",
+ "RightBrace",
+ "SemiColon",
+ "ERROR_TOKEN",
+ "EOF_TOKEN",
+ "expression_parser_start",
+ "]",
+ ")",
+ "}",
+ ";",
+ "expression",
+ "postfix_expression",
+ "member_name",
+ "type_name",
+ "initializer_list",
+ "unary_expression",
+ "cast_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",
+ "conditional_expression",
+ "assignment_expression",
+ "expression_list_actual",
+ "constant_expression",
+ "identifier_or_typedefname",
+ "declaration_specifiers",
+ "simple_declaration_specifiers",
+ "struct_or_union_declaration_sp" +
+ "ecifiers",
+ "elaborated_declaration_specifi" +
+ "ers",
+ "enum_declaration_specifiers",
+ "typdef_name_declaration_specif" +
+ "iers",
+ "no_type_declaration_specifier",
+ "type_qualifier",
+ "no_type_declaration_specifiers",
+ "simple_type_specifier",
+ "struct_or_union_specifier",
+ "elaborated_specifier",
+ "enum_specifier",
+ "typedef_name_in_declspec",
+ "initializer",
+ "declarator",
+ "struct_declaration_list",
+ "struct_declaration",
+ "specifier_qualifier_list",
+ "struct_declarator_list",
+ "complete_struct_declarator",
+ "enumerator_list",
+ "enumerator",
+ "direct_declarator",
+ "pointer_seq",
+ "array_direct_declarator",
+ "basic_direct_declarator",
+ "array_modifier",
+ "parameter_type_list",
+ "identifier_list",
+ "array_modifier_type_qualifiers",
+ "type_qualifier_list",
+ "parameter_list",
+ "parameter_declaration",
+ "complete_parameter_declarator",
+ "abstract_declarator",
+ "direct_abstract_declarator",
+ "basic_direct_abstract_declarat" +
+ "or",
+ "array_direct_abstract_declarat" +
+ "or",
+ "designated_initializer",
+ "designation",
+ "designator_list",
+ "designator"
+ };
+ };
+ public final static String name[] = Name.name;
+ public final String name(int index) { return name[index]; }
+
+ public final static int
+ ERROR_SYMBOL = 79,
+ SCOPE_UBOUND = 35,
+ SCOPE_SIZE = 36,
+ MAX_NAME_LENGTH = 38;
+
+ 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 = 208,
+ NT_OFFSET = 93,
+ LA_STATE_OFFSET = 2016,
+ MAX_LA = 2,
+ NUM_RULES = 307,
+ NUM_NONTERMINALS = 115,
+ NUM_SYMBOLS = 208,
+ SEGMENT_SIZE = 8192,
+ START_STATE = 1516,
+ IDENTIFIER_SYMBOL = 0,
+ EOFT_SYMBOL = 80,
+ EOLT_SYMBOL = 80,
+ ACCEPT_ACTION = 1696,
+ ERROR_ACTION = 1709;
+
+ 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/c99/C99ExpressionStatementParsersym.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99ExpressionStatementParsersym.java
new file mode 100644
index 00000000000..8edc95759b1
--- /dev/null
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99ExpressionStatementParsersym.java
@@ -0,0 +1,210 @@
+/*******************************************************************************
+* 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.c99;
+
+public interface C99ExpressionStatementParsersym {
+ public final static int
+ TK_auto = 24,
+ TK_break = 81,
+ TK_case = 82,
+ TK_char = 36,
+ TK_const = 8,
+ TK_continue = 83,
+ TK_default = 84,
+ TK_do = 85,
+ TK_double = 37,
+ TK_else = 86,
+ TK_enum = 58,
+ TK_extern = 25,
+ TK_float = 38,
+ TK_for = 87,
+ TK_goto = 88,
+ TK_if = 89,
+ TK_inline = 26,
+ TK_int = 39,
+ TK_long = 40,
+ TK_register = 27,
+ TK_restrict = 9,
+ TK_return = 90,
+ TK_short = 41,
+ TK_signed = 42,
+ TK_sizeof = 15,
+ TK_static = 23,
+ TK_struct = 59,
+ TK_switch = 91,
+ TK_typedef = 28,
+ TK_union = 60,
+ TK_unsigned = 43,
+ TK_void = 44,
+ TK_volatile = 10,
+ TK_while = 92,
+ TK__Bool = 45,
+ TK__Complex = 46,
+ TK__Imaginary = 47,
+ TK_integer = 16,
+ TK_floating = 17,
+ TK_charconst = 18,
+ TK_stringlit = 19,
+ TK_identifier = 1,
+ TK_Completion = 4,
+ TK_EndOfCompletion = 5,
+ TK_Invalid = 93,
+ TK_LeftBracket = 11,
+ TK_LeftParen = 2,
+ TK_LeftBrace = 22,
+ TK_Dot = 48,
+ TK_Arrow = 66,
+ TK_PlusPlus = 13,
+ TK_MinusMinus = 14,
+ TK_And = 12,
+ TK_Star = 3,
+ TK_Plus = 6,
+ TK_Minus = 7,
+ TK_Tilde = 20,
+ TK_Bang = 21,
+ TK_Slash = 49,
+ TK_Percent = 50,
+ TK_RightShift = 31,
+ TK_LeftShift = 32,
+ TK_LT = 51,
+ TK_GT = 52,
+ TK_LE = 53,
+ TK_GE = 54,
+ TK_EQ = 61,
+ TK_NE = 62,
+ TK_Caret = 63,
+ TK_Or = 64,
+ TK_AndAnd = 65,
+ TK_OrOr = 67,
+ TK_Question = 68,
+ TK_Colon = 55,
+ TK_DotDotDot = 33,
+ TK_Assign = 56,
+ TK_StarAssign = 69,
+ TK_SlashAssign = 70,
+ TK_PercentAssign = 71,
+ TK_PlusAssign = 72,
+ TK_MinusAssign = 73,
+ TK_RightShiftAssign = 74,
+ TK_LeftShiftAssign = 75,
+ TK_AndAssign = 76,
+ TK_CaretAssign = 77,
+ TK_OrAssign = 78,
+ TK_Comma = 30,
+ TK_RightBracket = 34,
+ TK_RightParen = 29,
+ TK_RightBrace = 35,
+ TK_SemiColon = 57,
+ TK_ERROR_TOKEN = 79,
+ TK_EOF_TOKEN = 80;
+
+ public final static String orderedTerminalSymbols[] = {
+ "",
+ "identifier",
+ "LeftParen",
+ "Star",
+ "Completion",
+ "EndOfCompletion",
+ "Plus",
+ "Minus",
+ "const",
+ "restrict",
+ "volatile",
+ "LeftBracket",
+ "And",
+ "PlusPlus",
+ "MinusMinus",
+ "sizeof",
+ "integer",
+ "floating",
+ "charconst",
+ "stringlit",
+ "Tilde",
+ "Bang",
+ "LeftBrace",
+ "static",
+ "auto",
+ "extern",
+ "inline",
+ "register",
+ "typedef",
+ "RightParen",
+ "Comma",
+ "RightShift",
+ "LeftShift",
+ "DotDotDot",
+ "RightBracket",
+ "RightBrace",
+ "char",
+ "double",
+ "float",
+ "int",
+ "long",
+ "short",
+ "signed",
+ "unsigned",
+ "void",
+ "_Bool",
+ "_Complex",
+ "_Imaginary",
+ "Dot",
+ "Slash",
+ "Percent",
+ "LT",
+ "GT",
+ "LE",
+ "GE",
+ "Colon",
+ "Assign",
+ "SemiColon",
+ "enum",
+ "struct",
+ "union",
+ "EQ",
+ "NE",
+ "Caret",
+ "Or",
+ "AndAnd",
+ "Arrow",
+ "OrOr",
+ "Question",
+ "StarAssign",
+ "SlashAssign",
+ "PercentAssign",
+ "PlusAssign",
+ "MinusAssign",
+ "RightShiftAssign",
+ "LeftShiftAssign",
+ "AndAssign",
+ "CaretAssign",
+ "OrAssign",
+ "ERROR_TOKEN",
+ "EOF_TOKEN",
+ "break",
+ "case",
+ "continue",
+ "default",
+ "do",
+ "else",
+ "for",
+ "goto",
+ "if",
+ "return",
+ "switch",
+ "while",
+ "Invalid"
+ };
+
+ public final static boolean isValidForParser = true;
+}
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
new file mode 100644
index 00000000000..1f30f8b8311
--- /dev/null
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99NoCastExpressionParser.java
@@ -0,0 +1,1244 @@
+/*******************************************************************************
+* 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.c99;
+
+import lpg.lpgjavaruntime.*;
+
+import java.util.*;
+import org.eclipse.cdt.core.dom.ast.*;
+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;
+
+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
+{
+ private static ParseTable prs = new C99NoCastExpressionParserprs();
+ 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 C99NoCastExpressionParser(LexStream lexStream)
+ {
+ super(lexStream);
+
+ try
+ {
+ super.remapTerminalSymbols(orderedTerminalSymbols(), C99NoCastExpressionParserprs.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(" " + C99NoCastExpressionParsersym.orderedTerminalSymbols[id.intValue()]);
+ }
+ System.out.println();
+ }
+ catch(UndefinedEofSymbolException e)
+ {
+ throw new Error(new UndefinedEofSymbolException
+ ("The Lexer does not implement the Eof symbol " +
+ C99NoCastExpressionParsersym.orderedTerminalSymbols[C99NoCastExpressionParserprs.EOFT_SYMBOL]));
+ }
+ }
+
+ public String[] orderedTerminalSymbols() { return C99NoCastExpressionParsersym.orderedTerminalSymbols; }
+ public String getTokenKindName(int kind) { return C99NoCastExpressionParsersym.orderedTerminalSymbols[kind]; }
+ public int getEOFTokenKind() { return C99NoCastExpressionParserprs.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 C99NoCastExpressionParserprs.java with -BACKTRACK option"));
+ }
+ catch (BadParseSymFileException e)
+ {
+ throw new Error(new BadParseSymFileException("Bad Parser Symbol File -- C99NoCastExpressionParsersym.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 C99BuildASTParserAction action;
+
+public C99NoCastExpressionParser() { // constructor
+}
+
+private void initActions(IASTTranslationUnit tu) {
+ action = new C99BuildASTParserAction ( C99ASTNodeFactory.DEFAULT_INSTANCE , this, tu);
+ action.setTokenMap( C99NoCastExpressionParsersym .orderedTerminalSymbols);
+}
+
+
+public void addToken(IToken token) {
+ token.setKind(mapKind(token.getKind())); // TODO does mapKind need to be called?
+ 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.getASTCompletionNode();
+
+ //action = null;
+ //parserAction = null;
+ return compNode;
+}
+
+// uncomment this method to use with backtracking parser
+public List getRuleTokens() {
+ return Collections.unmodifiableList(getTokens().subList(getLeftSpan(), getRightSpan() + 1));
+}
+
+
+
+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, C99NoCastExpressionParsersym .TK_EOF_TOKEN));
+}
+
+public C99NoCastExpressionParser(String[] mapFrom) { // constructor
+ tokenMap = new TokenMap( C99NoCastExpressionParsersym .orderedTerminalSymbols, mapFrom);
+}
+
+
+public IASTExpression getParseResult() {
+ return (IASTExpression) action.getSecondaryParseResult();
+}
+
+ public void ruleAction(int ruleNumber)
+ {
+ switch (ruleNumber)
+ {
+
+ //
+ // Rule 1: ::= $Empty
+ //
+ case 1: { action. openASTScope(); break;
+ }
+
+ //
+ // Rule 10: literal ::= integer
+ //
+ case 10: { action. consumeExpressionLiteral(IASTLiteralExpression.lk_integer_constant); break;
+ }
+
+ //
+ // Rule 11: literal ::= floating
+ //
+ case 11: { action. consumeExpressionLiteral(IASTLiteralExpression.lk_float_constant); break;
+ }
+
+ //
+ // Rule 12: literal ::= charconst
+ //
+ case 12: { action. consumeExpressionLiteral(IASTLiteralExpression.lk_char_constant); break;
+ }
+
+ //
+ // Rule 13: literal ::= stringlit
+ //
+ case 13: { action. consumeExpressionLiteral(IASTLiteralExpression.lk_string_literal); break;
+ }
+
+ //
+ // Rule 15: primary_expression ::= primary_expression_id
+ //
+ case 15: { action. consumeExpressionID(); break;
+ }
+
+ //
+ // Rule 16: primary_expression ::= ( expression )
+ //
+ case 16: { action. consumeExpressionBracketed(); break;
+ }
+
+ //
+ // Rule 20: postfix_expression ::= postfix_expression [ expression ]
+ //
+ case 20: { action. consumeExpressionArraySubscript(); break;
+ }
+
+ //
+ // Rule 21: postfix_expression ::= postfix_expression ( expression_list_opt )
+ //
+ case 21: { action. consumeExpressionFunctionCall(); break;
+ }
+
+ //
+ // Rule 22: postfix_expression ::= postfix_expression . member_name
+ //
+ case 22: { action. consumeExpressionFieldReference(false); break;
+ }
+
+ //
+ // Rule 23: postfix_expression ::= postfix_expression -> member_name
+ //
+ case 23: { action. consumeExpressionFieldReference(true); break;
+ }
+
+ //
+ // Rule 24: postfix_expression ::= postfix_expression ++
+ //
+ case 24: { action. consumeExpressionUnaryOperator(IASTUnaryExpression.op_postFixIncr); break;
+ }
+
+ //
+ // Rule 25: postfix_expression ::= postfix_expression --
+ //
+ case 25: { action. consumeExpressionUnaryOperator(IASTUnaryExpression.op_postFixDecr); break;
+ }
+
+ //
+ // Rule 26: postfix_expression ::= ( type_name ) { initializer_list comma_opt }
+ //
+ case 26: { action. consumeExpressionTypeIdInitializer(); break;
+ }
+
+ //
+ // Rule 32: unary_expression ::= ++ unary_expression
+ //
+ case 32: { action. consumeExpressionUnaryOperator(IASTUnaryExpression.op_prefixIncr); break;
+ }
+
+ //
+ // Rule 33: unary_expression ::= -- unary_expression
+ //
+ case 33: { action. consumeExpressionUnaryOperator(IASTUnaryExpression.op_prefixDecr); break;
+ }
+
+ //
+ // Rule 34: unary_expression ::= & cast_expression
+ //
+ case 34: { action. consumeExpressionUnaryOperator(IASTUnaryExpression.op_amper); break;
+ }
+
+ //
+ // Rule 35: unary_expression ::= * cast_expression
+ //
+ case 35: { action. consumeExpressionUnaryOperator(IASTUnaryExpression.op_star); break;
+ }
+
+ //
+ // Rule 36: unary_expression ::= + cast_expression
+ //
+ case 36: { action. consumeExpressionUnaryOperator(IASTUnaryExpression.op_plus); break;
+ }
+
+ //
+ // Rule 37: unary_expression ::= - cast_expression
+ //
+ case 37: { action. consumeExpressionUnaryOperator(IASTUnaryExpression.op_minus); break;
+ }
+
+ //
+ // Rule 38: unary_expression ::= ~ cast_expression
+ //
+ case 38: { action. consumeExpressionUnaryOperator(IASTUnaryExpression.op_tilde); break;
+ }
+
+ //
+ // Rule 39: unary_expression ::= ! cast_expression
+ //
+ case 39: { action. consumeExpressionUnaryOperator(IASTUnaryExpression.op_not); break;
+ }
+
+ //
+ // Rule 40: unary_expression ::= sizeof unary_expression
+ //
+ case 40: { action. consumeExpressionUnaryOperator(IASTUnaryExpression.op_sizeof); break;
+ }
+
+ //
+ // Rule 41: unary_expression ::= sizeof ( type_name )
+ //
+ case 41: { action. consumeExpressionSizeofTypeId(); break;
+ }
+
+ //
+ // Rule 44: multiplicative_expression ::= multiplicative_expression * cast_expression
+ //
+ case 44: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_multiply); break;
+ }
+
+ //
+ // Rule 45: multiplicative_expression ::= multiplicative_expression / cast_expression
+ //
+ case 45: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_divide); break;
+ }
+
+ //
+ // Rule 46: multiplicative_expression ::= multiplicative_expression % cast_expression
+ //
+ case 46: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_modulo); break;
+ }
+
+ //
+ // Rule 48: additive_expression ::= additive_expression + multiplicative_expression
+ //
+ case 48: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_plus); break;
+ }
+
+ //
+ // Rule 49: additive_expression ::= additive_expression - multiplicative_expression
+ //
+ case 49: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_minus); break;
+ }
+
+ //
+ // Rule 51: shift_expression ::= shift_expression << additive_expression
+ //
+ case 51: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_shiftLeft); break;
+ }
+
+ //
+ // Rule 52: shift_expression ::= shift_expression >> additive_expression
+ //
+ case 52: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_shiftRight); break;
+ }
+
+ //
+ // Rule 54: relational_expression ::= relational_expression < shift_expression
+ //
+ case 54: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_lessThan); break;
+ }
+
+ //
+ // Rule 55: relational_expression ::= relational_expression > shift_expression
+ //
+ case 55: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_greaterThan); break;
+ }
+
+ //
+ // Rule 56: relational_expression ::= relational_expression <= shift_expression
+ //
+ case 56: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_lessEqual); break;
+ }
+
+ //
+ // Rule 57: relational_expression ::= relational_expression >= shift_expression
+ //
+ case 57: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_greaterEqual); break;
+ }
+
+ //
+ // Rule 59: equality_expression ::= equality_expression == relational_expression
+ //
+ case 59: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_equals); break;
+ }
+
+ //
+ // Rule 60: equality_expression ::= equality_expression != relational_expression
+ //
+ case 60: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_notequals); break;
+ }
+
+ //
+ // Rule 62: AND_expression ::= AND_expression & equality_expression
+ //
+ case 62: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_binaryAnd); break;
+ }
+
+ //
+ // Rule 64: exclusive_OR_expression ::= exclusive_OR_expression ^ AND_expression
+ //
+ case 64: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_binaryXor); break;
+ }
+
+ //
+ // Rule 66: inclusive_OR_expression ::= inclusive_OR_expression | exclusive_OR_expression
+ //
+ case 66: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_binaryOr); break;
+ }
+
+ //
+ // Rule 68: logical_AND_expression ::= logical_AND_expression && inclusive_OR_expression
+ //
+ case 68: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_logicalAnd); break;
+ }
+
+ //
+ // Rule 70: logical_OR_expression ::= logical_OR_expression || logical_AND_expression
+ //
+ case 70: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_logicalOr); break;
+ }
+
+ //
+ // Rule 72: conditional_expression ::= logical_OR_expression ? expression : conditional_expression
+ //
+ case 72: { action. consumeExpressionConditional(); break;
+ }
+
+ //
+ // Rule 74: assignment_expression ::= unary_expression = assignment_expression
+ //
+ case 74: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_assign); break;
+ }
+
+ //
+ // Rule 75: assignment_expression ::= unary_expression *= assignment_expression
+ //
+ case 75: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_multiplyAssign); break;
+ }
+
+ //
+ // Rule 76: assignment_expression ::= unary_expression /= assignment_expression
+ //
+ case 76: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_divideAssign); break;
+ }
+
+ //
+ // Rule 77: assignment_expression ::= unary_expression %= assignment_expression
+ //
+ case 77: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_moduloAssign); break;
+ }
+
+ //
+ // Rule 78: assignment_expression ::= unary_expression += assignment_expression
+ //
+ case 78: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_plusAssign); break;
+ }
+
+ //
+ // Rule 79: assignment_expression ::= unary_expression -= assignment_expression
+ //
+ case 79: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_minusAssign); break;
+ }
+
+ //
+ // Rule 80: assignment_expression ::= unary_expression <<= assignment_expression
+ //
+ case 80: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_shiftLeftAssign); break;
+ }
+
+ //
+ // Rule 81: assignment_expression ::= unary_expression >>= assignment_expression
+ //
+ case 81: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_shiftRightAssign); break;
+ }
+
+ //
+ // Rule 82: assignment_expression ::= unary_expression &= assignment_expression
+ //
+ case 82: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_binaryAndAssign); break;
+ }
+
+ //
+ // Rule 83: assignment_expression ::= unary_expression ^= assignment_expression
+ //
+ case 83: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_binaryXorAssign); break;
+ }
+
+ //
+ // Rule 84: assignment_expression ::= unary_expression |= assignment_expression
+ //
+ case 84: { action. consumeExpressionBinaryOperator(IASTBinaryExpression.op_binaryOrAssign); break;
+ }
+
+ //
+ // Rule 87: expression_list ::= expression_list_actual
+ //
+ case 87: { action. consumeExpressionList(); break;
+ }
+
+ //
+ // Rule 89: expression_list_opt ::= $Empty
+ //
+ case 89: { action. consumeEmpty(); break;
+ }
+
+ //
+ // Rule 99: statement ::= ERROR_TOKEN
+ //
+ case 99: { action. consumeStatementProblem(); break;
+ }
+
+ //
+ // Rule 100: labeled_statement ::= identifier_or_typedefname : statement
+ //
+ case 100: { action. consumeStatementLabeled(); break;
+ }
+
+ //
+ // Rule 101: labeled_statement ::= case constant_expression :
+ //
+ case 101: { action. consumeStatementCase(); break;
+ }
+
+ //
+ // Rule 102: labeled_statement ::= default :
+ //
+ case 102: { action. consumeStatementDefault(); break;
+ }
+
+ //
+ // Rule 103: compound_statement ::= { }
+ //
+ case 103: { action. consumeStatementCompoundStatement(false); break;
+ }
+
+ //
+ // Rule 104: compound_statement ::= { block_item_list }
+ //
+ case 104: { action. consumeStatementCompoundStatement(true); break;
+ }
+
+ //
+ // Rule 108: block_item ::= declaration
+ //
+ case 108: { action. consumeStatementDeclaration(); break;
+ }
+
+ //
+ // Rule 109: expression_statement ::= ;
+ //
+ case 109: { action. consumeStatementNull(); break;
+ }
+
+ //
+ // Rule 110: expression_statement ::= expression_in_statement ;
+ //
+ case 110: { action. consumeStatementExpression(); break;
+ }
+
+ //
+ // Rule 111: selection_statement ::= if ( expression ) statement
+ //
+ case 111: { action. consumeStatementIf(false); break;
+ }
+
+ //
+ // Rule 112: selection_statement ::= if ( expression ) statement else statement
+ //
+ case 112: { action. consumeStatementIf(true); break;
+ }
+
+ //
+ // Rule 113: selection_statement ::= switch ( expression ) statement
+ //
+ case 113: { action. consumeStatementSwitch(); break;
+ }
+
+ //
+ // Rule 115: expression_opt ::= $Empty
+ //
+ case 115: { action. consumeEmpty(); break;
+ }
+
+ //
+ // Rule 116: iteration_statement ::= do statement while ( expression ) ;
+ //
+ case 116: { action. consumeStatementDoLoop(); break;
+ }
+
+ //
+ // Rule 117: iteration_statement ::= while ( expression ) statement
+ //
+ case 117: { action. consumeStatementWhileLoop(); break;
+ }
+
+ //
+ // Rule 118: iteration_statement ::= for ( expression_opt ; expression_opt ; expression_opt ) statement
+ //
+ case 118: { action. consumeStatementForLoop(); break;
+ }
+
+ //
+ // Rule 119: iteration_statement ::= for ( declaration expression_opt ; expression_opt ) statement
+ //
+ case 119: { action. consumeStatementForLoop(); break;
+ }
+
+ //
+ // Rule 120: jump_statement ::= goto identifier_or_typedefname ;
+ //
+ case 120: { action. consumeStatementGoto(); break;
+ }
+
+ //
+ // Rule 121: jump_statement ::= continue ;
+ //
+ case 121: { action. consumeStatementContinue(); break;
+ }
+
+ //
+ // Rule 122: jump_statement ::= break ;
+ //
+ case 122: { action. consumeStatementBreak(); break;
+ }
+
+ //
+ // Rule 123: jump_statement ::= return ;
+ //
+ case 123: { action. consumeStatementReturn(false); break;
+ }
+
+ //
+ // Rule 124: jump_statement ::= return expression ;
+ //
+ case 124: { action. consumeStatementReturn(true); break;
+ }
+
+ //
+ // Rule 125: declaration ::= declaration_specifiers ;
+ //
+ case 125: { action. consumeDeclarationSimple(false); break;
+ }
+
+ //
+ // Rule 126: declaration ::= declaration_specifiers init_declarator_list ;
+ //
+ case 126: { action. consumeDeclarationSimple(true); break;
+ }
+
+ //
+ // Rule 127: declaration_specifiers ::= simple_declaration_specifiers
+ //
+ case 127: { action. consumeDeclarationSpecifiersSimple(); break;
+ }
+
+ //
+ // Rule 128: declaration_specifiers ::= struct_or_union_declaration_specifiers
+ //
+ case 128: { action. consumeDeclarationSpecifiersStructUnionEnum(); break;
+ }
+
+ //
+ // Rule 129: declaration_specifiers ::= elaborated_declaration_specifiers
+ //
+ case 129: { action. consumeDeclarationSpecifiersStructUnionEnum(); break;
+ }
+
+ //
+ // Rule 130: declaration_specifiers ::= enum_declaration_specifiers
+ //
+ case 130: { action. consumeDeclarationSpecifiersStructUnionEnum(); break;
+ }
+
+ //
+ // Rule 131: declaration_specifiers ::= typdef_name_declaration_specifiers
+ //
+ case 131: { action. consumeDeclarationSpecifiersTypedefName(); break;
+ }
+
+ //
+ // Rule 156: init_declarator ::= complete_declarator = initializer
+ //
+ case 156: { action. consumeDeclaratorWithInitializer(true); break;
+ }
+
+ //
+ // Rule 158: storage_class_specifier ::= storage_class_specifier_token
+ //
+ case 158: { action. consumeDeclSpecToken(); break;
+ }
+
+ //
+ // Rule 164: simple_type_specifier ::= simple_type_specifier_token
+ //
+ case 164: { action. consumeDeclSpecToken(); break;
+ }
+
+ //
+ // Rule 177: typedef_name_in_declspec ::= Completion
+ //
+ case 177: { action. consumeDeclSpecToken(); break;
+ }
+
+ //
+ // Rule 178: typedef_name_in_declspec ::= identifier
+ //
+ case 178: { action. consumeDeclSpecToken(); break;
+ }
+
+ //
+ // Rule 181: struct_or_union_specifier ::= struct { struct_declaration_list_opt }
+ //
+ case 181: { action. consumeTypeSpecifierComposite(false, IASTCompositeTypeSpecifier.k_struct); break;
+ }
+
+ //
+ // Rule 182: struct_or_union_specifier ::= union { struct_declaration_list_opt }
+ //
+ case 182: { action. consumeTypeSpecifierComposite(false, IASTCompositeTypeSpecifier.k_union); break;
+ }
+
+ //
+ // Rule 183: struct_or_union_specifier ::= struct identifier_or_typedefname { struct_declaration_list_opt }
+ //
+ case 183: { action. consumeTypeSpecifierComposite(true, IASTCompositeTypeSpecifier.k_struct); break;
+ }
+
+ //
+ // Rule 184: struct_or_union_specifier ::= union identifier_or_typedefname { struct_declaration_list_opt }
+ //
+ case 184: { action. consumeTypeSpecifierComposite(true, IASTCompositeTypeSpecifier.k_union); break;
+ }
+
+ //
+ // Rule 185: elaborated_specifier ::= struct identifier_or_typedefname
+ //
+ case 185: { action. consumeTypeSpecifierElaborated(IASTCompositeTypeSpecifier.k_struct); break;
+ }
+
+ //
+ // Rule 186: elaborated_specifier ::= union identifier_or_typedefname
+ //
+ case 186: { action. consumeTypeSpecifierElaborated(IASTCompositeTypeSpecifier.k_union); break;
+ }
+
+ //
+ // Rule 187: elaborated_specifier ::= enum identifier_or_typedefname
+ //
+ case 187: { action. consumeTypeSpecifierElaborated(IASTElaboratedTypeSpecifier.k_enum); break;
+ }
+
+ //
+ // Rule 192: struct_declaration ::= specifier_qualifier_list struct_declarator_list ;
+ //
+ case 192: { action. consumeStructDeclaration(true); break;
+ }
+
+ //
+ // Rule 193: struct_declaration ::= specifier_qualifier_list ;
+ //
+ case 193: { action. consumeStructDeclaration(false); break;
+ }
+
+ //
+ // Rule 199: struct_declarator ::= : constant_expression
+ //
+ case 199: { action. consumeBitField(false); break;
+ }
+
+ //
+ // Rule 200: struct_declarator ::= declarator : constant_expression
+ //
+ case 200: { action. consumeBitField(true); break;
+ }
+
+ //
+ // Rule 201: enum_specifier ::= enum { enumerator_list_opt comma_opt }
+ //
+ case 201: { action. consumeTypeSpecifierEnumeration(false); break;
+ }
+
+ //
+ // Rule 202: enum_specifier ::= enum identifier_or_typedefname { enumerator_list_opt comma_opt }
+ //
+ case 202: { action. consumeTypeSpecifierEnumeration(true); break;
+ }
+
+ //
+ // Rule 207: enumerator ::= identifier_or_typedefname
+ //
+ case 207: { action. consumeEnumerator(false); break;
+ }
+
+ //
+ // Rule 208: enumerator ::= identifier_or_typedefname = constant_expression
+ //
+ case 208: { action. consumeEnumerator(true); break;
+ }
+
+ //
+ // Rule 209: type_qualifier ::= type_qualifier_token
+ //
+ case 209: { action. consumeDeclSpecToken(); break;
+ }
+
+ //
+ // Rule 213: function_specifier ::= inline
+ //
+ case 213: { action. consumeDeclSpecToken(); break;
+ }
+
+ //
+ // Rule 215: declarator ::= pointer_seq direct_declarator
+ //
+ case 215: { action. consumeDeclaratorWithPointer(true); break;
+ }
+
+ //
+ // Rule 220: basic_direct_declarator ::= declarator_id_name
+ //
+ case 220: { action. consumeDirectDeclaratorIdentifier(); break;
+ }
+
+ //
+ // Rule 221: basic_direct_declarator ::= ( declarator )
+ //
+ case 221: { action. consumeDirectDeclaratorBracketed(); break;
+ }
+
+ //
+ // Rule 222: declarator_id_name ::= identifier
+ //
+ case 222: { action. consumeIdentifierName(); break;
+ }
+
+ //
+ // Rule 223: array_direct_declarator ::= basic_direct_declarator array_modifier
+ //
+ case 223: { action. consumeDirectDeclaratorArrayDeclarator(true); break;
+ }
+
+ //
+ // Rule 224: array_direct_declarator ::= array_direct_declarator array_modifier
+ //
+ case 224: { action. consumeDirectDeclaratorArrayDeclarator(true); break;
+ }
+
+ //
+ // Rule 226: function_direct_declarator ::= basic_direct_declarator ( parameter_type_list )
+ //
+ case 226: { action. consumeDirectDeclaratorFunctionDeclarator(true, true); break;
+ }
+
+ //
+ // Rule 227: function_direct_declarator ::= basic_direct_declarator ( )
+ //
+ case 227: { action. consumeDirectDeclaratorFunctionDeclarator(true, false); break;
+ }
+
+ //
+ // Rule 229: function_declarator ::= pointer_seq function_direct_declarator
+ //
+ case 229: { action. consumeDeclaratorWithPointer(true); break;
+ }
+
+ //
+ // Rule 230: knr_direct_declarator ::= basic_direct_declarator ( identifier_list )
+ //
+ case 230: { action. consumeDirectDeclaratorFunctionDeclaratorKnR(); break;
+ }
+
+ //
+ // Rule 232: knr_function_declarator ::= pointer_seq knr_direct_declarator
+ //
+ case 232: { action. consumeDeclaratorWithPointer(true); break;
+ }
+
+ //
+ // Rule 233: identifier_list ::= identifier
+ //
+ case 233: { action. consumeIdentifierKnR(); break;
+ }
+
+ //
+ // Rule 234: identifier_list ::= identifier_list , identifier
+ //
+ case 234: { action. consumeIdentifierKnR(); break;
+ }
+
+ //
+ // Rule 235: array_modifier ::= [ ]
+ //
+ case 235: { action. consumeDirectDeclaratorArrayModifier(false); break;
+ }
+
+ //
+ // Rule 236: array_modifier ::= [ array_modifier_type_qualifiers ]
+ //
+ case 236: { action. consumeDirectDeclaratorModifiedArrayModifier(false, false, true, false); break;
+ }
+
+ //
+ // Rule 237: array_modifier ::= [ assignment_expression ]
+ //
+ case 237: { action. consumeDirectDeclaratorArrayModifier(true); break;
+ }
+
+ //
+ // Rule 238: array_modifier ::= [ array_modifier_type_qualifiers assignment_expression ]
+ //
+ case 238: { action. consumeDirectDeclaratorModifiedArrayModifier(false, false, true, true); break;
+ }
+
+ //
+ // Rule 239: array_modifier ::= [ static assignment_expression ]
+ //
+ case 239: { action. consumeDirectDeclaratorModifiedArrayModifier(true, false, false, true); break;
+ }
+
+ //
+ // Rule 240: array_modifier ::= [ static array_modifier_type_qualifiers assignment_expression ]
+ //
+ case 240: { action. consumeDirectDeclaratorModifiedArrayModifier(true, false, true, true); break;
+ }
+
+ //
+ // Rule 241: array_modifier ::= [ array_modifier_type_qualifiers static assignment_expression ]
+ //
+ case 241: { action. consumeDirectDeclaratorModifiedArrayModifier(true, false, true, true); break;
+ }
+
+ //
+ // Rule 242: array_modifier ::= [ * ]
+ //
+ case 242: { action. consumeDirectDeclaratorModifiedArrayModifier(false, true, false, false); break;
+ }
+
+ //
+ // Rule 243: array_modifier ::= [ array_modifier_type_qualifiers * ]
+ //
+ case 243: { action. consumeDirectDeclaratorModifiedArrayModifier(false, true, true, false); break;
+ }
+
+ //
+ // Rule 245: pointer_seq ::= *
+ //
+ case 245: { action. consumePointer(); break;
+ }
+
+ //
+ // Rule 246: pointer_seq ::= pointer_seq *
+ //
+ case 246: { action. consumePointer(); break;
+ }
+
+ //
+ // Rule 247: pointer_seq ::= * type_qualifier_list
+ //
+ case 247: { action. consumePointerTypeQualifierList(); break;
+ }
+
+ //
+ // Rule 248: pointer_seq ::= pointer_seq * type_qualifier_list
+ //
+ case 248: { action. consumePointerTypeQualifierList(); break;
+ }
+
+ //
+ // Rule 251: parameter_type_list ::= parameter_list
+ //
+ case 251: { action. consumeEmpty(); break;
+ }
+
+ //
+ // Rule 252: parameter_type_list ::= parameter_list , ...
+ //
+ case 252: { action. consumePlaceHolder(); break;
+ }
+
+ //
+ // Rule 253: parameter_type_list ::= ...
+ //
+ case 253: { action. consumePlaceHolder(); break;
+ }
+
+ //
+ // Rule 256: parameter_declaration ::= declaration_specifiers complete_parameter_declarator
+ //
+ case 256: { action. consumeParameterDeclaration(); break;
+ }
+
+ //
+ // Rule 257: parameter_declaration ::= declaration_specifiers
+ //
+ case 257: { action. consumeParameterDeclarationWithoutDeclarator(); break;
+ }
+
+ //
+ // Rule 260: type_name ::= specifier_qualifier_list
+ //
+ case 260: { action. consumeTypeId(false); break;
+ }
+
+ //
+ // Rule 261: type_name ::= specifier_qualifier_list abstract_declarator
+ //
+ case 261: { action. consumeTypeId(true); break;
+ }
+
+ //
+ // Rule 263: abstract_declarator ::= pointer_seq
+ //
+ case 263: { action. consumeDeclaratorWithPointer(false); break;
+ }
+
+ //
+ // Rule 264: abstract_declarator ::= pointer_seq direct_abstract_declarator
+ //
+ case 264: { action. consumeDeclaratorWithPointer(false); break;
+ }
+
+ //
+ // Rule 268: basic_direct_abstract_declarator ::= ( abstract_declarator )
+ //
+ case 268: { action. consumeDirectDeclaratorBracketed(); break;
+ }
+
+ //
+ // Rule 269: array_direct_abstract_declarator ::= array_modifier
+ //
+ case 269: { action. consumeDirectDeclaratorArrayDeclarator(false); break;
+ }
+
+ //
+ // Rule 270: array_direct_abstract_declarator ::= array_direct_abstract_declarator array_modifier
+ //
+ case 270: { action. consumeDirectDeclaratorArrayDeclarator(true); break;
+ }
+
+ //
+ // Rule 271: array_direct_abstract_declarator ::= basic_direct_abstract_declarator array_modifier
+ //
+ case 271: { action. consumeDirectDeclaratorArrayDeclarator(true); break;
+ }
+
+ //
+ // Rule 272: function_direct_abstract_declarator ::= ( )
+ //
+ case 272: { action. consumeDirectDeclaratorFunctionDeclarator(false, false); break;
+ }
+
+ //
+ // Rule 273: function_direct_abstract_declarator ::= basic_direct_abstract_declarator ( )
+ //
+ case 273: { action. consumeDirectDeclaratorFunctionDeclarator(true, false); break;
+ }
+
+ //
+ // Rule 274: function_direct_abstract_declarator ::= ( parameter_type_list )
+ //
+ case 274: { action. consumeDirectDeclaratorFunctionDeclarator(false, true); break;
+ }
+
+ //
+ // Rule 275: function_direct_abstract_declarator ::= basic_direct_abstract_declarator ( parameter_type_list )
+ //
+ case 275: { action. consumeDirectDeclaratorFunctionDeclarator(true, true); break;
+ }
+
+ //
+ // Rule 276: initializer ::= assignment_expression
+ //
+ case 276: { action. consumeInitializer(); break;
+ }
+
+ //
+ // Rule 277: initializer ::= { initializer_list comma_opt }
+ //
+ case 277: { action. consumeInitializerList(); break;
+ }
+
+ //
+ // Rule 282: designated_initializer ::= designation = initializer
+ //
+ case 282: { action. consumeInitializerDesignated(); break;
+ }
+
+ //
+ // Rule 286: designator_base ::= [ constant_expression ]
+ //
+ case 286: { action. consumeDesignatorArray(); break;
+ }
+
+ //
+ // Rule 287: designator_base ::= . identifier_or_typedefname
+ //
+ case 287: { action. consumeDesignatorField(); break;
+ }
+
+ //
+ // Rule 288: designator ::= [ constant_expression ]
+ //
+ case 288: { action. consumeDesignatorArray(); break;
+ }
+
+ //
+ // Rule 289: designator ::= . identifier_or_typedefname
+ //
+ case 289: { action. consumeDesignatorField(); break;
+ }
+
+ //
+ // Rule 290: translation_unit ::= external_declaration_list
+ //
+ case 290: { action. consumeTranslationUnit(); break;
+ }
+
+ //
+ // Rule 291: translation_unit ::= $Empty
+ //
+ case 291: { action. consumeTranslationUnit(); break;
+ }
+
+ //
+ // Rule 296: external_declaration ::= ;
+ //
+ case 296: { action. consumeDeclarationEmpty(); break;
+ }
+
+ //
+ // Rule 297: external_declaration ::= ERROR_TOKEN
+ //
+ case 297: { action. consumeDeclarationProblem(); break;
+ }
+
+ //
+ // Rule 300: function_definition ::= declaration_specifiers function_declarator function_body
+ //
+ case 300: { action. consumeFunctionDefinition(true); break;
+ }
+
+ //
+ // Rule 301: function_definition ::= function_declarator function_body
+ //
+ case 301: { action. consumeFunctionDefinition(false); break;
+ }
+
+ //
+ // Rule 302: function_definition ::= declaration_specifiers knr_function_declarator declaration_list compound_statement
+ //
+ case 302: { action. consumeFunctionDefinitionKnR(); break;
+ }
+
+ //
+ // Rule 303: function_body ::= { }
+ //
+ case 303: { action. consumeStatementCompoundStatement(false); break;
+ }
+
+ //
+ // Rule 304: function_body ::= { block_item_list }
+ //
+ case 304: { action. consumeStatementCompoundStatement(true); break;
+ }
+
+ //
+ // Rule 306: no_cast_start ::= ERROR_TOKEN
+ //
+ case 306: { action. consumeExpressionProblem(); break;
+ }
+
+
+ default:
+ break;
+ }
+ return;
+ }
+}
+
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99NoCastExpressionParserprs.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99NoCastExpressionParserprs.java
new file mode 100644
index 00000000000..d8b087d5425
--- /dev/null
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99NoCastExpressionParserprs.java
@@ -0,0 +1,1079 @@
+/*******************************************************************************
+* 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.c99;
+
+public class C99NoCastExpressionParserprs implements lpg.lpgjavaruntime.ParseTable, C99NoCastExpressionParsersym {
+
+ 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
+ };
+ };
+ 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,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,3,1,1,1,4,
+ 4,3,3,2,2,8,1,0,1,1,
+ 1,2,2,2,2,2,2,2,2,2,
+ 4,1,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,3,3,3,3,3,3,3,
+ 3,3,3,3,1,1,2,1,0,1,
+ 3,1,1,1,1,1,1,1,1,3,
+ 3,2,2,4,1,2,1,1,1,2,
+ 5,7,5,1,0,7,5,9,8,3,
+ 2,2,2,3,2,4,2,2,2,2,
+ 2,1,1,1,1,2,1,2,2,2,
+ 1,2,2,1,2,2,1,2,2,1,
+ 2,2,1,3,1,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,
+ 5,5,6,6,2,2,2,1,0,1,
+ 2,4,2,1,1,3,1,1,2,3,
+ 6,7,1,0,1,3,1,3,1,1,
+ 1,1,1,1,3,1,1,1,1,1,
+ 3,1,2,2,1,5,3,1,3,5,
+ 1,3,1,3,2,4,3,5,4,6,
+ 6,3,5,1,1,2,3,4,1,2,
+ 1,3,1,1,3,2,1,1,1,1,
+ 2,1,2,3,1,1,1,3,1,2,
+ 2,2,3,4,5,1,5,1,1,3,
+ 3,4,1,1,2,3,2,3,2,1,
+ 0,1,2,1,1,1,1,1,2,4,
+ 3,6,2,4,1,1,-32,0,0,0,
+ 0,0,0,0,0,-2,0,0,0,0,
+ 0,0,0,0,0,0,0,0,-5,0,
+ 0,0,0,0,0,0,0,0,-121,0,
+ 0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,-177,
+ 0,-12,0,0,0,0,0,0,0,0,
+ 0,-13,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,-127,-4,-15,-140,-169,
+ -104,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,-16,0,-170,
+ 0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,-165,
+ 0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,-33,
+ -34,-29,-30,-3,0,0,0,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,-49,0,0,0,0,0,0,
+ 0,0,-18,0,0,0,-70,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,-69,0,0,0,
+ -19,-20,-21,-22,0,-107,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,-23,0,0,0,0,0,
+ 0,0,0,0,0,0,-24,-25,0,-185,
+ 0,0,0,0,0,0,0,0,-26,0,
+ 0,0,0,0,0,0,0,0,0,-27,
+ 0,0,0,0,0,0,0,0,-68,0,
+ 0,0,0,0,0,0,0,0,0,-83,
+ -84,-139,-87,-56,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,-57,0,0,0,0,0,0,
+ 0,0,-88,0,0,0,0,0,0,0,
+ 0,0,0,-58,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,-59,0,0,0,0,0,0,
+ 0,0,-89,0,0,0,0,0,0,0,
+ 0,0,0,-60,0,0,0,0,0,0,
+ 0,0,-90,0,0,0,0,0,0,0,
+ 0,0,0,-61,0,0,0,0,0,0,
+ 0,0,-91,0,0,0,0,0,0,0,
+ 0,0,0,-62,0,0,0,0,0,0,
+ 0,0,-92,0,0,0,0,0,0,0,
+ 0,0,0,-63,0,0,0,0,0,0,
+ 0,0,-93,0,0,0,0,0,0,0,
+ 0,0,0,-64,0,0,0,0,0,0,
+ 0,0,-191,0,0,0,0,0,0,0,
+ 0,0,0,-65,0,0,0,0,0,0,
+ 0,0,-94,0,0,0,0,0,0,0,
+ 0,0,0,-66,0,0,0,0,0,0,
+ 0,0,-130,0,0,0,0,0,0,0,
+ 0,0,0,-46,0,0,0,0,0,0,
+ 0,0,0,0,-95,-96,-97,-98,-77,0,
+ 0,0,0,0,-144,0,0,0,0,0,
+ 0,0,0,-99,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,-100,-101,-102,
+ -151,-103,-78,0,0,0,0,-6,0,0,
+ 0,0,0,0,0,0,0,0,0,0,
+ -145,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,
+ -168,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,-182,
+ 0,0,0,0,0,0,0,0,-114,0,
+ 0,0,0,0,0,0,0,0,-37,0,
+ 0,0,0,0,0,0,0,-47,0,0,
+ 0,0,0,0,0,0,-188,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,-192,0,0,0,0,
+ 0,0,0,0,-80,0,0,0,0,0,
+ 0,0,0,0,-38,0,0,0,0,0,
+ 0,0,0,-7,0,0,0,0,0,0,
+ -116,0,-202,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,0,
+ -119,0,0,0,0,0,0,0,0,0,
+ -129,-8,0,0,0,0,0,0,0,0,
+ -51,0,0,0,0,0,0,0,0,-155,
+ 0,0,0,0,0,0,-131,-72,-123,-161,
+ -142,-148,-73,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,-203,0,0,0,
+ 0,0,0,0,-113,-67,0,0,-162,-166,
+ 0,-193,-106,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,-204,
+ 0,0,-54,0,0,0,0,0,0,0,
+ 0,-160,0,0,0,0,0,0,0,-55,
+ 0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,-52,0,0,0,0,
+ 0,0,0,0,-82,0,0,0,0,-74,
+ -179,-9,0,0,0,0,0,0,-115,0,
+ 0,-143,0,0,0,0,-167,0,-85,0,
+ 0,-171,0,0,0,0,-86,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,-184,0,0,0,0,0,
+ 0,0,-75,0,-111,0,0,0,0,-48,
+ 0,0,0,0,0,0,0,0,-201,0,
+ 0,0,0,0,-159,-152,0,0,0,0,
+ 0,0,0,0,0,0,-50,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,-10,0,
+ 0,0,0,0,0,0,-42,0,0,0,
+ 0,0,0,0,0,0,0,-43,0,0,
+ 0,0,0,0,0,0,-117,0,-11,0,
+ 0,0,0,0,0,0,0,0,-44,0,
+ 0,0,0,0,0,0,0,-108,0,-45,
+ 0,0,0,0,0,0,0,0,-194,0,
+ -71,-187,-156,-109,-118,-31,-124,0,0,0,
+ 0,0,0,0,0,-110,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,
+ -147,0,0,0,0,0,0,-14,-28,-35,
+ 0,0,-122,-76,0,0,0,0,0,0,
+ 0,0,0,0,-39,0,0,0,0,0,
+ 0,0,0,0,0,0,-189,0,0,0,
+ 0,0,0,0,0,-183,-125,0,0,0,
+ -79,-128,0,0,-40,0,0,0,0,0,
+ 0,-41,0,0,0,0,0,0,-81,0,
+ 0,0,0,0,-133,-36,0,0,0,0,
+ 0,0,-112,0,0,-153,-135,0,0,0,
+ 0,0,-134,0,-136,0,0,0,0,0,
+ -176,0,-138,0,-154,-174,0,0,-137,0,
+ 0,0,-105,0,-158,0,0,0,0,-149,
+ 0,-190,0,0,0,-164,0,0,0,0,
+ 0,0,0,0,-175,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,-1,0,0,
+ 0,-150,0,-132,-178,-53,0,-163,-157,0,
+ 0,0,0,0,0,-146,-141,0,0,-195,
+ 0,-172,-180,0,0,0,0,0,0,0,
+ 0,0,0,0,0,-173,-186,0,0,-181,
+ 0,-196,0,-197,0,0,0,0,0,-198,
+ 0,-199,-200,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,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[] = {
+ 83,9,23,23,22,22,26,26,67,67,
+ 1,1,1,1,2,2,2,3,3,4,
+ 4,4,4,4,4,4,4,51,51,68,
+ 68,5,5,5,5,5,5,5,5,5,
+ 5,5,6,7,7,7,7,8,8,8,
+ 10,10,10,11,11,11,11,11,12,12,
+ 12,13,13,14,14,15,15,16,16,17,
+ 17,18,18,19,19,19,19,19,19,19,
+ 19,19,19,19,19,93,45,40,84,84,
+ 71,71,46,94,94,94,94,94,94,94,
+ 95,95,95,96,96,101,101,102,102,97,
+ 97,98,98,98,104,104,99,99,99,99,
+ 100,100,100,100,100,103,103,24,24,24,
+ 24,24,28,28,28,77,77,72,72,72,
+ 72,73,73,73,74,74,74,75,75,75,
+ 76,76,76,105,105,106,106,107,29,31,
+ 31,31,31,31,52,54,54,54,54,54,
+ 54,54,54,54,54,54,54,64,64,27,
+ 27,61,61,61,61,62,62,62,55,55,
+ 56,56,48,48,32,85,85,78,79,79,
+ 79,63,63,80,80,81,81,65,65,20,
+ 21,21,21,30,47,47,33,33,33,33,
+ 36,36,38,34,34,35,39,39,108,108,
+ 37,109,109,86,86,25,25,25,25,25,
+ 25,25,25,25,82,49,49,49,49,58,
+ 58,57,57,57,59,59,50,50,87,87,
+ 69,69,60,60,60,41,41,41,42,43,
+ 43,43,44,44,44,44,53,53,70,70,
+ 70,70,66,88,89,89,90,90,91,91,
+ 110,110,111,111,112,112,112,112,114,114,
+ 113,113,113,115,115,83,83,1,14,19,
+ 15,388,579,43,482,408,219,521,493,523,
+ 522,555,524,568,567,73,90,133,209,342,
+ 14,19,15,388,40,135,132,134,158,270,
+ 14,19,15,388,579,43,482,408,389,521,
+ 493,523,522,555,524,568,567,73,276,137,
+ 432,164,318,14,19,15,388,33,141,144,
+ 147,150,318,14,19,15,388,32,387,1210,
+ 1263,1444,1481,1499,1205,269,549,371,496,580,
+ 597,6,278,215,1550,217,1592,219,220,225,
+ 339,264,1103,1098,267,279,250,209,191,612,
+ 270,14,19,15,388,579,43,482,408,389,
+ 521,493,523,522,555,524,568,567,73,276,
+ 195,14,19,15,388,579,43,482,408,389,
+ 521,493,523,522,555,524,568,567,73,276,
+ 98,98,334,334,318,14,19,15,388,579,
+ 43,482,408,278,521,493,523,522,555,524,
+ 568,567,73,90,599,16,279,1130,390,284,
+ 1467,285,51,280,318,14,19,15,388,42,
+ 43,482,408,10,521,846,281,145,14,19,
+ 15,388,579,43,482,408,1384,521,493,523,
+ 522,555,524,568,567,73,1368,166,23,22,
+ 235,36,22,476,115,387,366,14,19,15,
+ 388,579,43,482,408,1387,521,493,523,522,
+ 555,524,568,567,73,1477,170,14,19,15,
+ 388,579,43,482,408,286,521,493,523,522,
+ 555,524,568,567,73,1606,1543,211,262,236,
+ 294,14,19,15,388,579,43,482,408,382,
+ 521,493,523,522,555,524,568,567,73,276,
+ 318,14,19,15,388,579,43,482,408,373,
+ 521,493,523,522,555,524,568,567,73,91,
+ 390,420,609,127,318,14,19,15,388,579,
+ 43,482,408,282,521,493,523,522,555,524,
+ 568,567,73,84,318,14,19,15,388,579,
+ 43,482,408,251,521,493,523,522,555,524,
+ 568,567,73,83,318,14,19,15,388,579,
+ 43,482,408,1556,521,493,523,522,555,524,
+ 568,567,73,82,318,14,19,15,388,579,
+ 43,482,408,245,521,493,523,522,555,524,
+ 568,567,73,81,318,14,19,15,388,579,
+ 43,482,408,408,521,493,523,522,555,524,
+ 568,567,73,80,318,14,19,15,388,579,
+ 43,482,408,550,521,493,523,522,555,524,
+ 568,567,73,79,318,14,19,15,388,579,
+ 43,482,408,554,521,493,523,522,555,524,
+ 568,567,73,78,318,14,19,15,388,579,
+ 43,482,408,564,521,493,523,522,555,524,
+ 568,567,73,77,318,14,19,15,388,579,
+ 43,482,408,237,521,493,523,522,555,524,
+ 568,567,73,76,318,14,19,15,388,579,
+ 43,482,408,573,521,493,523,522,555,524,
+ 568,567,73,75,318,14,19,15,388,579,
+ 43,482,408,49,521,493,523,522,555,524,
+ 568,567,73,74,318,14,19,15,388,42,
+ 43,482,763,133,209,518,30,66,350,31,
+ 192,135,132,134,158,318,14,19,15,388,
+ 579,43,482,408,598,521,493,523,522,555,
+ 524,568,567,73,1612,137,949,164,220,310,
+ 387,166,400,110,141,144,147,150,318,14,
+ 19,15,388,42,39,1210,1263,1444,1481,1499,
+ 1205,318,14,19,15,388,579,43,482,408,
+ 1031,521,493,523,522,555,524,568,567,73,
+ 1626,318,14,19,15,388,42,43,482,408,
+ 360,521,493,523,522,555,524,568,567,92,
+ 318,14,19,15,388,42,43,482,408,442,
+ 521,493,523,522,555,524,568,567,92,318,
+ 14,19,15,388,42,43,613,1627,318,14,
+ 19,15,388,42,43,482,803,318,14,19,
+ 15,388,42,43,482,408,208,521,493,523,
+ 522,555,524,568,567,92,318,14,19,15,
+ 388,42,43,482,408,409,521,493,523,522,
+ 555,524,568,567,92,318,14,19,15,388,
+ 42,43,643,1634,318,14,19,15,388,42,
+ 38,591,1061,318,14,19,15,388,42,43,
+ 482,408,199,521,493,523,522,555,524,568,
+ 567,92,318,14,19,15,388,42,43,482,
+ 408,608,521,493,523,522,555,524,568,567,
+ 72,69,318,14,19,15,388,42,37,200,
+ 881,318,14,19,15,388,42,43,482,408,
+ 590,521,493,523,522,848,269,607,194,540,
+ 504,540,402,349,214,1550,217,1592,219,220,
+ 225,1565,262,1103,1098,267,182,151,258,249,
+ 209,249,209,270,272,587,334,269,271,617,
+ 576,259,615,535,1594,214,1550,217,1592,219,
+ 220,225,1099,262,1103,1098,267,273,882,1536,
+ 215,1550,217,1592,219,220,225,1222,256,1232,
+ 252,1694,1265,318,14,19,15,388,42,43,
+ 482,408,614,521,493,523,522,555,524,879,
+ 318,14,19,15,388,42,43,482,408,1694,
+ 521,493,523,522,555,880,318,14,19,15,
+ 388,42,43,482,408,49,521,493,523,864,
+ 97,513,318,14,19,15,388,42,36,6,
+ 1610,1694,559,1630,1694,133,209,323,1523,334,
+ 133,209,563,136,132,134,158,478,140,132,
+ 134,158,250,209,214,1550,217,1592,219,220,
+ 225,21,250,209,287,614,1694,138,1132,164,
+ 20,1694,139,461,164,334,142,145,148,151,
+ 318,14,19,15,388,42,43,482,408,513,
+ 521,493,845,133,209,590,613,268,1610,195,
+ 197,143,132,134,158,823,783,318,14,19,
+ 15,388,42,43,482,408,1632,521,847,1694,
+ 1071,181,214,1550,217,1592,219,220,225,318,
+ 14,19,15,388,42,35,1132,318,14,19,
+ 15,388,42,43,482,408,255,683,318,14,
+ 19,15,388,42,43,482,408,6,703,318,
+ 14,19,15,388,42,34,1525,196,197,318,
+ 14,19,15,388,42,43,482,408,478,723,
+ 318,14,19,15,388,42,43,482,408,227,
+ 743,529,323,599,540,6,462,540,1610,1694,
+ 1513,237,1211,1694,1539,517,221,14,19,15,
+ 388,42,35,272,249,209,269,249,209,289,
+ 1694,269,214,1550,217,1592,219,220,225,242,
+ 1694,1694,262,1103,1098,267,1536,262,1103,1098,
+ 267,221,14,19,15,388,42,35,6,6,
+ 470,1265,386,545,466,386,261,307,307,454,
+ 193,1694,1101,1694,243,318,14,19,15,388,
+ 42,46,194,194,133,209,546,609,1694,855,
+ 1386,1386,146,132,134,158,323,478,86,86,
+ 88,495,334,453,453,318,14,19,15,388,
+ 42,45,318,14,19,15,388,42,44,500,
+ 239,133,209,1100,274,6,6,452,1126,149,
+ 132,134,158,372,1535,454,334,6,1640,133,
+ 209,1694,823,588,1229,588,1545,152,132,134,
+ 158,587,823,6,823,588,334,1071,275,128,
+ 1552,206,1598,530,823,588,86,194,1694,194,
+ 611,1237,79,227,823,1383,590,1383,221,194,
+ 1694,823,1543,254,1694,372,1100,1383,269,194,
+ 1482,190,1097,190,823,224,1071,1383,1090,1599,
+ 1285,1599,26,190,264,1103,1098,267,246,1071,
+ 1595,1599,594,190,391,590,6,454,128,600,
+ 1613,1599,254,823,205,454,478,6,823,1642,
+ 166,1097,478,590,360,254,410,223,1071,1172,
+ 1129,184,1482,194,1097,1100,478,478,86,238,
+ 590,1383,590,305,478,240,86,1694,1643,183,
+ 590,878,334,572,254,1694,1694,191,1694,241,
+ 286,1516,1694,1097,1694,1694,201,288,202,1117,
+ 1694,1694,1694,205,226,230,277,1694,1694,1694,
+ 1694,316,1694,1694,1694,1694,1694,1694,1255,1129,
+ 1694,0,17,178,0,18,177,0,1,1916,
+ 0,1,1927,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,0,6,7,8,0,
+ 10,11,12,13,14,15,16,17,18,19,
+ 20,0,22,23,24,25,26,27,28,0,
+ 0,1,0,12,4,0,36,37,38,39,
+ 40,41,42,43,44,45,46,47,0,1,
+ 0,21,4,3,6,7,8,57,58,59,
+ 51,52,53,54,16,0,31,32,0,1,
+ 2,3,24,25,26,27,28,9,0,1,
+ 51,52,53,54,36,37,38,39,40,41,
+ 42,43,44,45,46,47,0,0,1,49,
+ 50,4,6,7,8,57,58,59,0,0,
+ 1,33,16,4,0,0,51,52,53,54,
+ 24,25,26,27,28,0,0,0,1,3,
+ 21,4,36,37,38,39,40,41,42,43,
+ 44,45,46,47,0,1,2,3,4,5,
+ 0,1,2,3,10,11,12,13,14,15,
+ 16,17,18,19,20,0,22,23,3,0,
+ 1,2,3,4,5,49,50,63,34,10,
+ 11,12,13,14,15,16,17,18,19,20,
+ 0,22,23,0,0,1,2,3,4,5,
+ 10,11,9,34,10,11,12,13,14,15,
+ 0,17,18,19,20,21,22,23,0,0,
+ 0,1,2,3,4,5,0,1,2,35,
+ 10,11,12,13,14,15,0,17,18,19,
+ 20,5,22,23,0,0,1,2,3,4,
+ 0,0,1,3,34,10,11,12,13,14,
+ 15,0,17,18,19,20,30,22,23,0,
+ 1,2,3,4,55,31,32,67,68,10,
+ 11,12,13,14,15,0,17,18,19,20,
+ 21,22,23,0,1,2,3,4,80,49,
+ 50,65,0,10,11,12,13,14,15,0,
+ 17,18,19,20,21,22,23,0,1,2,
+ 3,4,0,1,79,64,4,10,11,12,
+ 13,14,15,0,17,18,19,20,5,22,
+ 23,0,1,2,3,4,0,62,0,0,
+ 2,10,11,12,13,14,15,9,17,18,
+ 19,20,29,22,23,0,1,2,3,4,
+ 0,0,0,64,3,10,11,12,13,14,
+ 15,0,17,18,19,20,0,22,23,0,
+ 0,2,3,21,5,6,7,8,9,0,
+ 30,0,1,2,33,16,5,0,0,1,
+ 9,62,4,24,25,26,27,28,29,0,
+ 21,2,3,33,5,6,7,8,9,21,
+ 29,0,1,2,3,16,0,56,31,32,
+ 9,0,0,24,25,26,27,28,29,63,
+ 69,70,71,72,73,74,75,76,77,78,
+ 0,0,21,2,3,0,6,7,8,0,
+ 9,6,7,8,5,0,16,0,0,0,
+ 1,16,5,4,24,25,26,27,28,24,
+ 25,26,27,28,0,0,0,2,29,0,
+ 6,7,8,0,9,6,7,8,13,14,
+ 16,34,0,1,2,16,0,0,24,25,
+ 26,27,28,24,25,26,27,28,0,0,
+ 2,2,3,5,0,60,61,9,9,0,
+ 6,7,8,48,0,6,7,8,0,0,
+ 6,7,8,0,6,7,8,29,0,56,
+ 0,66,0,0,6,7,8,55,6,7,
+ 8,0,0,10,11,0,5,60,61,0,
+ 31,32,10,11,31,32,0,0,9,0,
+ 0,5,5,0,5,2,0,0,0,0,
+ 29,30,9,5,5,9,0,0,0,12,
+ 0,21,0,0,0,29,0,0,0,9,
+ 0,0,35,0,35,0,0,48,21,0,
+ 0,56,0,0,35,0,30,0,30,0,
+ 0,0,0,30,48,33,30,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,65,0,0,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,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,
+ 1694,610,1438,1319,611,1,1904,1905,1906,58,
+ 1212,1072,1349,372,362,329,1855,1704,1705,1706,
+ 1707,63,1024,888,1856,1854,1907,1857,1853,60,
+ 1694,1873,1694,1270,1874,53,1860,1865,1864,1862,
+ 1863,1861,1866,1867,1859,1868,1869,1870,1694,1872,
+ 47,1219,1871,1492,1904,1905,1906,1005,883,849,
+ 1370,1359,1338,1327,1855,59,834,968,257,1916,
+ 1102,1,1856,1854,1907,1857,1853,497,1,1691,
+ 1370,1359,1338,1327,1860,1865,1864,1862,1863,1861,
+ 1866,1867,1859,1868,1869,1870,127,1694,1723,1485,
+ 1455,1724,1904,1905,1906,1005,883,849,1694,1694,
+ 1873,1947,1855,1874,67,1694,1370,1359,1338,1327,
+ 1856,1854,1907,1857,1853,1694,49,204,1873,1492,
+ 1347,1874,1860,1865,1864,1862,1863,1861,1866,1867,
+ 1859,1868,1869,1870,1,1711,1438,1396,1712,1697,
+ 1694,1916,1379,1443,1212,1072,1349,372,362,329,
+ 526,1704,1705,1706,1707,1694,1024,888,1133,1694,
+ 1711,1438,1431,1712,1697,1485,1455,1081,1696,1212,
+ 1072,1349,372,362,329,901,1704,1705,1706,1707,
+ 50,1024,888,266,1,1711,1438,1319,1712,27,
+ 1015,959,497,1696,1212,1072,1349,372,362,329,
+ 71,1704,1705,1706,1707,1607,1024,888,1694,1694,
+ 1694,1711,1438,1319,1712,1697,1,1916,1379,27,
+ 1212,1072,1349,372,362,329,1694,1704,1705,1706,
+ 1707,1703,1024,888,57,1694,1,1,1,1,
+ 48,1694,1928,1492,1696,1,1,1,1,1,
+ 1,69,1,1,1,1,1279,1,1,1,
+ 1711,1438,1319,1712,1052,834,968,1163,1596,1212,
+ 1072,1349,372,362,329,65,1704,1705,1706,1707,
+ 1607,1024,888,1694,1711,1438,1319,1712,1681,1485,
+ 1455,1702,1694,1212,1072,1349,372,362,329,70,
+ 1704,1705,1706,1707,1607,1024,888,1694,1711,1438,
+ 1319,1712,1694,1873,2000,1180,1874,1212,1072,1349,
+ 372,362,329,1694,1704,1705,1706,1707,1699,1024,
+ 888,1694,1711,1439,1319,1712,1694,1196,265,66,
+ 1125,1212,1072,1349,372,362,329,497,1704,1705,
+ 1706,1707,1698,1024,888,1,1711,1438,1319,1712,
+ 87,1,1694,1180,1133,1212,1072,1349,372,362,
+ 329,42,1704,1705,1706,1707,68,1024,888,17,
+ 1,1682,1682,391,1682,178,178,178,1682,41,
+ 590,1,1688,1102,1947,178,1699,56,1694,1873,
+ 497,1196,1874,178,178,178,178,178,1682,18,
+ 391,1685,1685,1947,1685,177,177,177,1685,1385,
+ 1698,263,1916,1102,1443,177,1694,814,834,968,
+ 497,186,1694,177,177,177,177,177,1685,1081,
+ 794,774,754,734,714,674,694,654,634,614,
+ 128,260,1505,1381,1,129,1904,1905,1906,1,
+ 497,1904,1905,1906,89,61,1855,1694,1694,203,
+ 1476,1855,1697,1476,1856,1854,1907,1857,1853,1856,
+ 1854,1907,1857,1853,130,31,1694,1440,89,131,
+ 1904,1905,1906,207,1506,1904,1905,1906,1718,1719,
+ 1855,1696,1,1916,1379,1855,1694,62,1856,1854,
+ 1907,1857,1853,1856,1854,1907,1857,1853,1,263,
+ 1381,1381,1443,1699,245,1297,484,497,497,1694,
+ 1,1,1,451,246,1904,1905,1906,244,55,
+ 1,1,1,54,1904,1905,1906,1698,247,940,
+ 1694,450,248,52,1904,1905,1906,996,1904,1905,
+ 1906,1694,51,1015,959,1694,1699,1297,484,1694,
+ 834,968,1015,959,834,968,1,1,921,1694,
+ 185,1699,189,218,1701,1531,283,64,1,1,
+ 1698,1160,497,1703,188,977,251,187,28,1270,
+ 216,1517,1,28,198,1698,203,1694,1694,497,
+ 1694,1694,189,1694,1700,1694,1694,1227,1533,1694,
+ 1694,570,1694,1694,188,1694,1286,1694,430,1694,
+ 1694,1694,1694,1721,1382,1946,2480,1694,1694,1694,
+ 1694,1694,1694,1694,1694,1694,1694,1694,1694,1694,
+ 1694,1694,1694,1702,1694,1694,1694,1694,1694,1033
+ };
+ };
+ 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,
+ 426,1,80,41,80,80,80,80,80,80,
+ 80,80,80,337,3,181,178,185,183,191,
+ 189,193,192,195,194,10,80,337,163,163,
+ 256,337,321,321,378,80,80,80,80,80,
+ 80,80,80,80,80,80,80,80,80,80,
+ 80,80,80,80,80,80,80,80,80,80,
+ 80,80,80,80,80,80,163,72,260,74,
+ 291,161,160,231,243,243,70,70,243,70,
+ 243,351,117,117,163,45,178,178,183,183,
+ 183,183,181,181,189,185,185,192,191,224,
+ 194,193,166,54,256,251,97,45,374,78,
+ 163,397,294,206,262,206,262,331,206,80,
+ 54,251,374,374,45,77,74,163,254,351,
+ 162,296,262,262,262,262,331,331,333,49,
+ 54,374,251,80,80,45,78,291,219,218,
+ 260,296,163,262,288,324,262,262,288,333,
+ 226,333,331,288,52,229,321,80,48,54,
+ 251,45,45,163,397,294,254,288,326,288,
+ 288,80,321,333,56,45,321,80,333,296,
+ 202,80,201,93,260,288,45,288,163,162,
+ 326,80,93,322
+ };
+ };
+ 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,
+ 80,0,65,9,2,48,66,13,14,12,
+ 3,10,11,49,50,31,32,51,52,53,
+ 54,60,61,62,63,64,67,68,35,56,
+ 69,70,71,72,73,75,74,76,77,78,
+ 55,29,80,30,34,5,0,56,9,48,
+ 0,5,35,9,48,13,14,12,3,10,
+ 11,22,23,15,2,17,18,19,20,1,
+ 4,21,0,6,7,8,16,34,5,17,
+ 18,19,20,4,13,14,12,10,11,22,
+ 23,15,3,2,1,0,6,7,8,2,
+ 17,18,19,20,1,4,13,14,12,3,
+ 10,11,22,23,15,0,7,16,28,8,
+ 27,26,25,6,24,48,66,13,14,12,
+ 10,11,49,50,31,32,51,52,53,54,
+ 60,61,62,63,64,67,68,56,69,70,
+ 71,72,73,74,75,76,77,78,3,2,
+ 9,30,29,5,0,56,69,70,71,72,
+ 73,74,75,76,77,78,21,3,49,50,
+ 10,11,32,31,51,52,53,54,60,61,
+ 12,62,63,64,34,29,35,80,67,68,
+ 55,65,5,30,0,24,6,25,26,27,
+ 7,16,28,8,1,3,21,2,5,30,
+ 29,65,9,55,0,5,30,35,56,0,
+ 44,36,41,39,40,38,37,42,43,45,
+ 46,47,55,65,28,25,16,24,27,26,
+ 6,7,8,30,1,5,29,2,9,3,
+ 0,24,36,6,37,57,25,38,26,39,
+ 40,27,7,41,42,16,58,28,59,43,
+ 44,8,45,46,47,1,4,35,5,0,
+ 3,2,9,29,5,24,36,6,37,57,
+ 25,38,26,39,40,27,7,41,42,16,
+ 58,28,59,43,44,8,45,46,47,33,
+ 4,1,0,65,5,3,1,2,55,0,
+ 1,4,5,35,30,0,15,17,18,19,
+ 20,2,13,14,12,3,10,11,22,23,
+ 4,1,57,58,59,44,36,41,39,40,
+ 38,37,42,43,45,46,47,28,25,16,
+ 24,27,26,6,7,8,0,5,29,15,
+ 17,18,19,20,1,4,2,13,14,12,
+ 3,10,11,22,23,0,24,36,6,37,
+ 57,25,38,26,39,40,27,7,41,42,
+ 16,58,28,59,43,44,8,45,46,47,
+ 1,4,33,3,0,15,17,18,19,20,
+ 1,4,2,13,14,12,3,10,11,22,
+ 23,79,0
+ };
+ };
+ public final static byte asr[] = Asr.asr;
+ public final int asr(int index) { return asr[index]; }
+
+ public interface Nasb {
+ public final static byte nasb[] = {0,
+ 83,8,17,8,17,17,17,17,17,17,
+ 17,17,17,64,8,8,8,8,8,8,
+ 8,8,8,8,8,8,17,64,41,41,
+ 55,1,19,19,68,65,17,17,17,17,
+ 17,17,17,17,17,17,17,17,17,17,
+ 17,17,65,17,17,17,17,17,17,17,
+ 17,17,17,17,17,17,41,8,73,21,
+ 54,31,31,47,48,48,27,27,48,27,
+ 48,43,8,8,41,23,8,8,8,8,
+ 8,8,8,8,8,8,8,8,8,8,
+ 8,8,8,81,56,81,16,23,62,22,
+ 41,71,40,8,81,8,81,81,8,17,
+ 16,81,62,62,23,22,9,41,34,2,
+ 8,80,81,75,81,75,27,81,25,11,
+ 81,62,9,17,17,23,22,33,31,31,
+ 73,80,41,75,29,59,86,75,29,25,
+ 8,8,27,29,15,8,27,17,13,16,
+ 9,23,23,41,71,40,35,29,50,29,
+ 29,17,27,25,17,23,27,17,25,79,
+ 60,17,8,50,73,29,23,29,41,41,
+ 50,17,37,8
+ };
+ };
+ public final static byte nasb[] = Nasb.nasb;
+ public final int nasb(int index) { return nasb[index]; }
+
+ public interface Nasr {
+ public final static char nasr[] = {0,
+ 4,77,76,75,74,73,72,0,20,0,
+ 89,0,91,0,66,9,4,0,68,0,
+ 9,4,23,0,51,0,27,0,26,0,
+ 25,0,22,9,43,42,36,34,0,9,
+ 22,0,61,62,63,64,52,28,0,9,
+ 36,34,0,22,9,43,42,0,9,67,
+ 0,58,0,32,9,45,0,9,84,0,
+ 9,24,49,0,56,9,32,0,86,24,
+ 9,0,9,83,0,9,32,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,
+ 85,2,9,86,87,48,64,76,1,10,
+ 11,8,6,7,68,69,81,82,83,84,
+ 3,12,13,44,55,60,63,72,90,42,
+ 16,17,30,89,91,47,52,56,61,62,
+ 66,67,74,75,78,79,80,4,14,15,
+ 18,19,20,21,29,31,54,70,73,22,
+ 23,24,25,26,92,5,27,28,32,33,
+ 34,35,36,37,38,39,40,41,93,94,
+ 45,46,49,50,51,53,57,58,59,65,
+ 71,77,88
+ };
+ };
+ 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,
+ 0,0,0,101,105,106,107,108,0,109,
+ 110,111,112,113,114,115,116,117,118,129,
+ 0,97,96,122,149,98,121,128,0,0,
+ 0,140,145,147,0,148,0,0,0,0,
+ 158,159,160,0,100,120,137,139,146,155,
+ 0,131,136,0,0,138,150,153,154,157,
+ 132,133,134,135,144,161,99,102,103,104,
+ 119,123,124,125,126,127,130,142,0,0,
+ 143,152,95,0,141,151,156,162,163,0,
+ 164,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 char nonterminalIndex[] = NonterminalIndex.nonterminalIndex;
+ public final int nonterminalIndex(int index) { return nonterminalIndex[index]; }
+
+ public interface ScopePrefix {
+ public final static char scopePrefix[] = {
+ 158,80,33,39,87,107,113,138,12,19,
+ 49,67,119,124,26,45,97,154,176,180,
+ 147,1,1,30,54,77,184,6,101,129,
+ 166,93,57,57,57
+ };
+ };
+ public final static char scopePrefix[] = ScopePrefix.scopePrefix;
+ public final int scopePrefix(int index) { return scopePrefix[index]; }
+
+ public interface ScopeSuffix {
+ public final static char scopeSuffix[] = {
+ 17,17,4,4,17,17,17,144,17,24,
+ 4,24,17,17,24,4,95,24,24,4,
+ 151,4,4,24,4,24,24,9,104,132,
+ 169,95,64,59,72
+ };
+ };
+ public final static char scopeSuffix[] = ScopeSuffix.scopeSuffix;
+ public final int scopeSuffix(int index) { return scopeSuffix[index]; }
+
+ public interface ScopeLhs {
+ public final static char scopeLhs[] = {
+ 4,63,25,25,63,61,61,98,53,44,
+ 25,39,61,61,44,25,48,5,4,4,
+ 18,91,90,42,25,36,2,66,48,99,
+ 4,48,39,37,39
+ };
+ };
+ public final static char scopeLhs[] = ScopeLhs.scopeLhs;
+ public final int scopeLhs(int index) { return scopeLhs[index]; }
+
+ public interface ScopeLa {
+ public final static byte scopeLa[] = {
+ 35,35,34,34,35,35,35,86,35,29,
+ 34,29,35,35,29,34,65,29,29,34,
+ 55,34,34,29,34,29,29,56,1,92,
+ 29,65,2,2,2
+ };
+ };
+ public final static byte scopeLa[] = ScopeLa.scopeLa;
+ public final int scopeLa(int index) { return scopeLa[index]; }
+
+ public interface ScopeStateSet {
+ public final static byte scopeStateSet[] = {
+ 34,19,23,23,19,19,19,-1,88,27,
+ 23,11,19,19,27,23,5,34,34,34,
+ 63,1,3,27,23,11,34,89,5,-1,
+ 34,5,11,11,11
+ };
+ };
+ public final static byte scopeStateSet[] = ScopeStateSet.scopeStateSet;
+ public final int scopeStateSet(int index) { return scopeStateSet[index]; }
+
+ public interface ScopeRhs {
+ public final static char scopeRhs[] = {0,
+ 139,9,0,96,0,181,102,0,31,136,
+ 0,144,163,102,21,0,98,0,150,102,
+ 2,135,0,97,0,150,102,2,0,153,
+ 2,0,112,16,175,102,9,0,112,175,
+ 102,16,9,0,112,16,9,0,112,175,
+ 102,9,0,112,9,0,129,0,2,0,
+ 151,97,0,2,97,0,150,102,2,129,
+ 0,2,0,150,97,0,140,2,0,144,
+ 173,102,21,120,57,0,144,173,102,21,
+ 57,0,125,0,99,0,178,102,125,0,
+ 102,125,0,141,99,0,148,102,21,120,
+ 59,0,148,102,21,120,58,0,148,102,
+ 21,59,0,148,102,21,58,0,187,85,
+ 0,77,2,100,97,99,0,187,115,138,
+ 2,89,0,53,0,0,138,68,110,0,
+ 29,117,0,162,2,15,0,144,163,102,
+ 21,115,162,2,0,162,2,0,97,3,
+ 0,104,0,98,0,177,2,97,0,138,
+ 9,97,0,138,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,
+ 390,0,389,0,1545,1599,1535,1525,1523,0,
+ 1117,1279,1379,1211,360,1102,1071,0,823,1205,
+ 307,0,1592,1550,1103,1098,360,1102,1071,1543,
+ 1381,1386,0,1431,1396,1180,1163,1196,1081,1297,
+ 484,1270,968,834,1370,1359,1338,1327,1492,1485,
+ 1455,1015,959,372,362,1349,1319,1212,1072,1024,
+ 888,329,1033,996,977,940,921,901,855,546,
+ 1052,526,497,814,794,774,754,734,714,694,
+ 674,654,634,614,307,590,454,570,410,430,
+ 339,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,176,102,164,15,23,22,11,10,3,
+ 12,14,13,2,97,101,100,104,103,106,
+ 105,108,107,110,109,98,30,2,162,138,
+ 125,102,66,48,2,9,11,10,50,49,
+ 3,54,53,52,51,31,32,12,61,60,
+ 63,62,68,67,64,78,77,76,74,75,
+ 73,72,71,70,69,56,162,115,102,9,
+ 2,136,135,165,166,167,59,58,168,57,
+ 169,170,1,4,177,138,100,100,103,103,
+ 103,103,101,101,105,104,104,107,106,138,
+ 109,108,115,21,142,3,16,112,102,3,
+ 153,102,2,120,21,120,21,21,120,55,
+ 102,3,102,102,112,175,151,150,117,102,
+ 152,102,21,102,21,102,102,21,163,102,
+ 21,102,151,175,16,112,3,2,127,129,
+ 102,30,150,102,148,125,149,102,148,173,
+ 120,174,102,144,30,181,48,9,182,102,
+ 151,112,112,140,102,2,142,148,102,148,
+ 144,56,30,173,56,139,48,9,163,102,
+ 178,55,140,2,102,144,139,144,150,179,
+ 30,55,142,30
+ };
+ };
+ public final static char inSymb[] = InSymb.inSymb;
+ public final int inSymb(int index) { return inSymb[index]; }
+
+ public interface Name {
+ public final static String name[] = {
+ "",
+ "[",
+ "(",
+ "{",
+ ".",
+ "->",
+ "++",
+ "--",
+ "&",
+ "*",
+ "+",
+ "-",
+ "~",
+ "!",
+ "/",
+ "%",
+ ">>",
+ "<<",
+ "<",
+ ">",
+ "<=",
+ ">=",
+ "==",
+ "!=",
+ "^",
+ "|",
+ "&&",
+ "||",
+ "?",
+ ":",
+ "...",
+ "=",
+ "*=",
+ "/=",
+ "%=",
+ "+=",
+ "-=",
+ ">>=",
+ "<<=",
+ "&=",
+ "^=",
+ "|=",
+ ",",
+ "$empty",
+ "auto",
+ "break",
+ "case",
+ "char",
+ "const",
+ "continue",
+ "default",
+ "do",
+ "double",
+ "else",
+ "enum",
+ "extern",
+ "float",
+ "for",
+ "goto",
+ "if",
+ "inline",
+ "int",
+ "long",
+ "register",
+ "restrict",
+ "return",
+ "short",
+ "signed",
+ "sizeof",
+ "static",
+ "struct",
+ "switch",
+ "typedef",
+ "union",
+ "unsigned",
+ "void",
+ "volatile",
+ "while",
+ "_Bool",
+ "_Complex",
+ "_Imaginary",
+ "integer",
+ "floating",
+ "charconst",
+ "stringlit",
+ "identifier",
+ "Completion",
+ "EndOfCompletion",
+ "Invalid",
+ "RightBracket",
+ "RightParen",
+ "RightBrace",
+ "SemiColon",
+ "ERROR_TOKEN",
+ "EOF_TOKEN",
+ "no_cast_start",
+ "]",
+ ")",
+ "}",
+ ";",
+ "expression",
+ "postfix_expression",
+ "member_name",
+ "type_name",
+ "initializer_list",
+ "unary_expression",
+ "cast_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",
+ "conditional_expression",
+ "assignment_expression",
+ "expression_list_actual",
+ "constant_expression",
+ "identifier_or_typedefname",
+ "declaration_specifiers",
+ "simple_declaration_specifiers",
+ "struct_or_union_declaration_sp" +
+ "ecifiers",
+ "elaborated_declaration_specifi" +
+ "ers",
+ "enum_declaration_specifiers",
+ "typdef_name_declaration_specif" +
+ "iers",
+ "no_type_declaration_specifier",
+ "type_qualifier",
+ "no_type_declaration_specifiers",
+ "simple_type_specifier",
+ "struct_or_union_specifier",
+ "elaborated_specifier",
+ "enum_specifier",
+ "typedef_name_in_declspec",
+ "initializer",
+ "declarator",
+ "struct_declaration_list",
+ "struct_declaration",
+ "specifier_qualifier_list",
+ "struct_declarator_list",
+ "complete_struct_declarator",
+ "enumerator_list",
+ "enumerator",
+ "direct_declarator",
+ "pointer_seq",
+ "array_direct_declarator",
+ "basic_direct_declarator",
+ "array_modifier",
+ "parameter_type_list",
+ "identifier_list",
+ "array_modifier_type_qualifiers",
+ "type_qualifier_list",
+ "parameter_list",
+ "parameter_declaration",
+ "complete_parameter_declarator",
+ "abstract_declarator",
+ "direct_abstract_declarator",
+ "basic_direct_abstract_declarat" +
+ "or",
+ "array_direct_abstract_declarat" +
+ "or",
+ "designated_initializer",
+ "designation",
+ "designator_list",
+ "designator"
+ };
+ };
+ public final static String name[] = Name.name;
+ public final String name(int index) { return name[index]; }
+
+ public final static int
+ ERROR_SYMBOL = 79,
+ SCOPE_UBOUND = 34,
+ SCOPE_SIZE = 35,
+ MAX_NAME_LENGTH = 38;
+
+ 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 = 204,
+ NT_OFFSET = 93,
+ LA_STATE_OFFSET = 2000,
+ MAX_LA = 2,
+ NUM_RULES = 306,
+ NUM_NONTERMINALS = 115,
+ NUM_SYMBOLS = 208,
+ SEGMENT_SIZE = 8192,
+ START_STATE = 1588,
+ IDENTIFIER_SYMBOL = 0,
+ EOFT_SYMBOL = 80,
+ EOLT_SYMBOL = 80,
+ ACCEPT_ACTION = 1681,
+ ERROR_ACTION = 1694;
+
+ 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/c99/C99NoCastExpressionParsersym.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99NoCastExpressionParsersym.java
new file mode 100644
index 00000000000..777d2a8bc82
--- /dev/null
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99NoCastExpressionParsersym.java
@@ -0,0 +1,210 @@
+/*******************************************************************************
+* 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.c99;
+
+public interface C99NoCastExpressionParsersym {
+ public final static int
+ TK_auto = 24,
+ TK_break = 81,
+ TK_case = 82,
+ TK_char = 36,
+ TK_const = 6,
+ TK_continue = 83,
+ TK_default = 84,
+ TK_do = 85,
+ TK_double = 37,
+ TK_else = 86,
+ TK_enum = 57,
+ TK_extern = 25,
+ TK_float = 38,
+ TK_for = 87,
+ TK_goto = 88,
+ TK_if = 89,
+ TK_inline = 26,
+ TK_int = 39,
+ TK_long = 40,
+ TK_register = 27,
+ TK_restrict = 7,
+ TK_return = 90,
+ TK_short = 41,
+ TK_signed = 42,
+ TK_sizeof = 15,
+ TK_static = 16,
+ TK_struct = 58,
+ TK_switch = 91,
+ TK_typedef = 28,
+ TK_union = 59,
+ TK_unsigned = 43,
+ TK_void = 44,
+ TK_volatile = 8,
+ TK_while = 92,
+ TK__Bool = 45,
+ TK__Complex = 46,
+ TK__Imaginary = 47,
+ TK_integer = 17,
+ TK_floating = 18,
+ TK_charconst = 19,
+ TK_stringlit = 20,
+ TK_identifier = 1,
+ TK_Completion = 4,
+ TK_EndOfCompletion = 5,
+ TK_Invalid = 93,
+ TK_LeftBracket = 9,
+ TK_LeftParen = 2,
+ TK_LeftBrace = 21,
+ TK_Dot = 48,
+ TK_Arrow = 66,
+ TK_PlusPlus = 13,
+ TK_MinusMinus = 14,
+ TK_And = 12,
+ TK_Star = 3,
+ TK_Plus = 10,
+ TK_Minus = 11,
+ TK_Tilde = 22,
+ TK_Bang = 23,
+ TK_Slash = 49,
+ TK_Percent = 50,
+ TK_RightShift = 31,
+ TK_LeftShift = 32,
+ TK_LT = 51,
+ TK_GT = 52,
+ TK_LE = 53,
+ TK_GE = 54,
+ TK_EQ = 60,
+ TK_NE = 61,
+ TK_Caret = 62,
+ TK_Or = 63,
+ TK_AndAnd = 64,
+ TK_OrOr = 67,
+ TK_Question = 68,
+ TK_Colon = 55,
+ TK_DotDotDot = 33,
+ TK_Assign = 56,
+ TK_StarAssign = 69,
+ TK_SlashAssign = 70,
+ TK_PercentAssign = 71,
+ TK_PlusAssign = 72,
+ TK_MinusAssign = 73,
+ TK_RightShiftAssign = 74,
+ TK_LeftShiftAssign = 75,
+ TK_AndAssign = 76,
+ TK_CaretAssign = 77,
+ TK_OrAssign = 78,
+ TK_Comma = 30,
+ TK_RightBracket = 34,
+ TK_RightParen = 29,
+ TK_RightBrace = 35,
+ TK_SemiColon = 65,
+ TK_ERROR_TOKEN = 79,
+ TK_EOF_TOKEN = 80;
+
+ public final static String orderedTerminalSymbols[] = {
+ "",
+ "identifier",
+ "LeftParen",
+ "Star",
+ "Completion",
+ "EndOfCompletion",
+ "const",
+ "restrict",
+ "volatile",
+ "LeftBracket",
+ "Plus",
+ "Minus",
+ "And",
+ "PlusPlus",
+ "MinusMinus",
+ "sizeof",
+ "static",
+ "integer",
+ "floating",
+ "charconst",
+ "stringlit",
+ "LeftBrace",
+ "Tilde",
+ "Bang",
+ "auto",
+ "extern",
+ "inline",
+ "register",
+ "typedef",
+ "RightParen",
+ "Comma",
+ "RightShift",
+ "LeftShift",
+ "DotDotDot",
+ "RightBracket",
+ "RightBrace",
+ "char",
+ "double",
+ "float",
+ "int",
+ "long",
+ "short",
+ "signed",
+ "unsigned",
+ "void",
+ "_Bool",
+ "_Complex",
+ "_Imaginary",
+ "Dot",
+ "Slash",
+ "Percent",
+ "LT",
+ "GT",
+ "LE",
+ "GE",
+ "Colon",
+ "Assign",
+ "enum",
+ "struct",
+ "union",
+ "EQ",
+ "NE",
+ "Caret",
+ "Or",
+ "AndAnd",
+ "SemiColon",
+ "Arrow",
+ "OrOr",
+ "Question",
+ "StarAssign",
+ "SlashAssign",
+ "PercentAssign",
+ "PlusAssign",
+ "MinusAssign",
+ "RightShiftAssign",
+ "LeftShiftAssign",
+ "AndAssign",
+ "CaretAssign",
+ "OrAssign",
+ "ERROR_TOKEN",
+ "EOF_TOKEN",
+ "break",
+ "case",
+ "continue",
+ "default",
+ "do",
+ "else",
+ "for",
+ "goto",
+ "if",
+ "return",
+ "switch",
+ "while",
+ "Invalid"
+ };
+
+ public final static boolean isValidForParser = true;
+}
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 cea3422a98d..2eba59c6233 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
@@ -13,148 +13,174 @@
package org.eclipse.cdt.internal.core.dom.lrparser.c99;
-
import lpg.lpgjavaruntime.*;
-import org.eclipse.cdt.core.dom.lrparser.lpgextensions.ITrialUndoActionProvider;
-import org.eclipse.cdt.core.dom.lrparser.lpgextensions.AbstractTrialUndoActionProvider;
-import org.eclipse.cdt.core.dom.lrparser.lpgextensions.TrialUndoParser;
import java.util.*;
-
import org.eclipse.cdt.core.dom.ast.*;
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;
+
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;
-import org.eclipse.cdt.core.dom.lrparser.util.DebugUtil;
-
-public class C99Parser extends AbstractTrialUndoActionProvider< C99ParserAction , Object > implements IParserActionTokenProvider, IParser {
- private static ParseTable prs = new C99Parserprs();
- protected static final Action< C99ParserAction , Object >[] RULE_ACTIONS;
-
- {
- ruleAction = RULE_ACTIONS;
- }
-
- public C99Parser(LexStream lexStream) {
- super(lexStream);
-
- try {
- super.remapTerminalSymbols(orderedTerminalSymbols(), C99Parserprs.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(" " + C99Parsersym.orderedTerminalSymbols[id.intValue()]);
- }
- System.out.println();
- } catch (UndefinedEofSymbolException e) {
- throw new Error(new UndefinedEofSymbolException("The Lexer does not implement the Eof symbol " + C99Parsersym.orderedTerminalSymbols[C99Parserprs.EOFT_SYMBOL]));
- }
- }
-
- public C99Parser() { // constructor
- // this(new C99Lexer ());
- }
+public class C99Parser extends PrsStream implements RuleAction , IParserActionTokenProvider, IParser
+{
+ private static ParseTable prs = new C99Parserprs();
+ private BacktrackingParser btParser;
- public String[] orderedTerminalSymbols() {
- return C99Parsersym.orderedTerminalSymbols;
- }
+ public BacktrackingParser getParser() { return btParser; }
+ private void setResult(Object object) { btParser.setSym1(object); }
+ public Object getRhsSym(int i) { return btParser.getSym(i); }
- public String getTokenKindName(int kind) {
- return C99Parsersym.orderedTerminalSymbols[kind];
- }
+ 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 getEOFTokenKind() {
- return C99Parserprs.EOFT_SYMBOL;
- }
-
- public PrsStream getParseStream() {
- return (PrsStream) this;
- }
+ public int getRhsLastTokenIndex(int i) { return btParser.getLastToken(i); }
+ public IToken getRhsLastIToken(int i) { return super.getIToken(getRhsLastTokenIndex(i)); }
- //
- // Report error message for given error_token.
- //
- public final void reportErrorTokenMessage(int error_token, String msg) {
- int firsttok = super.getFirstRealToken(error_token), lasttok = super.getLastRealToken(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 int getLeftSpan() { return btParser.getFirstToken(); }
+ public IToken getLeftIToken() { return super.getIToken(getLeftSpan()); }
- public Object parser() {
- return parser(null, 0);
- }
-
- public Object parser(Monitor monitor) {
- return parser(monitor, 0);
- }
+ public int getRightSpan() { return btParser.getLastToken(); }
+ public IToken getRightIToken() { return super.getIToken(getRightSpan()); }
- public Object parser(int error_repair_count) {
- return parser(null, error_repair_count);
- }
+ 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 Object parser(Monitor monitor, int error_repair_count) {
- try {
- btParser = new TrialUndoParser((TokenStream) this, prs, (ITrialUndoActionProvider< Object >) this);
- } catch (NotBacktrackParseTableException e) {
- throw new Error(new NotBacktrackParseTableException("Regenerate C99Parserprs.java with -BACKTRACK option"));
- } catch (BadParseSymFileException e) {
- throw new Error(new BadParseSymFileException("Bad Parser Symbol File -- C99Parsersym.java"));
- }
+ public C99Parser(LexStream lexStream)
+ {
+ super(lexStream);
+
+ try
+ {
+ super.remapTerminalSymbols(orderedTerminalSymbols(), C99Parserprs.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(" " + C99Parsersym.orderedTerminalSymbols[id.intValue()]);
+ }
+ System.out.println();
+ }
+ catch(UndefinedEofSymbolException e)
+ {
+ throw new Error(new UndefinedEofSymbolException
+ ("The Lexer does not implement the Eof symbol " +
+ C99Parsersym.orderedTerminalSymbols[C99Parserprs.EOFT_SYMBOL]));
+ }
+ }
- try {
- Object result = (Object) btParser.parse(error_repair_count);
- btParser.commit();
- return result;
- } catch (BadParseException e) {
- reset(e.error_token); // point to error token
+ public String[] orderedTerminalSymbols() { return C99Parsersym.orderedTerminalSymbols; }
+ public String getTokenKindName(int kind) { return C99Parsersym.orderedTerminalSymbols[kind]; }
+ public int getEOFTokenKind() { return C99Parserprs.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);
+ }
- //DiagnoseParser diagnoseParser = new DiagnoseParser((TokenStream) this, prs);
- //diagnoseParser.diagnose(e.error_token);
- }
+ 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);
+ }
- return null;
- }
+ 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 C99Parserprs.java with -BACKTRACK option"));
+ }
+ catch (BadParseSymFileException e)
+ {
+ throw new Error(new BadParseSymFileException("Bad Parser Symbol File -- C99Parsersym.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 C99ParserAction action;
+private C99BuildASTParserAction action;
-//public C99Parser() { // constructor
-//}
+public C99Parser() { // constructor
+}
private void initActions(IASTTranslationUnit tu) {
- // binding resolution actions need access to IASTName nodes, temporary
- action = new C99ParserAction ();
- action.resolver = new C99TypedefTrackerParserAction (this);
- action.builder = new C99BuildASTParserAction ( C99ASTNodeFactory.DEFAULT_INSTANCE , this, tu);
- action.builder.setTokenMap( C99Parsersym .orderedTerminalSymbols);
- setParserAction(action);
+ action = new C99BuildASTParserAction ( C99ASTNodeFactory.DEFAULT_INSTANCE , this, tu);
+ action.setTokenMap( C99Parsersym .orderedTerminalSymbols);
}
public void addToken(IToken token) {
- token.setKind(mapKind(token.getKind()));
+ token.setKind(mapKind(token.getKind())); // TODO does mapKind need to be called?
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!
@@ -166,2283 +192,1049 @@ public IASTCompletionNode parse(IASTTranslationUnit tu) {
super.resetTokenStream(); // allow tokens to be garbage collected
// the completion node may be null
- IASTCompletionNode compNode = action.builder.getASTCompletionNode();
+ IASTCompletionNode compNode = action.getASTCompletionNode();
- action = null;
- parserAction = null;
+ //action = null;
+ //parserAction = null;
return compNode;
}
-
-public int getKind(int i) {
- int kind = super.getKind(i);
- // lexer feedback hack!
- 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));
}
- //
- // Initialize ruleAction array.
- //
- static {
- RULE_ACTIONS = new Action[309 + 1];
- RULE_ACTIONS[0] = null;
-
- RULE_ACTIONS[1] = new Action1();
- RULE_ACTIONS[2] = new Action2();
- RULE_ACTIONS[3] = new Action3();
- RULE_ACTIONS[12] = new Action12();
- RULE_ACTIONS[13] = new Action13();
- RULE_ACTIONS[14] = new Action14();
- RULE_ACTIONS[15] = new Action15();
- RULE_ACTIONS[17] = new Action17();
- RULE_ACTIONS[18] = new Action18();
- RULE_ACTIONS[22] = new Action22();
- RULE_ACTIONS[23] = new Action23();
- RULE_ACTIONS[24] = new Action24();
- RULE_ACTIONS[25] = new Action25();
- RULE_ACTIONS[26] = new Action26();
- RULE_ACTIONS[27] = new Action27();
- RULE_ACTIONS[28] = new Action28();
- RULE_ACTIONS[35] = new Action35();
- RULE_ACTIONS[36] = new Action36();
- RULE_ACTIONS[37] = new Action37();
- RULE_ACTIONS[38] = new Action38();
- RULE_ACTIONS[39] = new Action39();
- RULE_ACTIONS[40] = new Action40();
- RULE_ACTIONS[41] = new Action41();
- RULE_ACTIONS[42] = new Action42();
- RULE_ACTIONS[43] = new Action43();
- RULE_ACTIONS[44] = new Action44();
- RULE_ACTIONS[46] = new Action46();
- RULE_ACTIONS[48] = new Action48();
- RULE_ACTIONS[49] = new Action49();
- RULE_ACTIONS[50] = new Action50();
- RULE_ACTIONS[52] = new Action52();
- RULE_ACTIONS[53] = new Action53();
- RULE_ACTIONS[55] = new Action55();
- RULE_ACTIONS[56] = new Action56();
- RULE_ACTIONS[58] = new Action58();
- RULE_ACTIONS[59] = new Action59();
- RULE_ACTIONS[60] = new Action60();
- RULE_ACTIONS[61] = new Action61();
- RULE_ACTIONS[63] = new Action63();
- RULE_ACTIONS[64] = new Action64();
- RULE_ACTIONS[66] = new Action66();
- RULE_ACTIONS[68] = new Action68();
- RULE_ACTIONS[70] = new Action70();
- RULE_ACTIONS[72] = new Action72();
- RULE_ACTIONS[74] = new Action74();
- RULE_ACTIONS[76] = new Action76();
- RULE_ACTIONS[78] = new Action78();
- RULE_ACTIONS[79] = new Action79();
- RULE_ACTIONS[80] = new Action80();
- RULE_ACTIONS[81] = new Action81();
- RULE_ACTIONS[82] = new Action82();
- RULE_ACTIONS[83] = new Action83();
- RULE_ACTIONS[84] = new Action84();
- RULE_ACTIONS[85] = new Action85();
- RULE_ACTIONS[86] = new Action86();
- RULE_ACTIONS[87] = new Action87();
- RULE_ACTIONS[88] = new Action88();
- RULE_ACTIONS[91] = new Action91();
- RULE_ACTIONS[93] = new Action93();
- RULE_ACTIONS[103] = new Action103();
- RULE_ACTIONS[104] = new Action104();
- RULE_ACTIONS[105] = new Action105();
- RULE_ACTIONS[106] = new Action106();
- RULE_ACTIONS[107] = new Action107();
- RULE_ACTIONS[108] = new Action108();
- RULE_ACTIONS[112] = new Action112();
- RULE_ACTIONS[113] = new Action113();
- RULE_ACTIONS[114] = new Action114();
- RULE_ACTIONS[115] = new Action115();
- RULE_ACTIONS[116] = new Action116();
- RULE_ACTIONS[117] = new Action117();
- RULE_ACTIONS[119] = new Action119();
- RULE_ACTIONS[120] = new Action120();
- RULE_ACTIONS[121] = new Action121();
- RULE_ACTIONS[122] = new Action122();
- RULE_ACTIONS[123] = new Action123();
- RULE_ACTIONS[124] = new Action124();
- RULE_ACTIONS[125] = new Action125();
- RULE_ACTIONS[126] = new Action126();
- RULE_ACTIONS[127] = new Action127();
- RULE_ACTIONS[128] = new Action128();
- RULE_ACTIONS[129] = new Action129();
- RULE_ACTIONS[130] = new Action130();
- RULE_ACTIONS[131] = new Action131();
- RULE_ACTIONS[132] = new Action132();
- RULE_ACTIONS[133] = new Action133();
- RULE_ACTIONS[134] = new Action134();
- RULE_ACTIONS[135] = new Action135();
- RULE_ACTIONS[160] = new Action160();
- RULE_ACTIONS[161] = new Action161();
- RULE_ACTIONS[162] = new Action162();
- RULE_ACTIONS[168] = new Action168();
- RULE_ACTIONS[181] = new Action181();
- RULE_ACTIONS[182] = new Action182();
- RULE_ACTIONS[186] = new Action186();
- RULE_ACTIONS[187] = new Action187();
- RULE_ACTIONS[188] = new Action188();
- RULE_ACTIONS[189] = new Action189();
- RULE_ACTIONS[190] = new Action190();
- RULE_ACTIONS[191] = new Action191();
- RULE_ACTIONS[192] = new Action192();
- RULE_ACTIONS[197] = new Action197();
- RULE_ACTIONS[198] = new Action198();
- RULE_ACTIONS[202] = new Action202();
- RULE_ACTIONS[204] = new Action204();
- RULE_ACTIONS[205] = new Action205();
- RULE_ACTIONS[206] = new Action206();
- RULE_ACTIONS[207] = new Action207();
- RULE_ACTIONS[212] = new Action212();
- RULE_ACTIONS[213] = new Action213();
- RULE_ACTIONS[214] = new Action214();
- RULE_ACTIONS[218] = new Action218();
- RULE_ACTIONS[220] = new Action220();
- RULE_ACTIONS[225] = new Action225();
- RULE_ACTIONS[226] = new Action226();
- RULE_ACTIONS[227] = new Action227();
- RULE_ACTIONS[228] = new Action228();
- RULE_ACTIONS[229] = new Action229();
- RULE_ACTIONS[230] = new Action230();
- RULE_ACTIONS[231] = new Action231();
- RULE_ACTIONS[232] = new Action232();
- RULE_ACTIONS[234] = new Action234();
- RULE_ACTIONS[235] = new Action235();
- RULE_ACTIONS[237] = new Action237();
- RULE_ACTIONS[238] = new Action238();
- RULE_ACTIONS[239] = new Action239();
- RULE_ACTIONS[240] = new Action240();
- RULE_ACTIONS[241] = new Action241();
- RULE_ACTIONS[242] = new Action242();
- RULE_ACTIONS[243] = new Action243();
- RULE_ACTIONS[244] = new Action244();
- RULE_ACTIONS[245] = new Action245();
- RULE_ACTIONS[246] = new Action246();
- RULE_ACTIONS[247] = new Action247();
- RULE_ACTIONS[248] = new Action248();
- RULE_ACTIONS[250] = new Action250();
- RULE_ACTIONS[251] = new Action251();
- RULE_ACTIONS[252] = new Action252();
- RULE_ACTIONS[253] = new Action253();
- RULE_ACTIONS[256] = new Action256();
- RULE_ACTIONS[257] = new Action257();
- RULE_ACTIONS[258] = new Action258();
- RULE_ACTIONS[261] = new Action261();
- RULE_ACTIONS[262] = new Action262();
- RULE_ACTIONS[263] = new Action263();
- RULE_ACTIONS[264] = new Action264();
- RULE_ACTIONS[265] = new Action265();
- RULE_ACTIONS[266] = new Action266();
- RULE_ACTIONS[268] = new Action268();
- RULE_ACTIONS[269] = new Action269();
- RULE_ACTIONS[273] = new Action273();
- RULE_ACTIONS[274] = new Action274();
- RULE_ACTIONS[275] = new Action275();
- RULE_ACTIONS[276] = new Action276();
- RULE_ACTIONS[277] = new Action277();
- RULE_ACTIONS[278] = new Action278();
- RULE_ACTIONS[279] = new Action279();
- RULE_ACTIONS[280] = new Action280();
- RULE_ACTIONS[281] = new Action281();
- RULE_ACTIONS[282] = new Action282();
- RULE_ACTIONS[287] = new Action287();
- RULE_ACTIONS[291] = new Action291();
- RULE_ACTIONS[292] = new Action292();
- RULE_ACTIONS[293] = new Action293();
- RULE_ACTIONS[294] = new Action294();
- RULE_ACTIONS[295] = new Action295();
- RULE_ACTIONS[296] = new Action296();
- RULE_ACTIONS[301] = new Action301();
- RULE_ACTIONS[302] = new Action302();
- RULE_ACTIONS[305] = new Action305();
- RULE_ACTIONS[306] = new Action306();
- RULE_ACTIONS[307] = new Action307();
- RULE_ACTIONS[308] = new Action308();
- RULE_ACTIONS[309] = new Action309();
-
-
- //
- // Make sure that all elements of ruleAction are properly initialized
- //
- for (int i = 0; i < RULE_ACTIONS.length; i++) {
- if (RULE_ACTIONS[i] == null) {
- RULE_ACTIONS[i] = emptyAction();
- }
- }
- }
-
- //
- // Rule 1: ::= $Empty
- //
- static final class Action1 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- openASTScope(); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 2: ::= $Empty
- //
- static final class Action2 extends DeclaredAction< C99ParserAction , Object > {
-
- public boolean doTrial(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.resolver.
- openSymbolScope();
- return hasUndo;
- }
-
- public Action2() { hasUndo = true; };
- public void doUndo(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.resolver.undo();
- }
-
- }
-
- //
- // Rule 3: ::= $Empty
- //
- static final class Action3 extends DeclaredAction< C99ParserAction , Object > {
-
- public boolean doTrial(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.resolver.
- openDeclarationScope();
- return hasUndo;
- }
-
- public Action3() { hasUndo = true; };
- public void doUndo(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.resolver.undo();
- }
-
- }
-
- //
- // Rule 12: literal ::= integer
- //
- static final class Action12 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionLiteral(IASTLiteralExpression.lk_integer_constant); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 13: literal ::= floating
- //
- static final class Action13 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionLiteral(IASTLiteralExpression.lk_float_constant); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 14: literal ::= charconst
- //
- static final class Action14 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionLiteral(IASTLiteralExpression.lk_char_constant); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 15: literal ::= stringlit
- //
- static final class Action15 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionLiteral(IASTLiteralExpression.lk_string_literal); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 17: primary_expression ::= primary_expression_id
- //
- static final class Action17 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionID(); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 18: primary_expression ::= ( expression )
- //
- static final class Action18 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionBracketed(); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 22: postfix_expression ::= postfix_expression [ expression ]
- //
- static final class Action22 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionArraySubscript(); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 23: postfix_expression ::= postfix_expression ( expression_list_opt )
- //
- static final class Action23 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionFunctionCall(); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 24: postfix_expression ::= postfix_expression . member_name
- //
- static final class Action24 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionFieldReference(false); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 25: postfix_expression ::= postfix_expression -> member_name
- //
- static final class Action25 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionFieldReference(true); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 26: postfix_expression ::= postfix_expression ++
- //
- static final class Action26 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionUnaryOperator(IASTUnaryExpression.op_postFixIncr); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 27: postfix_expression ::= postfix_expression --
- //
- static final class Action27 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionUnaryOperator(IASTUnaryExpression.op_postFixDecr); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 28: postfix_expression ::= ( type_name ) { initializer_list comma_opt }
- //
- static final class Action28 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionTypeIdInitializer(); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 35: unary_expression ::= ++ unary_expression
- //
- static final class Action35 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionUnaryOperator(IASTUnaryExpression.op_prefixIncr); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 36: unary_expression ::= -- unary_expression
- //
- static final class Action36 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionUnaryOperator(IASTUnaryExpression.op_prefixDecr); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 37: unary_expression ::= & cast_expression
- //
- static final class Action37 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionUnaryOperator(IASTUnaryExpression.op_amper); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 38: unary_expression ::= * cast_expression
- //
- static final class Action38 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionUnaryOperator(IASTUnaryExpression.op_star); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 39: unary_expression ::= + cast_expression
- //
- static final class Action39 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionUnaryOperator(IASTUnaryExpression.op_plus); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 40: unary_expression ::= - cast_expression
- //
- static final class Action40 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionUnaryOperator(IASTUnaryExpression.op_minus); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 41: unary_expression ::= ~ cast_expression
- //
- static final class Action41 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionUnaryOperator(IASTUnaryExpression.op_tilde); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 42: unary_expression ::= ! cast_expression
- //
- static final class Action42 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionUnaryOperator(IASTUnaryExpression.op_not); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 43: unary_expression ::= sizeof unary_expression
- //
- static final class Action43 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionUnaryOperator(IASTUnaryExpression.op_sizeof); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 44: unary_expression ::= sizeof ( type_name )
- //
- static final class Action44 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionTypeId(IASTTypeIdExpression.op_sizeof); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 46: cast_expression ::= ( type_name ) cast_expression
- //
- static final class Action46 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionCast(IASTCastExpression.op_cast); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 48: multiplicative_expression ::= multiplicative_expression * cast_expression
- //
- static final class Action48 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionBinaryOperator(IASTBinaryExpression.op_multiply); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 49: multiplicative_expression ::= multiplicative_expression / cast_expression
- //
- static final class Action49 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionBinaryOperator(IASTBinaryExpression.op_divide); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 50: multiplicative_expression ::= multiplicative_expression % cast_expression
- //
- static final class Action50 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionBinaryOperator(IASTBinaryExpression.op_modulo); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 52: additive_expression ::= additive_expression + multiplicative_expression
- //
- static final class Action52 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionBinaryOperator(IASTBinaryExpression.op_plus); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 53: additive_expression ::= additive_expression - multiplicative_expression
- //
- static final class Action53 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionBinaryOperator(IASTBinaryExpression.op_minus); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 55: shift_expression ::= shift_expression << additive_expression
- //
- static final class Action55 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionBinaryOperator(IASTBinaryExpression.op_shiftLeft); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 56: shift_expression ::= shift_expression >> additive_expression
- //
- static final class Action56 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionBinaryOperator(IASTBinaryExpression.op_shiftRight); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 58: relational_expression ::= relational_expression < shift_expression
- //
- static final class Action58 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionBinaryOperator(IASTBinaryExpression.op_lessThan); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 59: relational_expression ::= relational_expression > shift_expression
- //
- static final class Action59 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionBinaryOperator(IASTBinaryExpression.op_greaterThan); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 60: relational_expression ::= relational_expression <= shift_expression
- //
- static final class Action60 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionBinaryOperator(IASTBinaryExpression.op_lessEqual); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 61: relational_expression ::= relational_expression >= shift_expression
- //
- static final class Action61 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionBinaryOperator(IASTBinaryExpression.op_greaterEqual); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 63: equality_expression ::= equality_expression == relational_expression
- //
- static final class Action63 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionBinaryOperator(IASTBinaryExpression.op_equals); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 64: equality_expression ::= equality_expression != relational_expression
- //
- static final class Action64 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionBinaryOperator(IASTBinaryExpression.op_notequals); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 66: AND_expression ::= AND_expression & equality_expression
- //
- static final class Action66 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionBinaryOperator(IASTBinaryExpression.op_binaryAnd); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 68: exclusive_OR_expression ::= exclusive_OR_expression ^ AND_expression
- //
- static final class Action68 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionBinaryOperator(IASTBinaryExpression.op_binaryXor); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 70: inclusive_OR_expression ::= inclusive_OR_expression | exclusive_OR_expression
- //
- static final class Action70 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionBinaryOperator(IASTBinaryExpression.op_binaryOr); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 72: logical_AND_expression ::= logical_AND_expression && inclusive_OR_expression
- //
- static final class Action72 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionBinaryOperator(IASTBinaryExpression.op_logicalAnd); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 74: logical_OR_expression ::= logical_OR_expression || logical_AND_expression
- //
- static final class Action74 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionBinaryOperator(IASTBinaryExpression.op_logicalOr); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 76: conditional_expression ::= logical_OR_expression ? expression : conditional_expression
- //
- static final class Action76 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionConditional(); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 78: assignment_expression ::= unary_expression = assignment_expression
- //
- static final class Action78 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionBinaryOperator(IASTBinaryExpression.op_assign); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 79: assignment_expression ::= unary_expression *= assignment_expression
- //
- static final class Action79 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionBinaryOperator(IASTBinaryExpression.op_multiplyAssign); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 80: assignment_expression ::= unary_expression /= assignment_expression
- //
- static final class Action80 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionBinaryOperator(IASTBinaryExpression.op_divideAssign); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 81: assignment_expression ::= unary_expression %= assignment_expression
- //
- static final class Action81 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionBinaryOperator(IASTBinaryExpression.op_moduloAssign); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 82: assignment_expression ::= unary_expression += assignment_expression
- //
- static final class Action82 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionBinaryOperator(IASTBinaryExpression.op_plusAssign); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 83: assignment_expression ::= unary_expression -= assignment_expression
- //
- static final class Action83 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionBinaryOperator(IASTBinaryExpression.op_minusAssign); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 84: assignment_expression ::= unary_expression <<= assignment_expression
- //
- static final class Action84 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionBinaryOperator(IASTBinaryExpression.op_shiftLeftAssign); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 85: assignment_expression ::= unary_expression >>= assignment_expression
- //
- static final class Action85 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionBinaryOperator(IASTBinaryExpression.op_shiftRightAssign); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 86: assignment_expression ::= unary_expression &= assignment_expression
- //
- static final class Action86 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionBinaryOperator(IASTBinaryExpression.op_binaryAndAssign); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 87: assignment_expression ::= unary_expression ^= assignment_expression
- //
- static final class Action87 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionBinaryOperator(IASTBinaryExpression.op_binaryXorAssign); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 88: assignment_expression ::= unary_expression |= assignment_expression
- //
- static final class Action88 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionBinaryOperator(IASTBinaryExpression.op_binaryOrAssign); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 91: expression_list ::= expression_list_actual
- //
- static final class Action91 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeExpressionList(); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 93: expression_list_opt ::= $Empty
- //
- static final class Action93 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeEmpty(); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 103: statement ::= ERROR_TOKEN
- //
- static final class Action103 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeStatementProblem(); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 104: labeled_statement ::= identifier_or_typedefname : statement
- //
- static final class Action104 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeStatementLabeled(); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 105: labeled_statement ::= case constant_expression :
- //
- static final class Action105 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeStatementCase(); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 106: labeled_statement ::= default :
- //
- static final class Action106 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeStatementDefault(); /* action.builder.getASTStack().print();*/
- }
- }
-
-
- //
- // Rule 107: compound_statement ::= { }
- //
- static final class Action107 extends DeclaredAction< C99ParserAction , Object > {
-
-
- public boolean doTrial(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.resolver.
- closeSymbolScope();
- return hasUndo;
- }
-
- public Action107() { hasUndo = true; };
- public void doUndo(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.resolver.undo();
- }
-
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeStatementCompoundStatement(false); /* action.builder.getASTStack().print();*/
- }
-
- }
-
-
- //
- // Rule 108: compound_statement ::= { block_item_list }
- //
- static final class Action108 extends DeclaredAction< C99ParserAction , Object > {
-
-
- public boolean doTrial(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.resolver.
- closeSymbolScope();
- return hasUndo;
- }
-
- public Action108() { hasUndo = true; };
- public void doUndo(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.resolver.undo();
- }
-
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeStatementCompoundStatement(true); /* action.builder.getASTStack().print();*/
- }
-
- }
-
- //
- // Rule 112: block_item ::= declaration
- //
- static final class Action112 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeStatementDeclaration(); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 113: expression_statement ::= ;
- //
- static final class Action113 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeStatementNull(); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 114: expression_statement ::= expression_in_statement ;
- //
- static final class Action114 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeStatementExpression(); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 115: selection_statement ::= if ( expression ) statement
- //
- static final class Action115 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeStatementIf(false); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 116: selection_statement ::= if ( expression ) statement else statement
- //
- static final class Action116 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeStatementIf(true); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 117: selection_statement ::= switch ( expression ) statement
- //
- static final class Action117 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeStatementSwitch(); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 119: expression_opt ::= $Empty
- //
- static final class Action119 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeEmpty(); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 120: iteration_statement ::= do statement while ( expression ) ;
- //
- static final class Action120 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeStatementDoLoop(); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 121: iteration_statement ::= while ( expression ) statement
- //
- static final class Action121 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeStatementWhileLoop(); /* action.builder.getASTStack().print();*/
- }
- }
-
-
- //
- // Rule 122: iteration_statement ::= for ( expression_opt ; expression_opt ; expression_opt ) statement
- //
- static final class Action122 extends DeclaredAction< C99ParserAction , Object > {
-
-
- public boolean doTrial(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.resolver.
- closeSymbolScope();
- return hasUndo;
- }
-
- public Action122() { hasUndo = true; };
- public void doUndo(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.resolver.undo();
- }
-
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeStatementForLoop(); /* action.builder.getASTStack().print();*/
- }
-
- }
-
-
- //
- // Rule 123: iteration_statement ::= for ( declaration expression_opt ; expression_opt ) statement
- //
- static final class Action123 extends DeclaredAction< C99ParserAction , Object > {
-
-
- public boolean doTrial(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.resolver.
- closeSymbolScope();
- return hasUndo;
- }
-
- public Action123() { hasUndo = true; };
- public void doUndo(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.resolver.undo();
- }
-
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeStatementForLoop(); /* action.builder.getASTStack().print();*/
- }
-
- }
-
- //
- // Rule 124: jump_statement ::= goto identifier_or_typedefname ;
- //
- static final class Action124 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeStatementGoto(); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 125: jump_statement ::= continue ;
- //
- static final class Action125 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeStatementContinue(); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 126: jump_statement ::= break ;
- //
- static final class Action126 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeStatementBreak(); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 127: jump_statement ::= return ;
- //
- static final class Action127 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeStatementReturn(false); /* action.builder.getASTStack().print();*/
- }
- }
-
- //
- // Rule 128: jump_statement ::= return expression ;
- //
- static final class Action128 extends DeclaredAction< C99ParserAction , Object > {
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeStatementReturn(true); /* action.builder.getASTStack().print();*/
- }
- }
-
-
- //
- // Rule 129: declaration ::= declaration_specifiers ;
- //
- static final class Action129 extends DeclaredAction< C99ParserAction , Object > {
-
-
- public boolean doTrial(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.resolver.
- closeDeclarationScope();
- return hasUndo;
- }
-
- public Action129() { hasUndo = true; };
- public void doUndo(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.resolver.undo();
- }
-
-
- public void doFinal(ITrialUndoActionProvider< Object > provider, C99ParserAction action) { action.builder.
- consumeDeclarationSimple(false); /* action.builder.getASTStack().print();*/
- }
-
- }
-
-
- //
- // Rule 130: declaration ::= declaration_specifiers