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

added support to LR parsers for GNU extensions typeof and alignof, added ISecondaryParserFactory

This commit is contained in:
Mike Kucera 2009-01-30 13:31:43 +00:00
parent 8a018e449f
commit 44907e7056
77 changed files with 29230 additions and 20531 deletions

View file

@ -1,5 +1,5 @@
<!--
Copyright (c) 2006, 2008 IBM Corporation and others.
Copyright (c) 2006, 2009 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
@ -75,6 +75,9 @@
<antcall target="generate_gcc">
<param name="grammar_name" value="GCCParser"/>
</antcall>
<antcall target="generate_gcc">
<param name="grammar_name" value="GCCSizeofExpressionParser"/>
</antcall>
</target>
@ -129,6 +132,9 @@
<antcall target="generate_gpp">
<param name="grammar_name" value="GPPParser"/>
</antcall>
<antcall target="generate_gpp">
<param name="grammar_name" value="GPPSizeofExpressionParser"/>
</antcall>
</target>

View file

@ -1,5 +1,5 @@
-----------------------------------------------------------------------------------
-- Copyright (c) 2006, 2008 IBM Corporation and others.
-- Copyright (c) 2006, 2009 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
@ -96,6 +96,7 @@ $Globals
/.
import org.eclipse.cdt.internal.core.dom.parser.c.CNodeFactory;
import org.eclipse.cdt.core.dom.lrparser.action.c99.C99BuildASTParserAction;
import org.eclipse.cdt.core.dom.lrparser.action.c99.C99SecondaryParserFactory;
./
$End
@ -104,6 +105,7 @@ $End
$Define
$build_action_class /. C99BuildASTParserAction ./
$node_factory_create_expression /. CNodeFactory.getDefault() ./
$parser_factory_create_expression /. C99SecondaryParserFactory.getDefault() ./
$End
@ -186,7 +188,7 @@ postfix_expression
/. $Build consumeExpressionUnaryOperator(IASTUnaryExpression.op_postFixIncr); $EndBuild ./
| postfix_expression '--'
/. $Build consumeExpressionUnaryOperator(IASTUnaryExpression.op_postFixDecr); $EndBuild ./
| '(' type_name ')' '{' <openscope-ast> initializer_list comma_opt '}'
| '(' type_id ')' '{' <openscope-ast> initializer_list comma_opt '}'
/. $Build consumeExpressionTypeIdInitializer(); $EndBuild ./
@ -220,13 +222,13 @@ unary_expression
/. $Build consumeExpressionUnaryOperator(IASTUnaryExpression.op_not); $EndBuild ./
| 'sizeof' unary_expression
/. $Build consumeExpressionUnaryOperator(IASTUnaryExpression.op_sizeof); $EndBuild ./
| 'sizeof' '(' type_name ')'
| 'sizeof' '(' type_id ')'
/. $Build consumeExpressionTypeId(IASTTypeIdExpression.op_sizeof); $EndBuild ./
cast_expression
::= unary_expression
| '(' type_name ')' cast_expression
| '(' type_id ')' cast_expression
/. $Build consumeExpressionCast(IASTCastExpression.op_cast); $EndBuild ./
@ -845,7 +847,7 @@ complete_parameter_declarator
-- only used in expressions, eg) sizeof, casts etc...
type_name
type_id
::= specifier_qualifier_list
/. $Build consumeTypeId(false); $EndBuild ./
| specifier_qualifier_list abstract_declarator

View file

@ -1,5 +1,5 @@
-----------------------------------------------------------------------------------
-- Copyright (c) 2006, 2008 IBM Corporation and others.
-- Copyright (c) 2006, 2009 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
@ -18,7 +18,7 @@ $Import
$DropRules
cast_expression
::= '(' type_name ')' cast_expression
::= '(' type_id ')' cast_expression
$End

View file

@ -1,5 +1,5 @@
-----------------------------------------------------------------------------------
-- Copyright (c) 2006, 2008 IBM Corporation and others.
-- Copyright (c) 2006, 2009 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
@ -19,17 +19,17 @@ $Import
$DropRules
unary_expression
::= 'sizeof' '(' type_name ')'
::= 'sizeof' '(' type_id ')'
$End
$Start
no_sizeof_type_name_start
no_sizeof_type_id_start
$End
$Rules
no_sizeof_type_name_start
no_sizeof_type_id_start
::= expression
| ERROR_TOKEN
/. $Build consumeExpressionProblem(); $EndBuild ./

View file

@ -1,5 +1,5 @@
----------------------------------------------------------------------------------
-- Copyright (c) 2006, 2008 IBM Corporation and others.
-- Copyright (c) 2006, 2009 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
@ -103,6 +103,7 @@ $Globals
import org.eclipse.cdt.core.dom.ast.cpp.*;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPNodeFactory;
import org.eclipse.cdt.core.dom.lrparser.action.cpp.CPPBuildASTParserAction;
import org.eclipse.cdt.core.dom.lrparser.action.cpp.CPPSecondaryParserFactory;
./
$End
@ -110,6 +111,7 @@ $End
$Define
$build_action_class /. CPPBuildASTParserAction ./
$node_factory_create_expression /. CPPNodeFactory.getDefault() ./
$parser_factory_create_expression /. CPPSecondaryParserFactory.getDefault() ./
$End
@ -178,8 +180,6 @@ identifier_token
literal
::= 'integer'
/. $Build consumeExpressionLiteral(ICPPASTLiteralExpression.lk_integer_constant); $EndBuild ./
| '0'
/. $Build consumeExpressionLiteral(ICPPASTLiteralExpression.lk_integer_constant); $EndBuild ./
| 'floating'
/. $Build consumeExpressionLiteral(ICPPASTLiteralExpression.lk_float_constant); $EndBuild ./
| 'charconst'

View file

@ -1,5 +1,5 @@
-----------------------------------------------------------------------------------
-- Copyright (c) 2006, 2008 IBM Corporation and others.
-- Copyright (c) 2006, 2009 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
@ -27,12 +27,12 @@ $DropRules
$End
$Start
no_sizeof_type_name_start
no_sizeof_type_id_start
$End
$Rules
no_sizeof_type_name_start
no_sizeof_type_id_start
::= expression
| ERROR_TOKEN
/. $Build consumeExpressionProblem(); $EndBuild ./

View file

@ -0,0 +1,106 @@
-----------------------------------------------------------------------------------
-- Copyright (c) 2009 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
-----------------------------------------------------------------------------------
-- For this to work the environment variable LPG_INCLUDE must be set up
-- to point at the directory where the C99Parser.g file is located.
$Import
../c99/C99Grammar.g
$End
$Import
../gnu/GNUExtensions.g
$End
-- Tokens used by GCC but not part of the C99 spec
$Terminals
asm
$End
$Globals
/.
import org.eclipse.cdt.core.dom.lrparser.action.gnu.GCCBuildASTParserAction;
import org.eclipse.cdt.core.dom.lrparser.action.gnu.GCCSecondaryParserFactory;
./
$End
$Define
$gnu_action_class /. GCCBuildASTParserAction ./
$parser_factory_create_expression /. GCCSecondaryParserFactory.getDefault() ./
$End
$Rules
declaration
::= extended_asm_declaration
no_type_declaration_specifier
::= attribute_or_decl_specifier
complete_declarator
::= attribute_or_decl_specifier_seq declarator
| declarator attribute_or_decl_specifier_seq
| attribute_or_decl_specifier_seq declarator attribute_or_decl_specifier_seq
complete_struct_declarator
::= attribute_or_decl_specifier_seq struct_declarator
| struct_declarator attribute_or_decl_specifier_seq
| attribute_or_decl_specifier_seq struct_declarator attribute_or_decl_specifier_seq
enum_specifier_hook
::= attribute_or_decl_specifier_seq
struct_or_union_specifier_hook
::= attribute_or_decl_specifier_seq
struct_or_union_specifier_suffix_hook
::= attribute_or_decl_specifier_seq
pointer_hook
::= attribute_or_decl_specifier_seq
elaborated_specifier_hook
::= attribute_or_decl_specifier_seq
-- GCC extensions to designated initializers
designator_base
::= field_name_designator
| array_range_designator
field_name_designator
::= identifier_token ':'
/. $BeginAction gnuAction.consumeDesignatorField(); $EndAction ./
array_range_designator
::= '[' constant_expression '...' constant_expression ']'
/. $BeginAction gnuAction.consumeDesignatorArray(); $EndAction ./
designated_initializer
::= <openscope-ast> field_name_designator initializer
/. $Build consumeInitializerDesignated(); $EndBuild ./
$End

View file

@ -1,5 +1,5 @@
-----------------------------------------------------------------------------------
-- Copyright (c) 2006, 2008 IBM Corporation and others.
-- Copyright (c) 2008, 2009 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
@ -14,89 +14,13 @@
%options template=FixedBtParserTemplateD.g
-- For this to work the environment variable LPG_INCLUDE must be set up
-- to point at the directory where the C99Parser.g file is located.
$Import
../c99/C99Parser.g
$End
-- This file is needed because LPG won't allow redefinition of the
-- start symbol, so C99Grammar.g cannot define a start symbol.
$Import
../gnu/GNUExtensions.g
GCCGrammar.g
$End
-- Tokens used by GCC but not part of the C99 spec
$Terminals
asm
$End
$Globals
/.
import org.eclipse.cdt.core.dom.lrparser.action.gnu.GCCBuildASTParserAction;
./
$End
$Define
$gnu_action_class /. GCCBuildASTParserAction ./
$End
$Rules
declaration
::= extended_asm_declaration
no_type_declaration_specifier
::= attribute_or_decl_specifier
complete_declarator
::= attribute_or_decl_specifier_seq declarator
| declarator attribute_or_decl_specifier_seq
| attribute_or_decl_specifier_seq declarator attribute_or_decl_specifier_seq
complete_struct_declarator
::= attribute_or_decl_specifier_seq struct_declarator
| struct_declarator attribute_or_decl_specifier_seq
| attribute_or_decl_specifier_seq struct_declarator attribute_or_decl_specifier_seq
enum_specifier_hook
::= attribute_or_decl_specifier_seq
struct_or_union_specifier_hook
::= attribute_or_decl_specifier_seq
struct_or_union_specifier_suffix_hook
::= attribute_or_decl_specifier_seq
pointer_hook
::= attribute_or_decl_specifier_seq
elaborated_specifier_hook
::= attribute_or_decl_specifier_seq
designator_base
::= identifier_token ':'
/. $BeginAction gnuAction.consumeDesignatorField(); $EndAction ./
| '[' constant_expression '...' constant_expression ']'
/. $BeginAction gnuAction.consumeDesignatorArray(); $EndAction ./
$Start
translation_unit
$End

View file

@ -0,0 +1,40 @@
-----------------------------------------------------------------------------------
-- Copyright (c) 2009 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.gcc
%options template=FixedBtParserTemplateD.g
$Import
GCCGrammar.g
$DropRules
unary_expression
::= 'sizeof' '(' type_id ')'
| '__alignof__' '(' type_id ')'
| 'typeof' '(' type_id ')'
$End
$Start
no_sizeof_type_name_start
$End
$Rules
no_sizeof_type_name_start
::= expression
| ERROR_TOKEN
/. $Build consumeExpressionProblem(); $EndBuild ./
$End

View file

@ -1,5 +1,5 @@
-----------------------------------------------------------------------------------
-- Copyright (c) 2006, 2008 IBM Corporation and others.
-- Copyright (c) 2008, 2009 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
@ -40,7 +40,7 @@ $Define
$action_initializations /.
gnuAction = new $gnu_action_class ($node_factory_create_expression, this, tu, astStack);
gnuAction = new $gnu_action_class (this, tu, astStack, $node_factory_create_expression);
gnuAction.setParserOptions(options);
./
@ -135,5 +135,18 @@ extended_asm_param
| 'stringlit' '(' '*' 'identifier' ')'
unary_expression
::= '__alignof__' unary_expression
/. $Build consumeExpressionUnaryOperator(IASTUnaryExpression.op_alignOf); $EndBuild ./
| '__alignof__' '(' type_id ')'
/. $Build consumeExpressionTypeId(IASTTypeIdExpression.op_alignof); $EndBuild ./
| 'typeof' unary_expression
/. $Build consumeExpressionUnaryOperator(IASTUnaryExpression.op_typeof); $EndBuild ./
| 'typeof' '(' type_id ')'
/. $Build consumeExpressionTypeId(IASTTypeIdExpression.op_typeof); $EndBuild ./
$End

View file

@ -0,0 +1,89 @@
-----------------------------------------------------------------------------------
-- Copyright (c) 2009 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.gpp
%options template=FixedBtParserTemplateD.g
-- For this to work the environment variable LPG_INCLUDE must be set up
-- to point at the directory where the CPPParser.g file is located.
$Import
../cpp/CPPGrammar.g
$DropRules
-- will be replaced by extended asm syntax
asm_definition
::= 'asm' '(' 'stringlit' ')' ';'
$End
$Import
../gnu/GNUExtensions.g
$End
$Globals
/.
import org.eclipse.cdt.core.dom.lrparser.action.gnu.GNUBuildASTParserAction;
import org.eclipse.cdt.core.dom.lrparser.action.gnu.GPPSecondaryParserFactory;
./
$End
$Define
$gnu_action_class /. GNUBuildASTParserAction ./
$parser_factory_create_expression /. GPPSecondaryParserFactory.getDefault() ./
$End
$Rules
asm_definition
::= extended_asm_declaration
no_type_declaration_specifier
::= attribute_or_decl_specifier
complete_declarator
::= attribute_or_decl_specifier_seq declarator
| declarator attribute_or_decl_specifier_seq
| attribute_or_decl_specifier_seq declarator attribute_or_decl_specifier_seq
member_declarator_complete
::= attribute_or_decl_specifier_seq member_declarator_complete
| member_declarator_complete attribute_or_decl_specifier_seq
| attribute_or_decl_specifier_seq member_declarator_complete attribute_or_decl_specifier_seq
enum_specifier_hook
::= attribute_or_decl_specifier_seq
composite_specifier_hook
::= attribute_or_decl_specifier_seq
class_name_suffix_hook
::= attribute_or_decl_specifier_seq
pointer_hook
::= attribute_or_decl_specifier_seq
declarator
::= <openscope-ast> ptr_operator_seq attribute_or_decl_specifier_seq direct_declarator
/. $Build consumeDeclaratorWithPointer(true); $EndBuild ./
elaborated_specifier_hook
::= attribute_or_decl_specifier_seq
$End

View file

@ -1,87 +1,26 @@
-----------------------------------------------------------------------------------
-- Copyright (c) 2008 IBM Corporation and others.
----------------------------------------------------------------------------------
-- Copyright (c) 2008, 2009 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
-- 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.gpp
%options template=FixedBtParserTemplateD.g
-- For this to work the environment variable LPG_INCLUDE must be set up
-- to point at the directory where the CPPParser.g file is located.
$Import
../cpp/CPPParser.g
$DropRules
-- will be replaced by extended asm syntax
asm_definition
::= 'asm' '(' 'stringlit' ')' ';'
$End
-- This file is needed because LPG won't allow redefinition of the
-- start symbol, so CPPGrammar.g cannot define a start symbol.
$Import
../gnu/GNUExtensions.g
GPPGrammar.g
$End
$Globals
/.
import org.eclipse.cdt.core.dom.lrparser.action.gnu.GNUBuildASTParserAction;
./
$End
$Define
$gnu_action_class /. GNUBuildASTParserAction ./
$End
$Rules
asm_definition
::= extended_asm_declaration
no_type_declaration_specifier
::= attribute_or_decl_specifier
complete_declarator
::= attribute_or_decl_specifier_seq declarator
| declarator attribute_or_decl_specifier_seq
| attribute_or_decl_specifier_seq declarator attribute_or_decl_specifier_seq
member_declarator_complete
::= attribute_or_decl_specifier_seq member_declarator_complete
| member_declarator_complete attribute_or_decl_specifier_seq
| attribute_or_decl_specifier_seq member_declarator_complete attribute_or_decl_specifier_seq
enum_specifier_hook
::= attribute_or_decl_specifier_seq
composite_specifier_hook
::= attribute_or_decl_specifier_seq
class_name_suffix_hook
::= attribute_or_decl_specifier_seq
pointer_hook
::= attribute_or_decl_specifier_seq
declarator
::= <openscope-ast> ptr_operator_seq attribute_or_decl_specifier_seq direct_declarator
/. $Build consumeDeclaratorWithPointer(true); $EndBuild ./
elaborated_specifier_hook
::= attribute_or_decl_specifier_seq
$Start
translation_unit
$End

View file

@ -0,0 +1,42 @@
-----------------------------------------------------------------------------------
-- Copyright (c) 2009 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.gpp
%options template=FixedBtParserTemplateD.g
$Import
GPPGrammar.g
$DropRules
unary_expression
::= 'sizeof' '(' type_id ')'
| '__alignof__' '(' type_id ')'
| 'typeof' '(' type_id ')'
postfix_expression
::= 'typeid' '(' type_id ')'
$End
$Start
no_sizeof_type_id_start
$End
$Rules
no_sizeof_type_id_start
::= expression
| ERROR_TOKEN
/. $Build consumeExpressionProblem(); $EndBuild ./
$End

View file

@ -1,5 +1,5 @@
----------------------------------------------------------------------------------
-- Copyright (c) 2006, 2008 IBM Corporation and others.
-- Copyright (c) 2006, 2009 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
@ -320,7 +320,8 @@ $Define
$additional_interfaces /. , IParserActionTokenProvider, IParser $extra_interfaces ./
$build_action_class /. ./ -- name of the class that has the AST building callbacks
$node_factory_create_expression /. ./ -- expression that will create the node factory
$node_factory_create_expression /. ./ -- expression that will create the INodeFactory
$parser_factory_create_expression /. ./ -- expression that will create the ISecondaryParserFactory
$action_initializations /. ./
@ -349,7 +350,7 @@ $Headers
}
private void initActions(IASTTranslationUnit tu, Set<IParser.Options> options) {
action = new $build_action_class($node_factory_create_expression, this, tu, astStack);
action = new $build_action_class(this, tu, astStack, $node_factory_create_expression, $parser_factory_create_expression);
action.setParserOptions(options);
$action_initializations
@ -422,8 +423,8 @@ $Headers
addToken(new Token(null, 0, 0, $sym_type.TK_EOF_TOKEN));
}
public $action_type(String[] mapFrom) { // constructor
tokenMap = new TokenMap($sym_type.orderedTerminalSymbols, mapFrom);
public $action_type(IParserActionTokenProvider parser) { // constructor
tokenMap = new TokenMap($sym_type.orderedTerminalSymbols, parser.getOrderedTerminalSymbols());
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2008 IBM Corporation and others.
* Copyright (c) 2006, 2009 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
@ -37,6 +37,8 @@ public interface IParser extends ITokenCollector {
* The LR parsers do not actually skip the parsing of function bodies,
* but this option does have the effect of not generating AST nodes
* for function bodies.
*
* TODO Implement this
*/
//OPTION_SKIP_FUNCTION_BODIES,

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2008 IBM Corporation and others.
* Copyright (c) 2006, 2009 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
@ -91,6 +91,9 @@ public abstract class BuildASTParserAction extends AbstractParserAction {
/** Abstract factory for creating AST node objects */
private final INodeFactory nodeFactory;
/** Abstract factory for creating secondary parsers */
private final ISecondaryParserFactory parserFactory;
/**
* Returns true if the token is an identifier.
@ -98,39 +101,23 @@ public abstract class BuildASTParserAction extends AbstractParserAction {
protected abstract boolean isIdentifierToken(IToken token);
/**
* Get the parser that will recognize expressions.
*/
protected abstract IParser getExpressionParser();
/**
* Expression parser that does not recognize cast expressions,
* used to disambiguate casts.
*/
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.
* @param tu Root node of the AST, its list of declarations should be empty.
* @throws NullPointerException if any of the parameters are null
*/
public BuildASTParserAction(INodeFactory nodeFactory, IParserActionTokenProvider parser, IASTTranslationUnit tu, ScopedStack<Object> astStack) {
public BuildASTParserAction(IParserActionTokenProvider parser, IASTTranslationUnit tu, ScopedStack<Object> astStack, INodeFactory nodeFactory, ISecondaryParserFactory parserFactory) {
super(parser, tu, astStack);
if(nodeFactory == null)
throw new NullPointerException("nodeFactory is null"); //$NON-NLS-1$
if(parserFactory == null)
throw new NullPointerException("parserFactory is null"); //$NON-NLS-1$
this.nodeFactory = nodeFactory;
this.parserFactory = parserFactory;
}
@ -188,7 +175,7 @@ public abstract class BuildASTParserAction extends AbstractParserAction {
List<IToken> expressionTokens = parser.getRuleTokens();
expressionTokens = expressionTokens.subList(0, expressionTokens.size()-1); // remove the semicolon at the end
IParser expressionParser = getExpressionParser();
IParser expressionParser = parserFactory.getExpressionParser(parser);
IASTExpression expr = (IASTExpression) runSecondaryParser(expressionParser, expressionTokens);
if(expr != null && !(expr instanceof IASTProblemExpression)) { // the parse may fail
@ -365,7 +352,7 @@ public abstract class BuildASTParserAction extends AbstractParserAction {
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();
IParser secondaryParser = parserFactory.getNoCastExpressionParser(parser);
alternateExpr = runSecondaryParser(secondaryParser);
}
@ -405,7 +392,7 @@ public abstract class BuildASTParserAction extends AbstractParserAction {
setOffsetAndLength(expr);
// try parsing as an expression to resolve ambiguities
IParser secondaryParser = getSizeofExpressionParser();
IParser secondaryParser = parserFactory.getSizeofExpressionParser(parser);
IASTNode alternateExpr = runSecondaryParser(secondaryParser);
if(alternateExpr == null || alternateExpr instanceof IASTProblemExpression)

View file

@ -0,0 +1,46 @@
/*******************************************************************************
* Copyright (c) 2009 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
*******************************************************************************/
package org.eclipse.cdt.core.dom.lrparser.action;
import org.eclipse.cdt.core.dom.lrparser.IParser;
import org.eclipse.cdt.core.dom.lrparser.IParserActionTokenProvider;
/**
* Some ambiguities are resolved by spawning a secondary parser
* to re-parse a sequence of tokens using a modified grammar.
* This factory is used to create these secondary parsers.
*
* @author Mike Kucera
*/
public interface ISecondaryParserFactory {
/**
* Get the parser that will recognize expressions.
*/
IParser getExpressionParser(IParserActionTokenProvider parser);
/**
* Expression parser that does not recognize cast expressions,
* used to disambiguate casts.
*/
IParser getNoCastExpressionParser(IParserActionTokenProvider parser);
/**
* Expression parser that treats all sizeof and typeid expressions
* as unary expressions.
*/
IParser getSizeofExpressionParser(IParserActionTokenProvider parser);
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2008 IBM Corporation and others.
* Copyright (c) 2006, 2009 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
@ -62,18 +62,15 @@ import org.eclipse.cdt.core.dom.ast.c.ICASTTypeIdInitializerExpression;
import org.eclipse.cdt.core.dom.ast.c.ICASTTypedefNameSpecifier;
import org.eclipse.cdt.core.dom.ast.c.ICNodeFactory;
import org.eclipse.cdt.core.dom.ast.gnu.c.ICASTKnRFunctionDeclarator;
import org.eclipse.cdt.core.dom.lrparser.IParser;
import org.eclipse.cdt.core.dom.lrparser.IParserActionTokenProvider;
import org.eclipse.cdt.core.dom.lrparser.action.BuildASTParserAction;
import org.eclipse.cdt.core.dom.lrparser.action.ISecondaryParserFactory;
import org.eclipse.cdt.core.dom.lrparser.action.ITokenMap;
import org.eclipse.cdt.core.dom.lrparser.action.ParserUtil;
import org.eclipse.cdt.core.dom.lrparser.action.ScopedStack;
import org.eclipse.cdt.core.dom.lrparser.action.TokenMap;
import org.eclipse.cdt.core.parser.util.CollectionUtils;
import org.eclipse.cdt.internal.core.dom.lrparser.c99.C99ExpressionParser;
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;
@ -98,8 +95,8 @@ public class C99BuildASTParserAction extends BuildASTParserAction {
* @param orderedTerminalSymbols When an instance of this class is created for a parser
* that parsers token kinds will be mapped back to the base C99 parser's token kinds.
*/
public C99BuildASTParserAction(ICNodeFactory nodeFactory, IParserActionTokenProvider parser, IASTTranslationUnit tu, ScopedStack<Object> astStack) {
super(nodeFactory, parser, tu, astStack);
public C99BuildASTParserAction(IParserActionTokenProvider parser, IASTTranslationUnit tu, ScopedStack<Object> astStack, ICNodeFactory nodeFactory, ISecondaryParserFactory parserFactory) {
super(parser, tu, astStack, nodeFactory, parserFactory);
this.nodeFactory = nodeFactory;
this.tokenMap = new TokenMap(C99Parsersym.orderedTerminalSymbols, parser.getOrderedTerminalSymbols());
@ -121,20 +118,6 @@ public class C99BuildASTParserAction extends BuildASTParserAction {
return baseKind(token) == TK_identifier;
}
@Override
protected IParser getExpressionParser() {
return new C99ExpressionParser(parser.getOrderedTerminalSymbols());
}
@Override
protected IParser getNoCastExpressionParser() {
return new C99NoCastExpressionParser(parser.getOrderedTerminalSymbols());
}
@Override
protected IParser getSizeofExpressionParser() {
return new C99SizeofExpressionParser(parser.getOrderedTerminalSymbols());
}
@Override
protected IASTName createName(char[] image) {

View file

@ -0,0 +1,40 @@
/*******************************************************************************
* Copyright (c) 2009 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
*******************************************************************************/
package org.eclipse.cdt.core.dom.lrparser.action.c99;
import org.eclipse.cdt.core.dom.lrparser.IParser;
import org.eclipse.cdt.core.dom.lrparser.IParserActionTokenProvider;
import org.eclipse.cdt.core.dom.lrparser.action.ISecondaryParserFactory;
import org.eclipse.cdt.internal.core.dom.lrparser.c99.C99ExpressionParser;
import org.eclipse.cdt.internal.core.dom.lrparser.c99.C99NoCastExpressionParser;
import org.eclipse.cdt.internal.core.dom.lrparser.c99.C99SizeofExpressionParser;
public class C99SecondaryParserFactory implements ISecondaryParserFactory {
public static final C99SecondaryParserFactory DEFAULT_INSTANCE = new C99SecondaryParserFactory();
public static C99SecondaryParserFactory getDefault() {
return DEFAULT_INSTANCE;
}
public IParser getExpressionParser(IParserActionTokenProvider parser) {
return new C99ExpressionParser(parser);
}
public IParser getNoCastExpressionParser(IParserActionTokenProvider parser) {
return new C99NoCastExpressionParser(parser);
}
public IParser getSizeofExpressionParser(IParserActionTokenProvider parser) {
return new C99SizeofExpressionParser(parser);
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2008 IBM Corporation and others.
* Copyright (c) 2006, 2009 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
@ -145,12 +145,7 @@ import org.eclipse.cdt.core.dom.lrparser.action.ITokenMap;
import org.eclipse.cdt.core.dom.lrparser.action.ParserUtil;
import org.eclipse.cdt.core.dom.lrparser.action.ScopedStack;
import org.eclipse.cdt.core.dom.lrparser.action.TokenMap;
import org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPExpressionParser;
import org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPNoCastExpressionParser;
import org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPNoFunctionDeclaratorParser;
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.lrparser.cpp.CPPTemplateTypeParameterParser;
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguousExpression;
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguousStatement;
@ -177,6 +172,8 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
/** Used to create the AST node objects */
protected final ICPPNodeFactory nodeFactory;
protected final ICPPSecondaryParserFactory parserFactory;
/** Stack that provides easy access to the current class name, used to disambiguate declarators. */
protected final LinkedList<IASTName> classNames = new LinkedList<IASTName>();
@ -186,10 +183,11 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
* @param orderedTerminalSymbols When an instance of this class is created for a parser
* that parsers token kinds will be mapped back to the base C99 parser's token kinds.
*/
public CPPBuildASTParserAction(ICPPNodeFactory nodeFactory, IParserActionTokenProvider parser, IASTTranslationUnit tu, ScopedStack<Object> astStack) {
super(nodeFactory, parser, tu, astStack);
public CPPBuildASTParserAction(IParserActionTokenProvider parser, IASTTranslationUnit tu, ScopedStack<Object> astStack, ICPPNodeFactory nodeFactory, ICPPSecondaryParserFactory parserFactory) {
super(parser, tu, astStack, nodeFactory, parserFactory);
this.nodeFactory = nodeFactory;
this.parserFactory = parserFactory;
this.tokenMap = new TokenMap(CPPParsersym.orderedTerminalSymbols, parser.getOrderedTerminalSymbols());
}
@ -213,28 +211,6 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
return nodeFactory.newName(image);
}
@Override
protected IParser getExpressionParser() {
return new CPPExpressionParser(parser.getOrderedTerminalSymbols());
}
@Override
protected IParser getNoCastExpressionParser() {
return new CPPNoCastExpressionParser(parser.getOrderedTerminalSymbols());
}
@Override
protected IParser getSizeofExpressionParser() {
return new CPPSizeofExpressionParser(parser.getOrderedTerminalSymbols());
}
protected IParser getTemplateTypeParameterParser() {
return new CPPTemplateTypeParameterParser(parser.getOrderedTerminalSymbols());
}
protected IParser getNoFunctionDeclaratorParser() {
return new CPPNoFunctionDeclaratorParser(parser.getOrderedTerminalSymbols());
}
public void consumeNewInitializer() {
@ -481,7 +457,7 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
*/
public void consumeTemplateArgumentTypeId() {
// TODO is this necessary? It should be able to tell if it looks like an id expression
IParser secondaryParser = getExpressionParser();
IParser secondaryParser = parserFactory.getExpressionParser(parser);
IASTNode result = runSecondaryParser(secondaryParser);
// The grammar rule allows assignment_expression, but the ambiguity
@ -1383,7 +1359,7 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
if(!(declarator instanceof IASTFunctionDeclarator))
return;
IParser secondaryParser = getNoFunctionDeclaratorParser();
IParser secondaryParser = parserFactory.getNoFunctionDeclaratorParser(parser);
IASTNode notFunctionDeclarator = runSecondaryParser(secondaryParser);
if(notFunctionDeclarator == null || notFunctionDeclarator instanceof IASTProblemDeclaration)
@ -1792,7 +1768,7 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
* Yes its a hack.
*/
public void consumeTemplateParamterDeclaration() {
IParser typeParameterParser = getTemplateTypeParameterParser();
IParser typeParameterParser = parserFactory.getTemplateTypeParameterParser(parser);
IASTNode alternate = runSecondaryParser(typeParameterParser);
if(alternate == null || alternate instanceof IASTProblemDeclaration)

View file

@ -0,0 +1,51 @@
/*******************************************************************************
* Copyright (c) 2009 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
*******************************************************************************/
package org.eclipse.cdt.core.dom.lrparser.action.cpp;
import org.eclipse.cdt.core.dom.lrparser.IParser;
import org.eclipse.cdt.core.dom.lrparser.IParserActionTokenProvider;
import org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPExpressionParser;
import org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPNoCastExpressionParser;
import org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPNoFunctionDeclaratorParser;
import org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPSizeofExpressionParser;
import org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPTemplateTypeParameterParser;
public class CPPSecondaryParserFactory implements ICPPSecondaryParserFactory {
private static final CPPSecondaryParserFactory DEFAULT_INSTANCE = new CPPSecondaryParserFactory();
public static CPPSecondaryParserFactory getDefault() {
return DEFAULT_INSTANCE;
}
public IParser getTemplateTypeParameterParser(IParserActionTokenProvider parser) {
return new CPPTemplateTypeParameterParser(parser);
}
public IParser getNoFunctionDeclaratorParser(IParserActionTokenProvider parser) {
return new CPPNoFunctionDeclaratorParser(parser);
}
public IParser getExpressionParser(IParserActionTokenProvider parser) {
return new CPPExpressionParser(parser);
}
public IParser getNoCastExpressionParser(IParserActionTokenProvider parser) {
return new CPPNoCastExpressionParser(parser);
}
public IParser getSizeofExpressionParser(IParserActionTokenProvider parser) {
return new CPPSizeofExpressionParser(parser);
}
}

View file

@ -0,0 +1,29 @@
/*******************************************************************************
* Copyright (c) 2009 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
*******************************************************************************/
package org.eclipse.cdt.core.dom.lrparser.action.cpp;
import org.eclipse.cdt.core.dom.lrparser.IParser;
import org.eclipse.cdt.core.dom.lrparser.IParserActionTokenProvider;
import org.eclipse.cdt.core.dom.lrparser.action.ISecondaryParserFactory;
/**
* Secondary parsers for resolving ambiguities specific to C++.
*
* @author Mike Kucera
*/
public interface ICPPSecondaryParserFactory extends ISecondaryParserFactory {
IParser getTemplateTypeParameterParser(IParserActionTokenProvider parser);
IParser getNoFunctionDeclaratorParser(IParserActionTokenProvider parser);
}

View file

@ -1,3 +1,13 @@
/*******************************************************************************
* Copyright (c) 2009 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
*******************************************************************************/
package org.eclipse.cdt.core.dom.lrparser.action.gnu;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
@ -13,8 +23,8 @@ public class GCCBuildASTParserAction extends GNUBuildASTParserAction {
private final ICNodeFactory nodeFactory;
public GCCBuildASTParserAction(ICNodeFactory nodeFactory, IParserActionTokenProvider parser, IASTTranslationUnit tu, ScopedStack<Object> astStack) {
super(nodeFactory, parser, tu, astStack);
public GCCBuildASTParserAction(IParserActionTokenProvider parser, IASTTranslationUnit tu, ScopedStack<Object> astStack, ICNodeFactory nodeFactory) {
super(parser, tu, astStack, nodeFactory);
this.nodeFactory = nodeFactory;
}

View file

@ -0,0 +1,40 @@
/*******************************************************************************
* Copyright (c) 2009 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
*******************************************************************************/
package org.eclipse.cdt.core.dom.lrparser.action.gnu;
import org.eclipse.cdt.core.dom.lrparser.IParser;
import org.eclipse.cdt.core.dom.lrparser.IParserActionTokenProvider;
import org.eclipse.cdt.core.dom.lrparser.action.ISecondaryParserFactory;
import org.eclipse.cdt.internal.core.dom.lrparser.c99.C99ExpressionParser;
import org.eclipse.cdt.internal.core.dom.lrparser.c99.C99NoCastExpressionParser;
import org.eclipse.cdt.internal.core.dom.lrparser.gcc.GCCSizeofExpressionParser;
public class GCCSecondaryParserFactory implements ISecondaryParserFactory {
public static final GCCSecondaryParserFactory DEFAULT_INSTANCE = new GCCSecondaryParserFactory();
public static GCCSecondaryParserFactory getDefault() {
return DEFAULT_INSTANCE;
}
public IParser getExpressionParser(IParserActionTokenProvider parser) {
return new C99ExpressionParser(parser);
}
public IParser getNoCastExpressionParser(IParserActionTokenProvider parser) {
return new C99NoCastExpressionParser(parser);
}
public IParser getSizeofExpressionParser(IParserActionTokenProvider parser) {
return new GCCSizeofExpressionParser(parser);
}
}

View file

@ -1,3 +1,13 @@
/*******************************************************************************
* Copyright (c) 2009 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
*******************************************************************************/
package org.eclipse.cdt.core.dom.lrparser.action.gnu;
import java.util.List;
@ -20,7 +30,7 @@ public class GNUBuildASTParserAction extends AbstractParserAction {
private final TokenMap tokenMap;
public GNUBuildASTParserAction(INodeFactory nodeFactory, IParserActionTokenProvider parser, IASTTranslationUnit tu, ScopedStack<Object> astStack) {
public GNUBuildASTParserAction(IParserActionTokenProvider parser, IASTTranslationUnit tu, ScopedStack<Object> astStack, INodeFactory nodeFactory) {
super(parser, tu, astStack);
this.nodeFactory = nodeFactory;

View file

@ -0,0 +1,52 @@
/*******************************************************************************
* Copyright (c) 2009 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
*******************************************************************************/
package org.eclipse.cdt.core.dom.lrparser.action.gnu;
import org.eclipse.cdt.core.dom.lrparser.IParser;
import org.eclipse.cdt.core.dom.lrparser.IParserActionTokenProvider;
import org.eclipse.cdt.core.dom.lrparser.action.cpp.ICPPSecondaryParserFactory;
import org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPExpressionParser;
import org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPNoCastExpressionParser;
import org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPNoFunctionDeclaratorParser;
import org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPTemplateTypeParameterParser;
import org.eclipse.cdt.internal.core.dom.lrparser.gpp.GPPSizeofExpressionParser;
public class GPPSecondaryParserFactory implements ICPPSecondaryParserFactory {
private static final GPPSecondaryParserFactory DEFAULT_INSTANCE = new GPPSecondaryParserFactory();
public static GPPSecondaryParserFactory getDefault() {
return DEFAULT_INSTANCE;
}
public IParser getTemplateTypeParameterParser(IParserActionTokenProvider parser) {
return new CPPTemplateTypeParameterParser(parser);
}
public IParser getNoFunctionDeclaratorParser(IParserActionTokenProvider parser) {
return new CPPNoFunctionDeclaratorParser(parser);
}
public IParser getExpressionParser(IParserActionTokenProvider parser) {
return new CPPExpressionParser(parser);
}
public IParser getNoCastExpressionParser(IParserActionTokenProvider parser) {
return new CPPNoCastExpressionParser(parser);
}
public IParser getSizeofExpressionParser(IParserActionTokenProvider parser) {
return new GPPSizeofExpressionParser(parser);
}
}

View file

@ -27,6 +27,7 @@ import org.eclipse.cdt.core.dom.lrparser.action.TokenMap;
import org.eclipse.cdt.internal.core.dom.parser.c.CNodeFactory;
import org.eclipse.cdt.core.dom.lrparser.action.c99.C99BuildASTParserAction;
import org.eclipse.cdt.core.dom.lrparser.action.c99.C99SecondaryParserFactory;
public class C99ExpressionParser extends PrsStream implements RuleAction , IParserActionTokenProvider, IParser
{
@ -172,7 +173,7 @@ public C99ExpressionParser() { // constructor
}
private void initActions(IASTTranslationUnit tu, Set<IParser.Options> options) {
action = new C99BuildASTParserAction ( CNodeFactory.getDefault() , this, tu, astStack);
action = new C99BuildASTParserAction (this, tu, astStack, CNodeFactory.getDefault() , C99SecondaryParserFactory.getDefault() );
action.setParserOptions(options);
@ -234,8 +235,8 @@ public void setTokens(List<IToken> tokens) {
addToken(new Token(null, 0, 0, C99ExpressionParsersym.TK_EOF_TOKEN));
}
public C99ExpressionParser(String[] mapFrom) { // constructor
tokenMap = new TokenMap(C99ExpressionParsersym.orderedTerminalSymbols, mapFrom);
public C99ExpressionParser(IParserActionTokenProvider parser) { // constructor
tokenMap = new TokenMap(C99ExpressionParsersym.orderedTerminalSymbols, parser.getOrderedTerminalSymbols());
}
@ -324,7 +325,7 @@ public C99ExpressionParser(String[] mapFrom) { // constructor
}
//
// Rule 26: postfix_expression ::= ( type_name ) { <openscope-ast> initializer_list comma_opt }
// Rule 26: postfix_expression ::= ( type_id ) { <openscope-ast> initializer_list comma_opt }
//
case 26: { action. consumeExpressionTypeIdInitializer(); break;
}
@ -384,13 +385,13 @@ public C99ExpressionParser(String[] mapFrom) { // constructor
}
//
// Rule 41: unary_expression ::= sizeof ( type_name )
// Rule 41: unary_expression ::= sizeof ( type_id )
//
case 41: { action. consumeExpressionTypeId(IASTTypeIdExpression.op_sizeof); break;
}
//
// Rule 43: cast_expression ::= ( type_name ) cast_expression
// Rule 43: cast_expression ::= ( type_id ) cast_expression
//
case 43: { action. consumeExpressionCast(IASTCastExpression.op_cast); break;
}
@ -1074,13 +1075,13 @@ public C99ExpressionParser(String[] mapFrom) { // constructor
}
//
// Rule 267: type_name ::= specifier_qualifier_list
// Rule 267: type_id ::= specifier_qualifier_list
//
case 267: { action. consumeTypeId(false); break;
}
//
// Rule 268: type_name ::= specifier_qualifier_list abstract_declarator
// Rule 268: type_id ::= specifier_qualifier_list abstract_declarator
//
case 268: { action. consumeTypeId(true); break;
}

View file

@ -972,7 +972,7 @@ public class C99ExpressionParserprs implements lpg.lpgjavaruntime.ParseTable, C9
"expression",
"postfix_expression",
"member_name",
"type_name",
"type_id",
"initializer_list",
"unary_expression",
"cast_expression",

View file

@ -27,6 +27,7 @@ import org.eclipse.cdt.core.dom.lrparser.action.TokenMap;
import org.eclipse.cdt.internal.core.dom.parser.c.CNodeFactory;
import org.eclipse.cdt.core.dom.lrparser.action.c99.C99BuildASTParserAction;
import org.eclipse.cdt.core.dom.lrparser.action.c99.C99SecondaryParserFactory;
public class C99NoCastExpressionParser extends PrsStream implements RuleAction , IParserActionTokenProvider, IParser
{
@ -172,7 +173,7 @@ public C99NoCastExpressionParser() { // constructor
}
private void initActions(IASTTranslationUnit tu, Set<IParser.Options> options) {
action = new C99BuildASTParserAction ( CNodeFactory.getDefault() , this, tu, astStack);
action = new C99BuildASTParserAction (this, tu, astStack, CNodeFactory.getDefault() , C99SecondaryParserFactory.getDefault() );
action.setParserOptions(options);
@ -234,8 +235,8 @@ public void setTokens(List<IToken> tokens) {
addToken(new Token(null, 0, 0, C99NoCastExpressionParsersym.TK_EOF_TOKEN));
}
public C99NoCastExpressionParser(String[] mapFrom) { // constructor
tokenMap = new TokenMap(C99NoCastExpressionParsersym.orderedTerminalSymbols, mapFrom);
public C99NoCastExpressionParser(IParserActionTokenProvider parser) { // constructor
tokenMap = new TokenMap(C99NoCastExpressionParsersym.orderedTerminalSymbols, parser.getOrderedTerminalSymbols());
}
@ -324,7 +325,7 @@ public C99NoCastExpressionParser(String[] mapFrom) { // constructor
}
//
// Rule 26: postfix_expression ::= ( type_name ) { <openscope-ast> initializer_list comma_opt }
// Rule 26: postfix_expression ::= ( type_id ) { <openscope-ast> initializer_list comma_opt }
//
case 26: { action. consumeExpressionTypeIdInitializer(); break;
}
@ -384,7 +385,7 @@ public C99NoCastExpressionParser(String[] mapFrom) { // constructor
}
//
// Rule 41: unary_expression ::= sizeof ( type_name )
// Rule 41: unary_expression ::= sizeof ( type_id )
//
case 41: { action. consumeExpressionTypeId(IASTTypeIdExpression.op_sizeof); break;
}
@ -1068,13 +1069,13 @@ public C99NoCastExpressionParser(String[] mapFrom) { // constructor
}
//
// Rule 266: type_name ::= specifier_qualifier_list
// Rule 266: type_id ::= specifier_qualifier_list
//
case 266: { action. consumeTypeId(false); break;
}
//
// Rule 267: type_name ::= specifier_qualifier_list abstract_declarator
// Rule 267: type_id ::= specifier_qualifier_list abstract_declarator
//
case 267: { action. consumeTypeId(true); break;
}

View file

@ -968,7 +968,7 @@ public class C99NoCastExpressionParserprs implements lpg.lpgjavaruntime.ParseTab
"expression",
"postfix_expression",
"member_name",
"type_name",
"type_id",
"initializer_list",
"unary_expression",
"cast_expression",

View file

@ -27,6 +27,7 @@ import org.eclipse.cdt.core.dom.lrparser.action.TokenMap;
import org.eclipse.cdt.internal.core.dom.parser.c.CNodeFactory;
import org.eclipse.cdt.core.dom.lrparser.action.c99.C99BuildASTParserAction;
import org.eclipse.cdt.core.dom.lrparser.action.c99.C99SecondaryParserFactory;
public class C99Parser extends PrsStream implements RuleAction , IParserActionTokenProvider, IParser
{
@ -172,7 +173,7 @@ public C99Parser() { // constructor
}
private void initActions(IASTTranslationUnit tu, Set<IParser.Options> options) {
action = new C99BuildASTParserAction ( CNodeFactory.getDefault() , this, tu, astStack);
action = new C99BuildASTParserAction (this, tu, astStack, CNodeFactory.getDefault() , C99SecondaryParserFactory.getDefault() );
action.setParserOptions(options);
@ -234,8 +235,8 @@ public void setTokens(List<IToken> tokens) {
addToken(new Token(null, 0, 0, C99Parsersym.TK_EOF_TOKEN));
}
public C99Parser(String[] mapFrom) { // constructor
tokenMap = new TokenMap(C99Parsersym.orderedTerminalSymbols, mapFrom);
public C99Parser(IParserActionTokenProvider parser) { // constructor
tokenMap = new TokenMap(C99Parsersym.orderedTerminalSymbols, parser.getOrderedTerminalSymbols());
}
@ -324,7 +325,7 @@ public C99Parser(String[] mapFrom) { // constructor
}
//
// Rule 26: postfix_expression ::= ( type_name ) { <openscope-ast> initializer_list comma_opt }
// Rule 26: postfix_expression ::= ( type_id ) { <openscope-ast> initializer_list comma_opt }
//
case 26: { action. consumeExpressionTypeIdInitializer(); break;
}
@ -384,13 +385,13 @@ public C99Parser(String[] mapFrom) { // constructor
}
//
// Rule 41: unary_expression ::= sizeof ( type_name )
// Rule 41: unary_expression ::= sizeof ( type_id )
//
case 41: { action. consumeExpressionTypeId(IASTTypeIdExpression.op_sizeof); break;
}
//
// Rule 43: cast_expression ::= ( type_name ) cast_expression
// Rule 43: cast_expression ::= ( type_id ) cast_expression
//
case 43: { action. consumeExpressionCast(IASTCastExpression.op_cast); break;
}
@ -1074,13 +1075,13 @@ public C99Parser(String[] mapFrom) { // constructor
}
//
// Rule 267: type_name ::= specifier_qualifier_list
// Rule 267: type_id ::= specifier_qualifier_list
//
case 267: { action. consumeTypeId(false); break;
}
//
// Rule 268: type_name ::= specifier_qualifier_list abstract_declarator
// Rule 268: type_id ::= specifier_qualifier_list abstract_declarator
//
case 268: { action. consumeTypeId(true); break;
}

View file

@ -1280,7 +1280,7 @@ public class C99Parserprs implements lpg.lpgjavaruntime.ParseTable, C99Parsersym
"expression",
"postfix_expression",
"member_name",
"type_name",
"type_id",
"initializer_list",
"unary_expression",
"cast_expression",

View file

@ -39,8 +39,8 @@ public interface C99SizeofExpressionParsersym {
TK_return = 90,
TK_short = 36,
TK_signed = 37,
TK_sizeof = 17,
TK_static = 13,
TK_sizeof = 16,
TK_static = 17,
TK_struct = 45,
TK_switch = 91,
TK_typedef = 28,
@ -60,14 +60,14 @@ public interface C99SizeofExpressionParsersym {
TK_Completion = 3,
TK_EndOfCompletion = 5,
TK_Invalid = 93,
TK_LeftBracket = 11,
TK_LeftBracket = 12,
TK_LeftParen = 2,
TK_LeftBrace = 14,
TK_LeftBrace = 13,
TK_Dot = 52,
TK_Arrow = 67,
TK_PlusPlus = 15,
TK_MinusMinus = 16,
TK_And = 12,
TK_PlusPlus = 14,
TK_MinusMinus = 15,
TK_And = 11,
TK_Star = 4,
TK_Plus = 9,
TK_Minus = 10,
@ -121,13 +121,13 @@ public interface C99SizeofExpressionParsersym {
"volatile",
"Plus",
"Minus",
"LeftBracket",
"And",
"static",
"LeftBracket",
"LeftBrace",
"PlusPlus",
"MinusMinus",
"sizeof",
"static",
"integer",
"floating",
"charconst",

View file

@ -15,69 +15,69 @@ package org.eclipse.cdt.internal.core.dom.lrparser.cpp;
public interface CPPExpressionParsersym {
public final static int
TK_asm = 65,
TK_asm = 64,
TK_auto = 28,
TK_bool = 11,
TK_break = 77,
TK_case = 78,
TK_catch = 119,
TK_break = 76,
TK_case = 77,
TK_catch = 118,
TK_char = 12,
TK_class = 40,
TK_const = 23,
TK_const_cast = 42,
TK_continue = 79,
TK_default = 80,
TK_delete = 66,
TK_do = 81,
TK_continue = 78,
TK_default = 79,
TK_delete = 65,
TK_do = 80,
TK_double = 13,
TK_dynamic_cast = 43,
TK_else = 122,
TK_enum = 57,
TK_else = 121,
TK_enum = 56,
TK_explicit = 29,
TK_export = 87,
TK_export = 86,
TK_extern = 30,
TK_false = 44,
TK_float = 14,
TK_for = 82,
TK_for = 81,
TK_friend = 31,
TK_goto = 83,
TK_if = 84,
TK_goto = 82,
TK_if = 83,
TK_inline = 32,
TK_int = 15,
TK_long = 16,
TK_mutable = 33,
TK_namespace = 60,
TK_new = 67,
TK_namespace = 59,
TK_new = 66,
TK_operator = 7,
TK_private = 103,
TK_protected = 104,
TK_public = 105,
TK_private = 102,
TK_protected = 103,
TK_public = 104,
TK_register = 34,
TK_reinterpret_cast = 45,
TK_return = 85,
TK_return = 84,
TK_short = 17,
TK_signed = 18,
TK_sizeof = 46,
TK_static = 35,
TK_static_cast = 47,
TK_struct = 58,
TK_switch = 86,
TK_struct = 57,
TK_switch = 85,
TK_template = 48,
TK_this = 49,
TK_throw = 61,
TK_try = 75,
TK_throw = 60,
TK_try = 74,
TK_true = 50,
TK_typedef = 36,
TK_typeid = 51,
TK_typename = 10,
TK_union = 59,
TK_union = 58,
TK_unsigned = 19,
TK_using = 63,
TK_using = 62,
TK_virtual = 22,
TK_void = 20,
TK_volatile = 24,
TK_wchar_t = 21,
TK_while = 76,
TK_while = 75,
TK_integer = 52,
TK_floating = 53,
TK_charconst = 54,
@ -85,13 +85,13 @@ public interface CPPExpressionParsersym {
TK_identifier = 1,
TK_Completion = 2,
TK_EndOfCompletion = 8,
TK_Invalid = 123,
TK_LeftBracket = 64,
TK_Invalid = 122,
TK_LeftBracket = 63,
TK_LeftParen = 3,
TK_Dot = 120,
TK_DotStar = 92,
TK_Arrow = 106,
TK_ArrowStar = 90,
TK_Dot = 119,
TK_DotStar = 91,
TK_Arrow = 105,
TK_ArrowStar = 89,
TK_PlusPlus = 37,
TK_MinusMinus = 38,
TK_And = 9,
@ -100,44 +100,43 @@ public interface CPPExpressionParsersym {
TK_Minus = 26,
TK_Tilde = 5,
TK_Bang = 41,
TK_Slash = 93,
TK_Percent = 94,
TK_RightShift = 88,
TK_LeftShift = 89,
TK_LT = 56,
TK_GT = 69,
TK_LE = 95,
TK_GE = 96,
TK_EQ = 97,
TK_NE = 98,
TK_Caret = 99,
TK_Or = 100,
TK_AndAnd = 101,
TK_OrOr = 102,
TK_Question = 107,
TK_Colon = 73,
TK_Slash = 92,
TK_Percent = 93,
TK_RightShift = 87,
TK_LeftShift = 88,
TK_LT = 55,
TK_GT = 68,
TK_LE = 94,
TK_GE = 95,
TK_EQ = 96,
TK_NE = 97,
TK_Caret = 98,
TK_Or = 99,
TK_AndAnd = 100,
TK_OrOr = 101,
TK_Question = 106,
TK_Colon = 72,
TK_ColonColon = 4,
TK_DotDotDot = 91,
TK_Assign = 70,
TK_StarAssign = 108,
TK_SlashAssign = 109,
TK_PercentAssign = 110,
TK_PlusAssign = 111,
TK_MinusAssign = 112,
TK_RightShiftAssign = 113,
TK_LeftShiftAssign = 114,
TK_AndAssign = 115,
TK_CaretAssign = 116,
TK_OrAssign = 117,
TK_Comma = 71,
TK_RightBracket = 118,
TK_RightParen = 74,
TK_RightBrace = 72,
TK_DotDotDot = 90,
TK_Assign = 69,
TK_StarAssign = 107,
TK_SlashAssign = 108,
TK_PercentAssign = 109,
TK_PlusAssign = 110,
TK_MinusAssign = 111,
TK_RightShiftAssign = 112,
TK_LeftShiftAssign = 113,
TK_AndAssign = 114,
TK_CaretAssign = 115,
TK_OrAssign = 116,
TK_Comma = 70,
TK_RightBracket = 117,
TK_RightParen = 73,
TK_RightBrace = 71,
TK_SemiColon = 27,
TK_LeftBrace = 68,
TK_ERROR_TOKEN = 62,
TK_0 = 55,
TK_EOF_TOKEN = 121;
TK_LeftBrace = 67,
TK_ERROR_TOKEN = 61,
TK_EOF_TOKEN = 120;
public final static String orderedTerminalSymbols[] = {
"",
@ -195,7 +194,6 @@ public interface CPPExpressionParsersym {
"integer",
"floating",
"charconst",
"0",
"LT",
"enum",
"struct",

View file

@ -15,69 +15,69 @@ package org.eclipse.cdt.internal.core.dom.lrparser.cpp;
public interface CPPNoCastExpressionParsersym {
public final static int
TK_asm = 65,
TK_asm = 64,
TK_auto = 28,
TK_bool = 11,
TK_break = 77,
TK_case = 78,
TK_catch = 119,
TK_break = 76,
TK_case = 77,
TK_catch = 118,
TK_char = 12,
TK_class = 40,
TK_const = 23,
TK_const_cast = 42,
TK_continue = 79,
TK_default = 80,
TK_delete = 66,
TK_do = 81,
TK_continue = 78,
TK_default = 79,
TK_delete = 65,
TK_do = 80,
TK_double = 13,
TK_dynamic_cast = 43,
TK_else = 122,
TK_enum = 57,
TK_else = 121,
TK_enum = 56,
TK_explicit = 29,
TK_export = 87,
TK_export = 86,
TK_extern = 30,
TK_false = 44,
TK_float = 14,
TK_for = 82,
TK_for = 81,
TK_friend = 31,
TK_goto = 83,
TK_if = 84,
TK_goto = 82,
TK_if = 83,
TK_inline = 32,
TK_int = 15,
TK_long = 16,
TK_mutable = 33,
TK_namespace = 60,
TK_new = 67,
TK_namespace = 59,
TK_new = 66,
TK_operator = 7,
TK_private = 103,
TK_protected = 104,
TK_public = 105,
TK_private = 102,
TK_protected = 103,
TK_public = 104,
TK_register = 34,
TK_reinterpret_cast = 45,
TK_return = 85,
TK_return = 84,
TK_short = 17,
TK_signed = 18,
TK_sizeof = 46,
TK_static = 35,
TK_static_cast = 47,
TK_struct = 58,
TK_switch = 86,
TK_struct = 57,
TK_switch = 85,
TK_template = 48,
TK_this = 49,
TK_throw = 61,
TK_try = 75,
TK_throw = 60,
TK_try = 74,
TK_true = 50,
TK_typedef = 36,
TK_typeid = 51,
TK_typename = 10,
TK_union = 59,
TK_union = 58,
TK_unsigned = 19,
TK_using = 63,
TK_using = 62,
TK_virtual = 22,
TK_void = 20,
TK_volatile = 24,
TK_wchar_t = 21,
TK_while = 76,
TK_while = 75,
TK_integer = 52,
TK_floating = 53,
TK_charconst = 54,
@ -85,13 +85,13 @@ public interface CPPNoCastExpressionParsersym {
TK_identifier = 1,
TK_Completion = 2,
TK_EndOfCompletion = 8,
TK_Invalid = 123,
TK_LeftBracket = 64,
TK_Invalid = 122,
TK_LeftBracket = 63,
TK_LeftParen = 3,
TK_Dot = 120,
TK_DotStar = 92,
TK_Arrow = 106,
TK_ArrowStar = 90,
TK_Dot = 119,
TK_DotStar = 91,
TK_Arrow = 105,
TK_ArrowStar = 89,
TK_PlusPlus = 37,
TK_MinusMinus = 38,
TK_And = 9,
@ -100,44 +100,43 @@ public interface CPPNoCastExpressionParsersym {
TK_Minus = 26,
TK_Tilde = 5,
TK_Bang = 41,
TK_Slash = 93,
TK_Percent = 94,
TK_RightShift = 88,
TK_LeftShift = 89,
TK_LT = 56,
TK_GT = 69,
TK_LE = 95,
TK_GE = 96,
TK_EQ = 97,
TK_NE = 98,
TK_Caret = 99,
TK_Or = 100,
TK_AndAnd = 101,
TK_OrOr = 102,
TK_Question = 107,
TK_Colon = 73,
TK_Slash = 92,
TK_Percent = 93,
TK_RightShift = 87,
TK_LeftShift = 88,
TK_LT = 55,
TK_GT = 68,
TK_LE = 94,
TK_GE = 95,
TK_EQ = 96,
TK_NE = 97,
TK_Caret = 98,
TK_Or = 99,
TK_AndAnd = 100,
TK_OrOr = 101,
TK_Question = 106,
TK_Colon = 72,
TK_ColonColon = 4,
TK_DotDotDot = 91,
TK_Assign = 70,
TK_StarAssign = 108,
TK_SlashAssign = 109,
TK_PercentAssign = 110,
TK_PlusAssign = 111,
TK_MinusAssign = 112,
TK_RightShiftAssign = 113,
TK_LeftShiftAssign = 114,
TK_AndAssign = 115,
TK_CaretAssign = 116,
TK_OrAssign = 117,
TK_Comma = 71,
TK_RightBracket = 118,
TK_RightParen = 74,
TK_RightBrace = 72,
TK_DotDotDot = 90,
TK_Assign = 69,
TK_StarAssign = 107,
TK_SlashAssign = 108,
TK_PercentAssign = 109,
TK_PlusAssign = 110,
TK_MinusAssign = 111,
TK_RightShiftAssign = 112,
TK_LeftShiftAssign = 113,
TK_AndAssign = 114,
TK_CaretAssign = 115,
TK_OrAssign = 116,
TK_Comma = 70,
TK_RightBracket = 117,
TK_RightParen = 73,
TK_RightBrace = 71,
TK_SemiColon = 27,
TK_LeftBrace = 68,
TK_ERROR_TOKEN = 62,
TK_0 = 55,
TK_EOF_TOKEN = 121;
TK_LeftBrace = 67,
TK_ERROR_TOKEN = 61,
TK_EOF_TOKEN = 120;
public final static String orderedTerminalSymbols[] = {
"",
@ -195,7 +194,6 @@ public interface CPPNoCastExpressionParsersym {
"integer",
"floating",
"charconst",
"0",
"LT",
"enum",
"struct",

View file

@ -15,69 +15,69 @@ package org.eclipse.cdt.internal.core.dom.lrparser.cpp;
public interface CPPNoFunctionDeclaratorParsersym {
public final static int
TK_asm = 65,
TK_asm = 64,
TK_auto = 26,
TK_bool = 11,
TK_break = 77,
TK_case = 78,
TK_catch = 119,
TK_break = 76,
TK_case = 77,
TK_catch = 118,
TK_char = 12,
TK_class = 40,
TK_const = 23,
TK_const_cast = 42,
TK_continue = 79,
TK_default = 80,
TK_delete = 66,
TK_do = 81,
TK_continue = 78,
TK_default = 79,
TK_delete = 65,
TK_do = 80,
TK_double = 13,
TK_dynamic_cast = 43,
TK_else = 122,
TK_enum = 57,
TK_else = 121,
TK_enum = 56,
TK_explicit = 27,
TK_export = 87,
TK_export = 86,
TK_extern = 28,
TK_false = 44,
TK_float = 14,
TK_for = 82,
TK_for = 81,
TK_friend = 29,
TK_goto = 83,
TK_if = 84,
TK_goto = 82,
TK_if = 83,
TK_inline = 30,
TK_int = 15,
TK_long = 16,
TK_mutable = 31,
TK_namespace = 60,
TK_new = 67,
TK_namespace = 59,
TK_new = 66,
TK_operator = 7,
TK_private = 103,
TK_protected = 104,
TK_public = 105,
TK_private = 102,
TK_protected = 103,
TK_public = 104,
TK_register = 32,
TK_reinterpret_cast = 45,
TK_return = 85,
TK_return = 84,
TK_short = 17,
TK_signed = 18,
TK_sizeof = 46,
TK_static = 33,
TK_static_cast = 47,
TK_struct = 58,
TK_switch = 86,
TK_struct = 57,
TK_switch = 85,
TK_template = 48,
TK_this = 49,
TK_throw = 62,
TK_try = 75,
TK_throw = 61,
TK_try = 74,
TK_true = 50,
TK_typedef = 34,
TK_typeid = 51,
TK_typename = 10,
TK_union = 59,
TK_union = 58,
TK_unsigned = 19,
TK_using = 63,
TK_using = 62,
TK_virtual = 22,
TK_void = 20,
TK_volatile = 24,
TK_wchar_t = 21,
TK_while = 76,
TK_while = 75,
TK_integer = 52,
TK_floating = 53,
TK_charconst = 54,
@ -85,13 +85,13 @@ public interface CPPNoFunctionDeclaratorParsersym {
TK_identifier = 1,
TK_Completion = 2,
TK_EndOfCompletion = 8,
TK_Invalid = 123,
TK_LeftBracket = 64,
TK_Invalid = 122,
TK_LeftBracket = 63,
TK_LeftParen = 3,
TK_Dot = 120,
TK_DotStar = 92,
TK_Arrow = 106,
TK_ArrowStar = 90,
TK_Dot = 119,
TK_DotStar = 91,
TK_Arrow = 105,
TK_ArrowStar = 89,
TK_PlusPlus = 37,
TK_MinusMinus = 38,
TK_And = 9,
@ -100,44 +100,43 @@ public interface CPPNoFunctionDeclaratorParsersym {
TK_Minus = 36,
TK_Tilde = 5,
TK_Bang = 41,
TK_Slash = 93,
TK_Percent = 94,
TK_RightShift = 88,
TK_LeftShift = 89,
TK_Slash = 92,
TK_Percent = 93,
TK_RightShift = 87,
TK_LeftShift = 88,
TK_LT = 55,
TK_GT = 69,
TK_LE = 95,
TK_GE = 96,
TK_EQ = 97,
TK_NE = 98,
TK_Caret = 99,
TK_Or = 100,
TK_AndAnd = 101,
TK_OrOr = 102,
TK_Question = 107,
TK_Colon = 73,
TK_GT = 68,
TK_LE = 94,
TK_GE = 95,
TK_EQ = 96,
TK_NE = 97,
TK_Caret = 98,
TK_Or = 99,
TK_AndAnd = 100,
TK_OrOr = 101,
TK_Question = 106,
TK_Colon = 72,
TK_ColonColon = 4,
TK_DotDotDot = 91,
TK_Assign = 70,
TK_StarAssign = 108,
TK_SlashAssign = 109,
TK_PercentAssign = 110,
TK_PlusAssign = 111,
TK_MinusAssign = 112,
TK_RightShiftAssign = 113,
TK_LeftShiftAssign = 114,
TK_AndAssign = 115,
TK_CaretAssign = 116,
TK_OrAssign = 117,
TK_Comma = 71,
TK_RightBracket = 118,
TK_RightParen = 74,
TK_RightBrace = 72,
TK_DotDotDot = 90,
TK_Assign = 69,
TK_StarAssign = 107,
TK_SlashAssign = 108,
TK_PercentAssign = 109,
TK_PlusAssign = 110,
TK_MinusAssign = 111,
TK_RightShiftAssign = 112,
TK_LeftShiftAssign = 113,
TK_AndAssign = 114,
TK_CaretAssign = 115,
TK_OrAssign = 116,
TK_Comma = 70,
TK_RightBracket = 117,
TK_RightParen = 73,
TK_RightBrace = 71,
TK_SemiColon = 25,
TK_LeftBrace = 68,
TK_ERROR_TOKEN = 61,
TK_0 = 56,
TK_EOF_TOKEN = 121;
TK_LeftBrace = 67,
TK_ERROR_TOKEN = 60,
TK_EOF_TOKEN = 120;
public final static String orderedTerminalSymbols[] = {
"",
@ -196,7 +195,6 @@ public interface CPPNoFunctionDeclaratorParsersym {
"floating",
"charconst",
"LT",
"0",
"enum",
"struct",
"union",

View file

@ -15,69 +15,69 @@ package org.eclipse.cdt.internal.core.dom.lrparser.cpp;
public interface CPPParsersym {
public final static int
TK_asm = 64,
TK_asm = 63,
TK_auto = 26,
TK_bool = 11,
TK_break = 77,
TK_case = 78,
TK_catch = 119,
TK_break = 76,
TK_case = 77,
TK_catch = 118,
TK_char = 12,
TK_class = 39,
TK_const = 23,
TK_const_cast = 43,
TK_continue = 79,
TK_default = 80,
TK_delete = 66,
TK_do = 81,
TK_continue = 78,
TK_default = 79,
TK_delete = 65,
TK_do = 80,
TK_double = 13,
TK_dynamic_cast = 44,
TK_else = 122,
TK_else = 121,
TK_enum = 45,
TK_explicit = 27,
TK_export = 87,
TK_export = 86,
TK_extern = 28,
TK_false = 46,
TK_float = 14,
TK_for = 82,
TK_for = 81,
TK_friend = 29,
TK_goto = 83,
TK_if = 84,
TK_goto = 82,
TK_if = 83,
TK_inline = 30,
TK_int = 15,
TK_long = 16,
TK_mutable = 31,
TK_namespace = 60,
TK_new = 67,
TK_namespace = 59,
TK_new = 66,
TK_operator = 7,
TK_private = 103,
TK_protected = 104,
TK_public = 105,
TK_private = 102,
TK_protected = 103,
TK_public = 104,
TK_register = 32,
TK_reinterpret_cast = 47,
TK_return = 85,
TK_return = 84,
TK_short = 17,
TK_signed = 18,
TK_sizeof = 48,
TK_static = 33,
TK_static_cast = 49,
TK_struct = 50,
TK_switch = 86,
TK_switch = 85,
TK_template = 41,
TK_this = 51,
TK_throw = 63,
TK_try = 75,
TK_throw = 62,
TK_try = 74,
TK_true = 52,
TK_typedef = 34,
TK_typeid = 53,
TK_typename = 10,
TK_union = 54,
TK_unsigned = 19,
TK_using = 61,
TK_using = 60,
TK_virtual = 22,
TK_void = 20,
TK_volatile = 24,
TK_wchar_t = 21,
TK_while = 76,
TK_while = 75,
TK_integer = 55,
TK_floating = 56,
TK_charconst = 57,
@ -85,13 +85,13 @@ public interface CPPParsersym {
TK_identifier = 1,
TK_Completion = 2,
TK_EndOfCompletion = 8,
TK_Invalid = 123,
TK_LeftBracket = 65,
TK_Invalid = 122,
TK_LeftBracket = 64,
TK_LeftParen = 3,
TK_Dot = 120,
TK_DotStar = 92,
TK_Arrow = 106,
TK_ArrowStar = 90,
TK_Dot = 119,
TK_DotStar = 91,
TK_Arrow = 105,
TK_ArrowStar = 89,
TK_PlusPlus = 37,
TK_MinusMinus = 38,
TK_And = 9,
@ -100,44 +100,43 @@ public interface CPPParsersym {
TK_Minus = 36,
TK_Tilde = 5,
TK_Bang = 42,
TK_Slash = 93,
TK_Percent = 94,
TK_RightShift = 88,
TK_LeftShift = 89,
TK_Slash = 92,
TK_Percent = 93,
TK_RightShift = 87,
TK_LeftShift = 88,
TK_LT = 58,
TK_GT = 69,
TK_LE = 95,
TK_GE = 96,
TK_EQ = 97,
TK_NE = 98,
TK_Caret = 99,
TK_Or = 100,
TK_AndAnd = 101,
TK_OrOr = 102,
TK_Question = 107,
TK_Colon = 73,
TK_GT = 68,
TK_LE = 94,
TK_GE = 95,
TK_EQ = 96,
TK_NE = 97,
TK_Caret = 98,
TK_Or = 99,
TK_AndAnd = 100,
TK_OrOr = 101,
TK_Question = 106,
TK_Colon = 72,
TK_ColonColon = 4,
TK_DotDotDot = 91,
TK_Assign = 70,
TK_StarAssign = 108,
TK_SlashAssign = 109,
TK_PercentAssign = 110,
TK_PlusAssign = 111,
TK_MinusAssign = 112,
TK_RightShiftAssign = 113,
TK_LeftShiftAssign = 114,
TK_AndAssign = 115,
TK_CaretAssign = 116,
TK_OrAssign = 117,
TK_Comma = 71,
TK_RightBracket = 118,
TK_RightParen = 74,
TK_RightBrace = 72,
TK_DotDotDot = 90,
TK_Assign = 69,
TK_StarAssign = 107,
TK_SlashAssign = 108,
TK_PercentAssign = 109,
TK_PlusAssign = 110,
TK_MinusAssign = 111,
TK_RightShiftAssign = 112,
TK_LeftShiftAssign = 113,
TK_AndAssign = 114,
TK_CaretAssign = 115,
TK_OrAssign = 116,
TK_Comma = 70,
TK_RightBracket = 117,
TK_RightParen = 73,
TK_RightBrace = 71,
TK_SemiColon = 25,
TK_LeftBrace = 68,
TK_ERROR_TOKEN = 62,
TK_0 = 59,
TK_EOF_TOKEN = 121;
TK_LeftBrace = 67,
TK_ERROR_TOKEN = 61,
TK_EOF_TOKEN = 120;
public final static String orderedTerminalSymbols[] = {
"",
@ -199,7 +198,6 @@ public interface CPPParsersym {
"floating",
"charconst",
"LT",
"0",
"namespace",
"using",
"ERROR_TOKEN",

View file

@ -15,69 +15,69 @@ package org.eclipse.cdt.internal.core.dom.lrparser.cpp;
public interface CPPSizeofExpressionParsersym {
public final static int
TK_asm = 65,
TK_asm = 64,
TK_auto = 28,
TK_bool = 11,
TK_break = 77,
TK_case = 78,
TK_catch = 119,
TK_break = 76,
TK_case = 77,
TK_catch = 118,
TK_char = 12,
TK_class = 40,
TK_const = 23,
TK_const_cast = 42,
TK_continue = 79,
TK_default = 80,
TK_delete = 66,
TK_do = 81,
TK_continue = 78,
TK_default = 79,
TK_delete = 65,
TK_do = 80,
TK_double = 13,
TK_dynamic_cast = 43,
TK_else = 122,
TK_enum = 57,
TK_else = 121,
TK_enum = 56,
TK_explicit = 29,
TK_export = 87,
TK_export = 86,
TK_extern = 30,
TK_false = 44,
TK_float = 14,
TK_for = 82,
TK_for = 81,
TK_friend = 31,
TK_goto = 83,
TK_if = 84,
TK_goto = 82,
TK_if = 83,
TK_inline = 32,
TK_int = 15,
TK_long = 16,
TK_mutable = 33,
TK_namespace = 60,
TK_new = 67,
TK_namespace = 59,
TK_new = 66,
TK_operator = 7,
TK_private = 103,
TK_protected = 104,
TK_public = 105,
TK_private = 102,
TK_protected = 103,
TK_public = 104,
TK_register = 34,
TK_reinterpret_cast = 45,
TK_return = 85,
TK_return = 84,
TK_short = 17,
TK_signed = 18,
TK_sizeof = 46,
TK_static = 35,
TK_static_cast = 47,
TK_struct = 58,
TK_switch = 86,
TK_struct = 57,
TK_switch = 85,
TK_template = 48,
TK_this = 49,
TK_throw = 61,
TK_try = 75,
TK_throw = 60,
TK_try = 74,
TK_true = 50,
TK_typedef = 36,
TK_typeid = 51,
TK_typename = 10,
TK_union = 59,
TK_union = 58,
TK_unsigned = 19,
TK_using = 63,
TK_using = 62,
TK_virtual = 22,
TK_void = 20,
TK_volatile = 24,
TK_wchar_t = 21,
TK_while = 76,
TK_while = 75,
TK_integer = 52,
TK_floating = 53,
TK_charconst = 54,
@ -85,13 +85,13 @@ public interface CPPSizeofExpressionParsersym {
TK_identifier = 1,
TK_Completion = 2,
TK_EndOfCompletion = 8,
TK_Invalid = 123,
TK_LeftBracket = 64,
TK_Invalid = 122,
TK_LeftBracket = 63,
TK_LeftParen = 3,
TK_Dot = 120,
TK_DotStar = 92,
TK_Arrow = 106,
TK_ArrowStar = 90,
TK_Dot = 119,
TK_DotStar = 91,
TK_Arrow = 105,
TK_ArrowStar = 89,
TK_PlusPlus = 37,
TK_MinusMinus = 38,
TK_And = 9,
@ -100,44 +100,43 @@ public interface CPPSizeofExpressionParsersym {
TK_Minus = 26,
TK_Tilde = 5,
TK_Bang = 41,
TK_Slash = 93,
TK_Percent = 94,
TK_RightShift = 88,
TK_LeftShift = 89,
TK_LT = 56,
TK_GT = 69,
TK_LE = 95,
TK_GE = 96,
TK_EQ = 97,
TK_NE = 98,
TK_Caret = 99,
TK_Or = 100,
TK_AndAnd = 101,
TK_OrOr = 102,
TK_Question = 107,
TK_Colon = 73,
TK_Slash = 92,
TK_Percent = 93,
TK_RightShift = 87,
TK_LeftShift = 88,
TK_LT = 55,
TK_GT = 68,
TK_LE = 94,
TK_GE = 95,
TK_EQ = 96,
TK_NE = 97,
TK_Caret = 98,
TK_Or = 99,
TK_AndAnd = 100,
TK_OrOr = 101,
TK_Question = 106,
TK_Colon = 72,
TK_ColonColon = 4,
TK_DotDotDot = 91,
TK_Assign = 70,
TK_StarAssign = 108,
TK_SlashAssign = 109,
TK_PercentAssign = 110,
TK_PlusAssign = 111,
TK_MinusAssign = 112,
TK_RightShiftAssign = 113,
TK_LeftShiftAssign = 114,
TK_AndAssign = 115,
TK_CaretAssign = 116,
TK_OrAssign = 117,
TK_Comma = 71,
TK_RightBracket = 118,
TK_RightParen = 74,
TK_RightBrace = 72,
TK_DotDotDot = 90,
TK_Assign = 69,
TK_StarAssign = 107,
TK_SlashAssign = 108,
TK_PercentAssign = 109,
TK_PlusAssign = 110,
TK_MinusAssign = 111,
TK_RightShiftAssign = 112,
TK_LeftShiftAssign = 113,
TK_AndAssign = 114,
TK_CaretAssign = 115,
TK_OrAssign = 116,
TK_Comma = 70,
TK_RightBracket = 117,
TK_RightParen = 73,
TK_RightBrace = 71,
TK_SemiColon = 27,
TK_LeftBrace = 68,
TK_ERROR_TOKEN = 62,
TK_0 = 55,
TK_EOF_TOKEN = 121;
TK_LeftBrace = 67,
TK_ERROR_TOKEN = 61,
TK_EOF_TOKEN = 120;
public final static String orderedTerminalSymbols[] = {
"",
@ -195,7 +194,6 @@ public interface CPPSizeofExpressionParsersym {
"integer",
"floating",
"charconst",
"0",
"LT",
"enum",
"struct",

View file

@ -15,69 +15,69 @@ package org.eclipse.cdt.internal.core.dom.lrparser.cpp;
public interface CPPTemplateTypeParameterParsersym {
public final static int
TK_asm = 65,
TK_asm = 64,
TK_auto = 26,
TK_bool = 11,
TK_break = 77,
TK_case = 78,
TK_catch = 119,
TK_break = 76,
TK_case = 77,
TK_catch = 118,
TK_char = 12,
TK_class = 39,
TK_const = 23,
TK_const_cast = 43,
TK_continue = 79,
TK_default = 80,
TK_delete = 66,
TK_do = 81,
TK_continue = 78,
TK_default = 79,
TK_delete = 65,
TK_do = 80,
TK_double = 13,
TK_dynamic_cast = 44,
TK_else = 122,
TK_enum = 57,
TK_else = 121,
TK_enum = 56,
TK_explicit = 27,
TK_export = 87,
TK_export = 86,
TK_extern = 28,
TK_false = 45,
TK_float = 14,
TK_for = 82,
TK_for = 81,
TK_friend = 29,
TK_goto = 83,
TK_if = 84,
TK_goto = 82,
TK_if = 83,
TK_inline = 30,
TK_int = 15,
TK_long = 16,
TK_mutable = 31,
TK_namespace = 60,
TK_new = 67,
TK_namespace = 59,
TK_new = 66,
TK_operator = 7,
TK_private = 103,
TK_protected = 104,
TK_public = 105,
TK_private = 102,
TK_protected = 103,
TK_public = 104,
TK_register = 32,
TK_reinterpret_cast = 46,
TK_return = 85,
TK_return = 84,
TK_short = 17,
TK_signed = 18,
TK_sizeof = 47,
TK_static = 33,
TK_static_cast = 48,
TK_struct = 58,
TK_switch = 86,
TK_struct = 57,
TK_switch = 85,
TK_template = 41,
TK_this = 49,
TK_throw = 62,
TK_try = 75,
TK_throw = 61,
TK_try = 74,
TK_true = 50,
TK_typedef = 34,
TK_typeid = 51,
TK_typename = 10,
TK_union = 59,
TK_union = 58,
TK_unsigned = 19,
TK_using = 63,
TK_using = 62,
TK_virtual = 22,
TK_void = 20,
TK_volatile = 24,
TK_wchar_t = 21,
TK_while = 76,
TK_while = 75,
TK_integer = 52,
TK_floating = 53,
TK_charconst = 54,
@ -85,13 +85,13 @@ public interface CPPTemplateTypeParameterParsersym {
TK_identifier = 1,
TK_Completion = 2,
TK_EndOfCompletion = 8,
TK_Invalid = 123,
TK_LeftBracket = 64,
TK_Invalid = 122,
TK_LeftBracket = 63,
TK_LeftParen = 3,
TK_Dot = 120,
TK_DotStar = 92,
TK_Arrow = 106,
TK_ArrowStar = 90,
TK_Dot = 119,
TK_DotStar = 91,
TK_Arrow = 105,
TK_ArrowStar = 89,
TK_PlusPlus = 37,
TK_MinusMinus = 38,
TK_And = 9,
@ -100,44 +100,43 @@ public interface CPPTemplateTypeParameterParsersym {
TK_Minus = 36,
TK_Tilde = 5,
TK_Bang = 42,
TK_Slash = 93,
TK_Percent = 94,
TK_RightShift = 88,
TK_LeftShift = 89,
TK_Slash = 92,
TK_Percent = 93,
TK_RightShift = 87,
TK_LeftShift = 88,
TK_LT = 55,
TK_GT = 69,
TK_LE = 95,
TK_GE = 96,
TK_EQ = 97,
TK_NE = 98,
TK_Caret = 99,
TK_Or = 100,
TK_AndAnd = 101,
TK_OrOr = 102,
TK_Question = 107,
TK_Colon = 73,
TK_GT = 68,
TK_LE = 94,
TK_GE = 95,
TK_EQ = 96,
TK_NE = 97,
TK_Caret = 98,
TK_Or = 99,
TK_AndAnd = 100,
TK_OrOr = 101,
TK_Question = 106,
TK_Colon = 72,
TK_ColonColon = 4,
TK_DotDotDot = 91,
TK_Assign = 70,
TK_StarAssign = 108,
TK_SlashAssign = 109,
TK_PercentAssign = 110,
TK_PlusAssign = 111,
TK_MinusAssign = 112,
TK_RightShiftAssign = 113,
TK_LeftShiftAssign = 114,
TK_AndAssign = 115,
TK_CaretAssign = 116,
TK_OrAssign = 117,
TK_Comma = 71,
TK_RightBracket = 118,
TK_RightParen = 74,
TK_RightBrace = 72,
TK_DotDotDot = 90,
TK_Assign = 69,
TK_StarAssign = 107,
TK_SlashAssign = 108,
TK_PercentAssign = 109,
TK_PlusAssign = 110,
TK_MinusAssign = 111,
TK_RightShiftAssign = 112,
TK_LeftShiftAssign = 113,
TK_AndAssign = 114,
TK_CaretAssign = 115,
TK_OrAssign = 116,
TK_Comma = 70,
TK_RightBracket = 117,
TK_RightParen = 73,
TK_RightBrace = 71,
TK_SemiColon = 25,
TK_LeftBrace = 68,
TK_ERROR_TOKEN = 61,
TK_0 = 56,
TK_EOF_TOKEN = 121;
TK_LeftBrace = 67,
TK_ERROR_TOKEN = 60,
TK_EOF_TOKEN = 120;
public final static String orderedTerminalSymbols[] = {
"",
@ -196,7 +195,6 @@ public interface CPPTemplateTypeParameterParsersym {
"floating",
"charconst",
"LT",
"0",
"enum",
"struct",
"union",

View file

@ -27,8 +27,10 @@ import org.eclipse.cdt.core.dom.lrparser.action.TokenMap;
import org.eclipse.cdt.internal.core.dom.parser.c.CNodeFactory;
import org.eclipse.cdt.core.dom.lrparser.action.c99.C99BuildASTParserAction;
import org.eclipse.cdt.core.dom.lrparser.action.c99.C99SecondaryParserFactory;
import org.eclipse.cdt.core.dom.lrparser.action.gnu.GCCBuildASTParserAction;
import org.eclipse.cdt.core.dom.lrparser.action.gnu.GCCSecondaryParserFactory;
public class GCCParser extends PrsStream implements RuleAction , IParserActionTokenProvider, IParser
{
@ -174,12 +176,12 @@ public GCCParser() { // constructor
}
private void initActions(IASTTranslationUnit tu, Set<IParser.Options> options) {
action = new C99BuildASTParserAction ( CNodeFactory.getDefault() , this, tu, astStack);
action = new C99BuildASTParserAction (this, tu, astStack, CNodeFactory.getDefault() , GCCSecondaryParserFactory.getDefault() );
action.setParserOptions(options);
gnuAction = new GCCBuildASTParserAction ( CNodeFactory.getDefault() , this, tu, astStack);
gnuAction = new GCCBuildASTParserAction (this, tu, astStack, CNodeFactory.getDefault() );
gnuAction.setParserOptions(options);
@ -241,8 +243,8 @@ public void setTokens(List<IToken> tokens) {
addToken(new Token(null, 0, 0, GCCParsersym.TK_EOF_TOKEN));
}
public GCCParser(String[] mapFrom) { // constructor
tokenMap = new TokenMap(GCCParsersym.orderedTerminalSymbols, mapFrom);
public GCCParser(IParserActionTokenProvider parser) { // constructor
tokenMap = new TokenMap(GCCParsersym.orderedTerminalSymbols, parser.getOrderedTerminalSymbols());
}
@ -333,7 +335,7 @@ private GCCBuildASTParserAction gnuAction;
}
//
// Rule 26: postfix_expression ::= ( type_name ) { <openscope-ast> initializer_list comma_opt }
// Rule 26: postfix_expression ::= ( type_id ) { <openscope-ast> initializer_list comma_opt }
//
case 26: { action. consumeExpressionTypeIdInitializer(); break;
}
@ -393,13 +395,13 @@ private GCCBuildASTParserAction gnuAction;
}
//
// Rule 41: unary_expression ::= sizeof ( type_name )
// Rule 41: unary_expression ::= sizeof ( type_id )
//
case 41: { action. consumeExpressionTypeId(IASTTypeIdExpression.op_sizeof); break;
}
//
// Rule 43: cast_expression ::= ( type_name ) cast_expression
// Rule 43: cast_expression ::= ( type_id ) cast_expression
//
case 43: { action. consumeExpressionCast(IASTCastExpression.op_cast); break;
}
@ -1083,13 +1085,13 @@ private GCCBuildASTParserAction gnuAction;
}
//
// Rule 267: type_name ::= specifier_qualifier_list
// Rule 267: type_id ::= specifier_qualifier_list
//
case 267: { action. consumeTypeId(false); break;
}
//
// Rule 268: type_name ::= specifier_qualifier_list abstract_declarator
// Rule 268: type_id ::= specifier_qualifier_list abstract_declarator
//
case 268: { action. consumeTypeId(true); break;
}
@ -1279,18 +1281,48 @@ private GCCBuildASTParserAction gnuAction;
//
case 341: { gnuAction.consumeDeclarationASM(); break;
}
//
// Rule 352: unary_expression ::= __alignof__ unary_expression
//
case 352: { action. consumeExpressionUnaryOperator(IASTUnaryExpression.op_alignOf); break;
}
//
// Rule 353: unary_expression ::= __alignof__ ( type_id )
//
case 353: { action. consumeExpressionTypeId(IASTTypeIdExpression.op_alignof); break;
}
//
// Rule 354: unary_expression ::= typeof unary_expression
//
case 354: { action. consumeExpressionUnaryOperator(IASTUnaryExpression.op_typeof); break;
}
//
// Rule 355: unary_expression ::= typeof ( type_id )
//
case 355: { action. consumeExpressionTypeId(IASTTypeIdExpression.op_typeof); break;
}
//
// Rule 365: designator_base ::= identifier_token :
// Rule 371: field_name_designator ::= identifier_token :
//
case 365: { gnuAction.consumeDesignatorField(); break;
case 371: { gnuAction.consumeDesignatorField(); break;
}
//
// Rule 366: designator_base ::= [ constant_expression ... constant_expression ]
// Rule 372: array_range_designator ::= [ constant_expression ... constant_expression ]
//
case 366: { gnuAction.consumeDesignatorArray(); break;
case 372: { gnuAction.consumeDesignatorArray(); break;
}
//
// Rule 373: designated_initializer ::= <openscope-ast> field_name_designator initializer
//
case 373: { action. consumeInitializerDesignated(); break;
}
default:

View file

@ -15,106 +15,106 @@ package org.eclipse.cdt.internal.core.dom.lrparser.gcc;
public interface GCCParsersym {
public final static int
TK_auto = 27,
TK_break = 37,
TK_case = 38,
TK_char = 47,
TK_const = 22,
TK_continue = 39,
TK_default = 40,
TK_do = 41,
TK_double = 48,
TK_else = 95,
TK_enum = 59,
TK_extern = 28,
TK_float = 49,
TK_for = 42,
TK_goto = 43,
TK_if = 44,
TK_inline = 29,
TK_int = 50,
TK_long = 51,
TK_register = 30,
TK_restrict = 25,
TK_return = 45,
TK_short = 52,
TK_signed = 53,
TK_auto = 29,
TK_break = 39,
TK_case = 40,
TK_char = 49,
TK_const = 24,
TK_continue = 41,
TK_default = 42,
TK_do = 43,
TK_double = 50,
TK_else = 97,
TK_enum = 61,
TK_extern = 30,
TK_float = 51,
TK_for = 44,
TK_goto = 45,
TK_if = 46,
TK_inline = 31,
TK_int = 52,
TK_long = 53,
TK_register = 32,
TK_restrict = 27,
TK_return = 47,
TK_short = 54,
TK_signed = 55,
TK_sizeof = 16,
TK_static = 26,
TK_struct = 60,
TK_switch = 46,
TK_typedef = 31,
TK_union = 61,
TK_unsigned = 54,
TK_void = 55,
TK_volatile = 23,
TK_while = 35,
TK__Bool = 56,
TK__Complex = 57,
TK__Imaginary = 58,
TK_static = 28,
TK_struct = 62,
TK_switch = 48,
TK_typedef = 33,
TK_union = 63,
TK_unsigned = 56,
TK_void = 57,
TK_volatile = 25,
TK_while = 37,
TK__Bool = 58,
TK__Complex = 59,
TK__Imaginary = 60,
TK_integer = 17,
TK_floating = 18,
TK_charconst = 19,
TK_stringlit = 13,
TK_identifier = 2,
TK_Completion = 7,
TK_Completion = 5,
TK_EndOfCompletion = 3,
TK_Invalid = 96,
TK_LeftBracket = 33,
TK_Invalid = 98,
TK_LeftBracket = 35,
TK_LeftParen = 1,
TK_LeftBrace = 11,
TK_Dot = 68,
TK_Arrow = 81,
TK_Dot = 70,
TK_Arrow = 83,
TK_PlusPlus = 14,
TK_MinusMinus = 15,
TK_And = 12,
TK_Star = 8,
TK_Star = 6,
TK_Plus = 9,
TK_Minus = 10,
TK_Tilde = 20,
TK_Bang = 21,
TK_Slash = 69,
TK_Percent = 70,
TK_RightShift = 65,
TK_LeftShift = 66,
TK_LT = 71,
TK_GT = 72,
TK_LE = 73,
TK_GE = 74,
TK_EQ = 76,
TK_NE = 77,
TK_Caret = 78,
TK_Or = 79,
TK_AndAnd = 80,
TK_OrOr = 82,
TK_Question = 83,
TK_Colon = 63,
TK_DotDotDot = 67,
TK_Assign = 64,
TK_StarAssign = 84,
TK_SlashAssign = 85,
TK_PercentAssign = 86,
TK_PlusAssign = 87,
TK_MinusAssign = 88,
TK_RightShiftAssign = 89,
TK_LeftShiftAssign = 90,
TK_AndAssign = 91,
TK_CaretAssign = 92,
TK_OrAssign = 93,
TK_Comma = 36,
TK_RightBracket = 75,
TK_RightParen = 34,
TK_RightBrace = 62,
TK_SemiColon = 24,
TK_typeof = 97,
TK___alignof__ = 98,
TK_Slash = 71,
TK_Percent = 72,
TK_RightShift = 67,
TK_LeftShift = 68,
TK_LT = 73,
TK_GT = 74,
TK_LE = 75,
TK_GE = 76,
TK_EQ = 78,
TK_NE = 79,
TK_Caret = 80,
TK_Or = 81,
TK_AndAnd = 82,
TK_OrOr = 84,
TK_Question = 85,
TK_Colon = 65,
TK_DotDotDot = 69,
TK_Assign = 66,
TK_StarAssign = 86,
TK_SlashAssign = 87,
TK_PercentAssign = 88,
TK_PlusAssign = 89,
TK_MinusAssign = 90,
TK_RightShiftAssign = 91,
TK_LeftShiftAssign = 92,
TK_AndAssign = 93,
TK_CaretAssign = 94,
TK_OrAssign = 95,
TK_Comma = 38,
TK_RightBracket = 77,
TK_RightParen = 36,
TK_RightBrace = 64,
TK_SemiColon = 26,
TK_typeof = 22,
TK___alignof__ = 23,
TK_MAX = 99,
TK_MIN = 100,
TK___attribute__ = 5,
TK___declspec = 6,
TK___attribute__ = 7,
TK___declspec = 8,
TK_asm = 4,
TK_ERROR_TOKEN = 32,
TK_EOF_TOKEN = 94;
TK_ERROR_TOKEN = 34,
TK_EOF_TOKEN = 96;
public final static String orderedTerminalSymbols[] = {
"",
@ -122,10 +122,10 @@ public interface GCCParsersym {
"identifier",
"EndOfCompletion",
"asm",
"__attribute__",
"__declspec",
"Completion",
"Star",
"__attribute__",
"__declspec",
"Plus",
"Minus",
"LeftBrace",
@ -139,6 +139,8 @@ public interface GCCParsersym {
"charconst",
"Tilde",
"Bang",
"typeof",
"__alignof__",
"const",
"volatile",
"SemiColon",
@ -214,8 +216,6 @@ public interface GCCParsersym {
"EOF_TOKEN",
"else",
"Invalid",
"typeof",
"__alignof__",
"MAX",
"MIN"
};

View file

@ -0,0 +1,224 @@
/*******************************************************************************
* 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.gcc;
public interface GCCSizeofExpressionParsersym {
public final static int
TK_auto = 30,
TK_break = 86,
TK_case = 87,
TK_char = 39,
TK_const = 11,
TK_continue = 88,
TK_default = 89,
TK_do = 90,
TK_double = 40,
TK_else = 91,
TK_enum = 52,
TK_extern = 31,
TK_float = 41,
TK_for = 92,
TK_goto = 93,
TK_if = 94,
TK_inline = 32,
TK_int = 42,
TK_long = 43,
TK_register = 33,
TK_restrict = 13,
TK_return = 95,
TK_short = 44,
TK_signed = 45,
TK_sizeof = 19,
TK_static = 28,
TK_struct = 53,
TK_switch = 96,
TK_typedef = 34,
TK_union = 54,
TK_unsigned = 46,
TK_void = 47,
TK_volatile = 14,
TK_while = 97,
TK__Bool = 48,
TK__Complex = 49,
TK__Imaginary = 50,
TK_integer = 20,
TK_floating = 21,
TK_charconst = 22,
TK_stringlit = 18,
TK_identifier = 1,
TK_Completion = 6,
TK_EndOfCompletion = 7,
TK_Invalid = 98,
TK_LeftBracket = 17,
TK_LeftParen = 2,
TK_LeftBrace = 29,
TK_Dot = 55,
TK_Arrow = 71,
TK_PlusPlus = 15,
TK_MinusMinus = 16,
TK_And = 12,
TK_Star = 8,
TK_Plus = 9,
TK_Minus = 10,
TK_Tilde = 23,
TK_Bang = 24,
TK_Slash = 56,
TK_Percent = 57,
TK_RightShift = 37,
TK_LeftShift = 38,
TK_LT = 58,
TK_GT = 59,
TK_LE = 60,
TK_GE = 61,
TK_EQ = 65,
TK_NE = 66,
TK_Caret = 67,
TK_Or = 68,
TK_AndAnd = 69,
TK_OrOr = 72,
TK_Question = 73,
TK_Colon = 62,
TK_DotDotDot = 51,
TK_Assign = 63,
TK_StarAssign = 74,
TK_SlashAssign = 75,
TK_PercentAssign = 76,
TK_PlusAssign = 77,
TK_MinusAssign = 78,
TK_RightShiftAssign = 79,
TK_LeftShiftAssign = 80,
TK_AndAssign = 81,
TK_CaretAssign = 82,
TK_OrAssign = 83,
TK_Comma = 35,
TK_RightBracket = 64,
TK_RightParen = 25,
TK_RightBrace = 36,
TK_SemiColon = 84,
TK_typeof = 26,
TK___alignof__ = 27,
TK_MAX = 99,
TK_MIN = 100,
TK___attribute__ = 3,
TK___declspec = 4,
TK_asm = 5,
TK_ERROR_TOKEN = 70,
TK_EOF_TOKEN = 85;
public final static String orderedTerminalSymbols[] = {
"",
"identifier",
"LeftParen",
"__attribute__",
"__declspec",
"asm",
"Completion",
"EndOfCompletion",
"Star",
"Plus",
"Minus",
"const",
"And",
"restrict",
"volatile",
"PlusPlus",
"MinusMinus",
"LeftBracket",
"stringlit",
"sizeof",
"integer",
"floating",
"charconst",
"Tilde",
"Bang",
"RightParen",
"typeof",
"__alignof__",
"static",
"LeftBrace",
"auto",
"extern",
"inline",
"register",
"typedef",
"Comma",
"RightBrace",
"RightShift",
"LeftShift",
"char",
"double",
"float",
"int",
"long",
"short",
"signed",
"unsigned",
"void",
"_Bool",
"_Complex",
"_Imaginary",
"DotDotDot",
"enum",
"struct",
"union",
"Dot",
"Slash",
"Percent",
"LT",
"GT",
"LE",
"GE",
"Colon",
"Assign",
"RightBracket",
"EQ",
"NE",
"Caret",
"Or",
"AndAnd",
"ERROR_TOKEN",
"Arrow",
"OrOr",
"Question",
"StarAssign",
"SlashAssign",
"PercentAssign",
"PlusAssign",
"MinusAssign",
"RightShiftAssign",
"LeftShiftAssign",
"AndAssign",
"CaretAssign",
"OrAssign",
"SemiColon",
"EOF_TOKEN",
"break",
"case",
"continue",
"default",
"do",
"else",
"for",
"goto",
"if",
"return",
"switch",
"while",
"Invalid",
"MAX",
"MIN"
};
public final static boolean isValidForParser = true;
}

View file

@ -16,134 +16,133 @@ package org.eclipse.cdt.internal.core.dom.lrparser.gpp;
public interface GPPParsersym {
public final static int
TK_asm = 5,
TK_auto = 29,
TK_auto = 32,
TK_bool = 14,
TK_break = 79,
TK_case = 80,
TK_catch = 121,
TK_break = 80,
TK_case = 81,
TK_catch = 122,
TK_char = 15,
TK_class = 43,
TK_class = 44,
TK_const = 25,
TK_const_cast = 46,
TK_continue = 81,
TK_default = 82,
TK_delete = 70,
TK_do = 83,
TK_const_cast = 45,
TK_continue = 82,
TK_default = 83,
TK_delete = 71,
TK_do = 84,
TK_double = 16,
TK_dynamic_cast = 47,
TK_else = 124,
TK_enum = 59,
TK_explicit = 30,
TK_export = 89,
TK_extern = 31,
TK_false = 48,
TK_dynamic_cast = 46,
TK_else = 125,
TK_enum = 60,
TK_explicit = 33,
TK_export = 90,
TK_extern = 34,
TK_false = 47,
TK_float = 17,
TK_for = 84,
TK_friend = 32,
TK_goto = 85,
TK_if = 86,
TK_inline = 33,
TK_for = 85,
TK_friend = 35,
TK_goto = 86,
TK_if = 87,
TK_inline = 36,
TK_int = 18,
TK_long = 19,
TK_mutable = 34,
TK_namespace = 63,
TK_new = 71,
TK_mutable = 37,
TK_namespace = 64,
TK_new = 72,
TK_operator = 9,
TK_private = 105,
TK_protected = 106,
TK_public = 107,
TK_register = 35,
TK_reinterpret_cast = 49,
TK_return = 87,
TK_private = 106,
TK_protected = 107,
TK_public = 108,
TK_register = 38,
TK_reinterpret_cast = 48,
TK_return = 88,
TK_short = 20,
TK_signed = 21,
TK_sizeof = 50,
TK_static = 36,
TK_static_cast = 51,
TK_struct = 60,
TK_switch = 88,
TK_template = 44,
TK_this = 52,
TK_throw = 64,
TK_try = 77,
TK_true = 53,
TK_typedef = 37,
TK_typeid = 54,
TK_sizeof = 49,
TK_static = 39,
TK_static_cast = 50,
TK_struct = 61,
TK_switch = 89,
TK_template = 59,
TK_this = 51,
TK_throw = 65,
TK_try = 78,
TK_true = 52,
TK_typedef = 40,
TK_typeid = 53,
TK_typename = 13,
TK_union = 61,
TK_union = 62,
TK_unsigned = 22,
TK_using = 65,
TK_using = 66,
TK_virtual = 26,
TK_void = 23,
TK_volatile = 27,
TK_wchar_t = 24,
TK_while = 78,
TK_integer = 55,
TK_floating = 56,
TK_charconst = 57,
TK_stringlit = 40,
TK_while = 79,
TK_integer = 54,
TK_floating = 55,
TK_charconst = 56,
TK_stringlit = 31,
TK_identifier = 1,
TK_Completion = 2,
TK_EndOfCompletion = 10,
TK_Invalid = 125,
TK_LeftBracket = 67,
TK_Invalid = 126,
TK_LeftBracket = 68,
TK_LeftParen = 3,
TK_Dot = 122,
TK_DotStar = 94,
TK_Arrow = 108,
TK_ArrowStar = 93,
TK_Dot = 123,
TK_DotStar = 95,
TK_Arrow = 109,
TK_ArrowStar = 94,
TK_PlusPlus = 41,
TK_MinusMinus = 42,
TK_And = 12,
TK_Star = 11,
TK_Plus = 38,
TK_Minus = 39,
TK_Plus = 28,
TK_Minus = 29,
TK_Tilde = 8,
TK_Bang = 45,
TK_Slash = 95,
TK_Percent = 96,
TK_RightShift = 90,
TK_LeftShift = 91,
TK_LT = 62,
TK_GT = 72,
TK_LE = 97,
TK_GE = 98,
TK_EQ = 99,
TK_NE = 100,
TK_Caret = 101,
TK_Or = 102,
TK_AndAnd = 103,
TK_OrOr = 104,
TK_Question = 109,
TK_Colon = 73,
TK_Bang = 43,
TK_Slash = 96,
TK_Percent = 97,
TK_RightShift = 91,
TK_LeftShift = 92,
TK_LT = 63,
TK_GT = 73,
TK_LE = 98,
TK_GE = 99,
TK_EQ = 100,
TK_NE = 101,
TK_Caret = 102,
TK_Or = 103,
TK_AndAnd = 104,
TK_OrOr = 105,
TK_Question = 110,
TK_Colon = 74,
TK_ColonColon = 4,
TK_DotDotDot = 92,
TK_Assign = 75,
TK_StarAssign = 110,
TK_SlashAssign = 111,
TK_PercentAssign = 112,
TK_PlusAssign = 113,
TK_MinusAssign = 114,
TK_RightShiftAssign = 115,
TK_LeftShiftAssign = 116,
TK_AndAssign = 117,
TK_CaretAssign = 118,
TK_OrAssign = 119,
TK_Comma = 69,
TK_RightBracket = 120,
TK_RightParen = 68,
TK_RightBrace = 76,
TK_SemiColon = 28,
TK_LeftBrace = 74,
TK_typeof = 126,
TK___alignof__ = 127,
TK_MAX = 128,
TK_MIN = 129,
TK_DotDotDot = 93,
TK_Assign = 76,
TK_StarAssign = 111,
TK_SlashAssign = 112,
TK_PercentAssign = 113,
TK_PlusAssign = 114,
TK_MinusAssign = 115,
TK_RightShiftAssign = 116,
TK_LeftShiftAssign = 117,
TK_AndAssign = 118,
TK_CaretAssign = 119,
TK_OrAssign = 120,
TK_Comma = 70,
TK_RightBracket = 121,
TK_RightParen = 69,
TK_RightBrace = 77,
TK_SemiColon = 30,
TK_LeftBrace = 75,
TK_typeof = 57,
TK___alignof__ = 58,
TK_MAX = 127,
TK_MIN = 128,
TK___attribute__ = 6,
TK___declspec = 7,
TK_ERROR_TOKEN = 66,
TK_0 = 58,
TK_EOF_TOKEN = 123;
TK_ERROR_TOKEN = 67,
TK_EOF_TOKEN = 124;
public final static String orderedTerminalSymbols[] = {
"",
@ -174,7 +173,10 @@ public interface GPPParsersym {
"const",
"virtual",
"volatile",
"Plus",
"Minus",
"SemiColon",
"stringlit",
"auto",
"explicit",
"extern",
@ -184,14 +186,10 @@ public interface GPPParsersym {
"register",
"static",
"typedef",
"Plus",
"Minus",
"stringlit",
"PlusPlus",
"MinusMinus",
"class",
"template",
"Bang",
"class",
"const_cast",
"dynamic_cast",
"false",
@ -204,7 +202,9 @@ public interface GPPParsersym {
"integer",
"floating",
"charconst",
"0",
"typeof",
"__alignof__",
"template",
"enum",
"struct",
"union",
@ -272,8 +272,6 @@ public interface GPPParsersym {
"EOF_TOKEN",
"else",
"Invalid",
"typeof",
"__alignof__",
"MAX",
"MIN"
};

View file

@ -0,0 +1,280 @@
/*******************************************************************************
* 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.gpp;
public interface GPPSizeofExpressionParsersym {
public final static int
TK_asm = 5,
TK_auto = 34,
TK_bool = 14,
TK_break = 80,
TK_case = 81,
TK_catch = 122,
TK_char = 15,
TK_class = 58,
TK_const = 27,
TK_const_cast = 44,
TK_continue = 82,
TK_default = 83,
TK_delete = 70,
TK_do = 84,
TK_double = 16,
TK_dynamic_cast = 45,
TK_else = 125,
TK_enum = 61,
TK_explicit = 35,
TK_export = 90,
TK_extern = 36,
TK_false = 46,
TK_float = 17,
TK_for = 85,
TK_friend = 37,
TK_goto = 86,
TK_if = 87,
TK_inline = 38,
TK_int = 18,
TK_long = 19,
TK_mutable = 39,
TK_namespace = 65,
TK_new = 71,
TK_operator = 9,
TK_private = 106,
TK_protected = 107,
TK_public = 108,
TK_register = 40,
TK_reinterpret_cast = 47,
TK_return = 88,
TK_short = 20,
TK_signed = 21,
TK_sizeof = 48,
TK_static = 41,
TK_static_cast = 49,
TK_struct = 62,
TK_switch = 89,
TK_template = 59,
TK_this = 50,
TK_throw = 64,
TK_try = 78,
TK_true = 51,
TK_typedef = 42,
TK_typeid = 52,
TK_typename = 13,
TK_union = 63,
TK_unsigned = 22,
TK_using = 67,
TK_virtual = 28,
TK_void = 23,
TK_volatile = 29,
TK_wchar_t = 24,
TK_while = 79,
TK_integer = 53,
TK_floating = 54,
TK_charconst = 55,
TK_stringlit = 30,
TK_identifier = 1,
TK_Completion = 2,
TK_EndOfCompletion = 10,
TK_Invalid = 126,
TK_LeftBracket = 68,
TK_LeftParen = 3,
TK_Dot = 123,
TK_DotStar = 95,
TK_Arrow = 109,
TK_ArrowStar = 94,
TK_PlusPlus = 32,
TK_MinusMinus = 33,
TK_And = 12,
TK_Star = 11,
TK_Plus = 25,
TK_Minus = 26,
TK_Tilde = 8,
TK_Bang = 43,
TK_Slash = 96,
TK_Percent = 97,
TK_RightShift = 91,
TK_LeftShift = 92,
TK_LT = 60,
TK_GT = 73,
TK_LE = 98,
TK_GE = 99,
TK_EQ = 100,
TK_NE = 101,
TK_Caret = 102,
TK_Or = 103,
TK_AndAnd = 104,
TK_OrOr = 105,
TK_Question = 110,
TK_Colon = 74,
TK_ColonColon = 4,
TK_DotDotDot = 93,
TK_Assign = 76,
TK_StarAssign = 111,
TK_SlashAssign = 112,
TK_PercentAssign = 113,
TK_PlusAssign = 114,
TK_MinusAssign = 115,
TK_RightShiftAssign = 116,
TK_LeftShiftAssign = 117,
TK_AndAssign = 118,
TK_CaretAssign = 119,
TK_OrAssign = 120,
TK_Comma = 72,
TK_RightBracket = 121,
TK_RightParen = 69,
TK_RightBrace = 77,
TK_SemiColon = 31,
TK_LeftBrace = 75,
TK_typeof = 56,
TK___alignof__ = 57,
TK_MAX = 127,
TK_MIN = 128,
TK___attribute__ = 6,
TK___declspec = 7,
TK_ERROR_TOKEN = 66,
TK_EOF_TOKEN = 124;
public final static String orderedTerminalSymbols[] = {
"",
"identifier",
"Completion",
"LeftParen",
"ColonColon",
"asm",
"__attribute__",
"__declspec",
"Tilde",
"operator",
"EndOfCompletion",
"Star",
"And",
"typename",
"bool",
"char",
"double",
"float",
"int",
"long",
"short",
"signed",
"unsigned",
"void",
"wchar_t",
"Plus",
"Minus",
"const",
"virtual",
"volatile",
"stringlit",
"SemiColon",
"PlusPlus",
"MinusMinus",
"auto",
"explicit",
"extern",
"friend",
"inline",
"mutable",
"register",
"static",
"typedef",
"Bang",
"const_cast",
"dynamic_cast",
"false",
"reinterpret_cast",
"sizeof",
"static_cast",
"this",
"true",
"typeid",
"integer",
"floating",
"charconst",
"typeof",
"__alignof__",
"class",
"template",
"LT",
"enum",
"struct",
"union",
"throw",
"namespace",
"ERROR_TOKEN",
"using",
"LeftBracket",
"RightParen",
"delete",
"new",
"Comma",
"GT",
"Colon",
"LeftBrace",
"Assign",
"RightBrace",
"try",
"while",
"break",
"case",
"continue",
"default",
"do",
"for",
"goto",
"if",
"return",
"switch",
"export",
"RightShift",
"LeftShift",
"DotDotDot",
"ArrowStar",
"DotStar",
"Slash",
"Percent",
"LE",
"GE",
"EQ",
"NE",
"Caret",
"Or",
"AndAnd",
"OrOr",
"private",
"protected",
"public",
"Arrow",
"Question",
"StarAssign",
"SlashAssign",
"PercentAssign",
"PlusAssign",
"MinusAssign",
"RightShiftAssign",
"LeftShiftAssign",
"AndAssign",
"CaretAssign",
"OrAssign",
"RightBracket",
"catch",
"Dot",
"EOF_TOKEN",
"else",
"Invalid",
"MAX",
"MIN"
};
public final static boolean isValidForParser = true;
}

View file

@ -1,5 +1,5 @@
-----------------------------------------------------------------------------------
-- Copyright (c) 2006, 2007 IBM Corporation and others.
-- Copyright (c) 2006, 2009 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
@ -13,12 +13,14 @@
$Define
$build_action_class /. UPCParserAction ./
$node_factory_create_expression /. UPCASTNodeFactory.DEFAULT_INSTANCE ./
$parser_factory_create_expression /. UPCSecondaryParserFactory.getDefault() ./
$End
$Globals
/.
import org.eclipse.cdt.core.dom.parser.upc.UPCASTNodeFactory;
import org.eclipse.cdt.core.dom.parser.upc.UPCSecondaryParserFactory;
import org.eclipse.cdt.core.dom.parser.upc.UPCParserAction;
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTKeywordExpression;
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTSynchronizationStatement;
@ -67,15 +69,15 @@ literal
unary_expression
::= 'upc_localsizeof' unary_expression
/. $Build consumeExpressionUnarySizeofOperator(IUPCASTUnarySizeofExpression.upc_localsizeof); $EndBuild ./
| 'upc_localsizeof' '(' type_name ')'
| 'upc_localsizeof' '(' type_id ')'
/. $Build consumeExpressionSizeofTypeId(IUPCASTUnarySizeofExpression.upc_localsizeof); $EndBuild ./
| 'upc_blocksizeof' unary_expression
/. $Build consumeExpressionUnarySizeofOperator(IUPCASTUnarySizeofExpression.upc_blocksizeof); $EndBuild ./
| 'upc_blocksizeof' '(' type_name ')'
| 'upc_blocksizeof' '(' type_id ')'
/. $Build consumeExpressionSizeofTypeId(IUPCASTUnarySizeofExpression.upc_blocksizeof); $EndBuild ./
| 'upc_elemsizeof' unary_expression
/. $Build consumeExpressionUnarySizeofOperator(IUPCASTUnarySizeofExpression.upc_elemsizeof); $EndBuild ./
| 'upc_elemsizeof' '(' type_name ')'
| 'upc_elemsizeof' '(' type_id ')'
/. $Build consumeExpressionSizeofTypeId(IUPCASTUnarySizeofExpression.upc_elemsizeof); $EndBuild ./

View file

@ -1,5 +1,5 @@
-----------------------------------------------------------------------------------
-- Copyright (c) 2006, 2008 IBM Corporation and others.
-- Copyright (c) 2006, 2009 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
@ -23,8 +23,8 @@ $Import
$DropRules
unary_expression
::= 'upc_localsizeof' '(' type_name ')'
| 'upc_blocksizeof' '(' type_name ')'
| 'upc_elemsizeof' '(' type_name ')'
::= 'upc_localsizeof' '(' type_id ')'
| 'upc_blocksizeof' '(' type_id ')'
| 'upc_elemsizeof' '(' type_id ')'
$End

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2007 IBM Corporation and others.
* Copyright (c) 2006, 2009 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
@ -21,17 +21,14 @@ import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression;
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
import org.eclipse.cdt.core.dom.ast.c.ICASTDeclSpecifier;
import org.eclipse.cdt.core.dom.lrparser.IParser;
import org.eclipse.cdt.core.dom.lrparser.IParserActionTokenProvider;
import org.eclipse.cdt.core.dom.lrparser.action.ISecondaryParserFactory;
import org.eclipse.cdt.core.dom.lrparser.action.ScopedStack;
import org.eclipse.cdt.core.dom.lrparser.action.c99.C99BuildASTParserAction;
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTDeclSpecifier;
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTForallStatement;
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTKeywordExpression;
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTSynchronizationStatement;
import org.eclipse.cdt.internal.core.dom.parser.upc.UPCExpressionParser;
import org.eclipse.cdt.internal.core.dom.parser.upc.UPCNoCastExpressionParser;
import org.eclipse.cdt.internal.core.dom.parser.upc.UPCSizeofExpressionParser;
/**
@ -49,8 +46,8 @@ public class UPCParserAction extends C99BuildASTParserAction {
* @param parser
* @param tu
*/
public UPCParserAction(UPCASTNodeFactory nodeFactory, IParserActionTokenProvider parser, IASTTranslationUnit tu, ScopedStack<Object> astStack) {
super(nodeFactory, parser, tu, astStack);
public UPCParserAction(IParserActionTokenProvider parser, IASTTranslationUnit tu, ScopedStack<Object> astStack, UPCASTNodeFactory nodeFactory, ISecondaryParserFactory parserFactory) {
super(parser, tu, astStack, nodeFactory, parserFactory);
this.nodeFactory = nodeFactory;
nodeFactory.setUseC99SizeofExpressions();
}
@ -61,20 +58,7 @@ public class UPCParserAction extends C99BuildASTParserAction {
return token.getKind() == TK_Completion;
}
@Override
protected IParser getExpressionParser() {
return new UPCExpressionParser(parser.getOrderedTerminalSymbols());
}
@Override
protected IParser getNoCastExpressionParser() {
return new UPCNoCastExpressionParser(parser.getOrderedTerminalSymbols());
}
@Override
protected IParser getSizeofExpressionParser() {
return new UPCSizeofExpressionParser(parser.getOrderedTerminalSymbols());
}
/**************************************************************************************

View file

@ -0,0 +1,41 @@
/*******************************************************************************
* Copyright (c) 2006, 2009 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
*******************************************************************************/
package org.eclipse.cdt.core.dom.parser.upc;
import org.eclipse.cdt.core.dom.lrparser.IParser;
import org.eclipse.cdt.core.dom.lrparser.IParserActionTokenProvider;
import org.eclipse.cdt.core.dom.lrparser.action.ISecondaryParserFactory;
import org.eclipse.cdt.internal.core.dom.parser.upc.UPCExpressionParser;
import org.eclipse.cdt.internal.core.dom.parser.upc.UPCNoCastExpressionParser;
import org.eclipse.cdt.internal.core.dom.parser.upc.UPCSizeofExpressionParser;
public class UPCSecondaryParserFactory implements ISecondaryParserFactory{
private static final UPCSecondaryParserFactory DEFAULT_INSTANCE = new UPCSecondaryParserFactory();
public static UPCSecondaryParserFactory getDefault() {
return DEFAULT_INSTANCE;
}
public IParser getExpressionParser(IParserActionTokenProvider parser) {
return new UPCExpressionParser(parser);
}
public IParser getNoCastExpressionParser(IParserActionTokenProvider parser) {
return new UPCNoCastExpressionParser(parser);
}
public IParser getSizeofExpressionParser(IParserActionTokenProvider parser) {
return new UPCSizeofExpressionParser(parser);
}
}

View file

@ -27,8 +27,10 @@ import org.eclipse.cdt.core.dom.lrparser.action.TokenMap;
import org.eclipse.cdt.internal.core.dom.parser.c.CNodeFactory;
import org.eclipse.cdt.core.dom.lrparser.action.c99.C99BuildASTParserAction;
import org.eclipse.cdt.core.dom.lrparser.action.c99.C99SecondaryParserFactory;
import org.eclipse.cdt.core.dom.parser.upc.UPCASTNodeFactory;
import org.eclipse.cdt.core.dom.parser.upc.UPCSecondaryParserFactory;
import org.eclipse.cdt.core.dom.parser.upc.UPCParserAction;
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTKeywordExpression;
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTSynchronizationStatement;
@ -179,7 +181,7 @@ public UPCExpressionParser() { // constructor
}
private void initActions(IASTTranslationUnit tu, Set<IParser.Options> options) {
action = new UPCParserAction ( UPCASTNodeFactory.DEFAULT_INSTANCE , this, tu, astStack);
action = new UPCParserAction (this, tu, astStack, UPCASTNodeFactory.DEFAULT_INSTANCE , UPCSecondaryParserFactory.getDefault() );
action.setParserOptions(options);
@ -241,8 +243,8 @@ public void setTokens(List<IToken> tokens) {
addToken(new Token(null, 0, 0, UPCExpressionParsersym.TK_EOF_TOKEN));
}
public UPCExpressionParser(String[] mapFrom) { // constructor
tokenMap = new TokenMap(UPCExpressionParsersym.orderedTerminalSymbols, mapFrom);
public UPCExpressionParser(IParserActionTokenProvider parser) { // constructor
tokenMap = new TokenMap(UPCExpressionParsersym.orderedTerminalSymbols, parser.getOrderedTerminalSymbols());
}
@ -331,7 +333,7 @@ public UPCExpressionParser(String[] mapFrom) { // constructor
}
//
// Rule 26: postfix_expression ::= ( type_name ) { <openscope-ast> initializer_list comma_opt }
// Rule 26: postfix_expression ::= ( type_id ) { <openscope-ast> initializer_list comma_opt }
//
case 26: { action. consumeExpressionTypeIdInitializer(); break;
}
@ -391,13 +393,13 @@ public UPCExpressionParser(String[] mapFrom) { // constructor
}
//
// Rule 41: unary_expression ::= sizeof ( type_name )
// Rule 41: unary_expression ::= sizeof ( type_id )
//
case 41: { action. consumeExpressionTypeId(IASTTypeIdExpression.op_sizeof); break;
}
//
// Rule 43: cast_expression ::= ( type_name ) cast_expression
// Rule 43: cast_expression ::= ( type_id ) cast_expression
//
case 43: { action. consumeExpressionCast(IASTCastExpression.op_cast); break;
}
@ -1081,13 +1083,13 @@ public UPCExpressionParser(String[] mapFrom) { // constructor
}
//
// Rule 267: type_name ::= specifier_qualifier_list
// Rule 267: type_id ::= specifier_qualifier_list
//
case 267: { action. consumeTypeId(false); break;
}
//
// Rule 268: type_name ::= specifier_qualifier_list abstract_declarator
// Rule 268: type_id ::= specifier_qualifier_list abstract_declarator
//
case 268: { action. consumeTypeId(true); break;
}
@ -1297,7 +1299,7 @@ public UPCExpressionParser(String[] mapFrom) { // constructor
}
//
// Rule 321: unary_expression ::= upc_localsizeof ( type_name )
// Rule 321: unary_expression ::= upc_localsizeof ( type_id )
//
case 321: { action. consumeExpressionSizeofTypeId(IUPCASTUnarySizeofExpression.upc_localsizeof); break;
}
@ -1309,7 +1311,7 @@ public UPCExpressionParser(String[] mapFrom) { // constructor
}
//
// Rule 323: unary_expression ::= upc_blocksizeof ( type_name )
// Rule 323: unary_expression ::= upc_blocksizeof ( type_id )
//
case 323: { action. consumeExpressionSizeofTypeId(IUPCASTUnarySizeofExpression.upc_blocksizeof); break;
}
@ -1321,7 +1323,7 @@ public UPCExpressionParser(String[] mapFrom) { // constructor
}
//
// Rule 325: unary_expression ::= upc_elemsizeof ( type_name )
// Rule 325: unary_expression ::= upc_elemsizeof ( type_id )
//
case 325: { action. consumeExpressionSizeofTypeId(IUPCASTUnarySizeofExpression.upc_elemsizeof); break;
}

View file

@ -1111,7 +1111,7 @@ public class UPCExpressionParserprs implements lpg.lpgjavaruntime.ParseTable, UP
"expression",
"postfix_expression",
"member_name",
"type_name",
"type_id",
"initializer_list",
"unary_expression",
"cast_expression",

View file

@ -27,8 +27,10 @@ import org.eclipse.cdt.core.dom.lrparser.action.TokenMap;
import org.eclipse.cdt.internal.core.dom.parser.c.CNodeFactory;
import org.eclipse.cdt.core.dom.lrparser.action.c99.C99BuildASTParserAction;
import org.eclipse.cdt.core.dom.lrparser.action.c99.C99SecondaryParserFactory;
import org.eclipse.cdt.core.dom.parser.upc.UPCASTNodeFactory;
import org.eclipse.cdt.core.dom.parser.upc.UPCSecondaryParserFactory;
import org.eclipse.cdt.core.dom.parser.upc.UPCParserAction;
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTKeywordExpression;
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTSynchronizationStatement;
@ -179,7 +181,7 @@ public UPCNoCastExpressionParser() { // constructor
}
private void initActions(IASTTranslationUnit tu, Set<IParser.Options> options) {
action = new UPCParserAction ( UPCASTNodeFactory.DEFAULT_INSTANCE , this, tu, astStack);
action = new UPCParserAction (this, tu, astStack, UPCASTNodeFactory.DEFAULT_INSTANCE , UPCSecondaryParserFactory.getDefault() );
action.setParserOptions(options);
@ -241,8 +243,8 @@ public void setTokens(List<IToken> tokens) {
addToken(new Token(null, 0, 0, UPCNoCastExpressionParsersym.TK_EOF_TOKEN));
}
public UPCNoCastExpressionParser(String[] mapFrom) { // constructor
tokenMap = new TokenMap(UPCNoCastExpressionParsersym.orderedTerminalSymbols, mapFrom);
public UPCNoCastExpressionParser(IParserActionTokenProvider parser) { // constructor
tokenMap = new TokenMap(UPCNoCastExpressionParsersym.orderedTerminalSymbols, parser.getOrderedTerminalSymbols());
}
@ -331,7 +333,7 @@ public UPCNoCastExpressionParser(String[] mapFrom) { // constructor
}
//
// Rule 26: postfix_expression ::= ( type_name ) { <openscope-ast> initializer_list comma_opt }
// Rule 26: postfix_expression ::= ( type_id ) { <openscope-ast> initializer_list comma_opt }
//
case 26: { action. consumeExpressionTypeIdInitializer(); break;
}
@ -391,7 +393,7 @@ public UPCNoCastExpressionParser(String[] mapFrom) { // constructor
}
//
// Rule 41: unary_expression ::= sizeof ( type_name )
// Rule 41: unary_expression ::= sizeof ( type_id )
//
case 41: { action. consumeExpressionTypeId(IASTTypeIdExpression.op_sizeof); break;
}
@ -1075,13 +1077,13 @@ public UPCNoCastExpressionParser(String[] mapFrom) { // constructor
}
//
// Rule 266: type_name ::= specifier_qualifier_list
// Rule 266: type_id ::= specifier_qualifier_list
//
case 266: { action. consumeTypeId(false); break;
}
//
// Rule 267: type_name ::= specifier_qualifier_list abstract_declarator
// Rule 267: type_id ::= specifier_qualifier_list abstract_declarator
//
case 267: { action. consumeTypeId(true); break;
}
@ -1291,7 +1293,7 @@ public UPCNoCastExpressionParser(String[] mapFrom) { // constructor
}
//
// Rule 320: unary_expression ::= upc_localsizeof ( type_name )
// Rule 320: unary_expression ::= upc_localsizeof ( type_id )
//
case 320: { action. consumeExpressionSizeofTypeId(IUPCASTUnarySizeofExpression.upc_localsizeof); break;
}
@ -1303,7 +1305,7 @@ public UPCNoCastExpressionParser(String[] mapFrom) { // constructor
}
//
// Rule 322: unary_expression ::= upc_blocksizeof ( type_name )
// Rule 322: unary_expression ::= upc_blocksizeof ( type_id )
//
case 322: { action. consumeExpressionSizeofTypeId(IUPCASTUnarySizeofExpression.upc_blocksizeof); break;
}
@ -1315,7 +1317,7 @@ public UPCNoCastExpressionParser(String[] mapFrom) { // constructor
}
//
// Rule 324: unary_expression ::= upc_elemsizeof ( type_name )
// Rule 324: unary_expression ::= upc_elemsizeof ( type_id )
//
case 324: { action. consumeExpressionSizeofTypeId(IUPCASTUnarySizeofExpression.upc_elemsizeof); break;
}

View file

@ -1084,7 +1084,7 @@ public class UPCNoCastExpressionParserprs implements lpg.lpgjavaruntime.ParseTab
"expression",
"postfix_expression",
"member_name",
"type_name",
"type_id",
"initializer_list",
"unary_expression",
"cast_expression",

View file

@ -27,8 +27,10 @@ import org.eclipse.cdt.core.dom.lrparser.action.TokenMap;
import org.eclipse.cdt.internal.core.dom.parser.c.CNodeFactory;
import org.eclipse.cdt.core.dom.lrparser.action.c99.C99BuildASTParserAction;
import org.eclipse.cdt.core.dom.lrparser.action.c99.C99SecondaryParserFactory;
import org.eclipse.cdt.core.dom.parser.upc.UPCASTNodeFactory;
import org.eclipse.cdt.core.dom.parser.upc.UPCSecondaryParserFactory;
import org.eclipse.cdt.core.dom.parser.upc.UPCParserAction;
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTKeywordExpression;
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTSynchronizationStatement;
@ -179,7 +181,7 @@ public UPCParser() { // constructor
}
private void initActions(IASTTranslationUnit tu, Set<IParser.Options> options) {
action = new UPCParserAction ( UPCASTNodeFactory.DEFAULT_INSTANCE , this, tu, astStack);
action = new UPCParserAction (this, tu, astStack, UPCASTNodeFactory.DEFAULT_INSTANCE , UPCSecondaryParserFactory.getDefault() );
action.setParserOptions(options);
@ -241,8 +243,8 @@ public void setTokens(List<IToken> tokens) {
addToken(new Token(null, 0, 0, UPCParsersym.TK_EOF_TOKEN));
}
public UPCParser(String[] mapFrom) { // constructor
tokenMap = new TokenMap(UPCParsersym.orderedTerminalSymbols, mapFrom);
public UPCParser(IParserActionTokenProvider parser) { // constructor
tokenMap = new TokenMap(UPCParsersym.orderedTerminalSymbols, parser.getOrderedTerminalSymbols());
}
@ -331,7 +333,7 @@ public UPCParser(String[] mapFrom) { // constructor
}
//
// Rule 26: postfix_expression ::= ( type_name ) { <openscope-ast> initializer_list comma_opt }
// Rule 26: postfix_expression ::= ( type_id ) { <openscope-ast> initializer_list comma_opt }
//
case 26: { action. consumeExpressionTypeIdInitializer(); break;
}
@ -391,13 +393,13 @@ public UPCParser(String[] mapFrom) { // constructor
}
//
// Rule 41: unary_expression ::= sizeof ( type_name )
// Rule 41: unary_expression ::= sizeof ( type_id )
//
case 41: { action. consumeExpressionTypeId(IASTTypeIdExpression.op_sizeof); break;
}
//
// Rule 43: cast_expression ::= ( type_name ) cast_expression
// Rule 43: cast_expression ::= ( type_id ) cast_expression
//
case 43: { action. consumeExpressionCast(IASTCastExpression.op_cast); break;
}
@ -1081,13 +1083,13 @@ public UPCParser(String[] mapFrom) { // constructor
}
//
// Rule 267: type_name ::= specifier_qualifier_list
// Rule 267: type_id ::= specifier_qualifier_list
//
case 267: { action. consumeTypeId(false); break;
}
//
// Rule 268: type_name ::= specifier_qualifier_list abstract_declarator
// Rule 268: type_id ::= specifier_qualifier_list abstract_declarator
//
case 268: { action. consumeTypeId(true); break;
}
@ -1291,7 +1293,7 @@ public UPCParser(String[] mapFrom) { // constructor
}
//
// Rule 319: unary_expression ::= upc_localsizeof ( type_name )
// Rule 319: unary_expression ::= upc_localsizeof ( type_id )
//
case 319: { action. consumeExpressionSizeofTypeId(IUPCASTUnarySizeofExpression.upc_localsizeof); break;
}
@ -1303,7 +1305,7 @@ public UPCParser(String[] mapFrom) { // constructor
}
//
// Rule 321: unary_expression ::= upc_blocksizeof ( type_name )
// Rule 321: unary_expression ::= upc_blocksizeof ( type_id )
//
case 321: { action. consumeExpressionSizeofTypeId(IUPCASTUnarySizeofExpression.upc_blocksizeof); break;
}
@ -1315,7 +1317,7 @@ public UPCParser(String[] mapFrom) { // constructor
}
//
// Rule 323: unary_expression ::= upc_elemsizeof ( type_name )
// Rule 323: unary_expression ::= upc_elemsizeof ( type_id )
//
case 323: { action. consumeExpressionSizeofTypeId(IUPCASTUnarySizeofExpression.upc_elemsizeof); break;
}

View file

@ -1886,7 +1886,7 @@ public class UPCParserprs implements lpg.lpgjavaruntime.ParseTable, UPCParsersym
"expression",
"postfix_expression",
"member_name",
"type_name",
"type_id",
"initializer_list",
"unary_expression",
"cast_expression",

View file

@ -27,8 +27,10 @@ import org.eclipse.cdt.core.dom.lrparser.action.TokenMap;
import org.eclipse.cdt.internal.core.dom.parser.c.CNodeFactory;
import org.eclipse.cdt.core.dom.lrparser.action.c99.C99BuildASTParserAction;
import org.eclipse.cdt.core.dom.lrparser.action.c99.C99SecondaryParserFactory;
import org.eclipse.cdt.core.dom.parser.upc.UPCASTNodeFactory;
import org.eclipse.cdt.core.dom.parser.upc.UPCSecondaryParserFactory;
import org.eclipse.cdt.core.dom.parser.upc.UPCParserAction;
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTKeywordExpression;
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTSynchronizationStatement;
@ -179,7 +181,7 @@ public UPCSizeofExpressionParser() { // constructor
}
private void initActions(IASTTranslationUnit tu, Set<IParser.Options> options) {
action = new UPCParserAction ( UPCASTNodeFactory.DEFAULT_INSTANCE , this, tu, astStack);
action = new UPCParserAction (this, tu, astStack, UPCASTNodeFactory.DEFAULT_INSTANCE , UPCSecondaryParserFactory.getDefault() );
action.setParserOptions(options);
@ -241,8 +243,8 @@ public void setTokens(List<IToken> tokens) {
addToken(new Token(null, 0, 0, UPCSizeofExpressionParsersym.TK_EOF_TOKEN));
}
public UPCSizeofExpressionParser(String[] mapFrom) { // constructor
tokenMap = new TokenMap(UPCSizeofExpressionParsersym.orderedTerminalSymbols, mapFrom);
public UPCSizeofExpressionParser(IParserActionTokenProvider parser) { // constructor
tokenMap = new TokenMap(UPCSizeofExpressionParsersym.orderedTerminalSymbols, parser.getOrderedTerminalSymbols());
}
@ -331,7 +333,7 @@ public UPCSizeofExpressionParser(String[] mapFrom) { // constructor
}
//
// Rule 26: postfix_expression ::= ( type_name ) { <openscope-ast> initializer_list comma_opt }
// Rule 26: postfix_expression ::= ( type_id ) { <openscope-ast> initializer_list comma_opt }
//
case 26: { action. consumeExpressionTypeIdInitializer(); break;
}
@ -391,7 +393,7 @@ public UPCSizeofExpressionParser(String[] mapFrom) { // constructor
}
//
// Rule 42: cast_expression ::= ( type_name ) cast_expression
// Rule 42: cast_expression ::= ( type_id ) cast_expression
//
case 42: { action. consumeExpressionCast(IASTCastExpression.op_cast); break;
}
@ -1075,13 +1077,13 @@ public UPCSizeofExpressionParser(String[] mapFrom) { // constructor
}
//
// Rule 266: type_name ::= specifier_qualifier_list
// Rule 266: type_id ::= specifier_qualifier_list
//
case 266: { action. consumeTypeId(false); break;
}
//
// Rule 267: type_name ::= specifier_qualifier_list abstract_declarator
// Rule 267: type_id ::= specifier_qualifier_list abstract_declarator
//
case 267: { action. consumeTypeId(true); break;
}
@ -1261,7 +1263,7 @@ public UPCSizeofExpressionParser(String[] mapFrom) { // constructor
}
//
// Rule 315: no_sizeof_type_name_start ::= ERROR_TOKEN
// Rule 315: no_sizeof_type_id_start ::= ERROR_TOKEN
//
case 315: { action. consumeExpressionProblem(); break;
}

View file

@ -1061,7 +1061,7 @@ public class UPCSizeofExpressionParserprs implements lpg.lpgjavaruntime.ParseTab
"upc_forall",
"ERROR_TOKEN",
"EOF_TOKEN",
"no_sizeof_type_name_start",
"no_sizeof_type_id_start",
"]",
")",
"}",
@ -1069,7 +1069,7 @@ public class UPCSizeofExpressionParserprs implements lpg.lpgjavaruntime.ParseTab
"expression",
"postfix_expression",
"member_name",
"type_name",
"type_id",
"initializer_list",
"unary_expression",
"cast_expression",