1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 09:25:31 +02:00

fixed problems with tokens not mapping correctly between main parser and secondary parsers, fixed for loop bug

This commit is contained in:
Mike Kucera 2008-03-14 21:30:55 +00:00
parent e7bb0ea2c2
commit 650153071e
26 changed files with 8451 additions and 9085 deletions

View file

@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.cdt.core.parser.util;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
/**
* This class contains several convenience methods

View file

@ -24,6 +24,7 @@ import lpg.lpgjavaruntime.Token;
import org.eclipse.cdt.core.dom.lrparser.IParserActionTokenProvider;
import org.eclipse.cdt.internal.core.dom.lrparser.c99.bindings.C99Variable;
@Deprecated
public class ResolverActionTests extends TestCase {
/**
@ -77,6 +78,13 @@ public class ResolverActionTests extends TestCase {
}
return tokens;
}
public String[] getOrderedTerminalSymbols() {
return null;
}
public String getName() {
return "Blah"; //$NON-NLS-1$
}
}

View file

@ -104,6 +104,14 @@ $Headers
return action.getSecondaryParseResult();
}
public String[] getOrderedTerminalSymbols() {
return $sym_type.orderedTerminalSymbols;
}
public String getName() {
return "$action_type"; //$NON-NLS-1$
}
./
$End

View file

@ -258,6 +258,15 @@ $Headers
public IASTNode getSecondaryParseResult() {
return action.builder.getSecondaryParseResult();
}
public String[] getOrderedTerminalSymbols() {
return $sym_type.orderedTerminalSymbols;
}
public String getName() {
return "$action_type"; //$NON-NLS-1$
}
./
$End
@ -762,8 +771,8 @@ assignment_expression
expression
::= expression_list
| ERROR_TOKEN
/. $Build consumeExpressionProblem(); $EndBuild ./
-- | ERROR_TOKEN
-- /. $Build consumeExpressionProblem(); $EndBuild ./
-- expression_list and expression_list_opt always result in a single element on the stack
-- the element might be an expression, an expression list or null
@ -861,12 +870,6 @@ condition
/. $Build consumeConditionDeclaration(); $EndBuild ./
-- where did this come from?
--condition_opt
-- ::= condition
-- | $empty
-- /. $Build consumeEmpty(); $EndBuild ./
iteration_statement
::= 'while' '(' condition ')' statement
@ -875,7 +878,7 @@ iteration_statement
/. $Build consumeStatementDoLoop(); $EndBuild ./
| 'for' '(' expression_opt ';' expression_opt ';' expression_opt ')' statement
/. $Build consumeStatementForLoop(); $EndBuild ./
| 'for' '(' simple_declaration expression_opt ';' expression_opt ')' statement
| 'for' '(' simple_declaration_with_declspec expression_opt ';' expression_opt ')' statement
/. $Build consumeStatementForLoop(); $EndBuild ./
@ -940,7 +943,12 @@ declaration_seq_opt
simple_declaration
::= declaration_specifiers_opt <openscope-ast> init_declarator_list_opt ';'
/. $Build consumeDeclarationSimple(true); $EndBuild ./
simple_declaration_with_declspec
::= declaration_specifiers <openscope-ast> init_declarator_list_opt ';'
/. $Build consumeDeclarationSimple(true); $EndBuild ./
-- declaration specifier nodes not created here, they are created by sub-rules
-- these rules add IToken modifiers to the declspec nodes

View file

@ -64,7 +64,8 @@ class CPreprocessorAdapter {
org.eclipse.cdt.core.parser.IToken domToken = preprocessor.nextToken(); // throws EndOfFileException
int type = domToken.getType();
IToken token = new LPGTokenAdapter(domToken, tokenMap.mapKind(type));
int newKind = tokenMap.mapKind(type);
IToken token = new LPGTokenAdapter(domToken, newKind);
tokenCollector.addToken(token);
if(type == tCOMPLETION) {

View file

@ -55,4 +55,15 @@ public interface IParserActionTokenProvider {
public IToken getRightIToken();
/**
* Returns the orderedTerminalSymbol field of the corresponding sym class
* generated by LPG.
*/
public String[] getOrderedTerminalSymbols();
/**
* Returns the parser's name, useful for debugging.
*/
public String getName();
}

View file

@ -269,11 +269,28 @@ public abstract class BuildASTParserAction {
* Runs the given parser on the tokens that make up the current rule.
*/
protected IASTNode runSecondaryParser(IParser secondaryParser) {
secondaryParser.setTokens(parser.getRuleTokens());
// need to pass tu because any completion nodes need to be linked directly to the root
List<IToken> tokens = parser.getRuleTokens();
// the secondary parser will alter the token kinds, which will need to be undone
int[] savedKinds = new int[tokens.size()];
int i = 0;
for(IToken token : tokens)
savedKinds[i++] = token.getKind();
secondaryParser.setTokens(tokens);
// need to pass tu because any new completion nodes need to be linked directly to the root
IASTCompletionNode compNode = secondaryParser.parse(tu);
addNameToCompletionNode(compNode);
return secondaryParser.getSecondaryParseResult();
IASTNode result = secondaryParser.getSecondaryParseResult();
// restore the token kinds
i = 0;
for(IToken token : tokens)
token.setKind(savedKinds[i++]);
return result;
}
@ -601,17 +618,19 @@ public abstract class BuildASTParserAction {
IASTTypeId typeId = (IASTTypeId) astStack.pop();
IASTCastExpression expr = nodeFactory.newCastExpression(operator, typeId, operand);
setOffsetAndLength(expr);
// try parsing as non-cast to resolve ambiguities
IParser secondaryParser = getNoCastExpressionParser();
IASTNode alternateExpr = runSecondaryParser(secondaryParser);
IASTNode alternateExpr = null;
if(operator == IASTCastExpression.op_cast) { // don't reparse for dynamic_cast etc as those are not ambiguous
// try parsing as non-cast to resolve ambiguities
IParser secondaryParser = getNoCastExpressionParser();
alternateExpr = runSecondaryParser(secondaryParser);
}
if(alternateExpr == null || alternateExpr instanceof IASTProblemExpression)
astStack.push(expr);
else
astStack.push(nodeFactory.newAmbiguousExpression(expr, (IASTExpression)alternateExpr));
if(TRACE_AST_STACK) System.out.println(astStack);
}

View file

@ -11,9 +11,6 @@
package org.eclipse.cdt.core.dom.lrparser.action;
import java.util.HashMap;
import java.util.Map;
/**
@ -26,9 +23,9 @@ public class TokenMap implements ITokenMap {
// LPG token kinds start at 0
// the kind is not part of the base language parser
public static int INVALID_KIND = -1;
public static final int INVALID_KIND = -1;
private int[] kindMap = null;
private final int[] kindMap;
/**
@ -39,19 +36,21 @@ public class TokenMap implements ITokenMap {
*/
public TokenMap(String[] toSymbols, String[] fromSymbols) {
// If this map is not being used with an extension then it becomes an "identity map".
if(toSymbols == fromSymbols)
if(toSymbols == fromSymbols) {
kindMap = null;
return;
kindMap = new int[fromSymbols.length];
Map<String,Integer> toMap = new HashMap<String,Integer>();
for(int i = 0; i < toSymbols.length; i++) {
toMap.put(toSymbols[i], new Integer(i));
}
for(int i = 0; i < fromSymbols.length; i++) {
kindMap = new int[fromSymbols.length];
HashMap<String,Integer> toMap = new HashMap<String,Integer>();
for(int i = 0, n = toSymbols.length; i < n; i++) {
toMap.put(toSymbols[i], i);
}
for(int i = 0, n = fromSymbols.length; i < n; i++) {
Integer kind = toMap.get(fromSymbols[i]);
kindMap[i] = kind == null ? INVALID_KIND : kind.intValue();
kindMap[i] = kind == null ? INVALID_KIND : kind;
}
}
@ -62,10 +61,23 @@ public class TokenMap implements ITokenMap {
public int mapKind(int kind) {
if(kindMap == null)
return kind;
if(kind < 0 || kind >= kindMap.length)
return INVALID_KIND;
return kindMap[kind];
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder('(') ;
boolean first = true;
for(int i = 0, n = kindMap.length; i < n; i++) {
if(!first)
sb.append(", "); //$NON-NLS-1$
sb.append(i).append('=').append(kindMap[i]);
first = false;
}
return sb.append(')').toString();
}
}

View file

@ -131,17 +131,17 @@ public class C99BuildASTParserAction extends BuildASTParserAction {
@Override
protected IParser getExpressionStatementParser() {
return new C99ExpressionStatementParser(C99Parsersym.orderedTerminalSymbols);
return new C99ExpressionStatementParser(parser.getOrderedTerminalSymbols());
}
@Override
protected IParser getNoCastExpressionParser() {
return new C99NoCastExpressionParser(C99Parsersym.orderedTerminalSymbols);
return new C99NoCastExpressionParser(parser.getOrderedTerminalSymbols());
}
@Override
protected IParser getSizeofExpressionParser() {
return new C99SizeofExpressionParser(CPPParsersym.orderedTerminalSymbols);
return new C99SizeofExpressionParser(parser.getOrderedTerminalSymbols());
}

View file

@ -130,18 +130,21 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
@Override
protected IParser getExpressionStatementParser() {
return new CPPExpressionStatementParser(CPPParsersym.orderedTerminalSymbols);
DebugUtil.printMethodTrace();
return new CPPExpressionStatementParser(parser.getOrderedTerminalSymbols());
}
@Override
protected IParser getNoCastExpressionParser() {
return new CPPNoCastExpressionParser(CPPParsersym.orderedTerminalSymbols);
DebugUtil.printMethodTrace();
return new CPPNoCastExpressionParser(parser.getOrderedTerminalSymbols());
}
@Override
protected IParser getSizeofExpressionParser() {
return new CPPSizeofExpressionParser(CPPParsersym.orderedTerminalSymbols);
DebugUtil.printMethodTrace();
return new CPPSizeofExpressionParser(parser.getOrderedTerminalSymbols());
}
/**

View file

@ -207,6 +207,14 @@ public IASTNode getSecondaryParseResult() {
return action.getSecondaryParseResult();
}
public String[] getOrderedTerminalSymbols() {
return C99ExpressionStatementParsersym.orderedTerminalSymbols;
}
public String getName() {
return "C99ExpressionStatementParser";//$NON-NLS-1$
}
private ITokenMap tokenMap = null;

View file

@ -207,6 +207,14 @@ public IASTNode getSecondaryParseResult() {
return action.getSecondaryParseResult();
}
public String[] getOrderedTerminalSymbols() {
return C99NoCastExpressionParsersym.orderedTerminalSymbols;
}
public String getName() {
return "C99NoCastExpressionParser";
}
private ITokenMap tokenMap = null;

View file

@ -207,6 +207,14 @@ public IASTNode getSecondaryParseResult() {
return action.getSecondaryParseResult();
}
public String[] getOrderedTerminalSymbols() {
return C99Parsersym.orderedTerminalSymbols;
}
public String getName() {
return "C99Parser";
}
private ITokenMap tokenMap = null;

View file

@ -207,6 +207,14 @@ public IASTNode getSecondaryParseResult() {
return action.getSecondaryParseResult();
}
public String[] getOrderedTerminalSymbols() {
return C99SizeofExpressionParsersym.orderedTerminalSymbols;
}
public String getName() {
return "C99SizeofExpressionParser";
}
private ITokenMap tokenMap = null;

View file

@ -239,6 +239,15 @@ public IASTNode getSecondaryParseResult() {
return action.builder.getSecondaryParseResult();
}
public String[] getOrderedTerminalSymbols() {
return CPPExpressionStatementParsersym.orderedTerminalSymbols;
}
public String getName() {
return "CPPExpressionStatementParser"; //$NON-NLS-1$
}
private ITokenMap tokenMap = null;
@ -1020,203 +1029,203 @@ public CPPExpressionStatementParser(String[] mapFrom) { // constructor
}
//
// Rule 161: expression ::= ERROR_TOKEN
// Rule 161: expression_list ::= <openscope-ast> expression_list_actual
//
case 161: { action.builder.
consumeExpressionProblem(); break;
}
//
// Rule 162: expression_list ::= <openscope-ast> expression_list_actual
//
case 162: { action.builder.
consumeExpressionList(); break;
}
//
// Rule 166: expression_list_opt ::= $Empty
// Rule 165: expression_list_opt ::= $Empty
//
case 166: { action.builder.
case 165: { action.builder.
consumeEmpty(); break;
}
//
// Rule 168: expression_opt ::= $Empty
// Rule 167: expression_opt ::= $Empty
//
case 168: { action.builder.
case 167: { action.builder.
consumeEmpty(); break;
}
//
// Rule 171: constant_expression_opt ::= $Empty
// Rule 170: constant_expression_opt ::= $Empty
//
case 171: { action.builder.
case 170: { action.builder.
consumeEmpty(); break;
}
//
// Rule 180: statement ::= ERROR_TOKEN
// Rule 179: statement ::= ERROR_TOKEN
//
case 180: { action.builder.
case 179: { action.builder.
consumeStatementProblem(); break;
}
//
// Rule 181: labeled_statement ::= identifier : statement
// Rule 180: labeled_statement ::= identifier : statement
//
case 181: { action.builder.
case 180: { action.builder.
consumeStatementLabeled(); break;
}
//
// Rule 182: labeled_statement ::= case constant_expression :
// Rule 181: labeled_statement ::= case constant_expression :
//
case 182: { action.builder.
case 181: { action.builder.
consumeStatementCase(); break;
}
//
// Rule 183: labeled_statement ::= default :
// Rule 182: labeled_statement ::= default :
//
case 183: { action.builder.
case 182: { action.builder.
consumeStatementDefault(); break;
}
//
// Rule 184: expression_statement ::= expression ;
// Rule 183: expression_statement ::= expression ;
//
case 184: { action.builder.
case 183: { action.builder.
consumeStatementExpression(); break;
}
//
// Rule 185: expression_statement ::= ;
// Rule 184: expression_statement ::= ;
//
case 185: { action.builder.
case 184: { action.builder.
consumeStatementNull(); break;
}
//
// Rule 186: compound_statement ::= { <openscope-ast> statement_seq }
// Rule 185: compound_statement ::= { <openscope-ast> statement_seq }
//
case 186: { action.builder.
case 185: { action.builder.
consumeStatementCompoundStatement(true); break;
}
//
// Rule 187: compound_statement ::= { }
// Rule 186: compound_statement ::= { }
//
case 187: { action.builder.
case 186: { action.builder.
consumeStatementCompoundStatement(false); break;
}
//
// Rule 190: selection_statement ::= if ( condition ) statement
// Rule 189: selection_statement ::= if ( condition ) statement
//
case 190: { action.builder.
case 189: { action.builder.
consumeStatementIf(false); break;
}
//
// Rule 191: selection_statement ::= if ( condition ) statement else statement
// Rule 190: selection_statement ::= if ( condition ) statement else statement
//
case 191: { action.builder.
case 190: { action.builder.
consumeStatementIf(true); break;
}
//
// Rule 192: selection_statement ::= switch ( condition ) statement
// Rule 191: selection_statement ::= switch ( condition ) statement
//
case 192: { action.builder.
case 191: { action.builder.
consumeStatementSwitch(); break;
}
//
// Rule 194: condition ::= type_specifier_seq declarator = assignment_expression
// Rule 193: condition ::= type_specifier_seq declarator = assignment_expression
//
case 194: { action.builder.
case 193: { action.builder.
consumeConditionDeclaration(); break;
}
//
// Rule 195: iteration_statement ::= while ( condition ) statement
// Rule 194: iteration_statement ::= while ( condition ) statement
//
case 195: { action.builder.
case 194: { action.builder.
consumeStatementWhileLoop(); break;
}
//
// Rule 196: iteration_statement ::= do statement while ( expression ) ;
// Rule 195: iteration_statement ::= do statement while ( expression ) ;
//
case 196: { action.builder.
case 195: { action.builder.
consumeStatementDoLoop(); break;
}
//
// Rule 197: iteration_statement ::= for ( expression_opt ; expression_opt ; expression_opt ) statement
// Rule 196: iteration_statement ::= for ( expression_opt ; expression_opt ; expression_opt ) statement
//
case 196: { action.builder.
consumeStatementForLoop(); break;
}
//
// Rule 197: iteration_statement ::= for ( simple_declaration_with_declspec expression_opt ; expression_opt ) statement
//
case 197: { action.builder.
consumeStatementForLoop(); break;
}
//
// Rule 198: iteration_statement ::= for ( simple_declaration expression_opt ; expression_opt ) statement
// Rule 198: jump_statement ::= break ;
//
case 198: { action.builder.
consumeStatementForLoop(); break;
}
//
// Rule 199: jump_statement ::= break ;
//
case 199: { action.builder.
consumeStatementBreak(); break;
}
//
// Rule 200: jump_statement ::= continue ;
// Rule 199: jump_statement ::= continue ;
//
case 200: { action.builder.
case 199: { action.builder.
consumeStatementContinue(); break;
}
//
// Rule 201: jump_statement ::= return expression ;
// Rule 200: jump_statement ::= return expression ;
//
case 201: { action.builder.
case 200: { action.builder.
consumeStatementReturn(true); break;
}
//
// Rule 202: jump_statement ::= return ;
// Rule 201: jump_statement ::= return ;
//
case 202: { action.builder.
case 201: { action.builder.
consumeStatementReturn(false); break;
}
//
// Rule 203: jump_statement ::= goto identifier_token ;
// Rule 202: jump_statement ::= goto identifier_token ;
//
case 203: { action.builder.
case 202: { action.builder.
consumeStatementGoto(); break;
}
//
// Rule 204: declaration_statement ::= block_declaration
// Rule 203: declaration_statement ::= block_declaration
//
case 203: { action.builder.
consumeStatementDeclaration(); break;
}
//
// Rule 204: declaration_statement ::= function_definition
//
case 204: { action.builder.
consumeStatementDeclaration(); break;
}
//
// Rule 205: declaration_statement ::= function_definition
// Rule 221: simple_declaration ::= declaration_specifiers_opt <openscope-ast> init_declarator_list_opt ;
//
case 205: { action.builder.
consumeStatementDeclaration(); break;
case 221: { action.builder.
consumeDeclarationSimple(true); break;
}
//
// Rule 222: simple_declaration ::= declaration_specifiers_opt <openscope-ast> init_declarator_list_opt ;
// Rule 222: simple_declaration_with_declspec ::= declaration_specifiers <openscope-ast> init_declarator_list_opt ;
//
case 222: { action.builder.
consumeDeclarationSimple(true); break;

View file

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

View file

@ -239,6 +239,15 @@ public IASTNode getSecondaryParseResult() {
return action.builder.getSecondaryParseResult();
}
public String[] getOrderedTerminalSymbols() {
return CPPNoCastExpressionParsersym.orderedTerminalSymbols;
}
public String getName() {
return "CPPNoCastExpressionParser"; //$NON-NLS-1$
}
private ITokenMap tokenMap = null;
@ -1013,203 +1022,203 @@ public CPPNoCastExpressionParser(String[] mapFrom) { // constructor
}
//
// Rule 160: expression ::= ERROR_TOKEN
// Rule 160: expression_list ::= <openscope-ast> expression_list_actual
//
case 160: { action.builder.
consumeExpressionProblem(); break;
}
//
// Rule 161: expression_list ::= <openscope-ast> expression_list_actual
//
case 161: { action.builder.
consumeExpressionList(); break;
}
//
// Rule 165: expression_list_opt ::= $Empty
// Rule 164: expression_list_opt ::= $Empty
//
case 165: { action.builder.
case 164: { action.builder.
consumeEmpty(); break;
}
//
// Rule 167: expression_opt ::= $Empty
// Rule 166: expression_opt ::= $Empty
//
case 167: { action.builder.
case 166: { action.builder.
consumeEmpty(); break;
}
//
// Rule 170: constant_expression_opt ::= $Empty
// Rule 169: constant_expression_opt ::= $Empty
//
case 170: { action.builder.
case 169: { action.builder.
consumeEmpty(); break;
}
//
// Rule 179: statement ::= ERROR_TOKEN
// Rule 178: statement ::= ERROR_TOKEN
//
case 179: { action.builder.
case 178: { action.builder.
consumeStatementProblem(); break;
}
//
// Rule 180: labeled_statement ::= identifier : statement
// Rule 179: labeled_statement ::= identifier : statement
//
case 180: { action.builder.
case 179: { action.builder.
consumeStatementLabeled(); break;
}
//
// Rule 181: labeled_statement ::= case constant_expression :
// Rule 180: labeled_statement ::= case constant_expression :
//
case 181: { action.builder.
case 180: { action.builder.
consumeStatementCase(); break;
}
//
// Rule 182: labeled_statement ::= default :
// Rule 181: labeled_statement ::= default :
//
case 182: { action.builder.
case 181: { action.builder.
consumeStatementDefault(); break;
}
//
// Rule 183: expression_statement ::= expression ;
// Rule 182: expression_statement ::= expression ;
//
case 183: { action.builder.
case 182: { action.builder.
consumeStatementExpression(); break;
}
//
// Rule 184: expression_statement ::= ;
// Rule 183: expression_statement ::= ;
//
case 184: { action.builder.
case 183: { action.builder.
consumeStatementNull(); break;
}
//
// Rule 185: compound_statement ::= { <openscope-ast> statement_seq }
// Rule 184: compound_statement ::= { <openscope-ast> statement_seq }
//
case 185: { action.builder.
case 184: { action.builder.
consumeStatementCompoundStatement(true); break;
}
//
// Rule 186: compound_statement ::= { }
// Rule 185: compound_statement ::= { }
//
case 186: { action.builder.
case 185: { action.builder.
consumeStatementCompoundStatement(false); break;
}
//
// Rule 189: selection_statement ::= if ( condition ) statement
// Rule 188: selection_statement ::= if ( condition ) statement
//
case 189: { action.builder.
case 188: { action.builder.
consumeStatementIf(false); break;
}
//
// Rule 190: selection_statement ::= if ( condition ) statement else statement
// Rule 189: selection_statement ::= if ( condition ) statement else statement
//
case 190: { action.builder.
case 189: { action.builder.
consumeStatementIf(true); break;
}
//
// Rule 191: selection_statement ::= switch ( condition ) statement
// Rule 190: selection_statement ::= switch ( condition ) statement
//
case 191: { action.builder.
case 190: { action.builder.
consumeStatementSwitch(); break;
}
//
// Rule 193: condition ::= type_specifier_seq declarator = assignment_expression
// Rule 192: condition ::= type_specifier_seq declarator = assignment_expression
//
case 193: { action.builder.
case 192: { action.builder.
consumeConditionDeclaration(); break;
}
//
// Rule 194: iteration_statement ::= while ( condition ) statement
// Rule 193: iteration_statement ::= while ( condition ) statement
//
case 194: { action.builder.
case 193: { action.builder.
consumeStatementWhileLoop(); break;
}
//
// Rule 195: iteration_statement ::= do statement while ( expression ) ;
// Rule 194: iteration_statement ::= do statement while ( expression ) ;
//
case 195: { action.builder.
case 194: { action.builder.
consumeStatementDoLoop(); break;
}
//
// Rule 196: iteration_statement ::= for ( expression_opt ; expression_opt ; expression_opt ) statement
// Rule 195: iteration_statement ::= for ( expression_opt ; expression_opt ; expression_opt ) statement
//
case 195: { action.builder.
consumeStatementForLoop(); break;
}
//
// Rule 196: iteration_statement ::= for ( simple_declaration_with_declspec expression_opt ; expression_opt ) statement
//
case 196: { action.builder.
consumeStatementForLoop(); break;
}
//
// Rule 197: iteration_statement ::= for ( simple_declaration expression_opt ; expression_opt ) statement
// Rule 197: jump_statement ::= break ;
//
case 197: { action.builder.
consumeStatementForLoop(); break;
}
//
// Rule 198: jump_statement ::= break ;
//
case 198: { action.builder.
consumeStatementBreak(); break;
}
//
// Rule 199: jump_statement ::= continue ;
// Rule 198: jump_statement ::= continue ;
//
case 199: { action.builder.
case 198: { action.builder.
consumeStatementContinue(); break;
}
//
// Rule 200: jump_statement ::= return expression ;
// Rule 199: jump_statement ::= return expression ;
//
case 200: { action.builder.
case 199: { action.builder.
consumeStatementReturn(true); break;
}
//
// Rule 201: jump_statement ::= return ;
// Rule 200: jump_statement ::= return ;
//
case 201: { action.builder.
case 200: { action.builder.
consumeStatementReturn(false); break;
}
//
// Rule 202: jump_statement ::= goto identifier_token ;
// Rule 201: jump_statement ::= goto identifier_token ;
//
case 202: { action.builder.
case 201: { action.builder.
consumeStatementGoto(); break;
}
//
// Rule 203: declaration_statement ::= block_declaration
// Rule 202: declaration_statement ::= block_declaration
//
case 202: { action.builder.
consumeStatementDeclaration(); break;
}
//
// Rule 203: declaration_statement ::= function_definition
//
case 203: { action.builder.
consumeStatementDeclaration(); break;
}
//
// Rule 204: declaration_statement ::= function_definition
// Rule 220: simple_declaration ::= declaration_specifiers_opt <openscope-ast> init_declarator_list_opt ;
//
case 204: { action.builder.
consumeStatementDeclaration(); break;
case 220: { action.builder.
consumeDeclarationSimple(true); break;
}
//
// Rule 221: simple_declaration ::= declaration_specifiers_opt <openscope-ast> init_declarator_list_opt ;
// Rule 221: simple_declaration_with_declspec ::= declaration_specifiers <openscope-ast> init_declarator_list_opt ;
//
case 221: { action.builder.
consumeDeclarationSimple(true); break;

View file

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

View file

@ -239,6 +239,15 @@ public IASTNode getSecondaryParseResult() {
return action.builder.getSecondaryParseResult();
}
public String[] getOrderedTerminalSymbols() {
return CPPParsersym.orderedTerminalSymbols;
}
public String getName() {
return "CPPParser"; //$NON-NLS-1$
}
private ITokenMap tokenMap = null;
@ -1020,203 +1029,203 @@ public CPPParser(String[] mapFrom) { // constructor
}
//
// Rule 161: expression ::= ERROR_TOKEN
// Rule 161: expression_list ::= <openscope-ast> expression_list_actual
//
case 161: { action.builder.
consumeExpressionProblem(); break;
}
//
// Rule 162: expression_list ::= <openscope-ast> expression_list_actual
//
case 162: { action.builder.
consumeExpressionList(); break;
}
//
// Rule 166: expression_list_opt ::= $Empty
// Rule 165: expression_list_opt ::= $Empty
//
case 166: { action.builder.
case 165: { action.builder.
consumeEmpty(); break;
}
//
// Rule 168: expression_opt ::= $Empty
// Rule 167: expression_opt ::= $Empty
//
case 168: { action.builder.
case 167: { action.builder.
consumeEmpty(); break;
}
//
// Rule 171: constant_expression_opt ::= $Empty
// Rule 170: constant_expression_opt ::= $Empty
//
case 171: { action.builder.
case 170: { action.builder.
consumeEmpty(); break;
}
//
// Rule 180: statement ::= ERROR_TOKEN
// Rule 179: statement ::= ERROR_TOKEN
//
case 180: { action.builder.
case 179: { action.builder.
consumeStatementProblem(); break;
}
//
// Rule 181: labeled_statement ::= identifier : statement
// Rule 180: labeled_statement ::= identifier : statement
//
case 181: { action.builder.
case 180: { action.builder.
consumeStatementLabeled(); break;
}
//
// Rule 182: labeled_statement ::= case constant_expression :
// Rule 181: labeled_statement ::= case constant_expression :
//
case 182: { action.builder.
case 181: { action.builder.
consumeStatementCase(); break;
}
//
// Rule 183: labeled_statement ::= default :
// Rule 182: labeled_statement ::= default :
//
case 183: { action.builder.
case 182: { action.builder.
consumeStatementDefault(); break;
}
//
// Rule 184: expression_statement ::= expression ;
// Rule 183: expression_statement ::= expression ;
//
case 184: { action.builder.
case 183: { action.builder.
consumeStatementExpression(); break;
}
//
// Rule 185: expression_statement ::= ;
// Rule 184: expression_statement ::= ;
//
case 185: { action.builder.
case 184: { action.builder.
consumeStatementNull(); break;
}
//
// Rule 186: compound_statement ::= { <openscope-ast> statement_seq }
// Rule 185: compound_statement ::= { <openscope-ast> statement_seq }
//
case 186: { action.builder.
case 185: { action.builder.
consumeStatementCompoundStatement(true); break;
}
//
// Rule 187: compound_statement ::= { }
// Rule 186: compound_statement ::= { }
//
case 187: { action.builder.
case 186: { action.builder.
consumeStatementCompoundStatement(false); break;
}
//
// Rule 190: selection_statement ::= if ( condition ) statement
// Rule 189: selection_statement ::= if ( condition ) statement
//
case 190: { action.builder.
case 189: { action.builder.
consumeStatementIf(false); break;
}
//
// Rule 191: selection_statement ::= if ( condition ) statement else statement
// Rule 190: selection_statement ::= if ( condition ) statement else statement
//
case 191: { action.builder.
case 190: { action.builder.
consumeStatementIf(true); break;
}
//
// Rule 192: selection_statement ::= switch ( condition ) statement
// Rule 191: selection_statement ::= switch ( condition ) statement
//
case 192: { action.builder.
case 191: { action.builder.
consumeStatementSwitch(); break;
}
//
// Rule 194: condition ::= type_specifier_seq declarator = assignment_expression
// Rule 193: condition ::= type_specifier_seq declarator = assignment_expression
//
case 194: { action.builder.
case 193: { action.builder.
consumeConditionDeclaration(); break;
}
//
// Rule 195: iteration_statement ::= while ( condition ) statement
// Rule 194: iteration_statement ::= while ( condition ) statement
//
case 195: { action.builder.
case 194: { action.builder.
consumeStatementWhileLoop(); break;
}
//
// Rule 196: iteration_statement ::= do statement while ( expression ) ;
// Rule 195: iteration_statement ::= do statement while ( expression ) ;
//
case 196: { action.builder.
case 195: { action.builder.
consumeStatementDoLoop(); break;
}
//
// Rule 197: iteration_statement ::= for ( expression_opt ; expression_opt ; expression_opt ) statement
// Rule 196: iteration_statement ::= for ( expression_opt ; expression_opt ; expression_opt ) statement
//
case 196: { action.builder.
consumeStatementForLoop(); break;
}
//
// Rule 197: iteration_statement ::= for ( simple_declaration_with_declspec expression_opt ; expression_opt ) statement
//
case 197: { action.builder.
consumeStatementForLoop(); break;
}
//
// Rule 198: iteration_statement ::= for ( simple_declaration expression_opt ; expression_opt ) statement
// Rule 198: jump_statement ::= break ;
//
case 198: { action.builder.
consumeStatementForLoop(); break;
}
//
// Rule 199: jump_statement ::= break ;
//
case 199: { action.builder.
consumeStatementBreak(); break;
}
//
// Rule 200: jump_statement ::= continue ;
// Rule 199: jump_statement ::= continue ;
//
case 200: { action.builder.
case 199: { action.builder.
consumeStatementContinue(); break;
}
//
// Rule 201: jump_statement ::= return expression ;
// Rule 200: jump_statement ::= return expression ;
//
case 201: { action.builder.
case 200: { action.builder.
consumeStatementReturn(true); break;
}
//
// Rule 202: jump_statement ::= return ;
// Rule 201: jump_statement ::= return ;
//
case 202: { action.builder.
case 201: { action.builder.
consumeStatementReturn(false); break;
}
//
// Rule 203: jump_statement ::= goto identifier_token ;
// Rule 202: jump_statement ::= goto identifier_token ;
//
case 203: { action.builder.
case 202: { action.builder.
consumeStatementGoto(); break;
}
//
// Rule 204: declaration_statement ::= block_declaration
// Rule 203: declaration_statement ::= block_declaration
//
case 203: { action.builder.
consumeStatementDeclaration(); break;
}
//
// Rule 204: declaration_statement ::= function_definition
//
case 204: { action.builder.
consumeStatementDeclaration(); break;
}
//
// Rule 205: declaration_statement ::= function_definition
// Rule 221: simple_declaration ::= declaration_specifiers_opt <openscope-ast> init_declarator_list_opt ;
//
case 205: { action.builder.
consumeStatementDeclaration(); break;
case 221: { action.builder.
consumeDeclarationSimple(true); break;
}
//
// Rule 222: simple_declaration ::= declaration_specifiers_opt <openscope-ast> init_declarator_list_opt ;
// Rule 222: simple_declaration_with_declspec ::= declaration_specifiers <openscope-ast> init_declarator_list_opt ;
//
case 222: { action.builder.
consumeDeclarationSimple(true); break;

View file

@ -15,98 +15,98 @@ package org.eclipse.cdt.internal.core.dom.lrparser.cpp;
public interface CPPParsersym {
public final static int
TK_asm = 66,
TK_auto = 50,
TK_bool = 11,
TK_break = 78,
TK_case = 79,
TK_asm = 58,
TK_auto = 49,
TK_bool = 12,
TK_break = 77,
TK_case = 78,
TK_catch = 119,
TK_char = 12,
TK_class = 59,
TK_const = 48,
TK_const_cast = 28,
TK_continue = 80,
TK_default = 81,
TK_delete = 43,
TK_do = 82,
TK_double = 13,
TK_dynamic_cast = 29,
TK_char = 13,
TK_class = 60,
TK_const = 46,
TK_const_cast = 31,
TK_continue = 79,
TK_default = 80,
TK_delete = 64,
TK_do = 81,
TK_double = 14,
TK_dynamic_cast = 32,
TK_else = 122,
TK_enum = 60,
TK_explicit = 51,
TK_enum = 65,
TK_explicit = 50,
TK_export = 74,
TK_extern = 42,
TK_false = 30,
TK_float = 14,
TK_for = 83,
TK_friend = 52,
TK_goto = 84,
TK_if = 85,
TK_inline = 53,
TK_int = 15,
TK_long = 16,
TK_mutable = 54,
TK_namespace = 65,
TK_new = 44,
TK_extern = 15,
TK_false = 33,
TK_float = 16,
TK_for = 82,
TK_friend = 51,
TK_goto = 83,
TK_if = 84,
TK_inline = 52,
TK_int = 17,
TK_long = 18,
TK_mutable = 53,
TK_namespace = 54,
TK_new = 66,
TK_operator = 7,
TK_private = 114,
TK_protected = 115,
TK_public = 116,
TK_register = 55,
TK_reinterpret_cast = 31,
TK_return = 86,
TK_short = 17,
TK_signed = 18,
TK_sizeof = 32,
TK_reinterpret_cast = 34,
TK_return = 85,
TK_short = 19,
TK_signed = 20,
TK_sizeof = 35,
TK_static = 56,
TK_static_cast = 33,
TK_struct = 61,
TK_switch = 87,
TK_template = 57,
TK_this = 34,
TK_throw = 41,
TK_static_cast = 36,
TK_struct = 67,
TK_switch = 86,
TK_template = 26,
TK_this = 37,
TK_throw = 61,
TK_try = 75,
TK_true = 35,
TK_typedef = 58,
TK_typeid = 36,
TK_typename = 9,
TK_union = 62,
TK_unsigned = 19,
TK_using = 64,
TK_virtual = 47,
TK_void = 20,
TK_volatile = 49,
TK_wchar_t = 21,
TK_true = 38,
TK_typedef = 57,
TK_typeid = 39,
TK_typename = 10,
TK_union = 68,
TK_unsigned = 21,
TK_using = 47,
TK_virtual = 40,
TK_void = 22,
TK_volatile = 48,
TK_wchar_t = 23,
TK_while = 76,
TK_integer = 37,
TK_floating = 38,
TK_charconst = 39,
TK_stringlit = 26,
TK_integer = 41,
TK_floating = 42,
TK_charconst = 43,
TK_stringlit = 29,
TK_identifier = 1,
TK_Completion = 2,
TK_EndOfCompletion = 10,
TK_EndOfCompletion = 9,
TK_Invalid = 124,
TK_LeftBracket = 68,
TK_LeftBracket = 62,
TK_LeftParen = 3,
TK_LeftBrace = 67,
TK_LeftBrace = 59,
TK_Dot = 120,
TK_DotStar = 96,
TK_Arrow = 103,
TK_ArrowStar = 90,
TK_PlusPlus = 24,
TK_MinusMinus = 25,
TK_PlusPlus = 27,
TK_MinusMinus = 28,
TK_And = 8,
TK_Star = 6,
TK_Plus = 22,
TK_Minus = 23,
TK_Plus = 24,
TK_Minus = 25,
TK_Tilde = 5,
TK_Bang = 27,
TK_Bang = 30,
TK_Slash = 91,
TK_Percent = 92,
TK_RightShift = 88,
TK_LeftShift = 89,
TK_LT = 63,
TK_GT = 69,
TK_LT = 44,
TK_GT = 63,
TK_LE = 93,
TK_GE = 94,
TK_EQ = 97,
@ -116,10 +116,10 @@ public interface CPPParsersym {
TK_AndAnd = 101,
TK_OrOr = 102,
TK_Question = 117,
TK_Colon = 73,
TK_Colon = 72,
TK_ColonColon = 4,
TK_DotDotDot = 95,
TK_Assign = 71,
TK_Assign = 70,
TK_StarAssign = 104,
TK_SlashAssign = 105,
TK_PercentAssign = 106,
@ -130,13 +130,13 @@ public interface CPPParsersym {
TK_AndAssign = 111,
TK_CaretAssign = 112,
TK_OrAssign = 113,
TK_Comma = 70,
TK_zero = 40,
TK_Comma = 69,
TK_zero = 45,
TK_RightBracket = 118,
TK_RightParen = 77,
TK_RightBrace = 72,
TK_SemiColon = 45,
TK_ERROR_TOKEN = 46,
TK_RightParen = 87,
TK_RightBrace = 71,
TK_SemiColon = 11,
TK_ERROR_TOKEN = 73,
TK_original_namespace_name = 123,
TK_EOF_TOKEN = 121;
@ -150,11 +150,13 @@ public interface CPPParsersym {
"Star",
"operator",
"And",
"typename",
"EndOfCompletion",
"typename",
"SemiColon",
"bool",
"char",
"double",
"extern",
"float",
"int",
"long",
@ -165,6 +167,7 @@ public interface CPPParsersym {
"wchar_t",
"Plus",
"Minus",
"template",
"PlusPlus",
"MinusMinus",
"stringlit",
@ -178,47 +181,43 @@ public interface CPPParsersym {
"this",
"true",
"typeid",
"virtual",
"integer",
"floating",
"charconst",
"LT",
"zero",
"throw",
"extern",
"delete",
"new",
"SemiColon",
"ERROR_TOKEN",
"virtual",
"const",
"using",
"volatile",
"auto",
"explicit",
"friend",
"inline",
"mutable",
"namespace",
"register",
"static",
"template",
"typedef",
"class",
"enum",
"struct",
"union",
"LT",
"using",
"namespace",
"asm",
"LeftBrace",
"class",
"throw",
"LeftBracket",
"GT",
"delete",
"enum",
"new",
"struct",
"union",
"Comma",
"Assign",
"RightBrace",
"Colon",
"ERROR_TOKEN",
"export",
"try",
"while",
"RightParen",
"break",
"case",
"continue",
@ -229,6 +228,7 @@ public interface CPPParsersym {
"if",
"return",
"switch",
"RightParen",
"RightShift",
"LeftShift",
"ArrowStar",

View file

@ -239,6 +239,15 @@ public IASTNode getSecondaryParseResult() {
return action.builder.getSecondaryParseResult();
}
public String[] getOrderedTerminalSymbols() {
return CPPSizeofExpressionParsersym.orderedTerminalSymbols;
}
public String getName() {
return "CPPSizeofExpressionParser"; //$NON-NLS-1$
}
private ITokenMap tokenMap = null;
@ -1006,203 +1015,203 @@ public CPPSizeofExpressionParser(String[] mapFrom) { // constructor
}
//
// Rule 159: expression ::= ERROR_TOKEN
// Rule 159: expression_list ::= <openscope-ast> expression_list_actual
//
case 159: { action.builder.
consumeExpressionProblem(); break;
}
//
// Rule 160: expression_list ::= <openscope-ast> expression_list_actual
//
case 160: { action.builder.
consumeExpressionList(); break;
}
//
// Rule 164: expression_list_opt ::= $Empty
// Rule 163: expression_list_opt ::= $Empty
//
case 164: { action.builder.
case 163: { action.builder.
consumeEmpty(); break;
}
//
// Rule 166: expression_opt ::= $Empty
// Rule 165: expression_opt ::= $Empty
//
case 166: { action.builder.
case 165: { action.builder.
consumeEmpty(); break;
}
//
// Rule 169: constant_expression_opt ::= $Empty
// Rule 168: constant_expression_opt ::= $Empty
//
case 169: { action.builder.
case 168: { action.builder.
consumeEmpty(); break;
}
//
// Rule 178: statement ::= ERROR_TOKEN
// Rule 177: statement ::= ERROR_TOKEN
//
case 178: { action.builder.
case 177: { action.builder.
consumeStatementProblem(); break;
}
//
// Rule 179: labeled_statement ::= identifier : statement
// Rule 178: labeled_statement ::= identifier : statement
//
case 179: { action.builder.
case 178: { action.builder.
consumeStatementLabeled(); break;
}
//
// Rule 180: labeled_statement ::= case constant_expression :
// Rule 179: labeled_statement ::= case constant_expression :
//
case 180: { action.builder.
case 179: { action.builder.
consumeStatementCase(); break;
}
//
// Rule 181: labeled_statement ::= default :
// Rule 180: labeled_statement ::= default :
//
case 181: { action.builder.
case 180: { action.builder.
consumeStatementDefault(); break;
}
//
// Rule 182: expression_statement ::= expression ;
// Rule 181: expression_statement ::= expression ;
//
case 182: { action.builder.
case 181: { action.builder.
consumeStatementExpression(); break;
}
//
// Rule 183: expression_statement ::= ;
// Rule 182: expression_statement ::= ;
//
case 183: { action.builder.
case 182: { action.builder.
consumeStatementNull(); break;
}
//
// Rule 184: compound_statement ::= { <openscope-ast> statement_seq }
// Rule 183: compound_statement ::= { <openscope-ast> statement_seq }
//
case 184: { action.builder.
case 183: { action.builder.
consumeStatementCompoundStatement(true); break;
}
//
// Rule 185: compound_statement ::= { }
// Rule 184: compound_statement ::= { }
//
case 185: { action.builder.
case 184: { action.builder.
consumeStatementCompoundStatement(false); break;
}
//
// Rule 188: selection_statement ::= if ( condition ) statement
// Rule 187: selection_statement ::= if ( condition ) statement
//
case 188: { action.builder.
case 187: { action.builder.
consumeStatementIf(false); break;
}
//
// Rule 189: selection_statement ::= if ( condition ) statement else statement
// Rule 188: selection_statement ::= if ( condition ) statement else statement
//
case 189: { action.builder.
case 188: { action.builder.
consumeStatementIf(true); break;
}
//
// Rule 190: selection_statement ::= switch ( condition ) statement
// Rule 189: selection_statement ::= switch ( condition ) statement
//
case 190: { action.builder.
case 189: { action.builder.
consumeStatementSwitch(); break;
}
//
// Rule 192: condition ::= type_specifier_seq declarator = assignment_expression
// Rule 191: condition ::= type_specifier_seq declarator = assignment_expression
//
case 192: { action.builder.
case 191: { action.builder.
consumeConditionDeclaration(); break;
}
//
// Rule 193: iteration_statement ::= while ( condition ) statement
// Rule 192: iteration_statement ::= while ( condition ) statement
//
case 193: { action.builder.
case 192: { action.builder.
consumeStatementWhileLoop(); break;
}
//
// Rule 194: iteration_statement ::= do statement while ( expression ) ;
// Rule 193: iteration_statement ::= do statement while ( expression ) ;
//
case 194: { action.builder.
case 193: { action.builder.
consumeStatementDoLoop(); break;
}
//
// Rule 195: iteration_statement ::= for ( expression_opt ; expression_opt ; expression_opt ) statement
// Rule 194: iteration_statement ::= for ( expression_opt ; expression_opt ; expression_opt ) statement
//
case 194: { action.builder.
consumeStatementForLoop(); break;
}
//
// Rule 195: iteration_statement ::= for ( simple_declaration_with_declspec expression_opt ; expression_opt ) statement
//
case 195: { action.builder.
consumeStatementForLoop(); break;
}
//
// Rule 196: iteration_statement ::= for ( simple_declaration expression_opt ; expression_opt ) statement
// Rule 196: jump_statement ::= break ;
//
case 196: { action.builder.
consumeStatementForLoop(); break;
}
//
// Rule 197: jump_statement ::= break ;
//
case 197: { action.builder.
consumeStatementBreak(); break;
}
//
// Rule 198: jump_statement ::= continue ;
// Rule 197: jump_statement ::= continue ;
//
case 198: { action.builder.
case 197: { action.builder.
consumeStatementContinue(); break;
}
//
// Rule 199: jump_statement ::= return expression ;
// Rule 198: jump_statement ::= return expression ;
//
case 199: { action.builder.
case 198: { action.builder.
consumeStatementReturn(true); break;
}
//
// Rule 200: jump_statement ::= return ;
// Rule 199: jump_statement ::= return ;
//
case 200: { action.builder.
case 199: { action.builder.
consumeStatementReturn(false); break;
}
//
// Rule 201: jump_statement ::= goto identifier_token ;
// Rule 200: jump_statement ::= goto identifier_token ;
//
case 201: { action.builder.
case 200: { action.builder.
consumeStatementGoto(); break;
}
//
// Rule 202: declaration_statement ::= block_declaration
// Rule 201: declaration_statement ::= block_declaration
//
case 201: { action.builder.
consumeStatementDeclaration(); break;
}
//
// Rule 202: declaration_statement ::= function_definition
//
case 202: { action.builder.
consumeStatementDeclaration(); break;
}
//
// Rule 203: declaration_statement ::= function_definition
// Rule 219: simple_declaration ::= declaration_specifiers_opt <openscope-ast> init_declarator_list_opt ;
//
case 203: { action.builder.
consumeStatementDeclaration(); break;
case 219: { action.builder.
consumeDeclarationSimple(true); break;
}
//
// Rule 220: simple_declaration ::= declaration_specifiers_opt <openscope-ast> init_declarator_list_opt ;
// Rule 220: simple_declaration_with_declspec ::= declaration_specifiers <openscope-ast> init_declarator_list_opt ;
//
case 220: { action.builder.
consumeDeclarationSimple(true); break;

View file

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