Skip to main content
summaryrefslogtreecommitdiffstats
path: root/upc
diff options
context:
space:
mode:
authorMike Kucera2009-01-30 08:31:43 -0500
committerMike Kucera2009-01-30 08:31:43 -0500
commit44907e70565784664cf3c4ab07a658682ff63d96 (patch)
treee78d0cefcf9927c03148b0fe14b383f6d7238e06 /upc
parent8a018e449f2c6a6d9c7186d45b735020d6610e14 (diff)
downloadorg.eclipse.cdt-44907e70565784664cf3c4ab07a658682ff63d96.tar.gz
org.eclipse.cdt-44907e70565784664cf3c4ab07a658682ff63d96.tar.xz
org.eclipse.cdt-44907e70565784664cf3c4ab07a658682ff63d96.zip
added support to LR parsers for GNU extensions typeof and alignof, added ISecondaryParserFactory
Diffstat (limited to 'upc')
-rw-r--r--upc/org.eclipse.cdt.core.parser.upc/grammar/upc/UPCGrammarExtensions.g10
-rw-r--r--upc/org.eclipse.cdt.core.parser.upc/grammar/upc/UPCSizeofExpressionParser.g8
-rw-r--r--upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/core/dom/parser/upc/UPCParserAction.java26
-rw-r--r--upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/core/dom/parser/upc/UPCSecondaryParserFactory.java41
-rw-r--r--upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/UPCExpressionParser.java24
-rw-r--r--upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/UPCExpressionParserprs.java2
-rw-r--r--upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/UPCNoCastExpressionParser.java22
-rw-r--r--upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/UPCNoCastExpressionParserprs.java2
-rw-r--r--upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/UPCParser.java24
-rw-r--r--upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/UPCParserprs.java2
-rw-r--r--upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/UPCSizeofExpressionParser.java18
-rw-r--r--upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/UPCSizeofExpressionParserprs.java4
12 files changed, 109 insertions, 74 deletions
diff --git a/upc/org.eclipse.cdt.core.parser.upc/grammar/upc/UPCGrammarExtensions.g b/upc/org.eclipse.cdt.core.parser.upc/grammar/upc/UPCGrammarExtensions.g
index 48655f6df8..a98b0d4814 100644
--- a/upc/org.eclipse.cdt.core.parser.upc/grammar/upc/UPCGrammarExtensions.g
+++ b/upc/org.eclipse.cdt.core.parser.upc/grammar/upc/UPCGrammarExtensions.g
@@ -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 ./
diff --git a/upc/org.eclipse.cdt.core.parser.upc/grammar/upc/UPCSizeofExpressionParser.g b/upc/org.eclipse.cdt.core.parser.upc/grammar/upc/UPCSizeofExpressionParser.g
index 369ab99e88..19e61f3af6 100644
--- a/upc/org.eclipse.cdt.core.parser.upc/grammar/upc/UPCSizeofExpressionParser.g
+++ b/upc/org.eclipse.cdt.core.parser.upc/grammar/upc/UPCSizeofExpressionParser.g
@@ -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 \ No newline at end of file
diff --git a/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/core/dom/parser/upc/UPCParserAction.java b/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/core/dom/parser/upc/UPCParserAction.java
index 142b48121a..8184f4ab8d 100644
--- a/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/core/dom/parser/upc/UPCParserAction.java
+++ b/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/core/dom/parser/upc/UPCParserAction.java
@@ -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());
- }
+
/**************************************************************************************
diff --git a/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/core/dom/parser/upc/UPCSecondaryParserFactory.java b/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/core/dom/parser/upc/UPCSecondaryParserFactory.java
new file mode 100644
index 0000000000..50b8599496
--- /dev/null
+++ b/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/core/dom/parser/upc/UPCSecondaryParserFactory.java
@@ -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);
+ }
+
+}
diff --git a/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/UPCExpressionParser.java b/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/UPCExpressionParser.java
index 24d399d1dd..7ba7e9e62b 100644
--- a/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/UPCExpressionParser.java
+++ b/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/UPCExpressionParser.java
@@ -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;
}
diff --git a/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/UPCExpressionParserprs.java b/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/UPCExpressionParserprs.java
index 6fe0a48569..9a7777c5a6 100644
--- a/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/UPCExpressionParserprs.java
+++ b/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/UPCExpressionParserprs.java
@@ -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",
diff --git a/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/UPCNoCastExpressionParser.java b/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/UPCNoCastExpressionParser.java
index 934912c416..cab42b8be4 100644
--- a/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/UPCNoCastExpressionParser.java
+++ b/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/UPCNoCastExpressionParser.java
@@ -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;
}
diff --git a/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/UPCNoCastExpressionParserprs.java b/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/UPCNoCastExpressionParserprs.java
index 565b28c6b2..b0496211d5 100644
--- a/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/UPCNoCastExpressionParserprs.java
+++ b/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/UPCNoCastExpressionParserprs.java
@@ -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",
diff --git a/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/UPCParser.java b/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/UPCParser.java
index c04af564cc..b62777a645 100644
--- a/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/UPCParser.java
+++ b/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/UPCParser.java
@@ -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;
}
diff --git a/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/UPCParserprs.java b/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/UPCParserprs.java
index b8d27ef959..e2437d9cf3 100644
--- a/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/UPCParserprs.java
+++ b/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/UPCParserprs.java
@@ -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",
diff --git a/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/UPCSizeofExpressionParser.java b/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/UPCSizeofExpressionParser.java
index a5d9262e76..cb5e3330fd 100644
--- a/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/UPCSizeofExpressionParser.java
+++ b/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/UPCSizeofExpressionParser.java
@@ -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;
}
diff --git a/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/UPCSizeofExpressionParserprs.java b/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/UPCSizeofExpressionParserprs.java
index ffd24960d9..a348d7a447 100644
--- a/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/UPCSizeofExpressionParserprs.java
+++ b/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/UPCSizeofExpressionParserprs.java
@@ -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",

Back to the top