mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-10 12:03:16 +02:00
added disambiguation parsers for UPC
This commit is contained in:
parent
fe47120500
commit
4023986654
37 changed files with 9432 additions and 297 deletions
|
@ -16,7 +16,8 @@ import org.eclipse.cdt.core.lrparser.tests.c99.C99CommentTests;
|
||||||
|
|
||||||
public class UPCC99CommentTests extends C99CommentTests {
|
public class UPCC99CommentTests extends C99CommentTests {
|
||||||
|
|
||||||
protected BaseExtensibleLanguage getLanguage() {
|
@Override
|
||||||
|
protected BaseExtensibleLanguage getC99Language() {
|
||||||
return UPCLanguage.getDefault();
|
return UPCLanguage.getDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,8 @@ import org.eclipse.cdt.core.lrparser.tests.c99.C99CompleteParser2Tests;
|
||||||
|
|
||||||
public class UPCC99CompleteParser2Tests extends C99CompleteParser2Tests {
|
public class UPCC99CompleteParser2Tests extends C99CompleteParser2Tests {
|
||||||
|
|
||||||
protected BaseExtensibleLanguage getLanguage() {
|
@Override
|
||||||
|
protected BaseExtensibleLanguage getC99Language() {
|
||||||
return UPCLanguage.getDefault();
|
return UPCLanguage.getDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,8 @@ public class UPCC99CompletionBasicTest extends C99CompletionBasicTest {
|
||||||
|
|
||||||
public UPCC99CompletionBasicTest() { }
|
public UPCC99CompletionBasicTest() { }
|
||||||
|
|
||||||
protected BaseExtensibleLanguage getLanguage() {
|
@Override
|
||||||
|
protected BaseExtensibleLanguage getC99Language() {
|
||||||
return C99Language.getDefault();
|
return C99Language.getDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ public class UPCC99CompletionParseTest extends C99CompletionParseTest {
|
||||||
public UPCC99CompletionParseTest() { }
|
public UPCC99CompletionParseTest() { }
|
||||||
public UPCC99CompletionParseTest(String name) { super(name); }
|
public UPCC99CompletionParseTest(String name) { super(name); }
|
||||||
|
|
||||||
|
@Override
|
||||||
protected BaseExtensibleLanguage getLanguage() {
|
protected BaseExtensibleLanguage getLanguage() {
|
||||||
return UPCLanguage.getDefault();
|
return UPCLanguage.getDefault();
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,15 +19,12 @@ public class UPCC99DOMLocationInclusionTests extends C99DOMLocationInclusionTest
|
||||||
public UPCC99DOMLocationInclusionTests() {
|
public UPCC99DOMLocationInclusionTests() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public UPCC99DOMLocationInclusionTests(String name, Class className) {
|
|
||||||
super(name, className);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UPCC99DOMLocationInclusionTests(String name) {
|
public UPCC99DOMLocationInclusionTests(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected BaseExtensibleLanguage getLanguage() {
|
@Override
|
||||||
|
protected BaseExtensibleLanguage getC99Language() {
|
||||||
return UPCLanguage.getDefault();
|
return UPCLanguage.getDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,8 @@ public class UPCC99DOMLocationMacroTests extends C99DOMLocationMacroTests {
|
||||||
public UPCC99DOMLocationMacroTests() {
|
public UPCC99DOMLocationMacroTests() {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected BaseExtensibleLanguage getLanguage() {
|
@Override
|
||||||
|
protected BaseExtensibleLanguage getC99Language() {
|
||||||
return UPCLanguage.getDefault();
|
return UPCLanguage.getDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,8 @@ public class UPCC99DOMLocationTests extends C99DOMLocationTests {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected BaseExtensibleLanguage getLanguage() {
|
@Override
|
||||||
|
protected BaseExtensibleLanguage getC99Language() {
|
||||||
return UPCLanguage.getDefault();
|
return UPCLanguage.getDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,8 @@ import org.eclipse.cdt.core.lrparser.tests.c99.C99DOMPreprocessorInformationTest
|
||||||
|
|
||||||
public class UPCC99DOMPreprocessorInformationTest extends C99DOMPreprocessorInformationTest {
|
public class UPCC99DOMPreprocessorInformationTest extends C99DOMPreprocessorInformationTest {
|
||||||
|
|
||||||
protected BaseExtensibleLanguage getLanguage() {
|
@Override
|
||||||
|
protected BaseExtensibleLanguage getC99Language() {
|
||||||
return UPCLanguage.getDefault();
|
return UPCLanguage.getDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ public class UPCC99DigraphTrigraphTests extends C99DigraphTrigraphTests {
|
||||||
public UPCC99DigraphTrigraphTests() { }
|
public UPCC99DigraphTrigraphTests() { }
|
||||||
public UPCC99DigraphTrigraphTests(String name) { super(name); }
|
public UPCC99DigraphTrigraphTests(String name) { super(name); }
|
||||||
|
|
||||||
|
@Override
|
||||||
protected BaseExtensibleLanguage getLanguage() {
|
protected BaseExtensibleLanguage getLanguage() {
|
||||||
return UPCLanguage.getDefault();
|
return UPCLanguage.getDefault();
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,8 @@ public class UPCC99GCCTests extends C99GCCTests {
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected BaseExtensibleLanguage getLanguage() {
|
@Override
|
||||||
|
protected BaseExtensibleLanguage getC99Language() {
|
||||||
return UPCLanguage.getDefault();
|
return UPCLanguage.getDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,8 @@ public class UPCC99KnRTests extends C99KnRTests {
|
||||||
public UPCC99KnRTests() {
|
public UPCC99KnRTests() {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected BaseExtensibleLanguage getLanguage() {
|
@Override
|
||||||
|
protected BaseExtensibleLanguage getC99Language() {
|
||||||
return UPCLanguage.getDefault();
|
return UPCLanguage.getDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,8 @@ public class UPCC99SelectionParseTest extends C99SelectionParseTest {
|
||||||
public UPCC99SelectionParseTest(String name) { super(name); }
|
public UPCC99SelectionParseTest(String name) { super(name); }
|
||||||
|
|
||||||
|
|
||||||
protected BaseExtensibleLanguage getLanguage() {
|
@Override
|
||||||
|
protected BaseExtensibleLanguage getC99Language() {
|
||||||
return UPCLanguage.getDefault();
|
return UPCLanguage.getDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,8 @@ public class UPCC99SpecTests extends C99SpecTests {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected BaseExtensibleLanguage getLanguage() {
|
@Override
|
||||||
|
protected BaseExtensibleLanguage getCLanguage() {
|
||||||
return UPCLanguage.getDefault();
|
return UPCLanguage.getDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,8 @@ import org.eclipse.cdt.core.lrparser.tests.c99.C99TaskParserTest;
|
||||||
|
|
||||||
public class UPCC99TaskParserTest extends C99TaskParserTest {
|
public class UPCC99TaskParserTest extends C99TaskParserTest {
|
||||||
|
|
||||||
protected BaseExtensibleLanguage getLanguage() {
|
@Override
|
||||||
|
protected BaseExtensibleLanguage getC99Language() {
|
||||||
return UPCLanguage.getDefault();
|
return UPCLanguage.getDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,8 @@ public class UPCC99Tests extends C99Tests {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected BaseExtensibleLanguage getLanguage() {
|
@Override
|
||||||
|
protected BaseExtensibleLanguage getC99Language() {
|
||||||
return UPCLanguage.getDefault();
|
return UPCLanguage.getDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,8 @@ import org.eclipse.cdt.core.lrparser.tests.c99.C99UtilOldTests;
|
||||||
|
|
||||||
public class UPCC99UtilOldTests extends C99UtilOldTests {
|
public class UPCC99UtilOldTests extends C99UtilOldTests {
|
||||||
|
|
||||||
protected BaseExtensibleLanguage getLanguage() {
|
@Override
|
||||||
|
protected BaseExtensibleLanguage getC99Language() {
|
||||||
return UPCLanguage.getDefault();
|
return UPCLanguage.getDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,8 @@ import org.eclipse.cdt.core.lrparser.tests.c99.C99UtilTests;
|
||||||
|
|
||||||
public class UPCC99UtilTests extends C99UtilTests {
|
public class UPCC99UtilTests extends C99UtilTests {
|
||||||
|
|
||||||
protected BaseExtensibleLanguage getLanguage() {
|
@Override
|
||||||
|
protected BaseExtensibleLanguage getC99Language() {
|
||||||
return UPCLanguage.getDefault();
|
return UPCLanguage.getDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ import org.eclipse.cdt.core.dom.upc.ast.IUPCASTSimpleDeclSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTSynchronizationStatement;
|
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTSynchronizationStatement;
|
||||||
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTUnaryExpression;
|
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTUnaryExpression;
|
||||||
import org.eclipse.cdt.core.lrparser.tests.ParseHelper;
|
import org.eclipse.cdt.core.lrparser.tests.ParseHelper;
|
||||||
import org.eclipse.cdt.internal.core.parser.ParserException;
|
|
||||||
|
|
||||||
public class UPCLanguageExtensionTests extends TestCase {
|
public class UPCLanguageExtensionTests extends TestCase {
|
||||||
|
|
||||||
|
@ -62,12 +62,12 @@ public class UPCLanguageExtensionTests extends TestCase {
|
||||||
// test the AST is correct
|
// test the AST is correct
|
||||||
// test that binding resolution works
|
// test that binding resolution works
|
||||||
|
|
||||||
private IASTTranslationUnit parseAndCheckBindings(String code) throws ParserException {
|
private IASTTranslationUnit parseAndCheckBindings(String code) {
|
||||||
return ParseHelper.parse(code, getLanguage(), true, true, 0 );
|
return ParseHelper.parse(code, getLanguage(), true, true, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private IASTTranslationUnit parse(String code) throws ParserException {
|
private IASTTranslationUnit parse(String code) {
|
||||||
return ParseHelper.parse(code, getLanguage(), true, false, 0 );
|
return ParseHelper.parse(code, getLanguage(), true, false, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,6 +135,7 @@ public class UPCLanguageExtensionTests extends TestCase {
|
||||||
assertEquals(IUPCASTDeclSpecifier.rt_unspecified, declspec_c.getReferenceType());
|
assertEquals(IUPCASTDeclSpecifier.rt_unspecified, declspec_c.getReferenceType());
|
||||||
assertEquals(IUPCASTDeclSpecifier.sh_shared_constant_expression, declspec_c.getSharedQualifier());
|
assertEquals(IUPCASTDeclSpecifier.sh_shared_constant_expression, declspec_c.getSharedQualifier());
|
||||||
assertEquals(IASTSimpleDeclSpecifier.t_int, declspec_c.getType());
|
assertEquals(IASTSimpleDeclSpecifier.t_int, declspec_c.getType());
|
||||||
|
@SuppressWarnings("unused")
|
||||||
IASTLiteralExpression literalExpr = (IASTLiteralExpression) declspec_c.getBlockSizeExpression();
|
IASTLiteralExpression literalExpr = (IASTLiteralExpression) declspec_c.getBlockSizeExpression();
|
||||||
declarators = decl_c.getDeclarators();
|
declarators = decl_c.getDeclarators();
|
||||||
assertNotNull(declarators);
|
assertNotNull(declarators);
|
||||||
|
@ -167,11 +168,11 @@ public class UPCLanguageExtensionTests extends TestCase {
|
||||||
|
|
||||||
IASTSimpleDeclaration decl_x = (IASTSimpleDeclaration) declarations[4];
|
IASTSimpleDeclaration decl_x = (IASTSimpleDeclaration) declarations[4];
|
||||||
IUPCASTSimpleDeclSpecifier declspec_x = (IUPCASTSimpleDeclSpecifier) decl_x.getDeclSpecifier();
|
IUPCASTSimpleDeclSpecifier declspec_x = (IUPCASTSimpleDeclSpecifier) decl_x.getDeclSpecifier();
|
||||||
assertEquals(IUPCASTSimpleDeclSpecifier.rt_relaxed, declspec_x.getReferenceType());
|
assertEquals(IUPCASTDeclSpecifier.rt_relaxed, declspec_x.getReferenceType());
|
||||||
|
|
||||||
IASTSimpleDeclaration decl_y = (IASTSimpleDeclaration) declarations[5];
|
IASTSimpleDeclaration decl_y = (IASTSimpleDeclaration) declarations[5];
|
||||||
IUPCASTSimpleDeclSpecifier declspec_y = (IUPCASTSimpleDeclSpecifier) decl_y.getDeclSpecifier();
|
IUPCASTSimpleDeclSpecifier declspec_y = (IUPCASTSimpleDeclSpecifier) decl_y.getDeclSpecifier();
|
||||||
assertEquals(IUPCASTSimpleDeclSpecifier.rt_strict, declspec_y.getReferenceType());
|
assertEquals(IUPCASTDeclSpecifier.rt_strict, declspec_y.getReferenceType());
|
||||||
|
|
||||||
|
|
||||||
IVariable binding_a = (IVariable) name_a.resolveBinding();
|
IVariable binding_a = (IVariable) name_a.resolveBinding();
|
||||||
|
@ -489,6 +490,7 @@ public class UPCLanguageExtensionTests extends TestCase {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
IASTTypeIdExpression idexpr = (IASTTypeIdExpression)((IASTExpressionStatement)body[0]).getExpression();
|
IASTTypeIdExpression idexpr = (IASTTypeIdExpression)((IASTExpressionStatement)body[0]).getExpression();
|
||||||
|
|
||||||
IASTUnaryExpression cexpr = (IASTUnaryExpression)((IASTExpressionStatement)body[1]).getExpression();
|
IASTUnaryExpression cexpr = (IASTUnaryExpression)((IASTExpressionStatement)body[1]).getExpression();
|
||||||
|
|
|
@ -31,23 +31,17 @@
|
||||||
<param name="grammar_name" value="UPCParser"/>
|
<param name="grammar_name" value="UPCParser"/>
|
||||||
</antcall>
|
</antcall>
|
||||||
<!-- Generate parser for disambiguating declarations vs expression statements -->
|
<!-- Generate parser for disambiguating declarations vs expression statements -->
|
||||||
<!--
|
|
||||||
<antcall target="generate_upc">
|
<antcall target="generate_upc">
|
||||||
<param name="grammar_name" value="C99ExpressionStatementParser"/>
|
<param name="grammar_name" value="UPCExpressionStatementParser"/>
|
||||||
</antcall>
|
</antcall>
|
||||||
-->
|
|
||||||
<!-- Generate parser for disambiguating cast expressions vs binary expressions-->
|
<!-- Generate parser for disambiguating cast expressions vs binary expressions-->
|
||||||
<!--
|
|
||||||
<antcall target="generate_upc">
|
<antcall target="generate_upc">
|
||||||
<param name="grammar_name" value="C99NoCastExpressionParser"/>
|
<param name="grammar_name" value="UPCNoCastExpressionParser"/>
|
||||||
</antcall>
|
</antcall>
|
||||||
-->
|
|
||||||
<!-- Generate parser for disambiguating sizeof expressions -->
|
<!-- Generate parser for disambiguating sizeof expressions -->
|
||||||
<!--
|
|
||||||
<antcall target="generate_upc">
|
<antcall target="generate_upc">
|
||||||
<param name="grammar_name" value="C99SizeofExpressionParser"/>
|
<param name="grammar_name" value="UPCSizeofExpressionParser"/>
|
||||||
</antcall>
|
</antcall>
|
||||||
-->
|
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
-----------------------------------------------------------------------------------
|
||||||
|
-- Copyright (c) 2006, 2008 IBM Corporation and others.
|
||||||
|
-- All rights reserved. This program and the accompanying materials
|
||||||
|
-- are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
-- which accompanies this distribution, and is available at
|
||||||
|
-- http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
--
|
||||||
|
-- Contributors:
|
||||||
|
-- IBM Corporation - initial API and implementation
|
||||||
|
-----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
%options la=2
|
||||||
|
%options package=org.eclipse.cdt.internal.core.dom.parser.upc
|
||||||
|
%options template=btParserTemplateD.g
|
||||||
|
|
||||||
|
|
||||||
|
$Import
|
||||||
|
C99ExpressionStatementParser.g
|
||||||
|
$End
|
||||||
|
|
||||||
|
$Import
|
||||||
|
UPCGrammarExtensions.g
|
||||||
|
$End
|
|
@ -0,0 +1,218 @@
|
||||||
|
-----------------------------------------------------------------------------------
|
||||||
|
-- Copyright (c) 2006, 2007 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
|
||||||
|
-----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
$Define
|
||||||
|
$build_action_class /. UPCParserAction ./
|
||||||
|
$node_factory_create_expression /. UPCASTNodeFactory.DEFAULT_INSTANCE ./
|
||||||
|
$End
|
||||||
|
|
||||||
|
|
||||||
|
$Globals
|
||||||
|
/.
|
||||||
|
import org.eclipse.cdt.core.dom.parser.upc.UPCASTNodeFactory;
|
||||||
|
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;
|
||||||
|
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTUnaryExpression;
|
||||||
|
./
|
||||||
|
$End
|
||||||
|
|
||||||
|
|
||||||
|
$Terminals -- Additional keywords defined by UPC
|
||||||
|
MYTHREAD
|
||||||
|
THREADS
|
||||||
|
UPC_MAX_BLOCKSIZE
|
||||||
|
relaxed
|
||||||
|
shared
|
||||||
|
strict
|
||||||
|
upc_barrier
|
||||||
|
upc_localsizeof
|
||||||
|
upc_blocksizeof
|
||||||
|
upc_elemsizeof
|
||||||
|
upc_notify
|
||||||
|
upc_fence
|
||||||
|
upc_wait
|
||||||
|
upc_forall
|
||||||
|
$End
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$Rules -- UPC grammar extensions to C99
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------------
|
||||||
|
-- Expressions
|
||||||
|
-----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
literal
|
||||||
|
::= 'MYTHREAD'
|
||||||
|
/. $Build consumeKeywordExpression(IUPCASTKeywordExpression.kw_mythread); $EndBuild ./
|
||||||
|
| 'THREADS'
|
||||||
|
/. $Build consumeKeywordExpression(IUPCASTKeywordExpression.kw_threads); $EndBuild ./
|
||||||
|
| 'UPC_MAX_BLOCKSIZE'
|
||||||
|
/. $Build consumeKeywordExpression(IUPCASTKeywordExpression.kw_upc_max_block_size); $EndBuild ./
|
||||||
|
|
||||||
|
|
||||||
|
-- causes ambiguities because of no type information, solution is SGLR
|
||||||
|
unary_expression
|
||||||
|
::= 'upc_localsizeof' unary_expression
|
||||||
|
/. $Build consumeExpressionUnaryOperator(IUPCASTUnaryExpression.op_upc_localsizeof); $EndBuild ./
|
||||||
|
| 'upc_localsizeof' '(' type_name ')'
|
||||||
|
/. $Build consumeExpressionTypeId(IUPCASTUnaryExpression.op_upc_localsizeof); $EndBuild ./
|
||||||
|
| 'upc_blocksizeof' unary_expression
|
||||||
|
/. $Build consumeExpressionUnaryOperator(IUPCASTUnaryExpression.op_upc_blocksizeof); $EndBuild ./
|
||||||
|
| 'upc_blocksizeof' '(' type_name ')'
|
||||||
|
/. $Build consumeExpressionTypeId(IUPCASTUnaryExpression.op_upc_blocksizeof); $EndBuild ./
|
||||||
|
| 'upc_elemsizeof' unary_expression
|
||||||
|
/. $Build consumeExpressionUnaryOperator(IUPCASTUnaryExpression.op_upc_elemsizeof); $EndBuild ./
|
||||||
|
| 'upc_elemsizeof' '(' type_name ')'
|
||||||
|
/. $Build consumeExpressionTypeId(IUPCASTUnaryExpression.op_upc_elemsizeof); $EndBuild ./
|
||||||
|
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------------
|
||||||
|
-- Declarations
|
||||||
|
-----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
type_qualifier
|
||||||
|
::= shared_type_qualifier
|
||||||
|
| reference_type_qualifier
|
||||||
|
|
||||||
|
-- causes ambiguities in parameter declarations, inherant in grammar
|
||||||
|
-- for example: int foo(int shared []);
|
||||||
|
-- does the [] bind to shared or is it shared with infinite block size array?
|
||||||
|
-- TODO: probably just resolved in the same way as dangling else
|
||||||
|
|
||||||
|
shared_type_qualifier
|
||||||
|
::= 'shared' layout_qualifier -- don't consume anything, the presense of the
|
||||||
|
-- layout_qualifier will determine that 'shared' token was encountered
|
||||||
|
| 'shared' /. $Build consumeToken(); $EndBuild ./
|
||||||
|
|
||||||
|
reference_type_qualifier
|
||||||
|
::= 'relaxed' /. $Build consumeToken(); $EndBuild ./
|
||||||
|
| 'strict' /. $Build consumeToken(); $EndBuild ./
|
||||||
|
|
||||||
|
layout_qualifier
|
||||||
|
::= '[' constant_expression ']'
|
||||||
|
/. $Build consumeLayoutQualifier(true, false); $EndBuild ./
|
||||||
|
| '[' '*' ']'
|
||||||
|
/. $Build consumeLayoutQualifier(false, true); $EndBuild ./
|
||||||
|
| '[' ']'
|
||||||
|
/. $Build consumeLayoutQualifier(false, false); $EndBuild ./
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------------
|
||||||
|
-- Statements
|
||||||
|
-----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
statement
|
||||||
|
::= synchronization_statement
|
||||||
|
|
||||||
|
synchronization_statement
|
||||||
|
::= 'upc_notify' expression ';'
|
||||||
|
/. $Build consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_notify, true); $EndBuild ./
|
||||||
|
| 'upc_notify' ';'
|
||||||
|
/. $Build consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_notify, false); $EndBuild ./
|
||||||
|
| 'upc_wait' expression ';'
|
||||||
|
/. $Build consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_wait, true); $EndBuild ./
|
||||||
|
| 'upc_wait' ';'
|
||||||
|
/. $Build consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_wait, false); $EndBuild ./
|
||||||
|
| 'upc_barrier' expression ';'
|
||||||
|
/. $Build consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_barrier, true); $EndBuild ./
|
||||||
|
| 'upc_barrier' ';'
|
||||||
|
/. $Build consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_barrier, false); $EndBuild ./
|
||||||
|
| 'upc_fence' ';'
|
||||||
|
/. $Build consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_fence, false); $EndBuild ./
|
||||||
|
|
||||||
|
|
||||||
|
iteration_statement
|
||||||
|
::= 'upc_forall' '(' expression ';' expression ';' expression ';' affinity ')' statement
|
||||||
|
/. $Build consumeStatementUPCForallLoop(true, true, true, true); $EndBuild ./
|
||||||
|
|
||||||
|
| 'upc_forall' '(' expression ';' expression ';' expression ';' ')' statement
|
||||||
|
/. $Build consumeStatementUPCForallLoop(true, true, true, false); $EndBuild ./
|
||||||
|
|
||||||
|
| 'upc_forall' '(' expression ';' expression ';' ';' affinity ')' statement
|
||||||
|
/. $Build consumeStatementUPCForallLoop(true, true, false, true); $EndBuild ./
|
||||||
|
|
||||||
|
| 'upc_forall' '(' expression ';' expression ';' ';' ')' statement
|
||||||
|
/. $Build consumeStatementUPCForallLoop(true, true, false, false); $EndBuild ./
|
||||||
|
|
||||||
|
| 'upc_forall' '(' expression ';' ';' expression ';' affinity ')' statement
|
||||||
|
/. $Build consumeStatementUPCForallLoop(true, false, true, true); $EndBuild ./
|
||||||
|
|
||||||
|
| 'upc_forall' '(' expression ';' ';' expression ';' ')' statement
|
||||||
|
/. $Build consumeStatementUPCForallLoop(true, false, true, false); $EndBuild ./
|
||||||
|
|
||||||
|
| 'upc_forall' '(' expression ';' ';' ';' affinity ')' statement
|
||||||
|
/. $Build consumeStatementUPCForallLoop(true, false, false, true); $EndBuild ./
|
||||||
|
|
||||||
|
| 'upc_forall' '(' expression ';' ';' ';' ')' statement
|
||||||
|
/. $Build consumeStatementUPCForallLoop(true, false, false, false); $EndBuild ./
|
||||||
|
|
||||||
|
| 'upc_forall' '(' ';' expression ';' expression ';' affinity ')' statement
|
||||||
|
/. $Build consumeStatementUPCForallLoop(false, true, true, true); $EndBuild ./
|
||||||
|
|
||||||
|
| 'upc_forall' '(' ';' expression ';' expression ';' ')' statement
|
||||||
|
/. $Build consumeStatementUPCForallLoop(false, true, true, false); $EndBuild ./
|
||||||
|
|
||||||
|
| 'upc_forall' '(' ';' expression ';' ';' affinity ')' statement
|
||||||
|
/. $Build consumeStatementUPCForallLoop(false, true, false, true); $EndBuild ./
|
||||||
|
|
||||||
|
| 'upc_forall' '(' ';' expression ';' ';' ')' statement
|
||||||
|
/. $Build consumeStatementUPCForallLoop(false, true, false, false); $EndBuild ./
|
||||||
|
|
||||||
|
| 'upc_forall' '(' ';' ';' expression ';' affinity ')' statement
|
||||||
|
/. $Build consumeStatementUPCForallLoop(false, false, true, true); $EndBuild ./
|
||||||
|
|
||||||
|
| 'upc_forall' '(' ';' ';' expression ';' ')' statement
|
||||||
|
/. $Build consumeStatementUPCForallLoop(false, false, true, false); $EndBuild ./
|
||||||
|
|
||||||
|
| 'upc_forall' '(' ';' ';' ';' affinity ')' statement
|
||||||
|
/. $Build consumeStatementUPCForallLoop(false, false, false, true); $EndBuild ./
|
||||||
|
|
||||||
|
| 'upc_forall' '(' ';' ';' ';' ')' statement
|
||||||
|
/. $Build consumeStatementUPCForallLoop(false, false, false, false); $EndBuild ./
|
||||||
|
|
||||||
|
| 'upc_forall' '(' declaration expression ';' expression ';' affinity ')' statement
|
||||||
|
/. $Build consumeStatementUPCForallLoop(true, true, true, true); $EndBuild ./
|
||||||
|
|
||||||
|
| 'upc_forall' '(' declaration expression ';' expression ';' ')' statement
|
||||||
|
/. $Build consumeStatementUPCForallLoop(true, true, true, false); $EndBuild ./
|
||||||
|
|
||||||
|
| 'upc_forall' '(' declaration expression ';' ';' affinity ')' statement
|
||||||
|
/. $Build consumeStatementUPCForallLoop(true, true, false, true); $EndBuild ./
|
||||||
|
|
||||||
|
| 'upc_forall' '(' declaration expression ';' ';' ')' statement
|
||||||
|
/. $Build consumeStatementUPCForallLoop(true, true, false, false); $EndBuild ./
|
||||||
|
|
||||||
|
| 'upc_forall' '(' declaration ';' expression ';' affinity ')' statement
|
||||||
|
/. $Build consumeStatementUPCForallLoop(true, false, true, true); $EndBuild ./
|
||||||
|
|
||||||
|
| 'upc_forall' '(' declaration ';' expression ';' ')' statement
|
||||||
|
/. $Build consumeStatementUPCForallLoop(true, false, true, false); $EndBuild ./
|
||||||
|
|
||||||
|
| 'upc_forall' '(' declaration ';' ';' affinity ')' statement
|
||||||
|
/. $Build consumeStatementUPCForallLoop(true, false, false, true); $EndBuild ./
|
||||||
|
|
||||||
|
| 'upc_forall' '(' declaration ';' ';' ')' statement
|
||||||
|
/. $Build consumeStatementUPCForallLoop(true, false, false, false); $EndBuild ./
|
||||||
|
|
||||||
|
affinity
|
||||||
|
::= expression
|
||||||
|
| 'continue'
|
||||||
|
/. $Build consumeToken(); $EndBuild ./
|
||||||
|
|
||||||
|
$End
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
-----------------------------------------------------------------------------------
|
||||||
|
-- Copyright (c) 2006, 2008 IBM Corporation and others.
|
||||||
|
-- All rights reserved. This program and the accompanying materials
|
||||||
|
-- are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
-- which accompanies this distribution, and is available at
|
||||||
|
-- http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
--
|
||||||
|
-- Contributors:
|
||||||
|
-- IBM Corporation - initial API and implementation
|
||||||
|
-----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
%options la=2
|
||||||
|
%options package=org.eclipse.cdt.internal.core.dom.parser.upc
|
||||||
|
%options template=btParserTemplateD.g
|
||||||
|
|
||||||
|
|
||||||
|
$Import
|
||||||
|
C99NoCastExpressionParser.g
|
||||||
|
$End
|
||||||
|
|
||||||
|
$Import
|
||||||
|
UPCGrammarExtensions.g
|
||||||
|
$End
|
|
@ -1,5 +1,5 @@
|
||||||
-----------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------
|
||||||
-- Copyright (c) 2006, 2007 IBM Corporation and others.
|
-- Copyright (c) 2006, 2008 IBM Corporation and others.
|
||||||
-- All rights reserved. This program and the accompanying materials
|
-- All rights reserved. This program and the accompanying materials
|
||||||
-- are made available under the terms of the Eclipse Public License v1.0
|
-- are made available under the terms of the Eclipse Public License v1.0
|
||||||
-- which accompanies this distribution, and is available at
|
-- which accompanies this distribution, and is available at
|
||||||
|
@ -14,232 +14,11 @@
|
||||||
%options template=btParserTemplateD.g
|
%options template=btParserTemplateD.g
|
||||||
|
|
||||||
|
|
||||||
-- Unified Parallel C (UPC) is an extension of C99.
|
|
||||||
-- Must set LPG_INCLUDE environment variable to the location of C99Parser.g
|
|
||||||
$Import
|
$Import
|
||||||
C99Grammar.g
|
C99Parser.g
|
||||||
$End
|
$End
|
||||||
|
|
||||||
$Start
|
$Import
|
||||||
translation_unit
|
UPCGrammarExtensions.g
|
||||||
$End
|
$End
|
||||||
|
|
||||||
|
|
||||||
$Define
|
|
||||||
$build_action_class /. UPCParserAction ./
|
|
||||||
$node_factory_create_expression /. UPCASTNodeFactory.DEFAULT_INSTANCE ./
|
|
||||||
$End
|
|
||||||
|
|
||||||
$Globals
|
|
||||||
/.
|
|
||||||
import org.eclipse.cdt.core.dom.parser.upc.UPCASTNodeFactory;
|
|
||||||
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;
|
|
||||||
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTUnaryExpression;
|
|
||||||
./
|
|
||||||
$End
|
|
||||||
|
|
||||||
|
|
||||||
$Terminals -- Additional keywords defined by UPC
|
|
||||||
MYTHREAD
|
|
||||||
THREADS
|
|
||||||
UPC_MAX_BLOCKSIZE
|
|
||||||
relaxed
|
|
||||||
shared
|
|
||||||
strict
|
|
||||||
upc_barrier
|
|
||||||
upc_localsizeof
|
|
||||||
upc_blocksizeof
|
|
||||||
upc_elemsizeof
|
|
||||||
upc_notify
|
|
||||||
upc_fence
|
|
||||||
upc_wait
|
|
||||||
upc_forall
|
|
||||||
$End
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$Rules -- UPC grammar extensions to C99
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------------
|
|
||||||
-- Expressions
|
|
||||||
-----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
literal
|
|
||||||
::= 'MYTHREAD'
|
|
||||||
/. $Build consumeKeywordExpression(IUPCASTKeywordExpression.kw_mythread); $EndBuild ./
|
|
||||||
| 'THREADS'
|
|
||||||
/. $Build consumeKeywordExpression(IUPCASTKeywordExpression.kw_threads); $EndBuild ./
|
|
||||||
| 'UPC_MAX_BLOCKSIZE'
|
|
||||||
/. $Build consumeKeywordExpression(IUPCASTKeywordExpression.kw_upc_max_block_size); $EndBuild ./
|
|
||||||
|
|
||||||
|
|
||||||
-- causes ambiguities because of no type information, solution is SGLR
|
|
||||||
unary_expression
|
|
||||||
::= 'upc_localsizeof' unary_expression
|
|
||||||
/. $Build consumeExpressionUpcSizeofOperator(IUPCASTUnaryExpression.op_upc_localsizeof); $EndBuild ./
|
|
||||||
| 'upc_localsizeof' '(' type_name ')'
|
|
||||||
/. $Build consumeExpressionUpcSizeofTypeName(IUPCASTUnaryExpression.op_upc_localsizeof); $EndBuild ./
|
|
||||||
| 'upc_blocksizeof' unary_expression
|
|
||||||
/. $Build consumeExpressionUpcSizeofOperator(IUPCASTUnaryExpression.op_upc_blocksizeof); $EndBuild ./
|
|
||||||
| 'upc_blocksizeof' '(' type_name ')'
|
|
||||||
/. $Build consumeExpressionUpcSizeofTypeName(IUPCASTUnaryExpression.op_upc_blocksizeof); $EndBuild ./
|
|
||||||
| 'upc_elemsizeof' unary_expression
|
|
||||||
/. $Build consumeExpressionUpcSizeofOperator(IUPCASTUnaryExpression.op_upc_elemsizeof); $EndBuild ./
|
|
||||||
| 'upc_elemsizeof' '(' type_name ')'
|
|
||||||
/. $Build consumeExpressionUpcSizeofTypeName(IUPCASTUnaryExpression.op_upc_elemsizeof); $EndBuild ./
|
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------------
|
|
||||||
-- Declarations
|
|
||||||
-----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
type_qualifier
|
|
||||||
::= shared_type_qualifier
|
|
||||||
| reference_type_qualifier
|
|
||||||
|
|
||||||
-- causes ambiguities in parameter declarations, inherant in grammar
|
|
||||||
-- for example: int foo(int shared []);
|
|
||||||
-- does the [] bind to shared or is it shared with infinite block size array?
|
|
||||||
-- TODO: probably just resolved in the same way as dangling else
|
|
||||||
|
|
||||||
shared_type_qualifier
|
|
||||||
::= 'shared' layout_qualifier -- don't consume anything, the presense of the
|
|
||||||
-- layout_qualifier will determine that 'shared' token was encountered
|
|
||||||
| 'shared' /. $Build consumeToken(); $EndBuild ./
|
|
||||||
|
|
||||||
reference_type_qualifier
|
|
||||||
::= 'relaxed' /. $Build consumeToken(); $EndBuild ./
|
|
||||||
| 'strict' /. $Build consumeToken(); $EndBuild ./
|
|
||||||
|
|
||||||
layout_qualifier
|
|
||||||
::= '[' constant_expression ']'
|
|
||||||
/. $Build consumeLayoutQualifier(true, false); $EndBuild ./
|
|
||||||
| '[' '*' ']'
|
|
||||||
/. $Build consumeLayoutQualifier(false, true); $EndBuild ./
|
|
||||||
| '[' ']'
|
|
||||||
/. $Build consumeLayoutQualifier(false, false); $EndBuild ./
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------------
|
|
||||||
-- Statements
|
|
||||||
-----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
statement
|
|
||||||
::= synchronization_statement
|
|
||||||
|
|
||||||
synchronization_statement
|
|
||||||
::= 'upc_notify' expression ';'
|
|
||||||
/. $Build consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_notify, true); $EndBuild ./
|
|
||||||
| 'upc_notify' ';'
|
|
||||||
/. $Build consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_notify, false); $EndBuild ./
|
|
||||||
| 'upc_wait' expression ';'
|
|
||||||
/. $Build consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_wait, true); $EndBuild ./
|
|
||||||
| 'upc_wait' ';'
|
|
||||||
/. $Build consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_wait, false); $EndBuild ./
|
|
||||||
| 'upc_barrier' expression ';'
|
|
||||||
/. $Build consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_barrier, true); $EndBuild ./
|
|
||||||
| 'upc_barrier' ';'
|
|
||||||
/. $Build consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_barrier, false); $EndBuild ./
|
|
||||||
| 'upc_fence' ';'
|
|
||||||
/. $Build consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_fence, false); $EndBuild ./
|
|
||||||
|
|
||||||
|
|
||||||
iteration_statement
|
|
||||||
::= 'upc_forall' '(' expression ';' expression ';' expression ';' affinity ')' statement
|
|
||||||
/. $Build consumeStatementUPCForallLoop(true, true, true, true); $EndBuild ./
|
|
||||||
|
|
||||||
| 'upc_forall' '(' expression ';' expression ';' expression ';' ')' statement
|
|
||||||
/. $Build consumeStatementUPCForallLoop(true, true, true, false); $EndBuild ./
|
|
||||||
|
|
||||||
| 'upc_forall' '(' expression ';' expression ';' ';' affinity ')' statement
|
|
||||||
/. $Build consumeStatementUPCForallLoop(true, true, false, true); $EndBuild ./
|
|
||||||
|
|
||||||
| 'upc_forall' '(' expression ';' expression ';' ';' ')' statement
|
|
||||||
/. $Build consumeStatementUPCForallLoop(true, true, false, false); $EndBuild ./
|
|
||||||
|
|
||||||
| 'upc_forall' '(' expression ';' ';' expression ';' affinity ')' statement
|
|
||||||
/. $Build consumeStatementUPCForallLoop(true, false, true, true); $EndBuild ./
|
|
||||||
|
|
||||||
| 'upc_forall' '(' expression ';' ';' expression ';' ')' statement
|
|
||||||
/. $Build consumeStatementUPCForallLoop(true, false, true, false); $EndBuild ./
|
|
||||||
|
|
||||||
| 'upc_forall' '(' expression ';' ';' ';' affinity ')' statement
|
|
||||||
/. $Build consumeStatementUPCForallLoop(true, false, false, true); $EndBuild ./
|
|
||||||
|
|
||||||
| 'upc_forall' '(' expression ';' ';' ';' ')' statement
|
|
||||||
/. $Build consumeStatementUPCForallLoop(true, false, false, false); $EndBuild ./
|
|
||||||
|
|
||||||
| 'upc_forall' '(' ';' expression ';' expression ';' affinity ')' statement
|
|
||||||
/. $Build consumeStatementUPCForallLoop(false, true, true, true); $EndBuild ./
|
|
||||||
|
|
||||||
| 'upc_forall' '(' ';' expression ';' expression ';' ')' statement
|
|
||||||
/. $Build consumeStatementUPCForallLoop(false, true, true, false); $EndBuild ./
|
|
||||||
|
|
||||||
| 'upc_forall' '(' ';' expression ';' ';' affinity ')' statement
|
|
||||||
/. $Build consumeStatementUPCForallLoop(false, true, false, true); $EndBuild ./
|
|
||||||
|
|
||||||
| 'upc_forall' '(' ';' expression ';' ';' ')' statement
|
|
||||||
/. $Build consumeStatementUPCForallLoop(false, true, false, false); $EndBuild ./
|
|
||||||
|
|
||||||
| 'upc_forall' '(' ';' ';' expression ';' affinity ')' statement
|
|
||||||
/. $Build consumeStatementUPCForallLoop(false, false, true, true); $EndBuild ./
|
|
||||||
|
|
||||||
| 'upc_forall' '(' ';' ';' expression ';' ')' statement
|
|
||||||
/. $Build consumeStatementUPCForallLoop(false, false, true, false); $EndBuild ./
|
|
||||||
|
|
||||||
| 'upc_forall' '(' ';' ';' ';' affinity ')' statement
|
|
||||||
/. $Build consumeStatementUPCForallLoop(false, false, false, true); $EndBuild ./
|
|
||||||
|
|
||||||
| 'upc_forall' '(' ';' ';' ';' ')' statement
|
|
||||||
/. $Build consumeStatementUPCForallLoop(false, false, false, false); $EndBuild ./
|
|
||||||
|
|
||||||
| 'upc_forall' '(' declaration expression ';' expression ';' affinity ')' statement
|
|
||||||
/. $Build consumeStatementUPCForallLoop(true, true, true, true); $EndBuild ./
|
|
||||||
|
|
||||||
| 'upc_forall' '(' declaration expression ';' expression ';' ')' statement
|
|
||||||
/. $Build consumeStatementUPCForallLoop(true, true, true, false); $EndBuild ./
|
|
||||||
|
|
||||||
| 'upc_forall' '(' declaration expression ';' ';' affinity ')' statement
|
|
||||||
/. $Build consumeStatementUPCForallLoop(true, true, false, true); $EndBuild ./
|
|
||||||
|
|
||||||
| 'upc_forall' '(' declaration expression ';' ';' ')' statement
|
|
||||||
/. $Build consumeStatementUPCForallLoop(true, true, false, false); $EndBuild ./
|
|
||||||
|
|
||||||
| 'upc_forall' '(' declaration ';' expression ';' affinity ')' statement
|
|
||||||
/. $Build consumeStatementUPCForallLoop(true, false, true, true); $EndBuild ./
|
|
||||||
|
|
||||||
| 'upc_forall' '(' declaration ';' expression ';' ')' statement
|
|
||||||
/. $Build consumeStatementUPCForallLoop(true, false, true, false); $EndBuild ./
|
|
||||||
|
|
||||||
| 'upc_forall' '(' declaration ';' ';' affinity ')' statement
|
|
||||||
/. $Build consumeStatementUPCForallLoop(true, false, false, true); $EndBuild ./
|
|
||||||
|
|
||||||
| 'upc_forall' '(' declaration ';' ';' ')' statement
|
|
||||||
/. $Build consumeStatementUPCForallLoop(true, false, false, false); $EndBuild ./
|
|
||||||
|
|
||||||
affinity
|
|
||||||
::= expression
|
|
||||||
| 'continue'
|
|
||||||
/. $Build consumeToken(); $EndBuild ./
|
|
||||||
|
|
||||||
$End
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
-----------------------------------------------------------------------------------
|
||||||
|
-- Copyright (c) 2006, 2008 IBM Corporation and others.
|
||||||
|
-- All rights reserved. This program and the accompanying materials
|
||||||
|
-- are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
-- which accompanies this distribution, and is available at
|
||||||
|
-- http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
--
|
||||||
|
-- Contributors:
|
||||||
|
-- IBM Corporation - initial API and implementation
|
||||||
|
-----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
%options la=2
|
||||||
|
%options package=org.eclipse.cdt.internal.core.dom.parser.upc
|
||||||
|
%options template=btParserTemplateD.g
|
||||||
|
|
||||||
|
|
||||||
|
$Import
|
||||||
|
C99SizeofExpressionParser.g
|
||||||
|
$End
|
||||||
|
|
||||||
|
$Import
|
||||||
|
UPCGrammarExtensions.g
|
||||||
|
$DropRules
|
||||||
|
|
||||||
|
unary_expression
|
||||||
|
::= 'upc_localsizeof' '(' type_name ')'
|
||||||
|
| 'upc_blocksizeof' '(' type_name ')'
|
||||||
|
| 'upc_elemsizeof' '(' type_name ')'
|
||||||
|
|
||||||
|
$End
|
|
@ -17,8 +17,6 @@ import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTDeclSpecifier;
|
import org.eclipse.cdt.core.dom.ast.c.ICASTDeclSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.lrparser.IParserActionTokenProvider;
|
import org.eclipse.cdt.core.dom.lrparser.IParserActionTokenProvider;
|
||||||
import org.eclipse.cdt.core.dom.lrparser.action.c99.C99BuildASTParserAction;
|
import org.eclipse.cdt.core.dom.lrparser.action.c99.C99BuildASTParserAction;
|
||||||
|
@ -26,7 +24,6 @@ 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.IUPCASTForallStatement;
|
||||||
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTKeywordExpression;
|
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTKeywordExpression;
|
||||||
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTSynchronizationStatement;
|
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTSynchronizationStatement;
|
||||||
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTUnaryExpression;
|
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.upc.UPCParsersym;
|
import org.eclipse.cdt.internal.core.dom.parser.upc.UPCParsersym;
|
||||||
|
|
||||||
|
|
||||||
|
@ -65,32 +62,6 @@ public class UPCParserAction extends C99BuildASTParserAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* unary_expression ::= 'upc_localsizeof' unary_expression
|
|
||||||
* | 'upc_blocksizeof' unary_expression
|
|
||||||
* | 'upc_elemsizeof' unary_expression
|
|
||||||
*/
|
|
||||||
public void consumeExpressionUpcSizeofOperator(int sizeofOp) {
|
|
||||||
IASTExpression operand = (IASTExpression) astStack.pop();
|
|
||||||
IUPCASTUnaryExpression expr = nodeFactory.newUnaryExpression(sizeofOp, operand);
|
|
||||||
setOffsetAndLength(expr);
|
|
||||||
astStack.push(expr);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* unary_expression ::= 'upc_localsizeof' '(' type_name ')'
|
|
||||||
* | 'upc_blocksizeof' '(' type_name ')'
|
|
||||||
* | 'upc_elemsizeof' '(' type_name ')'
|
|
||||||
*/
|
|
||||||
public void consumeExpressionUpcSizeofTypeName(int sizeofOp) {
|
|
||||||
IASTTypeId typeId = (IASTTypeId) astStack.pop();
|
|
||||||
IASTTypeIdExpression expr = nodeFactory.newTypeIdExpression(sizeofOp, typeId);
|
|
||||||
setOffsetAndLength(expr);
|
|
||||||
astStack.push(expr);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* synchronization_statement ::= 'upc_notify' expression ';'
|
* synchronization_statement ::= 'upc_notify' expression ';'
|
||||||
* | 'upc_notify' ';'
|
* | 'upc_notify' ';'
|
||||||
|
|
|
@ -33,6 +33,7 @@ import org.eclipse.cdt.internal.core.dom.parser.c.CASTTranslationUnit;
|
||||||
*
|
*
|
||||||
* @author Mike Kucera
|
* @author Mike Kucera
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("restriction")
|
||||||
public class UPCLanguage extends BaseExtensibleLanguage {
|
public class UPCLanguage extends BaseExtensibleLanguage {
|
||||||
|
|
||||||
public static final String PLUGIN_ID = "org.eclipse.cdt.core.parser.upc"; //$NON-NLS-1$
|
public static final String PLUGIN_ID = "org.eclipse.cdt.core.parser.upc"; //$NON-NLS-1$
|
||||||
|
@ -60,6 +61,9 @@ public class UPCLanguage extends BaseExtensibleLanguage {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param tu Not used, default model builder used.
|
||||||
|
*/
|
||||||
public IContributedModelBuilder createModelBuilder(ITranslationUnit tu) {
|
public IContributedModelBuilder createModelBuilder(ITranslationUnit tu) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -96,7 +100,6 @@ public class UPCLanguage extends BaseExtensibleLanguage {
|
||||||
/**
|
/**
|
||||||
* Gets the translation unit object and sets the index and the location resolver.
|
* Gets the translation unit object and sets the index and the location resolver.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("restriction")
|
|
||||||
@Override
|
@Override
|
||||||
protected IASTTranslationUnit createASTTranslationUnit(IIndex index, IScanner preprocessor) {
|
protected IASTTranslationUnit createASTTranslationUnit(IIndex index, IScanner preprocessor) {
|
||||||
IASTTranslationUnit tu = C99ASTNodeFactory.DEFAULT_INSTANCE.newTranslationUnit();
|
IASTTranslationUnit tu = C99ASTNodeFactory.DEFAULT_INSTANCE.newTranslationUnit();
|
||||||
|
|
|
@ -17,7 +17,7 @@ import org.eclipse.cdt.core.dom.ast.c.ICASTDeclSpecifier;
|
||||||
public interface IUPCASTDeclSpecifier extends ICASTDeclSpecifier {
|
public interface IUPCASTDeclSpecifier extends ICASTDeclSpecifier {
|
||||||
|
|
||||||
public static final ASTNodeProperty BLOCK_SIZE_EXPRESSION = new ASTNodeProperty(
|
public static final ASTNodeProperty BLOCK_SIZE_EXPRESSION = new ASTNodeProperty(
|
||||||
"IUPCASTDeclSpecifier.BLOCK_SIZE_EXPRESSION - IUPCASTDeclSpecifier block size expression"); //$NON-NLS-1
|
"IUPCASTDeclSpecifier.BLOCK_SIZE_EXPRESSION - IUPCASTDeclSpecifier block size expression"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
|
||||||
public static final int rt_unspecified = 0;
|
public static final int rt_unspecified = 0;
|
||||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,238 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* 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.parser.upc;
|
||||||
|
|
||||||
|
public interface UPCExpressionStatementParsersym {
|
||||||
|
public final static int
|
||||||
|
TK_auto = 33,
|
||||||
|
TK_break = 90,
|
||||||
|
TK_case = 91,
|
||||||
|
TK_char = 38,
|
||||||
|
TK_const = 6,
|
||||||
|
TK_continue = 92,
|
||||||
|
TK_default = 93,
|
||||||
|
TK_do = 94,
|
||||||
|
TK_double = 39,
|
||||||
|
TK_else = 95,
|
||||||
|
TK_enum = 51,
|
||||||
|
TK_extern = 34,
|
||||||
|
TK_float = 40,
|
||||||
|
TK_for = 96,
|
||||||
|
TK_goto = 97,
|
||||||
|
TK_if = 98,
|
||||||
|
TK_inline = 35,
|
||||||
|
TK_int = 41,
|
||||||
|
TK_long = 42,
|
||||||
|
TK_register = 36,
|
||||||
|
TK_restrict = 7,
|
||||||
|
TK_return = 99,
|
||||||
|
TK_short = 43,
|
||||||
|
TK_signed = 44,
|
||||||
|
TK_sizeof = 17,
|
||||||
|
TK_static = 30,
|
||||||
|
TK_struct = 52,
|
||||||
|
TK_switch = 100,
|
||||||
|
TK_typedef = 37,
|
||||||
|
TK_union = 53,
|
||||||
|
TK_unsigned = 45,
|
||||||
|
TK_void = 46,
|
||||||
|
TK_volatile = 8,
|
||||||
|
TK_while = 101,
|
||||||
|
TK__Bool = 47,
|
||||||
|
TK__Complex = 48,
|
||||||
|
TK__Imaginary = 49,
|
||||||
|
TK_integer = 18,
|
||||||
|
TK_floating = 19,
|
||||||
|
TK_charconst = 20,
|
||||||
|
TK_stringlit = 21,
|
||||||
|
TK_identifier = 1,
|
||||||
|
TK_Completion = 3,
|
||||||
|
TK_EndOfCompletion = 5,
|
||||||
|
TK_Invalid = 102,
|
||||||
|
TK_LeftBracket = 31,
|
||||||
|
TK_LeftParen = 2,
|
||||||
|
TK_LeftBrace = 32,
|
||||||
|
TK_Dot = 61,
|
||||||
|
TK_Arrow = 76,
|
||||||
|
TK_PlusPlus = 15,
|
||||||
|
TK_MinusMinus = 16,
|
||||||
|
TK_And = 14,
|
||||||
|
TK_Star = 4,
|
||||||
|
TK_Plus = 9,
|
||||||
|
TK_Minus = 10,
|
||||||
|
TK_Tilde = 22,
|
||||||
|
TK_Bang = 23,
|
||||||
|
TK_Slash = 62,
|
||||||
|
TK_Percent = 63,
|
||||||
|
TK_RightShift = 57,
|
||||||
|
TK_LeftShift = 58,
|
||||||
|
TK_LT = 64,
|
||||||
|
TK_GT = 65,
|
||||||
|
TK_LE = 66,
|
||||||
|
TK_GE = 67,
|
||||||
|
TK_EQ = 71,
|
||||||
|
TK_NE = 72,
|
||||||
|
TK_Caret = 73,
|
||||||
|
TK_Or = 74,
|
||||||
|
TK_AndAnd = 75,
|
||||||
|
TK_OrOr = 77,
|
||||||
|
TK_Question = 78,
|
||||||
|
TK_Colon = 68,
|
||||||
|
TK_DotDotDot = 60,
|
||||||
|
TK_Assign = 69,
|
||||||
|
TK_StarAssign = 79,
|
||||||
|
TK_SlashAssign = 80,
|
||||||
|
TK_PercentAssign = 81,
|
||||||
|
TK_PlusAssign = 82,
|
||||||
|
TK_MinusAssign = 83,
|
||||||
|
TK_RightShiftAssign = 84,
|
||||||
|
TK_LeftShiftAssign = 85,
|
||||||
|
TK_AndAssign = 86,
|
||||||
|
TK_CaretAssign = 87,
|
||||||
|
TK_OrAssign = 88,
|
||||||
|
TK_Comma = 54,
|
||||||
|
TK_RightBracket = 59,
|
||||||
|
TK_RightParen = 50,
|
||||||
|
TK_RightBrace = 55,
|
||||||
|
TK_SemiColon = 70,
|
||||||
|
TK_MYTHREAD = 24,
|
||||||
|
TK_THREADS = 25,
|
||||||
|
TK_UPC_MAX_BLOCKSIZE = 26,
|
||||||
|
TK_relaxed = 11,
|
||||||
|
TK_shared = 12,
|
||||||
|
TK_strict = 13,
|
||||||
|
TK_upc_barrier = 103,
|
||||||
|
TK_upc_localsizeof = 27,
|
||||||
|
TK_upc_blocksizeof = 28,
|
||||||
|
TK_upc_elemsizeof = 29,
|
||||||
|
TK_upc_notify = 104,
|
||||||
|
TK_upc_fence = 105,
|
||||||
|
TK_upc_wait = 106,
|
||||||
|
TK_upc_forall = 107,
|
||||||
|
TK_ERROR_TOKEN = 56,
|
||||||
|
TK_EOF_TOKEN = 89;
|
||||||
|
|
||||||
|
public final static String orderedTerminalSymbols[] = {
|
||||||
|
"",
|
||||||
|
"identifier",
|
||||||
|
"LeftParen",
|
||||||
|
"Completion",
|
||||||
|
"Star",
|
||||||
|
"EndOfCompletion",
|
||||||
|
"const",
|
||||||
|
"restrict",
|
||||||
|
"volatile",
|
||||||
|
"Plus",
|
||||||
|
"Minus",
|
||||||
|
"relaxed",
|
||||||
|
"shared",
|
||||||
|
"strict",
|
||||||
|
"And",
|
||||||
|
"PlusPlus",
|
||||||
|
"MinusMinus",
|
||||||
|
"sizeof",
|
||||||
|
"integer",
|
||||||
|
"floating",
|
||||||
|
"charconst",
|
||||||
|
"stringlit",
|
||||||
|
"Tilde",
|
||||||
|
"Bang",
|
||||||
|
"MYTHREAD",
|
||||||
|
"THREADS",
|
||||||
|
"UPC_MAX_BLOCKSIZE",
|
||||||
|
"upc_localsizeof",
|
||||||
|
"upc_blocksizeof",
|
||||||
|
"upc_elemsizeof",
|
||||||
|
"static",
|
||||||
|
"LeftBracket",
|
||||||
|
"LeftBrace",
|
||||||
|
"auto",
|
||||||
|
"extern",
|
||||||
|
"inline",
|
||||||
|
"register",
|
||||||
|
"typedef",
|
||||||
|
"char",
|
||||||
|
"double",
|
||||||
|
"float",
|
||||||
|
"int",
|
||||||
|
"long",
|
||||||
|
"short",
|
||||||
|
"signed",
|
||||||
|
"unsigned",
|
||||||
|
"void",
|
||||||
|
"_Bool",
|
||||||
|
"_Complex",
|
||||||
|
"_Imaginary",
|
||||||
|
"RightParen",
|
||||||
|
"enum",
|
||||||
|
"struct",
|
||||||
|
"union",
|
||||||
|
"Comma",
|
||||||
|
"RightBrace",
|
||||||
|
"ERROR_TOKEN",
|
||||||
|
"RightShift",
|
||||||
|
"LeftShift",
|
||||||
|
"RightBracket",
|
||||||
|
"DotDotDot",
|
||||||
|
"Dot",
|
||||||
|
"Slash",
|
||||||
|
"Percent",
|
||||||
|
"LT",
|
||||||
|
"GT",
|
||||||
|
"LE",
|
||||||
|
"GE",
|
||||||
|
"Colon",
|
||||||
|
"Assign",
|
||||||
|
"SemiColon",
|
||||||
|
"EQ",
|
||||||
|
"NE",
|
||||||
|
"Caret",
|
||||||
|
"Or",
|
||||||
|
"AndAnd",
|
||||||
|
"Arrow",
|
||||||
|
"OrOr",
|
||||||
|
"Question",
|
||||||
|
"StarAssign",
|
||||||
|
"SlashAssign",
|
||||||
|
"PercentAssign",
|
||||||
|
"PlusAssign",
|
||||||
|
"MinusAssign",
|
||||||
|
"RightShiftAssign",
|
||||||
|
"LeftShiftAssign",
|
||||||
|
"AndAssign",
|
||||||
|
"CaretAssign",
|
||||||
|
"OrAssign",
|
||||||
|
"EOF_TOKEN",
|
||||||
|
"break",
|
||||||
|
"case",
|
||||||
|
"continue",
|
||||||
|
"default",
|
||||||
|
"do",
|
||||||
|
"else",
|
||||||
|
"for",
|
||||||
|
"goto",
|
||||||
|
"if",
|
||||||
|
"return",
|
||||||
|
"switch",
|
||||||
|
"while",
|
||||||
|
"Invalid",
|
||||||
|
"upc_barrier",
|
||||||
|
"upc_notify",
|
||||||
|
"upc_fence",
|
||||||
|
"upc_wait",
|
||||||
|
"upc_forall"
|
||||||
|
};
|
||||||
|
|
||||||
|
public final static boolean isValidForParser = true;
|
||||||
|
}
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,238 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* 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.parser.upc;
|
||||||
|
|
||||||
|
public interface UPCNoCastExpressionParsersym {
|
||||||
|
public final static int
|
||||||
|
TK_auto = 32,
|
||||||
|
TK_break = 90,
|
||||||
|
TK_case = 91,
|
||||||
|
TK_char = 38,
|
||||||
|
TK_const = 6,
|
||||||
|
TK_continue = 92,
|
||||||
|
TK_default = 93,
|
||||||
|
TK_do = 94,
|
||||||
|
TK_double = 39,
|
||||||
|
TK_else = 95,
|
||||||
|
TK_enum = 51,
|
||||||
|
TK_extern = 33,
|
||||||
|
TK_float = 40,
|
||||||
|
TK_for = 96,
|
||||||
|
TK_goto = 97,
|
||||||
|
TK_if = 98,
|
||||||
|
TK_inline = 34,
|
||||||
|
TK_int = 41,
|
||||||
|
TK_long = 42,
|
||||||
|
TK_register = 35,
|
||||||
|
TK_restrict = 7,
|
||||||
|
TK_return = 99,
|
||||||
|
TK_short = 43,
|
||||||
|
TK_signed = 44,
|
||||||
|
TK_sizeof = 19,
|
||||||
|
TK_static = 15,
|
||||||
|
TK_struct = 52,
|
||||||
|
TK_switch = 100,
|
||||||
|
TK_typedef = 36,
|
||||||
|
TK_union = 53,
|
||||||
|
TK_unsigned = 45,
|
||||||
|
TK_void = 46,
|
||||||
|
TK_volatile = 8,
|
||||||
|
TK_while = 101,
|
||||||
|
TK__Bool = 47,
|
||||||
|
TK__Complex = 48,
|
||||||
|
TK__Imaginary = 49,
|
||||||
|
TK_integer = 20,
|
||||||
|
TK_floating = 21,
|
||||||
|
TK_charconst = 22,
|
||||||
|
TK_stringlit = 23,
|
||||||
|
TK_identifier = 1,
|
||||||
|
TK_Completion = 3,
|
||||||
|
TK_EndOfCompletion = 5,
|
||||||
|
TK_Invalid = 102,
|
||||||
|
TK_LeftBracket = 16,
|
||||||
|
TK_LeftParen = 2,
|
||||||
|
TK_LeftBrace = 37,
|
||||||
|
TK_Dot = 61,
|
||||||
|
TK_Arrow = 76,
|
||||||
|
TK_PlusPlus = 17,
|
||||||
|
TK_MinusMinus = 18,
|
||||||
|
TK_And = 14,
|
||||||
|
TK_Star = 4,
|
||||||
|
TK_Plus = 12,
|
||||||
|
TK_Minus = 13,
|
||||||
|
TK_Tilde = 24,
|
||||||
|
TK_Bang = 25,
|
||||||
|
TK_Slash = 62,
|
||||||
|
TK_Percent = 63,
|
||||||
|
TK_RightShift = 57,
|
||||||
|
TK_LeftShift = 58,
|
||||||
|
TK_LT = 64,
|
||||||
|
TK_GT = 65,
|
||||||
|
TK_LE = 66,
|
||||||
|
TK_GE = 67,
|
||||||
|
TK_EQ = 70,
|
||||||
|
TK_NE = 71,
|
||||||
|
TK_Caret = 72,
|
||||||
|
TK_Or = 73,
|
||||||
|
TK_AndAnd = 74,
|
||||||
|
TK_OrOr = 77,
|
||||||
|
TK_Question = 78,
|
||||||
|
TK_Colon = 68,
|
||||||
|
TK_DotDotDot = 60,
|
||||||
|
TK_Assign = 69,
|
||||||
|
TK_StarAssign = 79,
|
||||||
|
TK_SlashAssign = 80,
|
||||||
|
TK_PercentAssign = 81,
|
||||||
|
TK_PlusAssign = 82,
|
||||||
|
TK_MinusAssign = 83,
|
||||||
|
TK_RightShiftAssign = 84,
|
||||||
|
TK_LeftShiftAssign = 85,
|
||||||
|
TK_AndAssign = 86,
|
||||||
|
TK_CaretAssign = 87,
|
||||||
|
TK_OrAssign = 88,
|
||||||
|
TK_Comma = 54,
|
||||||
|
TK_RightBracket = 59,
|
||||||
|
TK_RightParen = 50,
|
||||||
|
TK_RightBrace = 55,
|
||||||
|
TK_SemiColon = 75,
|
||||||
|
TK_MYTHREAD = 26,
|
||||||
|
TK_THREADS = 27,
|
||||||
|
TK_UPC_MAX_BLOCKSIZE = 28,
|
||||||
|
TK_relaxed = 9,
|
||||||
|
TK_shared = 10,
|
||||||
|
TK_strict = 11,
|
||||||
|
TK_upc_barrier = 103,
|
||||||
|
TK_upc_localsizeof = 29,
|
||||||
|
TK_upc_blocksizeof = 30,
|
||||||
|
TK_upc_elemsizeof = 31,
|
||||||
|
TK_upc_notify = 104,
|
||||||
|
TK_upc_fence = 105,
|
||||||
|
TK_upc_wait = 106,
|
||||||
|
TK_upc_forall = 107,
|
||||||
|
TK_ERROR_TOKEN = 56,
|
||||||
|
TK_EOF_TOKEN = 89;
|
||||||
|
|
||||||
|
public final static String orderedTerminalSymbols[] = {
|
||||||
|
"",
|
||||||
|
"identifier",
|
||||||
|
"LeftParen",
|
||||||
|
"Completion",
|
||||||
|
"Star",
|
||||||
|
"EndOfCompletion",
|
||||||
|
"const",
|
||||||
|
"restrict",
|
||||||
|
"volatile",
|
||||||
|
"relaxed",
|
||||||
|
"shared",
|
||||||
|
"strict",
|
||||||
|
"Plus",
|
||||||
|
"Minus",
|
||||||
|
"And",
|
||||||
|
"static",
|
||||||
|
"LeftBracket",
|
||||||
|
"PlusPlus",
|
||||||
|
"MinusMinus",
|
||||||
|
"sizeof",
|
||||||
|
"integer",
|
||||||
|
"floating",
|
||||||
|
"charconst",
|
||||||
|
"stringlit",
|
||||||
|
"Tilde",
|
||||||
|
"Bang",
|
||||||
|
"MYTHREAD",
|
||||||
|
"THREADS",
|
||||||
|
"UPC_MAX_BLOCKSIZE",
|
||||||
|
"upc_localsizeof",
|
||||||
|
"upc_blocksizeof",
|
||||||
|
"upc_elemsizeof",
|
||||||
|
"auto",
|
||||||
|
"extern",
|
||||||
|
"inline",
|
||||||
|
"register",
|
||||||
|
"typedef",
|
||||||
|
"LeftBrace",
|
||||||
|
"char",
|
||||||
|
"double",
|
||||||
|
"float",
|
||||||
|
"int",
|
||||||
|
"long",
|
||||||
|
"short",
|
||||||
|
"signed",
|
||||||
|
"unsigned",
|
||||||
|
"void",
|
||||||
|
"_Bool",
|
||||||
|
"_Complex",
|
||||||
|
"_Imaginary",
|
||||||
|
"RightParen",
|
||||||
|
"enum",
|
||||||
|
"struct",
|
||||||
|
"union",
|
||||||
|
"Comma",
|
||||||
|
"RightBrace",
|
||||||
|
"ERROR_TOKEN",
|
||||||
|
"RightShift",
|
||||||
|
"LeftShift",
|
||||||
|
"RightBracket",
|
||||||
|
"DotDotDot",
|
||||||
|
"Dot",
|
||||||
|
"Slash",
|
||||||
|
"Percent",
|
||||||
|
"LT",
|
||||||
|
"GT",
|
||||||
|
"LE",
|
||||||
|
"GE",
|
||||||
|
"Colon",
|
||||||
|
"Assign",
|
||||||
|
"EQ",
|
||||||
|
"NE",
|
||||||
|
"Caret",
|
||||||
|
"Or",
|
||||||
|
"AndAnd",
|
||||||
|
"SemiColon",
|
||||||
|
"Arrow",
|
||||||
|
"OrOr",
|
||||||
|
"Question",
|
||||||
|
"StarAssign",
|
||||||
|
"SlashAssign",
|
||||||
|
"PercentAssign",
|
||||||
|
"PlusAssign",
|
||||||
|
"MinusAssign",
|
||||||
|
"RightShiftAssign",
|
||||||
|
"LeftShiftAssign",
|
||||||
|
"AndAssign",
|
||||||
|
"CaretAssign",
|
||||||
|
"OrAssign",
|
||||||
|
"EOF_TOKEN",
|
||||||
|
"break",
|
||||||
|
"case",
|
||||||
|
"continue",
|
||||||
|
"default",
|
||||||
|
"do",
|
||||||
|
"else",
|
||||||
|
"for",
|
||||||
|
"goto",
|
||||||
|
"if",
|
||||||
|
"return",
|
||||||
|
"switch",
|
||||||
|
"while",
|
||||||
|
"Invalid",
|
||||||
|
"upc_barrier",
|
||||||
|
"upc_notify",
|
||||||
|
"upc_fence",
|
||||||
|
"upc_wait",
|
||||||
|
"upc_forall"
|
||||||
|
};
|
||||||
|
|
||||||
|
public final static boolean isValidForParser = true;
|
||||||
|
}
|
|
@ -1274,37 +1274,37 @@ public UPCParser(String[] mapFrom) { // constructor
|
||||||
//
|
//
|
||||||
// Rule 310: unary_expression ::= upc_localsizeof unary_expression
|
// Rule 310: unary_expression ::= upc_localsizeof unary_expression
|
||||||
//
|
//
|
||||||
case 310: { action. consumeExpressionUpcSizeofOperator(IUPCASTUnaryExpression.op_upc_localsizeof); break;
|
case 310: { action. consumeExpressionUnaryOperator(IUPCASTUnaryExpression.op_upc_localsizeof); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Rule 311: unary_expression ::= upc_localsizeof ( type_name )
|
// Rule 311: unary_expression ::= upc_localsizeof ( type_name )
|
||||||
//
|
//
|
||||||
case 311: { action. consumeExpressionUpcSizeofTypeName(IUPCASTUnaryExpression.op_upc_localsizeof); break;
|
case 311: { action. consumeExpressionTypeId(IUPCASTUnaryExpression.op_upc_localsizeof); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Rule 312: unary_expression ::= upc_blocksizeof unary_expression
|
// Rule 312: unary_expression ::= upc_blocksizeof unary_expression
|
||||||
//
|
//
|
||||||
case 312: { action. consumeExpressionUpcSizeofOperator(IUPCASTUnaryExpression.op_upc_blocksizeof); break;
|
case 312: { action. consumeExpressionUnaryOperator(IUPCASTUnaryExpression.op_upc_blocksizeof); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Rule 313: unary_expression ::= upc_blocksizeof ( type_name )
|
// Rule 313: unary_expression ::= upc_blocksizeof ( type_name )
|
||||||
//
|
//
|
||||||
case 313: { action. consumeExpressionUpcSizeofTypeName(IUPCASTUnaryExpression.op_upc_blocksizeof); break;
|
case 313: { action. consumeExpressionTypeId(IUPCASTUnaryExpression.op_upc_blocksizeof); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Rule 314: unary_expression ::= upc_elemsizeof unary_expression
|
// Rule 314: unary_expression ::= upc_elemsizeof unary_expression
|
||||||
//
|
//
|
||||||
case 314: { action. consumeExpressionUpcSizeofOperator(IUPCASTUnaryExpression.op_upc_elemsizeof); break;
|
case 314: { action. consumeExpressionUnaryOperator(IUPCASTUnaryExpression.op_upc_elemsizeof); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Rule 315: unary_expression ::= upc_elemsizeof ( type_name )
|
// Rule 315: unary_expression ::= upc_elemsizeof ( type_name )
|
||||||
//
|
//
|
||||||
case 315: { action. consumeExpressionUpcSizeofTypeName(IUPCASTUnaryExpression.op_upc_elemsizeof); break;
|
case 315: { action. consumeExpressionTypeId(IUPCASTUnaryExpression.op_upc_elemsizeof); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,238 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* 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.parser.upc;
|
||||||
|
|
||||||
|
public interface UPCSizeofExpressionParsersym {
|
||||||
|
public final static int
|
||||||
|
TK_auto = 17,
|
||||||
|
TK_break = 90,
|
||||||
|
TK_case = 91,
|
||||||
|
TK_char = 38,
|
||||||
|
TK_const = 6,
|
||||||
|
TK_continue = 92,
|
||||||
|
TK_default = 93,
|
||||||
|
TK_do = 94,
|
||||||
|
TK_double = 39,
|
||||||
|
TK_else = 95,
|
||||||
|
TK_enum = 51,
|
||||||
|
TK_extern = 18,
|
||||||
|
TK_float = 40,
|
||||||
|
TK_for = 96,
|
||||||
|
TK_goto = 97,
|
||||||
|
TK_if = 98,
|
||||||
|
TK_inline = 19,
|
||||||
|
TK_int = 41,
|
||||||
|
TK_long = 42,
|
||||||
|
TK_register = 20,
|
||||||
|
TK_restrict = 7,
|
||||||
|
TK_return = 99,
|
||||||
|
TK_short = 43,
|
||||||
|
TK_signed = 44,
|
||||||
|
TK_sizeof = 24,
|
||||||
|
TK_static = 12,
|
||||||
|
TK_struct = 52,
|
||||||
|
TK_switch = 100,
|
||||||
|
TK_typedef = 21,
|
||||||
|
TK_union = 53,
|
||||||
|
TK_unsigned = 45,
|
||||||
|
TK_void = 46,
|
||||||
|
TK_volatile = 8,
|
||||||
|
TK_while = 101,
|
||||||
|
TK__Bool = 47,
|
||||||
|
TK__Complex = 48,
|
||||||
|
TK__Imaginary = 49,
|
||||||
|
TK_integer = 25,
|
||||||
|
TK_floating = 26,
|
||||||
|
TK_charconst = 27,
|
||||||
|
TK_stringlit = 28,
|
||||||
|
TK_identifier = 1,
|
||||||
|
TK_Completion = 3,
|
||||||
|
TK_EndOfCompletion = 5,
|
||||||
|
TK_Invalid = 102,
|
||||||
|
TK_LeftBracket = 13,
|
||||||
|
TK_LeftParen = 2,
|
||||||
|
TK_LeftBrace = 37,
|
||||||
|
TK_Dot = 61,
|
||||||
|
TK_Arrow = 76,
|
||||||
|
TK_PlusPlus = 22,
|
||||||
|
TK_MinusMinus = 23,
|
||||||
|
TK_And = 16,
|
||||||
|
TK_Star = 4,
|
||||||
|
TK_Plus = 14,
|
||||||
|
TK_Minus = 15,
|
||||||
|
TK_Tilde = 29,
|
||||||
|
TK_Bang = 30,
|
||||||
|
TK_Slash = 62,
|
||||||
|
TK_Percent = 63,
|
||||||
|
TK_RightShift = 57,
|
||||||
|
TK_LeftShift = 58,
|
||||||
|
TK_LT = 64,
|
||||||
|
TK_GT = 65,
|
||||||
|
TK_LE = 66,
|
||||||
|
TK_GE = 67,
|
||||||
|
TK_EQ = 70,
|
||||||
|
TK_NE = 71,
|
||||||
|
TK_Caret = 72,
|
||||||
|
TK_Or = 73,
|
||||||
|
TK_AndAnd = 74,
|
||||||
|
TK_OrOr = 77,
|
||||||
|
TK_Question = 78,
|
||||||
|
TK_Colon = 68,
|
||||||
|
TK_DotDotDot = 60,
|
||||||
|
TK_Assign = 69,
|
||||||
|
TK_StarAssign = 79,
|
||||||
|
TK_SlashAssign = 80,
|
||||||
|
TK_PercentAssign = 81,
|
||||||
|
TK_PlusAssign = 82,
|
||||||
|
TK_MinusAssign = 83,
|
||||||
|
TK_RightShiftAssign = 84,
|
||||||
|
TK_LeftShiftAssign = 85,
|
||||||
|
TK_AndAssign = 86,
|
||||||
|
TK_CaretAssign = 87,
|
||||||
|
TK_OrAssign = 88,
|
||||||
|
TK_Comma = 54,
|
||||||
|
TK_RightBracket = 59,
|
||||||
|
TK_RightParen = 50,
|
||||||
|
TK_RightBrace = 55,
|
||||||
|
TK_SemiColon = 75,
|
||||||
|
TK_MYTHREAD = 31,
|
||||||
|
TK_THREADS = 32,
|
||||||
|
TK_UPC_MAX_BLOCKSIZE = 33,
|
||||||
|
TK_relaxed = 9,
|
||||||
|
TK_shared = 10,
|
||||||
|
TK_strict = 11,
|
||||||
|
TK_upc_barrier = 103,
|
||||||
|
TK_upc_localsizeof = 34,
|
||||||
|
TK_upc_blocksizeof = 35,
|
||||||
|
TK_upc_elemsizeof = 36,
|
||||||
|
TK_upc_notify = 104,
|
||||||
|
TK_upc_fence = 105,
|
||||||
|
TK_upc_wait = 106,
|
||||||
|
TK_upc_forall = 107,
|
||||||
|
TK_ERROR_TOKEN = 56,
|
||||||
|
TK_EOF_TOKEN = 89;
|
||||||
|
|
||||||
|
public final static String orderedTerminalSymbols[] = {
|
||||||
|
"",
|
||||||
|
"identifier",
|
||||||
|
"LeftParen",
|
||||||
|
"Completion",
|
||||||
|
"Star",
|
||||||
|
"EndOfCompletion",
|
||||||
|
"const",
|
||||||
|
"restrict",
|
||||||
|
"volatile",
|
||||||
|
"relaxed",
|
||||||
|
"shared",
|
||||||
|
"strict",
|
||||||
|
"static",
|
||||||
|
"LeftBracket",
|
||||||
|
"Plus",
|
||||||
|
"Minus",
|
||||||
|
"And",
|
||||||
|
"auto",
|
||||||
|
"extern",
|
||||||
|
"inline",
|
||||||
|
"register",
|
||||||
|
"typedef",
|
||||||
|
"PlusPlus",
|
||||||
|
"MinusMinus",
|
||||||
|
"sizeof",
|
||||||
|
"integer",
|
||||||
|
"floating",
|
||||||
|
"charconst",
|
||||||
|
"stringlit",
|
||||||
|
"Tilde",
|
||||||
|
"Bang",
|
||||||
|
"MYTHREAD",
|
||||||
|
"THREADS",
|
||||||
|
"UPC_MAX_BLOCKSIZE",
|
||||||
|
"upc_localsizeof",
|
||||||
|
"upc_blocksizeof",
|
||||||
|
"upc_elemsizeof",
|
||||||
|
"LeftBrace",
|
||||||
|
"char",
|
||||||
|
"double",
|
||||||
|
"float",
|
||||||
|
"int",
|
||||||
|
"long",
|
||||||
|
"short",
|
||||||
|
"signed",
|
||||||
|
"unsigned",
|
||||||
|
"void",
|
||||||
|
"_Bool",
|
||||||
|
"_Complex",
|
||||||
|
"_Imaginary",
|
||||||
|
"RightParen",
|
||||||
|
"enum",
|
||||||
|
"struct",
|
||||||
|
"union",
|
||||||
|
"Comma",
|
||||||
|
"RightBrace",
|
||||||
|
"ERROR_TOKEN",
|
||||||
|
"RightShift",
|
||||||
|
"LeftShift",
|
||||||
|
"RightBracket",
|
||||||
|
"DotDotDot",
|
||||||
|
"Dot",
|
||||||
|
"Slash",
|
||||||
|
"Percent",
|
||||||
|
"LT",
|
||||||
|
"GT",
|
||||||
|
"LE",
|
||||||
|
"GE",
|
||||||
|
"Colon",
|
||||||
|
"Assign",
|
||||||
|
"EQ",
|
||||||
|
"NE",
|
||||||
|
"Caret",
|
||||||
|
"Or",
|
||||||
|
"AndAnd",
|
||||||
|
"SemiColon",
|
||||||
|
"Arrow",
|
||||||
|
"OrOr",
|
||||||
|
"Question",
|
||||||
|
"StarAssign",
|
||||||
|
"SlashAssign",
|
||||||
|
"PercentAssign",
|
||||||
|
"PlusAssign",
|
||||||
|
"MinusAssign",
|
||||||
|
"RightShiftAssign",
|
||||||
|
"LeftShiftAssign",
|
||||||
|
"AndAssign",
|
||||||
|
"CaretAssign",
|
||||||
|
"OrAssign",
|
||||||
|
"EOF_TOKEN",
|
||||||
|
"break",
|
||||||
|
"case",
|
||||||
|
"continue",
|
||||||
|
"default",
|
||||||
|
"do",
|
||||||
|
"else",
|
||||||
|
"for",
|
||||||
|
"goto",
|
||||||
|
"if",
|
||||||
|
"return",
|
||||||
|
"switch",
|
||||||
|
"while",
|
||||||
|
"Invalid",
|
||||||
|
"upc_barrier",
|
||||||
|
"upc_notify",
|
||||||
|
"upc_fence",
|
||||||
|
"upc_wait",
|
||||||
|
"upc_forall"
|
||||||
|
};
|
||||||
|
|
||||||
|
public final static boolean isValidForParser = true;
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue