mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 02:06:01 +02:00
fix UPC sizeof expressions
This commit is contained in:
parent
004d070b6e
commit
2044602e4b
15 changed files with 341 additions and 190 deletions
|
@ -40,11 +40,11 @@ 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.IUPCASTSimpleDeclSpecifier;
|
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.IUPCASTTypeIdExpression;
|
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTTypeIdSizeofExpression;
|
||||||
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTUnaryExpression;
|
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTUnarySizeofExpression;
|
||||||
import org.eclipse.cdt.core.lrparser.tests.ParseHelper;
|
import org.eclipse.cdt.core.lrparser.tests.ParseHelper;
|
||||||
|
|
||||||
|
@SuppressWarnings("nls")
|
||||||
public class UPCLanguageExtensionTests extends TestCase {
|
public class UPCLanguageExtensionTests extends TestCase {
|
||||||
|
|
||||||
public UPCLanguageExtensionTests() {
|
public UPCLanguageExtensionTests() {
|
||||||
|
@ -73,15 +73,15 @@ public class UPCLanguageExtensionTests extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void testUPCSharedDeclarations1() throws Exception {
|
public void testUPCSharedDeclarations1() throws Exception {
|
||||||
StringBuffer sb = new StringBuffer();
|
String code =
|
||||||
sb.append("shared int a [100+THREADS];\n");//$NON-NLS-1$
|
"shared int a [100+THREADS];\n" +
|
||||||
sb.append("shared [] int b [THREADS];\n");//$NON-NLS-1$
|
"shared [] int b [THREADS];\n" +
|
||||||
sb.append("shared [90] int c [10];\n");//$NON-NLS-1$
|
"shared [90] int c [10];\n" +
|
||||||
sb.append("shared [*] int d [];\n");//$NON-NLS-1$
|
"shared [*] int d [];\n" +
|
||||||
sb.append("relaxed int x;");//$NON-NLS-1$
|
"relaxed int x;" +
|
||||||
sb.append("strict int y;");//$NON-NLS-1$
|
"strict int y;";
|
||||||
String code = sb.toString();
|
|
||||||
|
|
||||||
IASTTranslationUnit tu = parseAndCheckBindings(code);
|
IASTTranslationUnit tu = parseAndCheckBindings(code);
|
||||||
IScope globalScope = tu.getScope();
|
IScope globalScope = tu.getScope();
|
||||||
|
@ -103,7 +103,7 @@ public class UPCLanguageExtensionTests extends TestCase {
|
||||||
assertEquals(1, declarators.length);
|
assertEquals(1, declarators.length);
|
||||||
IASTArrayDeclarator declarator_a = (IASTArrayDeclarator) declarators[0];
|
IASTArrayDeclarator declarator_a = (IASTArrayDeclarator) declarators[0];
|
||||||
IASTName name_a = declarator_a.getName();
|
IASTName name_a = declarator_a.getName();
|
||||||
assertEquals("a", name_a.toString());//$NON-NLS-1$
|
assertEquals("a", name_a.toString());
|
||||||
IASTArrayModifier[] array_modifiers = declarator_a.getArrayModifiers();
|
IASTArrayModifier[] array_modifiers = declarator_a.getArrayModifiers();
|
||||||
assertNotNull(array_modifiers);
|
assertNotNull(array_modifiers);
|
||||||
assertEquals(1, array_modifiers.length);
|
assertEquals(1, array_modifiers.length);
|
||||||
|
@ -123,7 +123,7 @@ public class UPCLanguageExtensionTests extends TestCase {
|
||||||
assertEquals(1, declarators.length);
|
assertEquals(1, declarators.length);
|
||||||
IASTArrayDeclarator declarator_b = (IASTArrayDeclarator) declarators[0];
|
IASTArrayDeclarator declarator_b = (IASTArrayDeclarator) declarators[0];
|
||||||
IASTName name_b = declarator_b.getName();
|
IASTName name_b = declarator_b.getName();
|
||||||
assertEquals("b", name_b.toString());//$NON-NLS-1$
|
assertEquals("b", name_b.toString());
|
||||||
array_modifiers = declarator_b.getArrayModifiers();
|
array_modifiers = declarator_b.getArrayModifiers();
|
||||||
assertNotNull(array_modifiers);
|
assertNotNull(array_modifiers);
|
||||||
assertEquals(1, array_modifiers.length);
|
assertEquals(1, array_modifiers.length);
|
||||||
|
@ -143,7 +143,7 @@ public class UPCLanguageExtensionTests extends TestCase {
|
||||||
assertEquals(1, declarators.length);
|
assertEquals(1, declarators.length);
|
||||||
IASTArrayDeclarator declarator_c = (IASTArrayDeclarator) declarators[0];
|
IASTArrayDeclarator declarator_c = (IASTArrayDeclarator) declarators[0];
|
||||||
IASTName name_c = declarator_c.getName();
|
IASTName name_c = declarator_c.getName();
|
||||||
assertEquals("c", name_c.toString());//$NON-NLS-1$
|
assertEquals("c", name_c.toString());
|
||||||
array_modifiers = declarator_c.getArrayModifiers();
|
array_modifiers = declarator_c.getArrayModifiers();
|
||||||
assertNotNull(array_modifiers);
|
assertNotNull(array_modifiers);
|
||||||
assertEquals(1, array_modifiers.length);
|
assertEquals(1, array_modifiers.length);
|
||||||
|
@ -161,7 +161,7 @@ public class UPCLanguageExtensionTests extends TestCase {
|
||||||
assertEquals(1, declarators.length);
|
assertEquals(1, declarators.length);
|
||||||
IASTArrayDeclarator declarator_d = (IASTArrayDeclarator) declarators[0];
|
IASTArrayDeclarator declarator_d = (IASTArrayDeclarator) declarators[0];
|
||||||
IASTName name_d = declarator_d.getName();
|
IASTName name_d = declarator_d.getName();
|
||||||
assertEquals("d", name_d.toString());//$NON-NLS-1$
|
assertEquals("d", name_d.toString());
|
||||||
array_modifiers = declarator_d.getArrayModifiers();
|
array_modifiers = declarator_d.getArrayModifiers();
|
||||||
assertNotNull(array_modifiers);
|
assertNotNull(array_modifiers);
|
||||||
assertEquals(1, array_modifiers.length);
|
assertEquals(1, array_modifiers.length);
|
||||||
|
@ -197,10 +197,9 @@ public class UPCLanguageExtensionTests extends TestCase {
|
||||||
|
|
||||||
|
|
||||||
public void testUPCSharedDeclarations2() throws Exception {
|
public void testUPCSharedDeclarations2() throws Exception {
|
||||||
StringBuffer sb = new StringBuffer();
|
String code =
|
||||||
sb.append("int x = 10;");//$NON-NLS-1$
|
"int x = 10;" +
|
||||||
sb.append("shared [x] int a [];\n");//$NON-NLS-1$
|
"shared [x] int a [];\n";
|
||||||
String code = sb.toString();
|
|
||||||
|
|
||||||
IASTTranslationUnit tu = parseAndCheckBindings(code);
|
IASTTranslationUnit tu = parseAndCheckBindings(code);
|
||||||
IScope globalScope = tu.getScope();
|
IScope globalScope = tu.getScope();
|
||||||
|
@ -229,15 +228,14 @@ public class UPCLanguageExtensionTests extends TestCase {
|
||||||
|
|
||||||
|
|
||||||
public void testUPCForall1() throws Exception {
|
public void testUPCForall1() throws Exception {
|
||||||
StringBuffer sb = new StringBuffer();
|
String code =
|
||||||
sb.append("int main() {\n");//$NON-NLS-1$
|
"int main() {\n" +
|
||||||
sb.append(" int i;\n");//$NON-NLS-1$
|
" int i;\n" +
|
||||||
sb.append(" shared float *a;\n");//$NON-NLS-1$
|
" shared float *a;\n" +
|
||||||
sb.append(" upc_forall(i=0; i<N; i++; &a[i]) { \n");//$NON-NLS-1$
|
" upc_forall(i=0; i<N; i++; &a[i]) { \n" +
|
||||||
sb.append(" a[i] = 99; \n");//$NON-NLS-1$
|
" a[i] = 99; \n" +
|
||||||
sb.append(" } \n");//$NON-NLS-1$
|
" } \n" +
|
||||||
sb.append("}\n");//$NON-NLS-1$
|
"}\n";
|
||||||
String code = sb.toString();
|
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(code);
|
IASTTranslationUnit tu = parse(code);
|
||||||
|
|
||||||
|
@ -312,14 +310,13 @@ public class UPCLanguageExtensionTests extends TestCase {
|
||||||
* Test a declaration inside a upc_forall definition.
|
* Test a declaration inside a upc_forall definition.
|
||||||
*/
|
*/
|
||||||
public void testUPCForall2() throws Exception {
|
public void testUPCForall2() throws Exception {
|
||||||
StringBuffer sb = new StringBuffer();
|
String code =
|
||||||
sb.append("int main() {\n");//$NON-NLS-1$
|
"int main() {\n" +
|
||||||
sb.append(" shared float *a;\n");//$NON-NLS-1$
|
" shared float *a;\n" +
|
||||||
sb.append(" upc_forall(int i=0; i<N; i++; &a[i]) { \n");//$NON-NLS-1$
|
" upc_forall(int i=0; i<N; i++; &a[i]) { \n" +
|
||||||
sb.append(" a[i] = 99; \n");//$NON-NLS-1$
|
" a[i] = 99; \n" +
|
||||||
sb.append(" } \n");//$NON-NLS-1$
|
" } \n" +
|
||||||
sb.append("}\n");//$NON-NLS-1$
|
"}\n";
|
||||||
String code = sb.toString();
|
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(code);
|
IASTTranslationUnit tu = parse(code);
|
||||||
|
|
||||||
|
@ -386,12 +383,11 @@ public class UPCLanguageExtensionTests extends TestCase {
|
||||||
* Test 'continue' inside upc_forall
|
* Test 'continue' inside upc_forall
|
||||||
*/
|
*/
|
||||||
public void testUPCForall3() throws Exception {
|
public void testUPCForall3() throws Exception {
|
||||||
StringBuffer sb = new StringBuffer();
|
String code =
|
||||||
sb.append("int main() {\n");//$NON-NLS-1$
|
"int main() {\n" +
|
||||||
sb.append(" upc_forall(int i=0; i<N; i++; continue) { \n");//$NON-NLS-1$
|
" upc_forall(int i=0; i<N; i++; continue) { \n" +
|
||||||
sb.append(" } \n");//$NON-NLS-1$
|
" } \n" +
|
||||||
sb.append("}\n");//$NON-NLS-1$
|
"}\n";
|
||||||
String code = sb.toString();
|
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(code);
|
IASTTranslationUnit tu = parse(code);
|
||||||
|
|
||||||
|
@ -412,17 +408,16 @@ public class UPCLanguageExtensionTests extends TestCase {
|
||||||
|
|
||||||
|
|
||||||
public void testUPCSynchronizationStatment() throws Exception {
|
public void testUPCSynchronizationStatment() throws Exception {
|
||||||
StringBuffer sb = new StringBuffer();
|
String code =
|
||||||
sb.append("int main() {\n");//$NON-NLS-1$
|
"int main() {\n" +
|
||||||
sb.append(" upc_notify 1;\n");//$NON-NLS-1$
|
" upc_notify 1;\n" +
|
||||||
sb.append(" upc_notify;\n");//$NON-NLS-1$
|
" upc_notify;\n" +
|
||||||
sb.append(" upc_wait 1;\n");//$NON-NLS-1$
|
" upc_wait 1;\n" +
|
||||||
sb.append(" upc_wait;\n");//$NON-NLS-1$
|
" upc_wait;\n" +
|
||||||
sb.append(" upc_barrier 1;\n");//$NON-NLS-1$
|
" upc_barrier 1;\n" +
|
||||||
sb.append(" upc_barrier;\n");//$NON-NLS-1$
|
" upc_barrier;\n" +
|
||||||
sb.append(" upc_fence;\n");//$NON-NLS-1$
|
" upc_fence;\n" +
|
||||||
sb.append("}\n");//$NON-NLS-1$
|
"}\n";
|
||||||
String code = sb.toString();
|
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(code);
|
IASTTranslationUnit tu = parse(code);
|
||||||
|
|
||||||
|
@ -466,18 +461,17 @@ public class UPCLanguageExtensionTests extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testUPCSizeofExpressions() throws Exception {
|
public void testUPCSizeofExpressions() throws Exception {
|
||||||
StringBuffer sb = new StringBuffer();
|
String code =
|
||||||
sb.append("int main() {\n");//$NON-NLS-1$
|
"int main() {\n" +
|
||||||
sb.append(" sizeof(int); \n");//$NON-NLS-1$
|
" sizeof(int); \n" +
|
||||||
sb.append(" sizeof x; \n");//$NON-NLS-1$
|
" sizeof x; \n" +
|
||||||
sb.append(" upc_localsizeof(int); \n");//$NON-NLS-1$
|
" upc_localsizeof(int); \n" +
|
||||||
sb.append(" upc_localsizeof x; \n");//$NON-NLS-1$
|
" upc_localsizeof x; \n" +
|
||||||
sb.append(" upc_blocksizeof(int); \n");//$NON-NLS-1$
|
" upc_blocksizeof(int); \n" +
|
||||||
sb.append(" upc_blocksizeof x; \n");//$NON-NLS-1$
|
" upc_blocksizeof x; \n" +
|
||||||
sb.append(" upc_elemsizeof(int); \n");//$NON-NLS-1$
|
" upc_elemsizeof(int); \n" +
|
||||||
sb.append(" upc_elemsizeof x; \n");//$NON-NLS-1$
|
" upc_elemsizeof x; \n" +
|
||||||
sb.append("}\n");//$NON-NLS-1$
|
"}\n";
|
||||||
String code = sb.toString();
|
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(code);
|
IASTTranslationUnit tu = parse(code);
|
||||||
|
|
||||||
|
@ -489,29 +483,57 @@ public class UPCLanguageExtensionTests extends TestCase {
|
||||||
IASTStatement[] body = ((IASTCompoundStatement)main.getBody()).getStatements();
|
IASTStatement[] body = ((IASTCompoundStatement)main.getBody()).getStatements();
|
||||||
assertEquals(8, body.length);
|
assertEquals(8, body.length);
|
||||||
|
|
||||||
IASTTypeIdExpression idexpr = (IASTTypeIdExpression)((IASTExpressionStatement)body[0]).getExpression();
|
@SuppressWarnings("unused")
|
||||||
|
IASTTypeIdExpression cidexpr = (IASTTypeIdExpression)((IASTExpressionStatement)body[0]).getExpression();
|
||||||
|
|
||||||
IASTUnaryExpression cexpr = (IASTUnaryExpression)((IASTExpressionStatement)body[1]).getExpression();
|
IASTUnaryExpression cexpr = (IASTUnaryExpression)((IASTExpressionStatement)body[1]).getExpression();
|
||||||
assertEquals(IASTUnaryExpression.op_sizeof, cexpr.getOperator());
|
assertEquals(IASTUnaryExpression.op_sizeof, cexpr.getOperator());
|
||||||
|
|
||||||
IUPCASTUnaryExpression expr;
|
IUPCASTUnarySizeofExpression expr;
|
||||||
|
IUPCASTTypeIdSizeofExpression idexpr;
|
||||||
|
|
||||||
idexpr = (IUPCASTTypeIdExpression)((IASTExpressionStatement)body[2]).getExpression();
|
idexpr = (IUPCASTTypeIdSizeofExpression)((IASTExpressionStatement)body[2]).getExpression();
|
||||||
assertEquals(IUPCASTUnaryExpression.op_upc_localsizeof, idexpr.getOperator());
|
assertEquals(IASTTypeIdExpression.op_sizeof, idexpr.getOperator());
|
||||||
|
assertEquals(IUPCASTTypeIdSizeofExpression.upc_localsizeof, idexpr.getUPCSizeofOperator());
|
||||||
|
|
||||||
expr = (IUPCASTUnaryExpression)((IASTExpressionStatement)body[3]).getExpression();
|
expr = (IUPCASTUnarySizeofExpression)((IASTExpressionStatement)body[3]).getExpression();
|
||||||
assertEquals(IUPCASTUnaryExpression.op_upc_localsizeof, expr.getOperator());
|
assertEquals(IASTUnaryExpression.op_sizeof, expr.getOperator());
|
||||||
|
assertEquals(IUPCASTUnarySizeofExpression.upc_localsizeof, expr.getUPCSizeofOperator());
|
||||||
|
|
||||||
idexpr = (IUPCASTTypeIdExpression)((IASTExpressionStatement)body[4]).getExpression();
|
idexpr = (IUPCASTTypeIdSizeofExpression)((IASTExpressionStatement)body[4]).getExpression();
|
||||||
assertEquals(IUPCASTUnaryExpression.op_upc_blocksizeof, idexpr.getOperator());
|
assertEquals(IASTTypeIdExpression.op_sizeof, idexpr.getOperator());
|
||||||
|
assertEquals(IUPCASTTypeIdSizeofExpression.upc_blocksizeof, idexpr.getUPCSizeofOperator());
|
||||||
|
|
||||||
expr = (IUPCASTUnaryExpression)((IASTExpressionStatement)body[5]).getExpression();
|
expr = (IUPCASTUnarySizeofExpression)((IASTExpressionStatement)body[5]).getExpression();
|
||||||
assertEquals(IUPCASTUnaryExpression.op_upc_blocksizeof, expr.getOperator());
|
assertEquals(IASTUnaryExpression.op_sizeof, expr.getOperator());
|
||||||
|
assertEquals(IUPCASTUnarySizeofExpression.upc_blocksizeof, expr.getUPCSizeofOperator());
|
||||||
|
|
||||||
idexpr = (IUPCASTTypeIdExpression)((IASTExpressionStatement)body[6]).getExpression();
|
idexpr = (IUPCASTTypeIdSizeofExpression)((IASTExpressionStatement)body[6]).getExpression();
|
||||||
assertEquals(IUPCASTUnaryExpression.op_upc_elemsizeof, idexpr.getOperator());
|
assertEquals(IASTTypeIdExpression.op_sizeof, idexpr.getOperator());
|
||||||
|
assertEquals(IUPCASTTypeIdSizeofExpression.upc_elemsizeof, idexpr.getUPCSizeofOperator());
|
||||||
|
|
||||||
expr = (IUPCASTUnaryExpression)((IASTExpressionStatement)body[7]).getExpression();
|
expr = (IUPCASTUnarySizeofExpression)((IASTExpressionStatement)body[7]).getExpression();
|
||||||
assertEquals(IUPCASTUnaryExpression.op_upc_elemsizeof, expr.getOperator());
|
assertEquals(IASTUnaryExpression.op_sizeof, expr.getOperator());
|
||||||
|
assertEquals(IUPCASTUnarySizeofExpression.upc_elemsizeof, expr.getUPCSizeofOperator());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void testUPCSizeofExpressionsDisambiguate() throws Exception {
|
||||||
|
String code =
|
||||||
|
"int foo() {" +
|
||||||
|
" typedef int t;" +
|
||||||
|
" int x;" +
|
||||||
|
" upc_blocksizeof(t);" +
|
||||||
|
" upc_blocksizeof(x);" +
|
||||||
|
"}";
|
||||||
|
|
||||||
|
IASTTranslationUnit tu = parse(code);
|
||||||
|
|
||||||
|
IASTDeclaration[] declarations = tu.getDeclarations();
|
||||||
|
IASTFunctionDefinition main = (IASTFunctionDefinition) declarations[0];
|
||||||
|
IASTStatement[] body = ((IASTCompoundStatement)main.getBody()).getStatements();
|
||||||
|
|
||||||
|
assertTrue(((IASTExpressionStatement)body[2]).getExpression() instanceof IUPCASTTypeIdSizeofExpression);
|
||||||
|
assertTrue(((IASTExpressionStatement)body[3]).getExpression() instanceof IUPCASTUnarySizeofExpression);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,17 +65,17 @@ literal
|
||||||
-- causes ambiguities because of no type information, solution is SGLR
|
-- causes ambiguities because of no type information, solution is SGLR
|
||||||
unary_expression
|
unary_expression
|
||||||
::= 'upc_localsizeof' unary_expression
|
::= 'upc_localsizeof' unary_expression
|
||||||
/. $Build consumeExpressionUnaryOperator(IUPCASTUnaryExpression.op_upc_localsizeof); $EndBuild ./
|
/. $Build consumeExpressionUnarySizeofOperator(IUPCASTUnaryExpression.upc_localsizeof); $EndBuild ./
|
||||||
| 'upc_localsizeof' '(' type_name ')'
|
| 'upc_localsizeof' '(' type_name ')'
|
||||||
/. $Build consumeExpressionTypeId(IUPCASTUnaryExpression.op_upc_localsizeof); $EndBuild ./
|
/. $Build consumeExpressionSizeofTypeId(IUPCASTUnaryExpression.upc_localsizeof); $EndBuild ./
|
||||||
| 'upc_blocksizeof' unary_expression
|
| 'upc_blocksizeof' unary_expression
|
||||||
/. $Build consumeExpressionUnaryOperator(IUPCASTUnaryExpression.op_upc_blocksizeof); $EndBuild ./
|
/. $Build consumeExpressionUnarySizeofOperator(IUPCASTUnaryExpression.upc_blocksizeof); $EndBuild ./
|
||||||
| 'upc_blocksizeof' '(' type_name ')'
|
| 'upc_blocksizeof' '(' type_name ')'
|
||||||
/. $Build consumeExpressionTypeId(IUPCASTUnaryExpression.op_upc_blocksizeof); $EndBuild ./
|
/. $Build consumeExpressionSizeofTypeId(IUPCASTUnaryExpression.upc_blocksizeof); $EndBuild ./
|
||||||
| 'upc_elemsizeof' unary_expression
|
| 'upc_elemsizeof' unary_expression
|
||||||
/. $Build consumeExpressionUnaryOperator(IUPCASTUnaryExpression.op_upc_elemsizeof); $EndBuild ./
|
/. $Build consumeExpressionUnarySizeofOperator(IUPCASTUnaryExpression.upc_elemsizeof); $EndBuild ./
|
||||||
| 'upc_elemsizeof' '(' type_name ')'
|
| 'upc_elemsizeof' '(' type_name ')'
|
||||||
/. $Build consumeExpressionTypeId(IUPCASTUnaryExpression.op_upc_elemsizeof); $EndBuild ./
|
/. $Build consumeExpressionSizeofTypeId(IUPCASTUnaryExpression.upc_elemsizeof); $EndBuild ./
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------
|
||||||
|
|
|
@ -15,6 +15,7 @@ import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTCompositeTypeSpecifier;
|
import org.eclipse.cdt.core.dom.ast.c.ICASTCompositeTypeSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTElaboratedTypeSpecifier;
|
import org.eclipse.cdt.core.dom.ast.c.ICASTElaboratedTypeSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTEnumerationSpecifier;
|
import org.eclipse.cdt.core.dom.ast.c.ICASTEnumerationSpecifier;
|
||||||
|
@ -24,7 +25,6 @@ import org.eclipse.cdt.core.dom.lrparser.action.c99.C99ASTNodeFactory;
|
||||||
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.ast.UPCASTCompositeTypeSpecifier;
|
import org.eclipse.cdt.internal.core.dom.parser.upc.ast.UPCASTCompositeTypeSpecifier;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.upc.ast.UPCASTElaboratedTypeSpecifier;
|
import org.eclipse.cdt.internal.core.dom.parser.upc.ast.UPCASTElaboratedTypeSpecifier;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.upc.ast.UPCASTEnumerationSpecifier;
|
import org.eclipse.cdt.internal.core.dom.parser.upc.ast.UPCASTEnumerationSpecifier;
|
||||||
|
@ -32,9 +32,9 @@ import org.eclipse.cdt.internal.core.dom.parser.upc.ast.UPCASTForallStatement;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.upc.ast.UPCASTKeywordExpression;
|
import org.eclipse.cdt.internal.core.dom.parser.upc.ast.UPCASTKeywordExpression;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.upc.ast.UPCASTSimpleDeclSpecifier;
|
import org.eclipse.cdt.internal.core.dom.parser.upc.ast.UPCASTSimpleDeclSpecifier;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.upc.ast.UPCASTSynchronizationStatement;
|
import org.eclipse.cdt.internal.core.dom.parser.upc.ast.UPCASTSynchronizationStatement;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.upc.ast.UPCASTTypeIdExpression;
|
import org.eclipse.cdt.internal.core.dom.parser.upc.ast.UPCASTTypeIdSizeofExpression;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.upc.ast.UPCASTTypedefNameSpecifier;
|
import org.eclipse.cdt.internal.core.dom.parser.upc.ast.UPCASTTypedefNameSpecifier;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.upc.ast.UPCASTUnaryExpression;
|
import org.eclipse.cdt.internal.core.dom.parser.upc.ast.UPCASTUnarySizeofExpression;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -49,21 +49,45 @@ public class UPCASTNodeFactory extends C99ASTNodeFactory {
|
||||||
|
|
||||||
public static final UPCASTNodeFactory DEFAULT_INSTANCE = new UPCASTNodeFactory();
|
public static final UPCASTNodeFactory DEFAULT_INSTANCE = new UPCASTNodeFactory();
|
||||||
|
|
||||||
|
private boolean useUPCSizeofExpressions = false;
|
||||||
|
private int currentUPCSizofExpressionOperator = 0;
|
||||||
|
|
||||||
|
|
||||||
|
public void setUseUPCSizeofExpressions(int op) {
|
||||||
|
useUPCSizeofExpressions = true;
|
||||||
|
currentUPCSizofExpressionOperator = op;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUseC99SizeofExpressions() {
|
||||||
|
useUPCSizeofExpressions = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IASTTypeIdExpression newTypeIdExpression(int operator, IASTTypeId typeId) {
|
public IASTTypeIdExpression newTypeIdExpression(int operator, IASTTypeId typeId) {
|
||||||
return new UPCASTTypeIdExpression(operator, typeId);
|
if(useUPCSizeofExpressions) {
|
||||||
|
assert operator == IASTTypeIdExpression.op_sizeof;
|
||||||
|
return new UPCASTTypeIdSizeofExpression(currentUPCSizofExpressionOperator, typeId);
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.newTypeIdExpression(operator, typeId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IASTUnaryExpression newUnaryExpression(int operator, IASTExpression operand) {
|
||||||
|
if(useUPCSizeofExpressions) {
|
||||||
|
assert operator == IASTUnaryExpression.op_sizeof;
|
||||||
|
return new UPCASTUnarySizeofExpression(currentUPCSizofExpressionOperator, operand);
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.newUnaryExpression(operator, operand);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IUPCASTKeywordExpression newKeywordExpression(int keywordKind) {
|
public IUPCASTKeywordExpression newKeywordExpression(int keywordKind) {
|
||||||
return new UPCASTKeywordExpression(keywordKind);
|
return new UPCASTKeywordExpression(keywordKind);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public IUPCASTUnaryExpression newUnaryExpression(int operator, IASTExpression operand) {
|
|
||||||
return new UPCASTUnaryExpression(operator, operand);
|
|
||||||
}
|
|
||||||
|
|
||||||
public IUPCASTSynchronizationStatement newSyncronizationStatment(IASTExpression barrierExpression, int statmentKind) {
|
public IUPCASTSynchronizationStatement newSyncronizationStatment(IASTExpression barrierExpression, int statmentKind) {
|
||||||
return new UPCASTSynchronizationStatement(barrierExpression, statmentKind);
|
return new UPCASTSynchronizationStatement(barrierExpression, statmentKind);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,20 +11,26 @@
|
||||||
package org.eclipse.cdt.core.dom.parser.upc;
|
package org.eclipse.cdt.core.dom.parser.upc;
|
||||||
|
|
||||||
|
|
||||||
|
import static org.eclipse.cdt.internal.core.dom.parser.upc.UPCParsersym.*;
|
||||||
import lpg.lpgjavaruntime.IToken;
|
import lpg.lpgjavaruntime.IToken;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
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.IASTTypeIdExpression;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
|
||||||
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.IParser;
|
||||||
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;
|
||||||
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTDeclSpecifier;
|
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.internal.core.dom.parser.upc.UPCParsersym;
|
import org.eclipse.cdt.internal.core.dom.parser.upc.UPCExpressionStatementParser;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.upc.UPCNoCastExpressionParser;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.upc.UPCSizeofExpressionParser;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,25 +39,63 @@ import org.eclipse.cdt.internal.core.dom.parser.upc.UPCParsersym;
|
||||||
*/
|
*/
|
||||||
public class UPCParserAction extends C99BuildASTParserAction {
|
public class UPCParserAction extends C99BuildASTParserAction {
|
||||||
|
|
||||||
private final UPCASTNodeFactory nodeFactory;
|
private UPCASTNodeFactory nodeFactory;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO why is the nodeFactory passed as an argument
|
||||||
|
* @param nodeFactory
|
||||||
|
* @param parser
|
||||||
|
* @param tu
|
||||||
|
*/
|
||||||
public UPCParserAction(UPCASTNodeFactory nodeFactory, IParserActionTokenProvider parser, IASTTranslationUnit tu) {
|
public UPCParserAction(UPCASTNodeFactory nodeFactory, IParserActionTokenProvider parser, IASTTranslationUnit tu) {
|
||||||
super(nodeFactory, parser, tu);
|
super(nodeFactory, parser, tu);
|
||||||
this.nodeFactory = nodeFactory;
|
this.nodeFactory = nodeFactory;
|
||||||
|
nodeFactory.setUseC99SizeofExpressions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isCompletionToken(IToken token) {
|
protected boolean isCompletionToken(IToken token) {
|
||||||
return token.getKind() == UPCParsersym.TK_Completion;
|
return token.getKind() == TK_Completion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected IParser getExpressionStatementParser() {
|
||||||
|
return new UPCExpressionStatementParser(parser.getOrderedTerminalSymbols());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected IParser getNoCastExpressionParser() {
|
||||||
|
return new UPCNoCastExpressionParser(parser.getOrderedTerminalSymbols());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected IParser getSizeofExpressionParser() {
|
||||||
|
return new UPCSizeofExpressionParser(parser.getOrderedTerminalSymbols());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************************
|
/**************************************************************************************
|
||||||
* Semantic actions
|
* Semantic actions
|
||||||
**************************************************************************************/
|
**************************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
public void consumeExpressionUnarySizeofOperator(int upcOp) {
|
||||||
|
nodeFactory.setUseUPCSizeofExpressions(upcOp);
|
||||||
|
super.consumeExpressionUnaryOperator(IASTUnaryExpression.op_sizeof);
|
||||||
|
nodeFactory.setUseC99SizeofExpressions();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void consumeExpressionSizeofTypeId(int upcOp) {
|
||||||
|
nodeFactory.setUseUPCSizeofExpressions(upcOp);
|
||||||
|
super.consumeExpressionTypeId(IASTTypeIdExpression.op_sizeof);
|
||||||
|
nodeFactory.setUseC99SizeofExpressions();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* constant ::= 'MYTHREAD' | 'THREADS' | 'UPC_MAX_BLOCKSIZE'
|
* constant ::= 'MYTHREAD' | 'THREADS' | 'UPC_MAX_BLOCKSIZE'
|
||||||
*/
|
*/
|
||||||
|
@ -165,13 +209,13 @@ public class UPCParserAction extends C99BuildASTParserAction {
|
||||||
*/
|
*/
|
||||||
protected void setTokenSpecifier(IUPCASTDeclSpecifier node, IToken token) {
|
protected void setTokenSpecifier(IUPCASTDeclSpecifier node, IToken token) {
|
||||||
switch(token.getKind()) {
|
switch(token.getKind()) {
|
||||||
case UPCParsersym.TK_relaxed:
|
case TK_relaxed:
|
||||||
node.setReferenceType(IUPCASTDeclSpecifier.rt_relaxed);
|
node.setReferenceType(IUPCASTDeclSpecifier.rt_relaxed);
|
||||||
break;
|
break;
|
||||||
case UPCParsersym.TK_strict:
|
case TK_strict:
|
||||||
node.setReferenceType(IUPCASTDeclSpecifier.rt_strict);
|
node.setReferenceType(IUPCASTDeclSpecifier.rt_strict);
|
||||||
break;
|
break;
|
||||||
case UPCParsersym.TK_shared:
|
case TK_shared:
|
||||||
node.setSharedQualifier(IUPCASTDeclSpecifier.sh_shared_default_block_size);
|
node.setSharedQualifier(IUPCASTDeclSpecifier.sh_shared_default_block_size);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
package org.eclipse.cdt.core.dom.upc.ast;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression;
|
|
||||||
|
|
||||||
public interface IUPCASTTypeIdExpression extends IASTTypeIdExpression {
|
|
||||||
|
|
||||||
public final int op_upc_localsizeof = op_last + 1;
|
|
||||||
|
|
||||||
public final int op_upc_blocksizeof = op_last + 2;
|
|
||||||
|
|
||||||
public final int op_upc_elemsizeof = op_last + 3;
|
|
||||||
}
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* 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
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.core.dom.upc.ast;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression;
|
||||||
|
|
||||||
|
public interface IUPCASTTypeIdSizeofExpression extends IASTTypeIdExpression {
|
||||||
|
|
||||||
|
public final int upc_localsizeof = 1;
|
||||||
|
|
||||||
|
public final int upc_blocksizeof = 2;
|
||||||
|
|
||||||
|
public final int upc_elemsizeof = 3;
|
||||||
|
|
||||||
|
|
||||||
|
public int getUPCSizeofOperator();
|
||||||
|
|
||||||
|
public void setUPCSizeofOperator(int upcSizeofOperator);
|
||||||
|
}
|
|
@ -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
|
||||||
|
@ -12,12 +12,17 @@ package org.eclipse.cdt.core.dom.upc.ast;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
|
||||||
|
|
||||||
public interface IUPCASTUnaryExpression extends IASTUnaryExpression {
|
public interface IUPCASTUnarySizeofExpression extends IASTUnaryExpression {
|
||||||
|
|
||||||
public final int op_upc_localsizeof = op_last + 1;
|
public final int upc_localsizeof = 1;
|
||||||
|
|
||||||
public final int op_upc_blocksizeof = op_last + 2;
|
public final int upc_blocksizeof = 2;
|
||||||
|
|
||||||
public final int op_upc_elemsizeof = op_last + 3;
|
public final int upc_elemsizeof = 3;
|
||||||
|
|
||||||
|
|
||||||
|
public int getUPCSizeofOperator();
|
||||||
|
|
||||||
|
public void setUPCSizeofOperator(int upcSizeofOperator);
|
||||||
|
|
||||||
}
|
}
|
|
@ -30,9 +30,8 @@ import org.eclipse.cdt.core.dom.parser.upc.UPCASTNodeFactory;
|
||||||
import org.eclipse.cdt.core.dom.parser.upc.UPCParserAction;
|
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.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.core.dom.upc.ast.IUPCASTUnarySizeofExpression;
|
||||||
|
|
||||||
@SuppressWarnings("all")
|
|
||||||
public class UPCExpressionStatementParser extends PrsStream implements RuleAction , IParserActionTokenProvider, IParser
|
public class UPCExpressionStatementParser extends PrsStream implements RuleAction , IParserActionTokenProvider, IParser
|
||||||
{
|
{
|
||||||
private static ParseTable prs = new UPCExpressionStatementParserprs();
|
private static ParseTable prs = new UPCExpressionStatementParserprs();
|
||||||
|
@ -1281,37 +1280,37 @@ public UPCExpressionStatementParser(String[] mapFrom) { // constructor
|
||||||
//
|
//
|
||||||
// Rule 312: unary_expression ::= upc_localsizeof unary_expression
|
// Rule 312: unary_expression ::= upc_localsizeof unary_expression
|
||||||
//
|
//
|
||||||
case 312: { action. consumeExpressionUnaryOperator(IUPCASTUnaryExpression.op_upc_localsizeof); break;
|
case 312: { action. consumeExpressionUnarySizeofOperator(IUPCASTUnarySizeofExpression.upc_localsizeof); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Rule 313: unary_expression ::= upc_localsizeof ( type_name )
|
// Rule 313: unary_expression ::= upc_localsizeof ( type_name )
|
||||||
//
|
//
|
||||||
case 313: { action. consumeExpressionTypeId(IUPCASTUnaryExpression.op_upc_localsizeof); break;
|
case 313: { action. consumeExpressionSizeofTypeId(IUPCASTUnarySizeofExpression.upc_localsizeof); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Rule 314: unary_expression ::= upc_blocksizeof unary_expression
|
// Rule 314: unary_expression ::= upc_blocksizeof unary_expression
|
||||||
//
|
//
|
||||||
case 314: { action. consumeExpressionUnaryOperator(IUPCASTUnaryExpression.op_upc_blocksizeof); break;
|
case 314: { action. consumeExpressionUnarySizeofOperator(IUPCASTUnarySizeofExpression.upc_blocksizeof); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Rule 315: unary_expression ::= upc_blocksizeof ( type_name )
|
// Rule 315: unary_expression ::= upc_blocksizeof ( type_name )
|
||||||
//
|
//
|
||||||
case 315: { action. consumeExpressionTypeId(IUPCASTUnaryExpression.op_upc_blocksizeof); break;
|
case 315: { action. consumeExpressionSizeofTypeId(IUPCASTUnarySizeofExpression.upc_blocksizeof); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Rule 316: unary_expression ::= upc_elemsizeof unary_expression
|
// Rule 316: unary_expression ::= upc_elemsizeof unary_expression
|
||||||
//
|
//
|
||||||
case 316: { action. consumeExpressionUnaryOperator(IUPCASTUnaryExpression.op_upc_elemsizeof); break;
|
case 316: { action. consumeExpressionUnarySizeofOperator(IUPCASTUnarySizeofExpression.upc_elemsizeof); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Rule 317: unary_expression ::= upc_elemsizeof ( type_name )
|
// Rule 317: unary_expression ::= upc_elemsizeof ( type_name )
|
||||||
//
|
//
|
||||||
case 317: { action. consumeExpressionTypeId(IUPCASTUnaryExpression.op_upc_elemsizeof); break;
|
case 317: { action. consumeExpressionSizeofTypeId(IUPCASTUnarySizeofExpression.upc_elemsizeof); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -30,7 +30,7 @@ import org.eclipse.cdt.core.dom.parser.upc.UPCASTNodeFactory;
|
||||||
import org.eclipse.cdt.core.dom.parser.upc.UPCParserAction;
|
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.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.core.dom.upc.ast.IUPCASTUnarySizeofExpression;
|
||||||
|
|
||||||
public class UPCNoCastExpressionParser extends PrsStream implements RuleAction , IParserActionTokenProvider, IParser
|
public class UPCNoCastExpressionParser extends PrsStream implements RuleAction , IParserActionTokenProvider, IParser
|
||||||
{
|
{
|
||||||
|
@ -1274,37 +1274,37 @@ public UPCNoCastExpressionParser(String[] mapFrom) { // constructor
|
||||||
//
|
//
|
||||||
// Rule 311: unary_expression ::= upc_localsizeof unary_expression
|
// Rule 311: unary_expression ::= upc_localsizeof unary_expression
|
||||||
//
|
//
|
||||||
case 311: { action. consumeExpressionUnaryOperator(IUPCASTUnaryExpression.op_upc_localsizeof); break;
|
case 311: { action. consumeExpressionUnarySizeofOperator(IUPCASTUnarySizeofExpression.upc_localsizeof); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Rule 312: unary_expression ::= upc_localsizeof ( type_name )
|
// Rule 312: unary_expression ::= upc_localsizeof ( type_name )
|
||||||
//
|
//
|
||||||
case 312: { action. consumeExpressionTypeId(IUPCASTUnaryExpression.op_upc_localsizeof); break;
|
case 312: { action. consumeExpressionSizeofTypeId(IUPCASTUnarySizeofExpression.upc_localsizeof); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Rule 313: unary_expression ::= upc_blocksizeof unary_expression
|
// Rule 313: unary_expression ::= upc_blocksizeof unary_expression
|
||||||
//
|
//
|
||||||
case 313: { action. consumeExpressionUnaryOperator(IUPCASTUnaryExpression.op_upc_blocksizeof); break;
|
case 313: { action. consumeExpressionUnarySizeofOperator(IUPCASTUnarySizeofExpression.upc_blocksizeof); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Rule 314: unary_expression ::= upc_blocksizeof ( type_name )
|
// Rule 314: unary_expression ::= upc_blocksizeof ( type_name )
|
||||||
//
|
//
|
||||||
case 314: { action. consumeExpressionTypeId(IUPCASTUnaryExpression.op_upc_blocksizeof); break;
|
case 314: { action. consumeExpressionSizeofTypeId(IUPCASTUnarySizeofExpression.upc_blocksizeof); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Rule 315: unary_expression ::= upc_elemsizeof unary_expression
|
// Rule 315: unary_expression ::= upc_elemsizeof unary_expression
|
||||||
//
|
//
|
||||||
case 315: { action. consumeExpressionUnaryOperator(IUPCASTUnaryExpression.op_upc_elemsizeof); break;
|
case 315: { action. consumeExpressionUnarySizeofOperator(IUPCASTUnarySizeofExpression.upc_elemsizeof); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Rule 316: unary_expression ::= upc_elemsizeof ( type_name )
|
// Rule 316: unary_expression ::= upc_elemsizeof ( type_name )
|
||||||
//
|
//
|
||||||
case 316: { action. consumeExpressionTypeId(IUPCASTUnaryExpression.op_upc_elemsizeof); break;
|
case 316: { action. consumeExpressionSizeofTypeId(IUPCASTUnarySizeofExpression.upc_elemsizeof); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -30,7 +30,7 @@ import org.eclipse.cdt.core.dom.parser.upc.UPCASTNodeFactory;
|
||||||
import org.eclipse.cdt.core.dom.parser.upc.UPCParserAction;
|
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.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.core.dom.upc.ast.IUPCASTUnarySizeofExpression;
|
||||||
|
|
||||||
public class UPCParser extends PrsStream implements RuleAction , IParserActionTokenProvider, IParser
|
public class UPCParser extends PrsStream implements RuleAction , IParserActionTokenProvider, IParser
|
||||||
{
|
{
|
||||||
|
@ -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. consumeExpressionUnaryOperator(IUPCASTUnaryExpression.op_upc_localsizeof); break;
|
case 310: { action. consumeExpressionUnarySizeofOperator(IUPCASTUnarySizeofExpression.upc_localsizeof); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Rule 311: unary_expression ::= upc_localsizeof ( type_name )
|
// Rule 311: unary_expression ::= upc_localsizeof ( type_name )
|
||||||
//
|
//
|
||||||
case 311: { action. consumeExpressionTypeId(IUPCASTUnaryExpression.op_upc_localsizeof); break;
|
case 311: { action. consumeExpressionSizeofTypeId(IUPCASTUnarySizeofExpression.upc_localsizeof); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Rule 312: unary_expression ::= upc_blocksizeof unary_expression
|
// Rule 312: unary_expression ::= upc_blocksizeof unary_expression
|
||||||
//
|
//
|
||||||
case 312: { action. consumeExpressionUnaryOperator(IUPCASTUnaryExpression.op_upc_blocksizeof); break;
|
case 312: { action. consumeExpressionUnarySizeofOperator(IUPCASTUnarySizeofExpression.upc_blocksizeof); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Rule 313: unary_expression ::= upc_blocksizeof ( type_name )
|
// Rule 313: unary_expression ::= upc_blocksizeof ( type_name )
|
||||||
//
|
//
|
||||||
case 313: { action. consumeExpressionTypeId(IUPCASTUnaryExpression.op_upc_blocksizeof); break;
|
case 313: { action. consumeExpressionSizeofTypeId(IUPCASTUnarySizeofExpression.upc_blocksizeof); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Rule 314: unary_expression ::= upc_elemsizeof unary_expression
|
// Rule 314: unary_expression ::= upc_elemsizeof unary_expression
|
||||||
//
|
//
|
||||||
case 314: { action. consumeExpressionUnaryOperator(IUPCASTUnaryExpression.op_upc_elemsizeof); break;
|
case 314: { action. consumeExpressionUnarySizeofOperator(IUPCASTUnarySizeofExpression.upc_elemsizeof); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Rule 315: unary_expression ::= upc_elemsizeof ( type_name )
|
// Rule 315: unary_expression ::= upc_elemsizeof ( type_name )
|
||||||
//
|
//
|
||||||
case 315: { action. consumeExpressionTypeId(IUPCASTUnaryExpression.op_upc_elemsizeof); break;
|
case 315: { action. consumeExpressionSizeofTypeId(IUPCASTUnarySizeofExpression.upc_elemsizeof); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -30,7 +30,7 @@ import org.eclipse.cdt.core.dom.parser.upc.UPCASTNodeFactory;
|
||||||
import org.eclipse.cdt.core.dom.parser.upc.UPCParserAction;
|
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.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.core.dom.upc.ast.IUPCASTUnarySizeofExpression;
|
||||||
|
|
||||||
public class UPCSizeofExpressionParser extends PrsStream implements RuleAction , IParserActionTokenProvider, IParser
|
public class UPCSizeofExpressionParser extends PrsStream implements RuleAction , IParserActionTokenProvider, IParser
|
||||||
{
|
{
|
||||||
|
@ -1274,19 +1274,19 @@ public UPCSizeofExpressionParser(String[] mapFrom) { // constructor
|
||||||
//
|
//
|
||||||
// Rule 311: unary_expression ::= upc_localsizeof unary_expression
|
// Rule 311: unary_expression ::= upc_localsizeof unary_expression
|
||||||
//
|
//
|
||||||
case 311: { action. consumeExpressionUnaryOperator(IUPCASTUnaryExpression.op_upc_localsizeof); break;
|
case 311: { action. consumeExpressionUnarySizeofOperator(IUPCASTUnarySizeofExpression.upc_localsizeof); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Rule 312: unary_expression ::= upc_blocksizeof unary_expression
|
// Rule 312: unary_expression ::= upc_blocksizeof unary_expression
|
||||||
//
|
//
|
||||||
case 312: { action. consumeExpressionUnaryOperator(IUPCASTUnaryExpression.op_upc_blocksizeof); break;
|
case 312: { action. consumeExpressionUnarySizeofOperator(IUPCASTUnarySizeofExpression.upc_blocksizeof); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Rule 313: unary_expression ::= upc_elemsizeof unary_expression
|
// Rule 313: unary_expression ::= upc_elemsizeof unary_expression
|
||||||
//
|
//
|
||||||
case 313: { action. consumeExpressionUnaryOperator(IUPCASTUnaryExpression.op_upc_elemsizeof); break;
|
case 313: { action. consumeExpressionUnarySizeofOperator(IUPCASTUnarySizeofExpression.upc_elemsizeof); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.upc.ast;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
|
||||||
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTTypeIdExpression;
|
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.c.CASTTypeIdExpression;
|
|
||||||
|
|
||||||
@SuppressWarnings("restriction")
|
|
||||||
public class UPCASTTypeIdExpression extends CASTTypeIdExpression implements
|
|
||||||
IUPCASTTypeIdExpression {
|
|
||||||
|
|
||||||
public UPCASTTypeIdExpression() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public UPCASTTypeIdExpression(int op, IASTTypeId typeId) {
|
|
||||||
super(op, typeId);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* 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
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.internal.core.dom.parser.upc.ast;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression;
|
||||||
|
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTTypeIdSizeofExpression;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.c.CASTTypeIdExpression;
|
||||||
|
|
||||||
|
@SuppressWarnings("restriction")
|
||||||
|
public class UPCASTTypeIdSizeofExpression extends CASTTypeIdExpression implements IUPCASTTypeIdSizeofExpression {
|
||||||
|
|
||||||
|
private int upcSizeofOperator;
|
||||||
|
|
||||||
|
public UPCASTTypeIdSizeofExpression() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public UPCASTTypeIdSizeofExpression(IASTTypeId typeId) {
|
||||||
|
super(IASTTypeIdExpression.op_sizeof, typeId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public UPCASTTypeIdSizeofExpression(int upcSizeofOperator, IASTTypeId typeId) {
|
||||||
|
super(IASTTypeIdExpression.op_sizeof, typeId);
|
||||||
|
this.upcSizeofOperator = upcSizeofOperator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getUPCSizeofOperator() {
|
||||||
|
return upcSizeofOperator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUPCSizeofOperator(int upcSizeofOperator) {
|
||||||
|
this.upcSizeofOperator = upcSizeofOperator;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,26 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* 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
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.upc.ast;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
|
||||||
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTUnaryExpression;
|
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.c.CASTUnaryExpression;
|
|
||||||
|
|
||||||
@SuppressWarnings("restriction")
|
|
||||||
public class UPCASTUnaryExpression extends CASTUnaryExpression implements IUPCASTUnaryExpression {
|
|
||||||
|
|
||||||
public UPCASTUnaryExpression() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public UPCASTUnaryExpression(int operator, IASTExpression operand) {
|
|
||||||
super(operator, operand);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* 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
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.internal.core.dom.parser.upc.ast;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
|
||||||
|
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTUnarySizeofExpression;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.parser.c.CASTUnaryExpression;
|
||||||
|
|
||||||
|
@SuppressWarnings("restriction")
|
||||||
|
public class UPCASTUnarySizeofExpression extends CASTUnaryExpression implements IUPCASTUnarySizeofExpression {
|
||||||
|
|
||||||
|
private int upcSizeofOperator;
|
||||||
|
|
||||||
|
|
||||||
|
public UPCASTUnarySizeofExpression() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public UPCASTUnarySizeofExpression(IASTExpression operand) {
|
||||||
|
super(IASTUnaryExpression.op_sizeof, operand);
|
||||||
|
}
|
||||||
|
|
||||||
|
public UPCASTUnarySizeofExpression(int upcSizeofOperator, IASTExpression operand) {
|
||||||
|
super(IASTUnaryExpression.op_sizeof, operand);
|
||||||
|
this.upcSizeofOperator = upcSizeofOperator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getUPCSizeofOperator() {
|
||||||
|
return upcSizeofOperator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUPCSizeofOperator(int upcSizeofOperator) {
|
||||||
|
this.upcSizeofOperator = upcSizeofOperator;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue