mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
resolve sizeof ambiguity for C++
This commit is contained in:
parent
d860addc6d
commit
3b41669fc2
16 changed files with 5346 additions and 85 deletions
|
@ -4184,17 +4184,14 @@ public class AST2Tests extends AST2BaseTest {
|
|||
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.CPP, false );
|
||||
CNameCollector col = new CNameCollector();
|
||||
tu.accept(col);
|
||||
Iterator i = col.nameList.iterator();
|
||||
while (i.hasNext()) {
|
||||
IASTName n = (IASTName) i.next();
|
||||
if (n.isReference() && "f1".equals(n.toString())) {
|
||||
for(Object o : col.nameList) {
|
||||
IASTName n = (IASTName)o;
|
||||
if (n.isReference() && "f1".equals(n.toString()))
|
||||
assertTrue(n.resolveBinding() instanceof IProblemBinding);
|
||||
}
|
||||
else {
|
||||
else
|
||||
assertFalse(n.resolveBinding() instanceof IProblemBinding);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// void isTrue( int field, int bit ){
|
||||
// return ((field) & (bit));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2007 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 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
|
||||
|
@ -11,8 +11,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
//no change for leave()
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
|
@ -36,6 +34,7 @@ public abstract class CPPASTAmbiguity extends CPPASTNode {
|
|||
shouldVisitNames = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int visit(IASTName name) {
|
||||
if (name != null) {
|
||||
namesPos++;
|
||||
|
@ -52,30 +51,28 @@ public abstract class CPPASTAmbiguity extends CPPASTNode {
|
|||
|
||||
protected abstract IASTNode[] getNodes();
|
||||
|
||||
@Override
|
||||
public boolean accept(ASTVisitor visitor) {
|
||||
IASTNode[] nodez = getNodes();
|
||||
// if( debugging )
|
||||
// printNode();
|
||||
int[] issues = new int[nodez.length];
|
||||
int[] problems = new int[nodez.length];
|
||||
for(int i = 0; i < nodez.length; ++i) {
|
||||
IASTNode s = nodez[i];
|
||||
s.accept( visitor );
|
||||
CPPASTNameCollector resolver = new CPPASTNameCollector();
|
||||
s.accept(resolver);
|
||||
IASTName[] names = resolver.getNames();
|
||||
for (int j = 0; j < names.length; ++j) {
|
||||
IASTNode node = nodez[i];
|
||||
node.accept(visitor);
|
||||
CPPASTNameCollector nameCollector = new CPPASTNameCollector();
|
||||
node.accept(nameCollector);
|
||||
IASTName[] names = nameCollector.getNames();
|
||||
for(IASTName name : names) {
|
||||
try {
|
||||
IBinding b = names[j].resolveBinding();
|
||||
IBinding b = name.resolveBinding();
|
||||
if(b == null || b instanceof IProblemBinding)
|
||||
++issues[i];
|
||||
++problems[i];
|
||||
} catch (Exception t) {
|
||||
++issues[i];
|
||||
++problems[i];
|
||||
}
|
||||
}
|
||||
if(names.length > 0) {
|
||||
IScope scope = CPPVisitor.getContainingScope(names[0]);
|
||||
if( scope != null )
|
||||
{
|
||||
if( scope != null ) {
|
||||
try {
|
||||
ASTInternal.flushCache(scope);
|
||||
} catch (DOMException de) {}
|
||||
|
@ -83,11 +80,11 @@ public abstract class CPPASTAmbiguity extends CPPASTNode {
|
|||
}
|
||||
}
|
||||
int bestIndex = 0;
|
||||
int bestValue = issues[0];
|
||||
for (int i = 1; i < issues.length; ++i) {
|
||||
if (issues[i] < bestValue) {
|
||||
int bestValue = problems[0];
|
||||
for (int i = 1; i < problems.length; ++i) {
|
||||
if (problems[i] < bestValue) {
|
||||
bestIndex = i;
|
||||
bestValue = issues[i];
|
||||
bestValue = problems[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,14 +93,4 @@ public abstract class CPPASTAmbiguity extends CPPASTNode {
|
|||
return true;
|
||||
}
|
||||
|
||||
// protected void printNode() {
|
||||
// System.out.println( "Ambiguity " + getClass().getName() + ": ");
|
||||
// IASTNode [] nodes = getNodes();
|
||||
// for( int i = 0; i < nodes.length; ++i )
|
||||
// {
|
||||
// System.out.print( "\t" + i + " : " );
|
||||
// System.out.println( ASTSignatureUtil.getNodeSignature(nodes[i]) );
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
@ -75,6 +75,10 @@
|
|||
<antcall target="generate_cpp">
|
||||
<param name="grammar_name" value="CPPNoCastExpressionParser"/>
|
||||
</antcall>
|
||||
<!-- Generate parser for disambiguating sizeof expressions -->
|
||||
<antcall target="generate_cpp">
|
||||
<param name="grammar_name" value="CPPSizeofExpressionParser"/>
|
||||
</antcall>
|
||||
</target>
|
||||
|
||||
|
||||
|
|
|
@ -238,7 +238,7 @@ unary_expression
|
|||
| 'sizeof' unary_expression
|
||||
/. $Build consumeExpressionUnaryOperator(IASTUnaryExpression.op_sizeof); $EndBuild ./
|
||||
| 'sizeof' '(' type_name ')'
|
||||
/. $Build consumeExpressionSizeofTypeId(); $EndBuild ./
|
||||
/. $Build consumeExpressionTypeId(IASTTypeIdExpression.op_sizeof); $EndBuild ./
|
||||
|
||||
|
||||
cast_expression
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
-----------------------------------------------------------------------------------
|
||||
-- Copyright (c) 2006, 2008 IBM Corporation and others.
|
||||
-- All rights reserved. This program and the accompanying materials
|
||||
-- are made available under the terms of the Eclipse Public License v1.0
|
||||
-- which accompanies this distribution, and is available at
|
||||
-- http://www.eclipse.org/legal/epl-v10.html
|
||||
--
|
||||
-- Contributors:
|
||||
-- IBM Corporation - initial API and implementation
|
||||
-----------------------------------------------------------------------------------
|
||||
|
||||
%options la=2
|
||||
%options package=org.eclipse.cdt.internal.core.dom.lrparser.cpp
|
||||
%options template=btParserTemplateD.g
|
||||
|
||||
|
||||
$Import
|
||||
CPPGrammar.g
|
||||
$DropRules
|
||||
|
||||
unary_expression
|
||||
::= 'sizeof' '(' type_id ')'
|
||||
|
||||
postfix_expression
|
||||
::= 'typeid' '(' type_id ')'
|
||||
|
||||
$End
|
||||
|
||||
$Start
|
||||
no_sizeof_type_name_start
|
||||
$End
|
||||
|
||||
$Rules
|
||||
|
||||
no_sizeof_type_name_start
|
||||
::= expression
|
||||
| ERROR_TOKEN
|
||||
/. $Build consumeExpressionProblem(); $EndBuild ./
|
||||
|
||||
$End
|
|
@ -57,6 +57,7 @@ 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;
|
||||
|
@ -70,6 +71,8 @@ import org.eclipse.cdt.core.dom.lrparser.IParser;
|
|||
import org.eclipse.cdt.core.dom.lrparser.IParserActionTokenProvider;
|
||||
import static org.eclipse.cdt.core.dom.lrparser.util.CollectionUtils.matchTokens;
|
||||
import org.eclipse.cdt.core.dom.lrparser.util.DebugUtil;
|
||||
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.lrparser.cpp.CPPParsersym;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||
|
||||
|
@ -139,6 +142,13 @@ public abstract class BuildASTParserAction {
|
|||
protected abstract IParser getNoCastExpressionParser();
|
||||
|
||||
|
||||
/**
|
||||
* Expression parser that treats all sizeof and typeid expressions
|
||||
* as unary expressions.
|
||||
*/
|
||||
protected abstract IParser getSizeofExpressionParser();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Create a new parser action.
|
||||
|
@ -408,16 +418,37 @@ public abstract class BuildASTParserAction {
|
|||
}
|
||||
}
|
||||
|
||||
IASTNode result;
|
||||
if(expressionStatement == null)
|
||||
astStack.push(declarationStatement);
|
||||
result = declarationStatement;
|
||||
else if(isImplicitInt(decl))
|
||||
result = expressionStatement;
|
||||
else
|
||||
astStack.push(nodeFactory.newAmbiguousStatement(declarationStatement, expressionStatement));
|
||||
result = nodeFactory.newAmbiguousStatement(declarationStatement, expressionStatement);
|
||||
|
||||
astStack.push(result);
|
||||
|
||||
if(TRACE_AST_STACK) System.out.println(astStack);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* TODO : don't think this is correct.
|
||||
*
|
||||
* Returns true if the given declaration has unspecified type,
|
||||
* in this case the type defaults to int and is know as "implicit int".
|
||||
*/
|
||||
protected static boolean isImplicitInt(IASTDeclaration declaration) {
|
||||
if(declaration instanceof IASTSimpleDeclaration) {
|
||||
IASTDeclSpecifier declSpec = ((IASTSimpleDeclaration)declaration).getDeclSpecifier();
|
||||
if(declSpec instanceof IASTSimpleDeclSpecifier &&
|
||||
((IASTSimpleDeclSpecifier)declSpec).getType() == IASTSimpleDeclSpecifier.t_unspecified) {
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
@ -591,9 +622,26 @@ public abstract class BuildASTParserAction {
|
|||
IASTTypeId typeId = (IASTTypeId) astStack.pop();
|
||||
IASTTypeIdExpression expr = nodeFactory.newTypeIdExpression(operator, typeId);
|
||||
setOffsetAndLength(expr);
|
||||
|
||||
// try parsing as an expression to resolve ambiguities
|
||||
IParser secondaryParser = getSizeofExpressionParser();
|
||||
IASTNode 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);
|
||||
|
||||
// if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
|
||||
//
|
||||
// IASTTypeId typeId = (IASTTypeId) astStack.pop();
|
||||
// IASTTypeIdExpression expr = nodeFactory.newTypeIdExpression(operator, typeId);
|
||||
// setOffsetAndLength(expr);
|
||||
// astStack.push(expr);
|
||||
//
|
||||
// if(TRACE_AST_STACK) System.out.println(astStack);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -38,14 +38,11 @@ import java.util.List;
|
|||
|
||||
import lpg.lpgjavaruntime.IToken;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCompletionNode;
|
||||
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.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;
|
||||
|
@ -53,10 +50,8 @@ import org.eclipse.cdt.core.dom.ast.IASTIfStatement;
|
|||
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTInitializerList;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTPointer;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTProblemExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTStandardFunctionDeclarator;
|
||||
|
@ -64,8 +59,6 @@ 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;
|
||||
|
@ -90,10 +83,8 @@ import org.eclipse.cdt.internal.core.dom.lrparser.c99.C99ExpressionStatementPars
|
|||
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.lrparser.cpp.CPPParsersym;
|
||||
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.
|
||||
|
@ -148,6 +139,10 @@ public class C99BuildASTParserAction extends BuildASTParserAction {
|
|||
return new C99NoCastExpressionParser(C99Parsersym.orderedTerminalSymbols);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IParser getSizeofExpressionParser() {
|
||||
return new C99SizeofExpressionParser(CPPParsersym.orderedTerminalSymbols);
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************
|
||||
|
@ -193,28 +188,28 @@ 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 secondaryParser = new C99SizeofExpressionParser(C99Parsersym.orderedTerminalSymbols);
|
||||
IASTNode 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);
|
||||
}
|
||||
// /**
|
||||
// * 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 secondaryParser = new C99SizeofExpressionParser(C99Parsersym.orderedTerminalSymbols);
|
||||
// IASTNode 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);
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -94,6 +94,7 @@ import org.eclipse.cdt.internal.core.dom.lrparser.c99.C99Parsersym;
|
|||
import org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPExpressionStatementParser;
|
||||
import org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPNoCastExpressionParser;
|
||||
import org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym;
|
||||
import org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPSizeofExpressionParser;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTFunctionDeclarator;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.OverloadableOperator;
|
||||
|
||||
|
@ -137,6 +138,11 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected IParser getSizeofExpressionParser() {
|
||||
return new CPPSizeofExpressionParser(CPPParsersym.orderedTerminalSymbols);
|
||||
}
|
||||
|
||||
/**
|
||||
* new_expression
|
||||
* ::= dcolon_opt 'new' new_placement_opt new_type_id <openscope-ast> new_array_expressions_op new_initializer_opt
|
||||
|
|
|
@ -37,13 +37,13 @@ class BindingCheckVisitor extends CASTVisitor {
|
|||
shouldVisitEnumerators = true;
|
||||
shouldVisitTranslationUnit = true;
|
||||
shouldVisitProblems = false;
|
||||
shouldVisitComments = false;
|
||||
shouldVisitDesignators = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int visit(IASTName name) {
|
||||
if(name.getBinding() == null)
|
||||
throw new AssertionError("Binding did not get pre-resolved: '" + name + "'");
|
||||
throw new AssertionError("Binding did not get pre-resolved: '" + name + "'"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
return PROCESS_CONTINUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -375,7 +375,7 @@ public C99ExpressionStatementParser(String[] mapFrom) { // constructor
|
|||
//
|
||||
// Rule 41: unary_expression ::= sizeof ( type_name )
|
||||
//
|
||||
case 41: { action. consumeExpressionSizeofTypeId(); break;
|
||||
case 41: { action. consumeExpressionTypeId(IASTTypeIdExpression.op_sizeof); break;
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -375,7 +375,7 @@ public C99NoCastExpressionParser(String[] mapFrom) { // constructor
|
|||
//
|
||||
// Rule 41: unary_expression ::= sizeof ( type_name )
|
||||
//
|
||||
case 41: { action. consumeExpressionSizeofTypeId(); break;
|
||||
case 41: { action. consumeExpressionTypeId(IASTTypeIdExpression.op_sizeof); break;
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -375,7 +375,7 @@ public C99Parser(String[] mapFrom) { // constructor
|
|||
//
|
||||
// Rule 41: unary_expression ::= sizeof ( type_name )
|
||||
//
|
||||
case 41: { action. consumeExpressionSizeofTypeId(); break;
|
||||
case 41: { action. consumeExpressionTypeId(IASTTypeIdExpression.op_sizeof); break;
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -185,7 +185,6 @@ private void initActions(IASTTranslationUnit tu) {
|
|||
|
||||
public void addToken(IToken token) {
|
||||
token.setKind(mapKind(token.getKind()));
|
||||
//System.out.println("Token: " + token);
|
||||
super.addToken(token);
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,270 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2008 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl_v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
*********************************************************************************/
|
||||
|
||||
// This file was generated by LPG
|
||||
|
||||
package org.eclipse.cdt.internal.core.dom.lrparser.cpp;
|
||||
|
||||
public interface CPPSizeofExpressionParsersym {
|
||||
public final static int
|
||||
TK_asm = 68,
|
||||
TK_auto = 51,
|
||||
TK_bool = 15,
|
||||
TK_break = 77,
|
||||
TK_case = 78,
|
||||
TK_catch = 118,
|
||||
TK_char = 16,
|
||||
TK_class = 60,
|
||||
TK_const = 48,
|
||||
TK_const_cast = 28,
|
||||
TK_continue = 79,
|
||||
TK_default = 80,
|
||||
TK_delete = 42,
|
||||
TK_do = 81,
|
||||
TK_double = 17,
|
||||
TK_dynamic_cast = 29,
|
||||
TK_else = 122,
|
||||
TK_enum = 64,
|
||||
TK_explicit = 52,
|
||||
TK_export = 82,
|
||||
TK_extern = 44,
|
||||
TK_false = 30,
|
||||
TK_float = 18,
|
||||
TK_for = 83,
|
||||
TK_friend = 53,
|
||||
TK_goto = 84,
|
||||
TK_if = 85,
|
||||
TK_inline = 54,
|
||||
TK_int = 19,
|
||||
TK_long = 20,
|
||||
TK_mutable = 55,
|
||||
TK_namespace = 65,
|
||||
TK_new = 43,
|
||||
TK_operator = 7,
|
||||
TK_private = 119,
|
||||
TK_protected = 120,
|
||||
TK_public = 121,
|
||||
TK_register = 56,
|
||||
TK_reinterpret_cast = 31,
|
||||
TK_return = 86,
|
||||
TK_short = 21,
|
||||
TK_signed = 22,
|
||||
TK_sizeof = 32,
|
||||
TK_static = 57,
|
||||
TK_static_cast = 33,
|
||||
TK_struct = 66,
|
||||
TK_switch = 87,
|
||||
TK_template = 49,
|
||||
TK_this = 34,
|
||||
TK_throw = 41,
|
||||
TK_try = 74,
|
||||
TK_true = 35,
|
||||
TK_typedef = 58,
|
||||
TK_typeid = 36,
|
||||
TK_typename = 9,
|
||||
TK_union = 67,
|
||||
TK_unsigned = 23,
|
||||
TK_using = 62,
|
||||
TK_virtual = 47,
|
||||
TK_void = 24,
|
||||
TK_volatile = 50,
|
||||
TK_wchar_t = 25,
|
||||
TK_while = 76,
|
||||
TK_integer = 37,
|
||||
TK_floating = 38,
|
||||
TK_charconst = 39,
|
||||
TK_stringlit = 26,
|
||||
TK_identifier = 1,
|
||||
TK_Completion = 2,
|
||||
TK_EndOfCompletion = 12,
|
||||
TK_Invalid = 123,
|
||||
TK_LeftBracket = 63,
|
||||
TK_LeftParen = 3,
|
||||
TK_LeftBrace = 61,
|
||||
TK_Dot = 117,
|
||||
TK_DotStar = 96,
|
||||
TK_Arrow = 103,
|
||||
TK_ArrowStar = 90,
|
||||
TK_PlusPlus = 13,
|
||||
TK_MinusMinus = 14,
|
||||
TK_And = 8,
|
||||
TK_Star = 6,
|
||||
TK_Plus = 10,
|
||||
TK_Minus = 11,
|
||||
TK_Tilde = 5,
|
||||
TK_Bang = 27,
|
||||
TK_Slash = 91,
|
||||
TK_Percent = 92,
|
||||
TK_RightShift = 88,
|
||||
TK_LeftShift = 89,
|
||||
TK_LT = 59,
|
||||
TK_GT = 69,
|
||||
TK_LE = 93,
|
||||
TK_GE = 94,
|
||||
TK_EQ = 97,
|
||||
TK_NE = 98,
|
||||
TK_Caret = 99,
|
||||
TK_Or = 100,
|
||||
TK_AndAnd = 101,
|
||||
TK_OrOr = 102,
|
||||
TK_Question = 114,
|
||||
TK_Colon = 73,
|
||||
TK_ColonColon = 4,
|
||||
TK_DotDotDot = 95,
|
||||
TK_Assign = 71,
|
||||
TK_StarAssign = 104,
|
||||
TK_SlashAssign = 105,
|
||||
TK_PercentAssign = 106,
|
||||
TK_PlusAssign = 107,
|
||||
TK_MinusAssign = 108,
|
||||
TK_RightShiftAssign = 109,
|
||||
TK_LeftShiftAssign = 110,
|
||||
TK_AndAssign = 111,
|
||||
TK_CaretAssign = 112,
|
||||
TK_OrAssign = 113,
|
||||
TK_Comma = 70,
|
||||
TK_zero = 40,
|
||||
TK_RightBracket = 115,
|
||||
TK_RightParen = 75,
|
||||
TK_RightBrace = 72,
|
||||
TK_SemiColon = 45,
|
||||
TK_ERROR_TOKEN = 46,
|
||||
TK_EOF_TOKEN = 116;
|
||||
|
||||
public final static String orderedTerminalSymbols[] = {
|
||||
"",
|
||||
"identifier",
|
||||
"Completion",
|
||||
"LeftParen",
|
||||
"ColonColon",
|
||||
"Tilde",
|
||||
"Star",
|
||||
"operator",
|
||||
"And",
|
||||
"typename",
|
||||
"Plus",
|
||||
"Minus",
|
||||
"EndOfCompletion",
|
||||
"PlusPlus",
|
||||
"MinusMinus",
|
||||
"bool",
|
||||
"char",
|
||||
"double",
|
||||
"float",
|
||||
"int",
|
||||
"long",
|
||||
"short",
|
||||
"signed",
|
||||
"unsigned",
|
||||
"void",
|
||||
"wchar_t",
|
||||
"stringlit",
|
||||
"Bang",
|
||||
"const_cast",
|
||||
"dynamic_cast",
|
||||
"false",
|
||||
"reinterpret_cast",
|
||||
"sizeof",
|
||||
"static_cast",
|
||||
"this",
|
||||
"true",
|
||||
"typeid",
|
||||
"integer",
|
||||
"floating",
|
||||
"charconst",
|
||||
"zero",
|
||||
"throw",
|
||||
"delete",
|
||||
"new",
|
||||
"extern",
|
||||
"SemiColon",
|
||||
"ERROR_TOKEN",
|
||||
"virtual",
|
||||
"const",
|
||||
"template",
|
||||
"volatile",
|
||||
"auto",
|
||||
"explicit",
|
||||
"friend",
|
||||
"inline",
|
||||
"mutable",
|
||||
"register",
|
||||
"static",
|
||||
"typedef",
|
||||
"LT",
|
||||
"class",
|
||||
"LeftBrace",
|
||||
"using",
|
||||
"LeftBracket",
|
||||
"enum",
|
||||
"namespace",
|
||||
"struct",
|
||||
"union",
|
||||
"asm",
|
||||
"GT",
|
||||
"Comma",
|
||||
"Assign",
|
||||
"RightBrace",
|
||||
"Colon",
|
||||
"try",
|
||||
"RightParen",
|
||||
"while",
|
||||
"break",
|
||||
"case",
|
||||
"continue",
|
||||
"default",
|
||||
"do",
|
||||
"export",
|
||||
"for",
|
||||
"goto",
|
||||
"if",
|
||||
"return",
|
||||
"switch",
|
||||
"RightShift",
|
||||
"LeftShift",
|
||||
"ArrowStar",
|
||||
"Slash",
|
||||
"Percent",
|
||||
"LE",
|
||||
"GE",
|
||||
"DotDotDot",
|
||||
"DotStar",
|
||||
"EQ",
|
||||
"NE",
|
||||
"Caret",
|
||||
"Or",
|
||||
"AndAnd",
|
||||
"OrOr",
|
||||
"Arrow",
|
||||
"StarAssign",
|
||||
"SlashAssign",
|
||||
"PercentAssign",
|
||||
"PlusAssign",
|
||||
"MinusAssign",
|
||||
"RightShiftAssign",
|
||||
"LeftShiftAssign",
|
||||
"AndAssign",
|
||||
"CaretAssign",
|
||||
"OrAssign",
|
||||
"Question",
|
||||
"RightBracket",
|
||||
"EOF_TOKEN",
|
||||
"Dot",
|
||||
"catch",
|
||||
"private",
|
||||
"protected",
|
||||
"public",
|
||||
"else",
|
||||
"Invalid"
|
||||
};
|
||||
|
||||
public final static boolean isValidForParser = true;
|
||||
}
|
Loading…
Add table
Reference in a new issue