mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-21 21:52:10 +02:00
RESOLVED - bug 183848: add parser for Unified Parallel C
https://bugs.eclipse.org/bugs/show_bug.cgi?id=183848 Patch from Mike Kucera
This commit is contained in:
parent
5a24d7c682
commit
53b7411eeb
36 changed files with 5890 additions and 0 deletions
7
upc/org.eclipse.cdt.core.parser.upc/.classpath
Normal file
7
upc/org.eclipse.cdt.core.parser.upc/.classpath
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
34
upc/org.eclipse.cdt.core.parser.upc/.project
Normal file
34
upc/org.eclipse.cdt.core.parser.upc/.project
Normal file
|
@ -0,0 +1,34 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>org.eclipse.cdt.core.parser.upc</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>net.sourceforge.metrics.builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>net.sourceforge.metrics.nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
16
upc/org.eclipse.cdt.core.parser.upc/META-INF/MANIFEST.MF
Normal file
16
upc/org.eclipse.cdt.core.parser.upc/META-INF/MANIFEST.MF
Normal file
|
@ -0,0 +1,16 @@
|
|||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %Bundle-Name.1
|
||||
Bundle-SymbolicName: org.eclipse.cdt.core.parser.upc;singleton:=true
|
||||
Bundle-Version: 1.0.0
|
||||
Bundle-ClassPath: .
|
||||
Require-Bundle: org.eclipse.cdt.core,
|
||||
net.sourceforge.lpg.lpgjavaruntime;bundle-version="1.1.0";visibility:=reexport,
|
||||
org.eclipse.core.runtime,
|
||||
org.eclipse.cdt.core.parser.c99
|
||||
Export-Package: org.eclipse.cdt.core.dom.upc,
|
||||
org.eclipse.cdt.core.dom.upc.ast,
|
||||
org.eclipse.cdt.internal.core.dom.parser.upc;x-internal:=true,
|
||||
org.eclipse.cdt.internal.core.dom.parser.upc.ast;x-internal:=true
|
||||
Bundle-Localization: plugin
|
||||
Bundle-Vendor: %Bundle-Vendor.0
|
24
upc/org.eclipse.cdt.core.parser.upc/about.html
Normal file
24
upc/org.eclipse.cdt.core.parser.upc/about.html
Normal file
|
@ -0,0 +1,24 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"><head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>About</title></head>
|
||||
|
||||
<body lang="EN-US">
|
||||
<h2>About This Content</h2>
|
||||
|
||||
<p>February 8, 2007</p>
|
||||
<h3>License</h3>
|
||||
|
||||
<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
|
||||
indicated below, the Content is provided to you under the terms and conditions of the
|
||||
Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
|
||||
at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
|
||||
For purposes of the EPL, "Program" will mean the Content.</p>
|
||||
|
||||
<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
|
||||
being redistributed by another party ("Redistributor") and different terms and conditions may
|
||||
apply to your use of any object code in the Content. Check the Redistributor's license that was
|
||||
provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
|
||||
indicated below, the terms and conditions of the EPL still apply to any source code in the Content
|
||||
and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
|
||||
|
||||
</body></html>
|
7
upc/org.eclipse.cdt.core.parser.upc/build.properties
Normal file
7
upc/org.eclipse.cdt.core.parser.upc/build.properties
Normal file
|
@ -0,0 +1,7 @@
|
|||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
about.html,\
|
||||
plugin.properties,\
|
||||
plugin.xml
|
4
upc/org.eclipse.cdt.core.parser.upc/plugin.properties
Normal file
4
upc/org.eclipse.cdt.core.parser.upc/plugin.properties
Normal file
|
@ -0,0 +1,4 @@
|
|||
# properties file for org.eclipse.cdt.core.parser.c99
|
||||
Bundle-Name.0 = C99 Parser Plug-in
|
||||
Bundle-Vendor.0 = Eclipse.org
|
||||
Bundle-Name.1 = C99 Parser Plug-in
|
26
upc/org.eclipse.cdt.core.parser.upc/plugin.xml
Normal file
26
upc/org.eclipse.cdt.core.parser.upc/plugin.xml
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?eclipse version="3.2"?>
|
||||
<plugin>
|
||||
|
||||
|
||||
<extension point="org.eclipse.core.runtime.contentTypes">
|
||||
<content-type id="upcSource" name="%upcSourceName"
|
||||
base-type="org.eclipse.cdt.core.cSource"
|
||||
file-extensions="upc"
|
||||
priority="high"/>
|
||||
</extension>
|
||||
|
||||
<extension point="org.eclipse.cdt.core.language">
|
||||
<language
|
||||
class="org.eclipse.cdt.core.dom.upc.UPCLanguage"
|
||||
id="upc"
|
||||
name="UPC">
|
||||
<contentType id="org.eclipse.cdt.core.parser.upc.upcSource"/>
|
||||
</language>
|
||||
<pdomLinkageFactory
|
||||
class="org.eclipse.cdt.internal.core.pdom.dom.c.PDOMCLinkageFactory"
|
||||
id="upc"/>
|
||||
</extension>
|
||||
|
||||
|
||||
</plugin>
|
|
@ -0,0 +1,83 @@
|
|||
/*******************************************************************************
|
||||
* 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.core.dom.parser.upc;
|
||||
|
||||
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.ICASTEnumerationSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.c.ICASTTypedefNameSpecifier;
|
||||
import org.eclipse.cdt.core.dom.parser.c99.C99ASTNodeFactory;
|
||||
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.IUPCASTSizeofExpression;
|
||||
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTSynchronizationStatement;
|
||||
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.UPCASTEnumerationSpecifier;
|
||||
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.UPCASTSimpleDeclSpecifier;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.upc.ast.UPCASTSizeofExpression;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.upc.ast.UPCASTSynchronizationStatement;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.upc.ast.UPCASTTypedefNameSpecifier;
|
||||
|
||||
|
||||
/**
|
||||
* Creates AST nodes that are specific to the UPC parser.
|
||||
*
|
||||
* The methods in ASTNodeFactory that build nodes for declaration
|
||||
* specifiers are overridden here to replace thos nodes with the UPC nodes for
|
||||
* declaration specifiers. These UPC specific nodes add support
|
||||
* for 'strict', 'relaxed' and 'shared'.
|
||||
*/
|
||||
public class UPCASTNodeFactory extends C99ASTNodeFactory {
|
||||
|
||||
public IUPCASTKeywordExpression newKeywordExpression() {
|
||||
return new UPCASTKeywordExpression();
|
||||
}
|
||||
|
||||
public IUPCASTSizeofExpression newSizeofExpression() {
|
||||
return new UPCASTSizeofExpression();
|
||||
}
|
||||
|
||||
public IUPCASTSynchronizationStatement newSyncronizationStatment() {
|
||||
return new UPCASTSynchronizationStatement();
|
||||
}
|
||||
|
||||
public IUPCASTForallStatement newForallStatement() {
|
||||
return new UPCASTForallStatement();
|
||||
}
|
||||
|
||||
/**
|
||||
* Override to return UPC version of decl specifier.
|
||||
*/
|
||||
public ICASTSimpleDeclSpecifier newCSimpleDeclSpecifier() {
|
||||
return new UPCASTSimpleDeclSpecifier();
|
||||
}
|
||||
|
||||
public ICASTCompositeTypeSpecifier newCCompositeTypeSpecifier() {
|
||||
return new UPCASTCompositeTypeSpecifier();
|
||||
}
|
||||
|
||||
public ICASTElaboratedTypeSpecifier newCElaboratedTypeSpecifier() {
|
||||
return new UPCASTElaboratedTypeSpecifier();
|
||||
}
|
||||
|
||||
public ICASTEnumerationSpecifier newCEnumerationSpecifier() {
|
||||
return new UPCASTEnumerationSpecifier();
|
||||
}
|
||||
|
||||
public ICASTTypedefNameSpecifier newCTypedefNameSpecifier() {
|
||||
return new UPCASTTypedefNameSpecifier();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
/*******************************************************************************
|
||||
* 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.core.dom.parser.upc;
|
||||
|
||||
import org.eclipse.cdt.core.dom.parser.c99.C99KeywordMap;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.upc.UPCParsersym;
|
||||
|
||||
|
||||
/**
|
||||
* Provides UPC specific keywords in addition to the C99 keywords.
|
||||
*
|
||||
* Keyword token mappings from the superclass must be overridden.
|
||||
*
|
||||
* @author Mike Kucera
|
||||
*/
|
||||
public class UPCKeywordMap extends C99KeywordMap {
|
||||
|
||||
|
||||
public static final String
|
||||
MYTHREAD = "MYTHREAD",//$NON-NLS-1$
|
||||
THREADS = "THREADS",//$NON-NLS-1$
|
||||
UPC_MAX_BLOCKSIZE = "UPC",//$NON-NLS-1$
|
||||
relaxed = "relaxed",//$NON-NLS-1$
|
||||
shared = "shared",//$NON-NLS-1$
|
||||
strict = "strict",//$NON-NLS-1$
|
||||
upc_barrier = "upc_barrier",//$NON-NLS-1$
|
||||
upc_localsizeof = "upc_localsizeof",//$NON-NLS-1$
|
||||
upc_blocksizeof = "upc_blocksizeof",//$NON-NLS-1$
|
||||
upc_elemsizeof = "upc_elemsizeof",//$NON-NLS-1$
|
||||
upc_notify = "upc_notify",//$NON-NLS-1$
|
||||
upc_fence = "upc_fence",//$NON-NLS-1$
|
||||
upc_wait = "upc_wait",//$NON-NLS-1$
|
||||
upc_forall = "upc_forall";//$NON-NLS-1$
|
||||
|
||||
|
||||
public UPCKeywordMap() {
|
||||
putKeyword(MYTHREAD, UPCParsersym.TK_MYTHREAD);
|
||||
putKeyword(THREADS, UPCParsersym.TK_THREADS);
|
||||
putKeyword(UPC_MAX_BLOCKSIZE, UPCParsersym.TK_UPC_MAX_BLOCKSIZE);
|
||||
putKeyword(relaxed, UPCParsersym.TK_relaxed);
|
||||
putKeyword(shared, UPCParsersym.TK_shared);
|
||||
putKeyword(strict, UPCParsersym.TK_strict);
|
||||
putKeyword(upc_barrier, UPCParsersym.TK_upc_barrier);
|
||||
putKeyword(upc_localsizeof, UPCParsersym.TK_upc_localsizeof);
|
||||
putKeyword(upc_blocksizeof, UPCParsersym.TK_upc_blocksizeof);
|
||||
putKeyword(upc_elemsizeof, UPCParsersym.TK_upc_elemsizeof);
|
||||
putKeyword(upc_notify, UPCParsersym.TK_upc_notify);
|
||||
putKeyword(upc_fence, UPCParsersym.TK_upc_fence);
|
||||
putKeyword(upc_wait, UPCParsersym.TK_upc_wait);
|
||||
putKeyword(upc_forall, UPCParsersym.TK_upc_forall);
|
||||
|
||||
// The keyword token mappings from the superclass must be overridden.
|
||||
// This is because LPG generates totally different values for token
|
||||
// kinds every time you genereate a parser.
|
||||
putKeyword(AUTO, UPCParsersym.TK_auto);
|
||||
putKeyword(BREAK, UPCParsersym.TK_break);
|
||||
putKeyword(CASE, UPCParsersym.TK_case);
|
||||
putKeyword(CHAR, UPCParsersym.TK_char);
|
||||
putKeyword(CONST, UPCParsersym.TK_const);
|
||||
putKeyword(CONTINUE, UPCParsersym.TK_continue);
|
||||
putKeyword(DEFAULT, UPCParsersym.TK_default);
|
||||
putKeyword(DO, UPCParsersym.TK_do);
|
||||
putKeyword(DOUBLE, UPCParsersym.TK_double);
|
||||
putKeyword(ELSE, UPCParsersym.TK_else);
|
||||
putKeyword(ENUM, UPCParsersym.TK_enum);
|
||||
putKeyword(EXTERN, UPCParsersym.TK_extern);
|
||||
putKeyword(FLOAT, UPCParsersym.TK_float);
|
||||
putKeyword(FOR, UPCParsersym.TK_for);
|
||||
putKeyword(GOTO, UPCParsersym.TK_goto);
|
||||
putKeyword(IF, UPCParsersym.TK_if);
|
||||
putKeyword(INLINE, UPCParsersym.TK_inline);
|
||||
putKeyword(INT, UPCParsersym.TK_int);
|
||||
putKeyword(LONG, UPCParsersym.TK_long);
|
||||
putKeyword(REGISTER, UPCParsersym.TK_register);
|
||||
putKeyword(RESTRICT, UPCParsersym.TK_restrict);
|
||||
putKeyword(RETURN, UPCParsersym.TK_return);
|
||||
putKeyword(SHORT, UPCParsersym.TK_short);
|
||||
putKeyword(SIGNED, UPCParsersym.TK_signed);
|
||||
putKeyword(SIZEOF, UPCParsersym.TK_sizeof);
|
||||
putKeyword(STATIC, UPCParsersym.TK_static);
|
||||
putKeyword(STRUCT, UPCParsersym.TK_struct);
|
||||
putKeyword(SWITCH, UPCParsersym.TK_switch);
|
||||
putKeyword(TYPEDEF, UPCParsersym.TK_typedef);
|
||||
putKeyword(UNION, UPCParsersym.TK_union);
|
||||
putKeyword(UNSIGNED, UPCParsersym.TK_unsigned);
|
||||
putKeyword(VOID, UPCParsersym.TK_void);
|
||||
putKeyword(VOLATILE, UPCParsersym.TK_volatile);
|
||||
putKeyword(WHILE, UPCParsersym.TK_while);
|
||||
putKeyword(_BOOL, UPCParsersym.TK__Bool);
|
||||
putKeyword(_COMPLEX, UPCParsersym.TK__Complex);
|
||||
putKeyword(_IMAGINARY, UPCParsersym.TK__Imaginary);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,304 @@
|
|||
/*******************************************************************************
|
||||
* 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.core.dom.parser.upc;
|
||||
|
||||
import lpg.lpgjavaruntime.IToken;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarationStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTExpressionStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.c.ICASTDeclSpecifier;
|
||||
import org.eclipse.cdt.core.dom.c99.IASTNodeFactory;
|
||||
import org.eclipse.cdt.core.dom.c99.IParserActionTokenProvider;
|
||||
import org.eclipse.cdt.core.dom.parser.c99.ASTStack;
|
||||
import org.eclipse.cdt.core.dom.parser.c99.C99ParserAction;
|
||||
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTDeclSpecifier;
|
||||
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTForallStatement;
|
||||
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTKeywordExpression;
|
||||
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTSizeofExpression;
|
||||
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTSynchronizationStatement;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.upc.UPCParsersym;
|
||||
|
||||
|
||||
/**
|
||||
* Extension to the C99ParserAction that adds support fot building
|
||||
* an AST with UPC specific nodes.
|
||||
*/
|
||||
public class UPCParserAction extends C99ParserAction {
|
||||
|
||||
private final UPCASTNodeFactory nodeFactory;
|
||||
private final ASTStack astStack;
|
||||
|
||||
|
||||
public UPCParserAction(IParserActionTokenProvider parser, String[] orderedTerminalSymbols) {
|
||||
super(parser, orderedTerminalSymbols);
|
||||
this.astStack = super.getASTStack();
|
||||
this.nodeFactory = (UPCASTNodeFactory) super.getNodeFactory();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds support for UPC specific nodes.
|
||||
* Some of the methods in UPCASTNodeFactory are overrides
|
||||
* and are called up in C99ParserAction.
|
||||
*/
|
||||
protected IASTNodeFactory createNodeFactory() {
|
||||
return new UPCASTNodeFactory();
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************************
|
||||
* Semantic actions
|
||||
**************************************************************************************/
|
||||
|
||||
|
||||
/**
|
||||
* constant ::= 'MYTHREAD' | 'THREADS' | 'UPC_MAX_BLOCKSIZE'
|
||||
*/
|
||||
public void consumeKeywordExpression(int keywordKind) {
|
||||
IUPCASTKeywordExpression expr = nodeFactory.newKeywordExpression();
|
||||
expr.setKeywordKind(keywordKind);
|
||||
setOffsetAndLength(expr);
|
||||
astStack.push(expr);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* unary_expression ::= 'upc_localsizeof' unary_expression
|
||||
* | 'upc_blocksizeof' unary_expression
|
||||
* | 'upc_elemsizeof' unary_expression
|
||||
*/
|
||||
public void consumeExpressionUpcSizeofOperator(int sizeofOp) {
|
||||
IUPCASTSizeofExpression expr = nodeFactory.newSizeofExpression();
|
||||
expr.setUPCSizeofOperator(sizeofOp);
|
||||
|
||||
IASTExpression operand = (IASTExpression) astStack.pop();
|
||||
expr.setOperand(operand);
|
||||
operand.setParent(expr);
|
||||
operand.setPropertyInParent(IASTUnaryExpression.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();
|
||||
|
||||
expr.setTypeId(typeId);
|
||||
typeId.setParent(expr);
|
||||
typeId.setPropertyInParent(IASTTypeIdExpression.TYPE_ID);
|
||||
setOffsetAndLength(expr);
|
||||
|
||||
astStack.push(expr);
|
||||
consumeExpressionUpcSizeofOperator(sizeofOp);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* synchronization_statement ::= 'upc_notify' expression ';'
|
||||
* | 'upc_notify' ';'
|
||||
* | 'upc_wait' expression ';'
|
||||
* | 'upc_wait' ';'
|
||||
* | 'upc_barrier' expression ';'
|
||||
* | 'upc_barrier' ';'
|
||||
* | 'upc_fence' ';'
|
||||
*/
|
||||
public void consumeStatementSynchronizationStatement(int statementKind, boolean hasBarrierExpr) {
|
||||
IUPCASTSynchronizationStatement statement = nodeFactory.newSyncronizationStatment();
|
||||
statement.setStatementKind(statementKind);
|
||||
|
||||
if(hasBarrierExpr) {
|
||||
IASTExpression barrierExpression = (IASTExpression) astStack.pop();
|
||||
statement.setBarrierExpression(barrierExpression);
|
||||
barrierExpression.setParent(statement);
|
||||
barrierExpression.setPropertyInParent(IUPCASTSynchronizationStatement.BARRIER_EXPRESSION);
|
||||
}
|
||||
|
||||
setOffsetAndLength(statement);
|
||||
astStack.push(statement);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* iteration_statement
|
||||
* ::= 'upc_forall' '(' expression ';' expression ';' expression ';' affinity ')' statement
|
||||
* | 'upc_forall' '(' declaration expression ';' expression ';' affinity ')' statement
|
||||
*/
|
||||
public void consumeStatementUPCForallLoop(boolean hasExpr1, boolean hasExpr2, boolean hasExpr3, boolean hasAffinity) {
|
||||
IUPCASTForallStatement forStat = nodeFactory.newForallStatement();
|
||||
|
||||
IASTStatement body = (IASTStatement) astStack.pop();
|
||||
forStat.setBody(body);
|
||||
body.setParent(forStat);
|
||||
body.setPropertyInParent(IUPCASTForallStatement.BODY);
|
||||
|
||||
if(hasAffinity) {
|
||||
Object o = astStack.pop();
|
||||
if(o instanceof IASTExpression) {
|
||||
IASTExpression expr = (IASTExpression)o;
|
||||
forStat.setAffinityExpression(expr);
|
||||
expr.setParent(forStat);
|
||||
expr.setPropertyInParent(IUPCASTForallStatement.AFFINITY);
|
||||
}
|
||||
if(o instanceof IToken) {
|
||||
IToken token = (IToken) o;
|
||||
assert token.getKind() == UPCParsersym.TK_continue;
|
||||
forStat.setAffinityContinue(true);
|
||||
}
|
||||
}
|
||||
|
||||
if(hasExpr3) {
|
||||
IASTExpression expr = (IASTExpression) astStack.pop();
|
||||
forStat.setIterationExpression(expr);
|
||||
expr.setParent(forStat);
|
||||
expr.setPropertyInParent(IUPCASTForallStatement.ITERATION);
|
||||
}
|
||||
|
||||
if(hasExpr2) {
|
||||
IASTExpression expr = (IASTExpression) astStack.pop();
|
||||
forStat.setConditionExpression(expr);
|
||||
expr.setParent(forStat);
|
||||
expr.setPropertyInParent(IUPCASTForallStatement.CONDITION);
|
||||
}
|
||||
|
||||
if(hasExpr1) { // may be an expression or a declaration
|
||||
IASTNode node = (IASTNode) astStack.pop();
|
||||
|
||||
if(node instanceof IASTExpression) {
|
||||
IASTExpressionStatement stat = nodeFactory.newExpressionStatement();
|
||||
IASTExpression expr = (IASTExpression)node;
|
||||
stat.setExpression(expr);
|
||||
expr.setParent(stat);
|
||||
expr.setPropertyInParent(IASTExpressionStatement.EXPFRESSION);
|
||||
|
||||
forStat.setInitializerStatement(stat);
|
||||
stat.setParent(forStat);
|
||||
stat.setPropertyInParent(IUPCASTForallStatement.INITIALIZER);
|
||||
}
|
||||
else if(node instanceof IASTDeclaration) {
|
||||
IASTDeclarationStatement stat = nodeFactory.newDeclarationStatement();
|
||||
IASTDeclaration declaration = (IASTDeclaration)node;
|
||||
stat.setDeclaration(declaration);
|
||||
declaration.setParent(stat);
|
||||
declaration.setPropertyInParent(IASTDeclarationStatement.DECLARATION);
|
||||
|
||||
forStat.setInitializerStatement(stat);
|
||||
stat.setParent(forStat);
|
||||
stat.setPropertyInParent(IUPCASTForallStatement.INITIALIZER);
|
||||
}
|
||||
}
|
||||
else {
|
||||
forStat.setInitializerStatement(nodeFactory.newNullStatement());
|
||||
}
|
||||
|
||||
setOffsetAndLength(forStat);
|
||||
astStack.push(forStat);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Temporary object used during the parsing of UPC declaration specifiers.
|
||||
* Stored temporarily on the astStack, but does not become part of the AST.
|
||||
* Makes parsing of layout qualifiers easier.
|
||||
*
|
||||
* @author Mike
|
||||
*/
|
||||
private static class UPCParserActionLayoutQualifier {
|
||||
public boolean hasStar = false;
|
||||
public IASTExpression expression = null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* layout_qualifier ::= '[' constant_expression ']'
|
||||
* | '[' '*' ']'
|
||||
* | '[' ']'
|
||||
*/
|
||||
public void consumeLayoutQualifier(boolean hasExpression, boolean hasStar) {
|
||||
UPCParserActionLayoutQualifier layoutQualifier = new UPCParserActionLayoutQualifier();
|
||||
layoutQualifier.hasStar = hasStar;
|
||||
if(hasExpression) {
|
||||
layoutQualifier.expression = (IASTExpression) astStack.pop();
|
||||
}
|
||||
astStack.push(layoutQualifier);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Overrides setSpecifier to add support for temporary layout qualifier nodes.
|
||||
*/
|
||||
protected void setSpecifier(ICASTDeclSpecifier declSpec, Object o) {
|
||||
if(o instanceof IToken)
|
||||
setTokenSpecifier((IUPCASTDeclSpecifier)declSpec, (IToken)o);
|
||||
else
|
||||
setLayoutQualifier((IUPCASTDeclSpecifier)declSpec, (UPCParserActionLayoutQualifier) o);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Support for new declaration specifier keywords.
|
||||
*
|
||||
* 'shared' without [] is handled here
|
||||
* 'shared' with [] is handled in setLayoutQualifier().
|
||||
*/
|
||||
protected void setTokenSpecifier(IUPCASTDeclSpecifier node, IToken token) {
|
||||
switch(token.getKind()) {
|
||||
case UPCParsersym.TK_relaxed:
|
||||
node.setReferenceType(IUPCASTDeclSpecifier.rt_relaxed);
|
||||
break;
|
||||
case UPCParsersym.TK_strict:
|
||||
node.setReferenceType(IUPCASTDeclSpecifier.rt_strict);
|
||||
break;
|
||||
case UPCParsersym.TK_shared:
|
||||
node.setSharedQualifier(IUPCASTDeclSpecifier.sh_shared_default_block_size);
|
||||
break;
|
||||
default:
|
||||
super.setSpecifier(node, token);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handles layout qualifiers with block size specified.
|
||||
*/
|
||||
protected void setLayoutQualifier(IUPCASTDeclSpecifier node, UPCParserActionLayoutQualifier layoutQualifier) {
|
||||
if(layoutQualifier.hasStar) {
|
||||
node.setSharedQualifier(IUPCASTDeclSpecifier.sh_shared_pure_allocation);
|
||||
}
|
||||
else if(layoutQualifier.expression != null) {
|
||||
node.setSharedQualifier(IUPCASTDeclSpecifier.sh_shared_constant_expression);
|
||||
IASTExpression expr = layoutQualifier.expression;
|
||||
node.setBlockSizeExpression(expr);
|
||||
expr.setParent(node);
|
||||
expr.setPropertyInParent(IUPCASTDeclSpecifier.BLOCK_SIZE_EXPRESSION);
|
||||
}
|
||||
else {
|
||||
node.setSharedQualifier(IUPCASTDeclSpecifier.sh_shared_indefinite_allocation);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
/*******************************************************************************
|
||||
* 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.core.dom.upc;
|
||||
|
||||
import org.eclipse.cdt.core.dom.c99.C99Language;
|
||||
import org.eclipse.cdt.core.dom.c99.IParser;
|
||||
import org.eclipse.cdt.core.dom.parser.c99.C99KeywordMap;
|
||||
import org.eclipse.cdt.core.dom.parser.upc.UPCKeywordMap;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.upc.UPCParser;
|
||||
|
||||
|
||||
/**
|
||||
* Implementation of the ILanguage extension point, adds UPC as a language to CDT.
|
||||
*
|
||||
* Just hooks into C99Language and provides UPC specifier parser and keyword map.
|
||||
*
|
||||
* @author Mike Kucera
|
||||
*/
|
||||
public class UPCLanguage extends C99Language {
|
||||
|
||||
// TODO: this should probably go somewhere else
|
||||
public static final String PLUGIN_ID = "org.eclipse.cdt.core.parser.c99"; //$NON-NLS-1$
|
||||
public static final String ID = PLUGIN_ID + ".upc"; //$NON-NLS-1$
|
||||
|
||||
private static UPCKeywordMap keywordMap = new UPCKeywordMap();
|
||||
|
||||
|
||||
|
||||
public String getId() {
|
||||
return ID;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
// TODO: this has to be read from a message bundle
|
||||
return "UPC";//$NON-NLS-1$
|
||||
}
|
||||
|
||||
|
||||
protected IParser getParser() {
|
||||
return new UPCParser();
|
||||
}
|
||||
|
||||
public C99KeywordMap getKeywordMap() {
|
||||
return keywordMap;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
/*******************************************************************************
|
||||
* 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.core.dom.upc.ast;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.c.ICASTCompositeTypeSpecifier;
|
||||
|
||||
public interface IUPCASTCompositeTypeSpecifier extends
|
||||
IUPCASTDeclSpecifier, ICASTCompositeTypeSpecifier {
|
||||
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/*******************************************************************************
|
||||
* 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.core.dom.upc.ast;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.c.ICASTDeclSpecifier;
|
||||
|
||||
public interface IUPCASTDeclSpecifier extends ICASTDeclSpecifier {
|
||||
|
||||
public static final ASTNodeProperty BLOCK_SIZE_EXPRESSION = new ASTNodeProperty(
|
||||
"IUPCASTDeclSpecifier.BLOCK_SIZE_EXPRESSION - IUPCASTDeclSpecifier block size expression"); //$NON-NLS-1
|
||||
|
||||
|
||||
public static final int rt_unspecified = 0;
|
||||
|
||||
public static final int rt_strict = 1;
|
||||
|
||||
public static final int rt_relaxed = 2;
|
||||
|
||||
|
||||
|
||||
public static final int sh_not_shared = 0;
|
||||
|
||||
public static final int sh_shared_default_block_size = 1;
|
||||
|
||||
public static final int sh_shared_pure_allocation = 2;
|
||||
|
||||
public static final int sh_shared_indefinite_allocation = 3;
|
||||
|
||||
public static final int sh_shared_constant_expression = 4;
|
||||
|
||||
|
||||
|
||||
public int getReferenceType();
|
||||
|
||||
public void setReferenceType(int referenceType);
|
||||
|
||||
|
||||
|
||||
public int getSharedQualifier();
|
||||
|
||||
public void setSharedQualifier(int shared);
|
||||
|
||||
|
||||
|
||||
public IASTExpression getBlockSizeExpression();
|
||||
|
||||
public void setBlockSizeExpression(IASTExpression expr);
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
/*******************************************************************************
|
||||
* 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.core.dom.upc.ast;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.c.ICASTElaboratedTypeSpecifier;
|
||||
|
||||
public interface IUPCASTElaboratedTypeSpecifier extends IUPCASTDeclSpecifier,
|
||||
ICASTElaboratedTypeSpecifier {
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
/*******************************************************************************
|
||||
* 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.core.dom.upc.ast;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.c.ICASTEnumerationSpecifier;
|
||||
|
||||
public interface IUPCASTEnumerationSpecifier extends IUPCASTDeclSpecifier,
|
||||
ICASTEnumerationSpecifier {
|
||||
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
/*******************************************************************************
|
||||
* 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.core.dom.upc.ast;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTForStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
||||
|
||||
public interface IUPCASTForallStatement extends IASTForStatement {
|
||||
|
||||
public static final ASTNodeProperty CONDITION = new ASTNodeProperty(
|
||||
"IUPCASTForallStatement.CONDITION - IASTExpression condition of IUPCASTForallStatement"); //$NON-NLS-1$
|
||||
|
||||
public static final ASTNodeProperty ITERATION = new ASTNodeProperty(
|
||||
"IUPCASTForallStatement.ITERATION - IASTExpression iteration of IUPCASTForallStatement"); //$NON-NLS-1$
|
||||
|
||||
public static final ASTNodeProperty BODY = new ASTNodeProperty(
|
||||
"IUPCASTForallStatement.BODY - IASTStatement body of IUPCASTForallStatement"); //$NON-NLS-1$
|
||||
|
||||
public static final ASTNodeProperty INITIALIZER = new ASTNodeProperty(
|
||||
"IUPCASTForallStatement.INITIALIZER - initializer for IUPCASTForallStatement"); //$NON-NLS-1$
|
||||
|
||||
public static final ASTNodeProperty AFFINITY = new ASTNodeProperty(
|
||||
"IUPCASTForallStatement.AFFINITY - IASTExpression affinity for IUPCASTForallStatement"); //$NON-NLS-1$
|
||||
|
||||
|
||||
public IASTStatement getInitializerStatement();
|
||||
|
||||
public void setInitializerStatement( IASTStatement statement );
|
||||
|
||||
public IASTExpression getConditionExpression();
|
||||
|
||||
public void setConditionExpression(IASTExpression condition);
|
||||
|
||||
public IASTExpression getIterationExpression();
|
||||
|
||||
public void setIterationExpression(IASTExpression iterator);
|
||||
|
||||
public IASTExpression getAffinityExpresiion();
|
||||
|
||||
public void setAffinityExpression(IASTExpression affinity);
|
||||
|
||||
public boolean isAffinityContinue();
|
||||
|
||||
public void setAffinityContinue(boolean affinityContinue);
|
||||
|
||||
public IASTStatement getBody();
|
||||
|
||||
public void setBody(IASTStatement statement);
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
/*******************************************************************************
|
||||
* 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.core.dom.upc.ast;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||
|
||||
public interface IUPCASTKeywordExpression extends IASTExpression {
|
||||
|
||||
public static final int kw_threads = 1;
|
||||
|
||||
public static final int kw_mythread = 2;
|
||||
|
||||
public static final int kw_upc_max_block_size = 3;
|
||||
|
||||
|
||||
public int getKeywordKind();
|
||||
|
||||
public void setKeywordKind(int kind);
|
||||
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/*******************************************************************************
|
||||
* 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.core.dom.upc.ast;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||
|
||||
|
||||
public interface IUPCASTLayoutQualifier {
|
||||
|
||||
|
||||
public boolean isIndefiniteBlockAllocation();
|
||||
|
||||
public void setIndefiniteBlockAllocation(boolean allocation);
|
||||
|
||||
|
||||
public boolean isPureBlockAllocation();
|
||||
|
||||
public void setPureBlockAllocation(boolean allocation);
|
||||
|
||||
|
||||
public IASTExpression getBlockSizeExpression();
|
||||
|
||||
public void setBlockSizeExpression(IASTExpression expr);
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
/*******************************************************************************
|
||||
* 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.core.dom.upc.ast;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier;
|
||||
|
||||
public interface IUPCASTSimpleDeclSpecifier extends IUPCASTDeclSpecifier,
|
||||
ICASTSimpleDeclSpecifier {
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
/*******************************************************************************
|
||||
* 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.core.dom.upc.ast;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
|
||||
|
||||
public interface IUPCASTSizeofExpression extends IASTUnaryExpression {
|
||||
|
||||
public final int op_sizeof = 0;
|
||||
|
||||
public final int op_upc_localsizeof = 1;
|
||||
|
||||
public final int op_upc_blocksizeof = 2;
|
||||
|
||||
public final int op_upc_elemsizeof = 3;
|
||||
|
||||
public void setUPCSizeofOperator(int upcSizeofOperator);
|
||||
|
||||
public int getUPCSizeofOperator();
|
||||
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
/*******************************************************************************
|
||||
* 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.core.dom.upc.ast;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
||||
|
||||
public interface IUPCASTSynchronizationStatement extends IASTStatement {
|
||||
|
||||
|
||||
public static final ASTNodeProperty BARRIER_EXPRESSION = new ASTNodeProperty(
|
||||
"IUPCASTSynchronizationStatement.BARRIER_EXPRESSION - IASTExpression barrier for IUPCASTSynchronizationStatement"); //$NON-NLS-1$
|
||||
|
||||
|
||||
public final int st_upc_notify = 1;
|
||||
|
||||
public final int st_upc_wait = 2;
|
||||
|
||||
public final int st_upc_barrier = 3;
|
||||
|
||||
public final int st_upc_fence = 4;
|
||||
|
||||
|
||||
public IASTExpression getBarrierExpression();
|
||||
|
||||
public void setBarrierExpression(IASTExpression expr);
|
||||
|
||||
public int getStatementKind();
|
||||
|
||||
public void setStatementKind(int kind);
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
/*******************************************************************************
|
||||
* 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.core.dom.upc.ast;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.c.ICASTTypedefNameSpecifier;
|
||||
|
||||
public interface IUPCASTTypedefNameSpecifier extends IUPCASTDeclSpecifier,
|
||||
ICASTTypedefNameSpecifier {
|
||||
|
||||
}
|
|
@ -0,0 +1,252 @@
|
|||
-----------------------------------------------------------------------------------
|
||||
-- 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
|
||||
-----------------------------------------------------------------------------------
|
||||
|
||||
%options la=2
|
||||
%options package=org.eclipse.cdt.internal.core.dom.parser.upc
|
||||
%options template=btParserTemplateD.g
|
||||
%options import_terminals=D:\workspaces\cdt-head2\org.eclipse.cdt.core.parser.c99\src\org\eclipse\cdt\internal\core\dom\parser\c99\C99Lexer.g
|
||||
|
||||
|
||||
-- Unified Parallel C (UPC) is an extension of C99
|
||||
$Import
|
||||
D:\workspaces\cdt-head2\org.eclipse.cdt.core.parser.c99\src\org\eclipse\cdt\internal\core\dom\parser\c99\C99Parser.g
|
||||
$End
|
||||
|
||||
$Globals
|
||||
/.
|
||||
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTKeywordExpression;
|
||||
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTSizeofExpression;
|
||||
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTSynchronizationStatement;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.c99.C99Lexer;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.c99.C99Parsersym;
|
||||
import org.eclipse.cdt.core.dom.parser.upc.UPCKeywordMap;
|
||||
import org.eclipse.cdt.core.dom.parser.upc.UPCParserAction;
|
||||
./
|
||||
$End
|
||||
|
||||
$Define
|
||||
$action_class /. UPCParserAction ./
|
||||
$keyword_map_class /. UPCKeywordMap ./
|
||||
$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
|
||||
-----------------------------------------------------------------------------------
|
||||
|
||||
-- also need to be a pre-defined macro
|
||||
-- THREADS and UPC_MAX_BLOCKSIZE are macros, but I want to be able to recognize
|
||||
-- them in the AST, how do I do this? (getRawSignature() to get the source code and then string compare to THREADS?)
|
||||
-- just use the paths and symbols dialog to add them, good for testing they can be added later by a upc toolchain
|
||||
|
||||
-- map them to integers in the UPCKeywordMap
|
||||
-- override consumeExpressionConstant(IASTLiteralExpression.lk_integer_constant), call toString() onthe token
|
||||
-- and check if its THREADS or UPC_MAX_BLOCKSIZE and create appropriate AST node
|
||||
|
||||
-- but then the value would be lost, its no good, they need to be builtin macros
|
||||
|
||||
constant
|
||||
::= 'MYTHREAD'
|
||||
/.$ba consumeKeywordExpression(IUPCASTKeywordExpression.kw_mythread); $ea./
|
||||
| 'THREADS'
|
||||
/.$ba consumeKeywordExpression(IUPCASTKeywordExpression.kw_threads); $ea./
|
||||
| 'UPC_MAX_BLOCKSIZE'
|
||||
/.$ba consumeKeywordExpression(IUPCASTKeywordExpression.kw_upc_max_block_size); $ea./
|
||||
|
||||
|
||||
-- causes ambiguities because of no type information, solution is SGLR
|
||||
unary_expression
|
||||
::= 'upc_localsizeof' unary_expression
|
||||
/.$ba consumeExpressionUpcSizeofOperator(IUPCASTSizeofExpression.op_upc_localsizeof); $ea./
|
||||
| 'upc_localsizeof' '(' type_name ')'
|
||||
/.$ba consumeExpressionUpcSizeofTypeName(IUPCASTSizeofExpression.op_upc_localsizeof); $ea./
|
||||
| 'upc_blocksizeof' unary_expression
|
||||
/.$ba consumeExpressionUpcSizeofOperator(IUPCASTSizeofExpression.op_upc_blocksizeof); $ea./
|
||||
| 'upc_blocksizeof' '(' type_name ')'
|
||||
/.$ba consumeExpressionUpcSizeofTypeName(IUPCASTSizeofExpression.op_upc_blocksizeof); $ea./
|
||||
| 'upc_elemsizeof' unary_expression
|
||||
/.$ba consumeExpressionUpcSizeofOperator(IUPCASTSizeofExpression.op_upc_elemsizeof); $ea./
|
||||
| 'upc_elemsizeof' '(' type_name ')'
|
||||
/.$ba consumeExpressionUpcSizeofTypeName(IUPCASTSizeofExpression.op_upc_elemsizeof); $ea./
|
||||
|
||||
|
||||
-----------------------------------------------------------------------------------
|
||||
-- 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' /.$ba consumeToken(); $ea./
|
||||
|
||||
reference_type_qualifier
|
||||
::= 'relaxed' /.$ba consumeToken(); $ea./
|
||||
| 'strict' /.$ba consumeToken(); $ea./
|
||||
|
||||
layout_qualifier
|
||||
::= '[' constant_expression ']'
|
||||
/.$ba consumeLayoutQualifier(true, false); $ea./
|
||||
| '[' '*' ']'
|
||||
/.$ba consumeLayoutQualifier(false, true); $ea./
|
||||
| '[' ']'
|
||||
/.$ba consumeLayoutQualifier(false, false); $ea./
|
||||
|
||||
|
||||
|
||||
-----------------------------------------------------------------------------------
|
||||
-- Statements
|
||||
-----------------------------------------------------------------------------------
|
||||
|
||||
statement
|
||||
::= synchronization_statement
|
||||
|
||||
synchronization_statement
|
||||
::= 'upc_notify' expression ';'
|
||||
/.$ba consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_notify, true); $ea./
|
||||
| 'upc_notify' ';'
|
||||
/.$ba consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_notify, false); $ea./
|
||||
| 'upc_wait' expression ';'
|
||||
/.$ba consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_wait, true); $ea./
|
||||
| 'upc_wait' ';'
|
||||
/.$ba consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_wait, false); $ea./
|
||||
| 'upc_barrier' expression ';'
|
||||
/.$ba consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_barrier, true); $ea./
|
||||
| 'upc_barrier' ';'
|
||||
/.$ba consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_barrier, false); $ea./
|
||||
| 'upc_fence' ';'
|
||||
/.$ba consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_fence, false); $ea./
|
||||
|
||||
|
||||
iteration_statement
|
||||
::= 'upc_forall' '(' expression ';' expression ';' expression ';' affinity ')' statement
|
||||
/.$ba consumeStatementUPCForallLoop(true, true, true, true); $ea./
|
||||
|
||||
| 'upc_forall' '(' expression ';' expression ';' expression ';' ')' statement
|
||||
/.$ba consumeStatementUPCForallLoop(true, true, true, false); $ea./
|
||||
|
||||
| 'upc_forall' '(' expression ';' expression ';' ';' affinity ')' statement
|
||||
/.$ba consumeStatementUPCForallLoop(true, true, false, true); $ea./
|
||||
|
||||
| 'upc_forall' '(' expression ';' expression ';' ';' ')' statement
|
||||
/.$ba consumeStatementUPCForallLoop(true, true, false, false); $ea./
|
||||
|
||||
| 'upc_forall' '(' expression ';' ';' expression ';' affinity ')' statement
|
||||
/.$ba consumeStatementUPCForallLoop(true, false, true, true); $ea./
|
||||
|
||||
| 'upc_forall' '(' expression ';' ';' expression ';' ')' statement
|
||||
/.$ba consumeStatementUPCForallLoop(true, false, true, false); $ea./
|
||||
|
||||
| 'upc_forall' '(' expression ';' ';' ';' affinity ')' statement
|
||||
/.$ba consumeStatementUPCForallLoop(true, false, false, true); $ea./
|
||||
|
||||
| 'upc_forall' '(' expression ';' ';' ';' ')' statement
|
||||
/.$ba consumeStatementUPCForallLoop(true, false, false, false); $ea./
|
||||
|
||||
| 'upc_forall' '(' ';' expression ';' expression ';' affinity ')' statement
|
||||
/.$ba consumeStatementUPCForallLoop(false, true, true, true); $ea./
|
||||
|
||||
| 'upc_forall' '(' ';' expression ';' expression ';' ')' statement
|
||||
/.$ba consumeStatementUPCForallLoop(false, true, true, false); $ea./
|
||||
|
||||
| 'upc_forall' '(' ';' expression ';' ';' affinity ')' statement
|
||||
/.$ba consumeStatementUPCForallLoop(false, true, false, true); $ea./
|
||||
|
||||
| 'upc_forall' '(' ';' expression ';' ';' ')' statement
|
||||
/.$ba consumeStatementUPCForallLoop(false, true, false, false); $ea./
|
||||
|
||||
| 'upc_forall' '(' ';' ';' expression ';' affinity ')' statement
|
||||
/.$ba consumeStatementUPCForallLoop(false, false, true, true); $ea./
|
||||
|
||||
| 'upc_forall' '(' ';' ';' expression ';' ')' statement
|
||||
/.$ba consumeStatementUPCForallLoop(false, false, true, false); $ea./
|
||||
|
||||
| 'upc_forall' '(' ';' ';' ';' affinity ')' statement
|
||||
/.$ba consumeStatementUPCForallLoop(false, false, false, true); $ea./
|
||||
|
||||
| 'upc_forall' '(' ';' ';' ';' ')' statement
|
||||
/.$ba consumeStatementUPCForallLoop(false, false, false, false); $ea./
|
||||
|
||||
| 'upc_forall' '(' declaration expression ';' expression ';' affinity ')' statement
|
||||
/.$ba consumeStatementUPCForallLoop(true, true, true, true); $ea./
|
||||
|
||||
| 'upc_forall' '(' declaration expression ';' expression ';' ')' statement
|
||||
/.$ba consumeStatementUPCForallLoop(true, true, true, false); $ea./
|
||||
|
||||
| 'upc_forall' '(' declaration expression ';' ';' affinity ')' statement
|
||||
/.$ba consumeStatementUPCForallLoop(true, true, false, true); $ea./
|
||||
|
||||
| 'upc_forall' '(' declaration expression ';' ';' ')' statement
|
||||
/.$ba consumeStatementUPCForallLoop(true, true, false, false); $ea./
|
||||
|
||||
| 'upc_forall' '(' declaration ';' expression ';' affinity ')' statement
|
||||
/.$ba consumeStatementUPCForallLoop(true, false, true, true); $ea./
|
||||
|
||||
| 'upc_forall' '(' declaration ';' expression ';' ')' statement
|
||||
/.$ba consumeStatementUPCForallLoop(true, false, true, false); $ea./
|
||||
|
||||
| 'upc_forall' '(' declaration ';' ';' affinity ')' statement
|
||||
/.$ba consumeStatementUPCForallLoop(true, false, false, true); $ea./
|
||||
|
||||
| 'upc_forall' '(' declaration ';' ';' ')' statement
|
||||
/.$ba consumeStatementUPCForallLoop(true, false, false, false); $ea./
|
||||
|
||||
affinity
|
||||
::= expression
|
||||
| 'continue'
|
||||
/.$ba consumeToken(); $ea./
|
||||
|
||||
$End
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,254 @@
|
|||
/*******************************************************************************
|
||||
* 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
|
||||
*********************************************************************************/
|
||||
|
||||
// This file was generated by LPG
|
||||
|
||||
package org.eclipse.cdt.internal.core.dom.parser.upc;
|
||||
|
||||
public interface UPCParsersym {
|
||||
public final static int
|
||||
TK_auto = 32,
|
||||
TK_break = 64,
|
||||
TK_case = 65,
|
||||
TK_char = 41,
|
||||
TK_const = 6,
|
||||
TK_continue = 59,
|
||||
TK_default = 66,
|
||||
TK_do = 67,
|
||||
TK_double = 42,
|
||||
TK_else = 93,
|
||||
TK_enum = 54,
|
||||
TK_extern = 33,
|
||||
TK_float = 43,
|
||||
TK_for = 68,
|
||||
TK_goto = 69,
|
||||
TK_if = 70,
|
||||
TK_inline = 34,
|
||||
TK_int = 44,
|
||||
TK_long = 45,
|
||||
TK_register = 35,
|
||||
TK_restrict = 7,
|
||||
TK_return = 71,
|
||||
TK_short = 46,
|
||||
TK_signed = 47,
|
||||
TK_sizeof = 17,
|
||||
TK_static = 30,
|
||||
TK_struct = 55,
|
||||
TK_switch = 72,
|
||||
TK_typedef = 36,
|
||||
TK_union = 56,
|
||||
TK_unsigned = 48,
|
||||
TK_void = 49,
|
||||
TK_volatile = 8,
|
||||
TK_while = 60,
|
||||
TK__Bool = 50,
|
||||
TK__Complex = 51,
|
||||
TK__Imaginary = 52,
|
||||
TK_LeftBracket = 37,
|
||||
TK_LeftParen = 1,
|
||||
TK_LeftBrace = 31,
|
||||
TK_Dot = 80,
|
||||
TK_Arrow = 94,
|
||||
TK_PlusPlus = 15,
|
||||
TK_MinusMinus = 16,
|
||||
TK_And = 14,
|
||||
TK_Star = 3,
|
||||
TK_Plus = 12,
|
||||
TK_Minus = 13,
|
||||
TK_Tilde = 18,
|
||||
TK_Bang = 19,
|
||||
TK_Slash = 81,
|
||||
TK_Percent = 82,
|
||||
TK_RightShift = 61,
|
||||
TK_LeftShift = 62,
|
||||
TK_LT = 83,
|
||||
TK_GT = 84,
|
||||
TK_LE = 85,
|
||||
TK_GE = 86,
|
||||
TK_EQ = 88,
|
||||
TK_NE = 89,
|
||||
TK_Caret = 90,
|
||||
TK_Or = 91,
|
||||
TK_AndAnd = 92,
|
||||
TK_OrOr = 95,
|
||||
TK_Question = 96,
|
||||
TK_Colon = 57,
|
||||
TK_DotDotDot = 73,
|
||||
TK_Assign = 74,
|
||||
TK_StarAssign = 97,
|
||||
TK_SlashAssign = 98,
|
||||
TK_PercentAssign = 99,
|
||||
TK_PlusAssign = 100,
|
||||
TK_MinusAssign = 101,
|
||||
TK_RightShiftAssign = 102,
|
||||
TK_LeftShiftAssign = 103,
|
||||
TK_AndAssign = 104,
|
||||
TK_CaretAssign = 105,
|
||||
TK_OrAssign = 106,
|
||||
TK_Comma = 38,
|
||||
TK_Hash = 107,
|
||||
TK_HashHash = 108,
|
||||
TK_NewLine = 109,
|
||||
TK_MYTHREAD = 20,
|
||||
TK_THREADS = 21,
|
||||
TK_UPC_MAX_BLOCKSIZE = 22,
|
||||
TK_relaxed = 9,
|
||||
TK_shared = 10,
|
||||
TK_strict = 11,
|
||||
TK_upc_barrier = 75,
|
||||
TK_upc_localsizeof = 23,
|
||||
TK_upc_blocksizeof = 24,
|
||||
TK_upc_elemsizeof = 25,
|
||||
TK_upc_notify = 76,
|
||||
TK_upc_fence = 77,
|
||||
TK_upc_wait = 78,
|
||||
TK_upc_forall = 79,
|
||||
TK_EOF_TOKEN = 87,
|
||||
TK_identifier = 2,
|
||||
TK_integer = 26,
|
||||
TK_floating = 27,
|
||||
TK_charconst = 28,
|
||||
TK_stringlit = 29,
|
||||
TK_RightBracket = 63,
|
||||
TK_RightParen = 53,
|
||||
TK_RightBrace = 40,
|
||||
TK_SemiColon = 39,
|
||||
TK_Invalid = 110,
|
||||
TK_PlaceMarker = 111,
|
||||
TK_Parameter = 112,
|
||||
TK_DisabledMacroName = 113,
|
||||
TK_Completion = 5,
|
||||
TK_EndOfCompletion = 4,
|
||||
TK_SingleLineComment = 114,
|
||||
TK_MultiLineComment = 115,
|
||||
TK_ERROR_TOKEN = 58;
|
||||
|
||||
public final static String orderedTerminalSymbols[] = {
|
||||
"",//$NON-NLS-1$
|
||||
"LeftParen",//$NON-NLS-1$
|
||||
"identifier",//$NON-NLS-1$
|
||||
"Star",//$NON-NLS-1$
|
||||
"EndOfCompletion",//$NON-NLS-1$
|
||||
"Completion",//$NON-NLS-1$
|
||||
"const",//$NON-NLS-1$
|
||||
"restrict",//$NON-NLS-1$
|
||||
"volatile",//$NON-NLS-1$
|
||||
"relaxed",//$NON-NLS-1$
|
||||
"shared",//$NON-NLS-1$
|
||||
"strict",//$NON-NLS-1$
|
||||
"Plus",//$NON-NLS-1$
|
||||
"Minus",//$NON-NLS-1$
|
||||
"And",//$NON-NLS-1$
|
||||
"PlusPlus",//$NON-NLS-1$
|
||||
"MinusMinus",//$NON-NLS-1$
|
||||
"sizeof",//$NON-NLS-1$
|
||||
"Tilde",//$NON-NLS-1$
|
||||
"Bang",//$NON-NLS-1$
|
||||
"MYTHREAD",//$NON-NLS-1$
|
||||
"THREADS",//$NON-NLS-1$
|
||||
"UPC_MAX_BLOCKSIZE",//$NON-NLS-1$
|
||||
"upc_localsizeof",//$NON-NLS-1$
|
||||
"upc_blocksizeof",//$NON-NLS-1$
|
||||
"upc_elemsizeof",//$NON-NLS-1$
|
||||
"integer",//$NON-NLS-1$
|
||||
"floating",//$NON-NLS-1$
|
||||
"charconst",//$NON-NLS-1$
|
||||
"stringlit",//$NON-NLS-1$
|
||||
"static",//$NON-NLS-1$
|
||||
"LeftBrace",//$NON-NLS-1$
|
||||
"auto",//$NON-NLS-1$
|
||||
"extern",//$NON-NLS-1$
|
||||
"inline",//$NON-NLS-1$
|
||||
"register",//$NON-NLS-1$
|
||||
"typedef",//$NON-NLS-1$
|
||||
"LeftBracket",//$NON-NLS-1$
|
||||
"Comma",//$NON-NLS-1$
|
||||
"SemiColon",//$NON-NLS-1$
|
||||
"RightBrace",//$NON-NLS-1$
|
||||
"char",//$NON-NLS-1$
|
||||
"double",//$NON-NLS-1$
|
||||
"float",//$NON-NLS-1$
|
||||
"int",//$NON-NLS-1$
|
||||
"long",//$NON-NLS-1$
|
||||
"short",//$NON-NLS-1$
|
||||
"signed",//$NON-NLS-1$
|
||||
"unsigned",//$NON-NLS-1$
|
||||
"void",//$NON-NLS-1$
|
||||
"_Bool",//$NON-NLS-1$
|
||||
"_Complex",//$NON-NLS-1$
|
||||
"_Imaginary",//$NON-NLS-1$
|
||||
"RightParen",//$NON-NLS-1$
|
||||
"enum",//$NON-NLS-1$
|
||||
"struct",//$NON-NLS-1$
|
||||
"union",//$NON-NLS-1$
|
||||
"Colon",//$NON-NLS-1$
|
||||
"ERROR_TOKEN",//$NON-NLS-1$
|
||||
"continue",//$NON-NLS-1$
|
||||
"while",//$NON-NLS-1$
|
||||
"RightShift",//$NON-NLS-1$
|
||||
"LeftShift",//$NON-NLS-1$
|
||||
"RightBracket",//$NON-NLS-1$
|
||||
"break",//$NON-NLS-1$
|
||||
"case",//$NON-NLS-1$
|
||||
"default",//$NON-NLS-1$
|
||||
"do",//$NON-NLS-1$
|
||||
"for",//$NON-NLS-1$
|
||||
"goto",//$NON-NLS-1$
|
||||
"if",//$NON-NLS-1$
|
||||
"return",//$NON-NLS-1$
|
||||
"switch",//$NON-NLS-1$
|
||||
"DotDotDot",//$NON-NLS-1$
|
||||
"Assign",//$NON-NLS-1$
|
||||
"upc_barrier",//$NON-NLS-1$
|
||||
"upc_notify",//$NON-NLS-1$
|
||||
"upc_fence",//$NON-NLS-1$
|
||||
"upc_wait",//$NON-NLS-1$
|
||||
"upc_forall",//$NON-NLS-1$
|
||||
"Dot",//$NON-NLS-1$
|
||||
"Slash",//$NON-NLS-1$
|
||||
"Percent",//$NON-NLS-1$
|
||||
"LT",//$NON-NLS-1$
|
||||
"GT",//$NON-NLS-1$
|
||||
"LE",//$NON-NLS-1$
|
||||
"GE",//$NON-NLS-1$
|
||||
"EOF_TOKEN",//$NON-NLS-1$
|
||||
"EQ",//$NON-NLS-1$
|
||||
"NE",//$NON-NLS-1$
|
||||
"Caret",//$NON-NLS-1$
|
||||
"Or",//$NON-NLS-1$
|
||||
"AndAnd",//$NON-NLS-1$
|
||||
"else",//$NON-NLS-1$
|
||||
"Arrow",//$NON-NLS-1$
|
||||
"OrOr",//$NON-NLS-1$
|
||||
"Question",//$NON-NLS-1$
|
||||
"StarAssign",//$NON-NLS-1$
|
||||
"SlashAssign",//$NON-NLS-1$
|
||||
"PercentAssign",//$NON-NLS-1$
|
||||
"PlusAssign",//$NON-NLS-1$
|
||||
"MinusAssign",//$NON-NLS-1$
|
||||
"RightShiftAssign",//$NON-NLS-1$
|
||||
"LeftShiftAssign",//$NON-NLS-1$
|
||||
"AndAssign",//$NON-NLS-1$
|
||||
"CaretAssign",//$NON-NLS-1$
|
||||
"OrAssign",//$NON-NLS-1$
|
||||
"Hash",//$NON-NLS-1$
|
||||
"HashHash",//$NON-NLS-1$
|
||||
"NewLine",//$NON-NLS-1$
|
||||
"Invalid",//$NON-NLS-1$
|
||||
"PlaceMarker",//$NON-NLS-1$
|
||||
"Parameter",//$NON-NLS-1$
|
||||
"DisabledMacroName",//$NON-NLS-1$
|
||||
"SingleLineComment",//$NON-NLS-1$
|
||||
"MultiLineComment"//$NON-NLS-1$
|
||||
};
|
||||
|
||||
public final static boolean isValidForParser = true;
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
/*******************************************************************************
|
||||
* 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.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTCompositeTypeSpecifier;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.c.CASTCompositeTypeSpecifier;
|
||||
|
||||
public class UPCASTCompositeTypeSpecifier extends CASTCompositeTypeSpecifier implements
|
||||
IUPCASTCompositeTypeSpecifier {
|
||||
|
||||
|
||||
private int referenceType;
|
||||
private int sharedQualifier;
|
||||
private IASTExpression blockSizeExpression;
|
||||
|
||||
|
||||
public IASTExpression getBlockSizeExpression() {
|
||||
return blockSizeExpression;
|
||||
}
|
||||
|
||||
public int getReferenceType() {
|
||||
return referenceType;
|
||||
}
|
||||
|
||||
public int getSharedQualifier() {
|
||||
return sharedQualifier;
|
||||
}
|
||||
|
||||
public void setBlockSizeExpression(IASTExpression expr) {
|
||||
this.blockSizeExpression = expr;
|
||||
}
|
||||
|
||||
public void setReferenceType(int referenceType) {
|
||||
this.referenceType = referenceType;
|
||||
}
|
||||
|
||||
public void setSharedQualifier(int shared) {
|
||||
this.sharedQualifier = shared;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public boolean accept( ASTVisitor action ){
|
||||
if( action.shouldVisitDeclSpecifiers ){
|
||||
switch( action.visit( this ) ){
|
||||
case ASTVisitor.PROCESS_ABORT : return false;
|
||||
case ASTVisitor.PROCESS_SKIP : return true;
|
||||
default : break;
|
||||
}
|
||||
}
|
||||
if( getName() != null ) if( !getName().accept( action ) ) return false;
|
||||
if( blockSizeExpression != null) if( !blockSizeExpression.accept( action ) ) return false;
|
||||
|
||||
IASTDeclaration [] decls = getMembers();
|
||||
for( int i = 0; i < decls.length; i++ )
|
||||
if( !decls[i].accept( action ) ) return false;
|
||||
|
||||
if( action.shouldVisitDeclSpecifiers ){
|
||||
switch( action.leave( this ) ){
|
||||
case ASTVisitor.PROCESS_ABORT : return false;
|
||||
case ASTVisitor.PROCESS_SKIP : return true;
|
||||
default : break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
/*******************************************************************************
|
||||
* 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.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTElaboratedTypeSpecifier;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.c.CASTElaboratedTypeSpecifier;
|
||||
|
||||
public class UPCASTElaboratedTypeSpecifier extends CASTElaboratedTypeSpecifier implements IUPCASTElaboratedTypeSpecifier {
|
||||
|
||||
private int referenceType;
|
||||
private int sharedQualifier;
|
||||
private IASTExpression blockSizeExpression;
|
||||
|
||||
|
||||
public IASTExpression getBlockSizeExpression() {
|
||||
return blockSizeExpression;
|
||||
}
|
||||
|
||||
public int getReferenceType() {
|
||||
return referenceType;
|
||||
}
|
||||
|
||||
public int getSharedQualifier() {
|
||||
return sharedQualifier;
|
||||
}
|
||||
|
||||
public void setBlockSizeExpression(IASTExpression expr) {
|
||||
this.blockSizeExpression = expr;
|
||||
}
|
||||
|
||||
public void setReferenceType(int referenceType) {
|
||||
this.referenceType = referenceType;
|
||||
}
|
||||
|
||||
public void setSharedQualifier(int shared) {
|
||||
this.sharedQualifier = shared;
|
||||
}
|
||||
|
||||
|
||||
public boolean accept( ASTVisitor action ){
|
||||
if( action.shouldVisitDeclSpecifiers ){
|
||||
switch( action.visit( this ) ){
|
||||
case ASTVisitor.PROCESS_ABORT : return false;
|
||||
case ASTVisitor.PROCESS_SKIP : return true;
|
||||
default : break;
|
||||
}
|
||||
}
|
||||
if( getName() != null ) if( !getName().accept( action ) ) return false;
|
||||
if( blockSizeExpression != null) if( !blockSizeExpression.accept( action ) ) return false;
|
||||
|
||||
if( action.shouldVisitDeclSpecifiers ){
|
||||
switch( action.leave( this ) ){
|
||||
case ASTVisitor.PROCESS_ABORT : return false;
|
||||
case ASTVisitor.PROCESS_SKIP : return true;
|
||||
default : break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
/*******************************************************************************
|
||||
* 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.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTEnumerationSpecifier;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.c.CASTEnumerationSpecifier;
|
||||
|
||||
public class UPCASTEnumerationSpecifier extends CASTEnumerationSpecifier
|
||||
implements IUPCASTEnumerationSpecifier {
|
||||
|
||||
private int referenceType;
|
||||
private int sharedQualifier;
|
||||
private IASTExpression blockSizeExpression;
|
||||
|
||||
|
||||
public IASTExpression getBlockSizeExpression() {
|
||||
return blockSizeExpression;
|
||||
}
|
||||
|
||||
public int getReferenceType() {
|
||||
return referenceType;
|
||||
}
|
||||
|
||||
public int getSharedQualifier() {
|
||||
return sharedQualifier;
|
||||
}
|
||||
|
||||
public void setBlockSizeExpression(IASTExpression expr) {
|
||||
this.blockSizeExpression = expr;
|
||||
}
|
||||
|
||||
public void setReferenceType(int referenceType) {
|
||||
this.referenceType = referenceType;
|
||||
}
|
||||
|
||||
public void setSharedQualifier(int shared) {
|
||||
this.sharedQualifier = shared;
|
||||
}
|
||||
|
||||
public boolean accept( ASTVisitor action ){
|
||||
if( action.shouldVisitDeclSpecifiers ){
|
||||
switch( action.visit( this ) ){
|
||||
case ASTVisitor.PROCESS_ABORT : return false;
|
||||
case ASTVisitor.PROCESS_SKIP : return true;
|
||||
default : break;
|
||||
}
|
||||
}
|
||||
if( getName() != null ) if( !getName().accept( action ) ) return false;
|
||||
if( blockSizeExpression != null) if( !blockSizeExpression.accept( action ) ) return false;
|
||||
|
||||
IASTEnumerator[] etors = getEnumerators();
|
||||
for ( int i = 0; i < etors.length; i++ ) {
|
||||
if( !etors[i].accept( action ) ) return false;
|
||||
}
|
||||
if( action.shouldVisitDeclSpecifiers ){
|
||||
switch( action.leave( this ) ){
|
||||
case ASTVisitor.PROCESS_ABORT : return false;
|
||||
case ASTVisitor.PROCESS_SKIP : return true;
|
||||
default : break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
/*******************************************************************************
|
||||
* 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.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
||||
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTForallStatement;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.c.CASTForStatement;
|
||||
|
||||
public class UPCASTForallStatement extends CASTForStatement implements IUPCASTForallStatement {
|
||||
|
||||
private IASTExpression affinity;
|
||||
private boolean affinityContinue;
|
||||
|
||||
|
||||
public boolean isAffinityContinue() {
|
||||
return affinityContinue;
|
||||
}
|
||||
|
||||
public IASTExpression getAffinityExpresiion() {
|
||||
return affinity;
|
||||
}
|
||||
|
||||
public void setAffinityExpression(IASTExpression affinity) {
|
||||
if(affinity != null)
|
||||
this.affinityContinue = false;
|
||||
this.affinity = affinity;
|
||||
}
|
||||
|
||||
public void setAffinityContinue(boolean affinityContinue) {
|
||||
if(affinityContinue)
|
||||
this.affinity = null;
|
||||
this.affinityContinue = affinityContinue;
|
||||
}
|
||||
|
||||
|
||||
public boolean accept(ASTVisitor visitor) {
|
||||
if(visitor.shouldVisitStatements) {
|
||||
switch(visitor.visit(this)){
|
||||
case ASTVisitor.PROCESS_ABORT : return false;
|
||||
case ASTVisitor.PROCESS_SKIP : return true;
|
||||
}
|
||||
}
|
||||
|
||||
IASTStatement initializer = super.getInitializerStatement();
|
||||
if(initializer != null) if(!initializer.accept(visitor)) return false;
|
||||
|
||||
IASTExpression condition = super.getConditionExpression();
|
||||
if(condition != null) if(!condition.accept(visitor)) return false;
|
||||
|
||||
IASTExpression iteration = super.getIterationExpression();
|
||||
if(iteration != null) if(!iteration.accept(visitor)) return false;
|
||||
|
||||
if(affinity != null) if(!affinity.accept(visitor)) return false;
|
||||
|
||||
IASTStatement body = super.getBody();
|
||||
if(body != null) if(!body.accept(visitor)) return false;
|
||||
|
||||
if(visitor.shouldVisitStatements) {
|
||||
switch(visitor.leave(this)){
|
||||
case ASTVisitor.PROCESS_ABORT : return false;
|
||||
case ASTVisitor.PROCESS_SKIP : return true;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
/*******************************************************************************
|
||||
* 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.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IBasicType;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTKeywordExpression;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.c.CASTNode;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.c.CBasicType;
|
||||
|
||||
public class UPCASTKeywordExpression extends CASTNode implements IUPCASTKeywordExpression {
|
||||
|
||||
|
||||
private int keywordKind;
|
||||
|
||||
public int getKeywordKind() {
|
||||
return keywordKind;
|
||||
}
|
||||
|
||||
public void setKeywordKind(int kind) {
|
||||
this.keywordKind = kind;
|
||||
|
||||
}
|
||||
|
||||
public IType getExpressionType() {
|
||||
return new CBasicType(IBasicType.t_int, 0, this);
|
||||
}
|
||||
|
||||
|
||||
public boolean accept(ASTVisitor visitor) {
|
||||
if(visitor.shouldVisitExpressions) {
|
||||
switch(visitor.visit(this)) {
|
||||
case ASTVisitor.PROCESS_ABORT : return false;
|
||||
case ASTVisitor.PROCESS_SKIP : return true;
|
||||
}
|
||||
}
|
||||
if(visitor.shouldVisitExpressions) {
|
||||
switch(visitor.leave(this)) {
|
||||
case ASTVisitor.PROCESS_ABORT : return false;
|
||||
case ASTVisitor.PROCESS_SKIP : return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
/*******************************************************************************
|
||||
* 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.IUPCASTLayoutQualifier;
|
||||
|
||||
public class UPCASTLayoutQualifier implements IUPCASTLayoutQualifier {
|
||||
|
||||
|
||||
private boolean isPure;
|
||||
private boolean isIndefinite;
|
||||
private IASTExpression blockSizeExpression;
|
||||
|
||||
|
||||
public IASTExpression getBlockSizeExpression() {
|
||||
return blockSizeExpression;
|
||||
}
|
||||
|
||||
|
||||
public boolean isIndefiniteBlockAllocation() {
|
||||
return isIndefinite;
|
||||
}
|
||||
|
||||
|
||||
public boolean isPureBlockAllocation() {
|
||||
return isPure;
|
||||
}
|
||||
|
||||
|
||||
public void setBlockSizeExpression(IASTExpression expr) {
|
||||
this.blockSizeExpression = expr;
|
||||
}
|
||||
|
||||
|
||||
public void setIndefiniteBlockAllocation(boolean allocation) {
|
||||
this.isIndefinite = allocation;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void setPureBlockAllocation(boolean allocation) {
|
||||
this.isPure = allocation;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
/*******************************************************************************
|
||||
* 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.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTSimpleDeclSpecifier;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.c.CASTSimpleDeclSpecifier;
|
||||
|
||||
public class UPCASTSimpleDeclSpecifier extends CASTSimpleDeclSpecifier
|
||||
implements IUPCASTSimpleDeclSpecifier {
|
||||
|
||||
private int referenceType;
|
||||
private int sharedQualifier;
|
||||
private IASTExpression blockSizeExpression;
|
||||
|
||||
|
||||
public IASTExpression getBlockSizeExpression() {
|
||||
return blockSizeExpression;
|
||||
}
|
||||
|
||||
public int getReferenceType() {
|
||||
return referenceType;
|
||||
}
|
||||
|
||||
public int getSharedQualifier() {
|
||||
return sharedQualifier;
|
||||
}
|
||||
|
||||
public void setBlockSizeExpression(IASTExpression expr) {
|
||||
this.blockSizeExpression = expr;
|
||||
}
|
||||
|
||||
public void setReferenceType(int referenceType) {
|
||||
this.referenceType = referenceType;
|
||||
}
|
||||
|
||||
public void setSharedQualifier(int shared) {
|
||||
this.sharedQualifier = shared;
|
||||
}
|
||||
|
||||
|
||||
public boolean accept( ASTVisitor action ){
|
||||
if( action.shouldVisitDeclSpecifiers ){
|
||||
switch( action.visit( this ) ){
|
||||
case ASTVisitor.PROCESS_ABORT : return false;
|
||||
case ASTVisitor.PROCESS_SKIP : return true;
|
||||
default : break;
|
||||
}
|
||||
}
|
||||
if( blockSizeExpression != null) if( !blockSizeExpression.accept( action ) ) return false;
|
||||
|
||||
if( action.shouldVisitDeclSpecifiers ){
|
||||
switch( action.leave( this ) ){
|
||||
case ASTVisitor.PROCESS_ABORT : return false;
|
||||
case ASTVisitor.PROCESS_SKIP : return true;
|
||||
default : break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
/*******************************************************************************
|
||||
* 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.IASTUnaryExpression;
|
||||
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTSizeofExpression;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.c.CASTUnaryExpression;
|
||||
|
||||
public class UPCASTSizeofExpression extends CASTUnaryExpression implements IUPCASTSizeofExpression {
|
||||
|
||||
// TODO: don't really know if extending CASTUnaryExpression is the right thing to do
|
||||
private int upcSizeofOperator;
|
||||
|
||||
|
||||
public int getOperator() {
|
||||
return IASTUnaryExpression.op_sizeof;
|
||||
}
|
||||
|
||||
|
||||
public void setUPCSizeofOperator(int upcSizeofOperator) {
|
||||
this.upcSizeofOperator = upcSizeofOperator;
|
||||
}
|
||||
|
||||
|
||||
public int getUPCSizeofOperator() {
|
||||
return upcSizeofOperator;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
/*******************************************************************************
|
||||
* 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.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTSynchronizationStatement;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.c.CASTNode;
|
||||
|
||||
public class UPCASTSynchronizationStatement extends CASTNode implements IUPCASTSynchronizationStatement {
|
||||
|
||||
private int statmentKind;
|
||||
private IASTExpression barrierExpression = null;
|
||||
|
||||
public IASTExpression getBarrierExpression() {
|
||||
return barrierExpression;
|
||||
}
|
||||
|
||||
public int getStatementKind() {
|
||||
return statmentKind;
|
||||
}
|
||||
|
||||
public void setBarrierExpression(IASTExpression expr) {
|
||||
this.barrierExpression = expr;
|
||||
|
||||
}
|
||||
|
||||
public void setStatementKind(int kind) {
|
||||
this.statmentKind = kind;
|
||||
}
|
||||
|
||||
|
||||
public boolean accept(ASTVisitor visitor) {
|
||||
if(visitor.shouldVisitStatements) {
|
||||
switch(visitor.visit(this)) {
|
||||
case ASTVisitor.PROCESS_ABORT : return false;
|
||||
case ASTVisitor.PROCESS_SKIP : return true;
|
||||
}
|
||||
}
|
||||
|
||||
if(barrierExpression != null) {
|
||||
boolean abort = !barrierExpression.accept(visitor);
|
||||
if(abort)
|
||||
return false;
|
||||
}
|
||||
|
||||
if(visitor.shouldVisitStatements) {
|
||||
switch(visitor.leave(this)) {
|
||||
case ASTVisitor.PROCESS_ABORT : return false;
|
||||
case ASTVisitor.PROCESS_SKIP : return true;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
/*******************************************************************************
|
||||
* 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.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTTypedefNameSpecifier;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.c.CASTTypedefNameSpecifier;
|
||||
|
||||
public class UPCASTTypedefNameSpecifier extends CASTTypedefNameSpecifier
|
||||
implements IUPCASTTypedefNameSpecifier {
|
||||
|
||||
|
||||
private int referenceType;
|
||||
private int sharedQualifier;
|
||||
private IASTExpression blockSizeExpression;
|
||||
|
||||
|
||||
public IASTExpression getBlockSizeExpression() {
|
||||
return blockSizeExpression;
|
||||
}
|
||||
|
||||
public int getReferenceType() {
|
||||
return referenceType;
|
||||
}
|
||||
|
||||
public int getSharedQualifier() {
|
||||
return sharedQualifier;
|
||||
}
|
||||
|
||||
public void setBlockSizeExpression(IASTExpression expr) {
|
||||
this.blockSizeExpression = expr;
|
||||
}
|
||||
|
||||
public void setReferenceType(int referenceType) {
|
||||
this.referenceType = referenceType;
|
||||
}
|
||||
|
||||
public void setSharedQualifier(int shared) {
|
||||
this.sharedQualifier = shared;
|
||||
}
|
||||
|
||||
|
||||
public boolean accept( ASTVisitor action ){
|
||||
if( action.shouldVisitDeclSpecifiers ){
|
||||
switch( action.visit( this ) ){
|
||||
case ASTVisitor.PROCESS_ABORT : return false;
|
||||
case ASTVisitor.PROCESS_SKIP : return true;
|
||||
default : break;
|
||||
}
|
||||
}
|
||||
if( getName() != null ) if( !getName().accept( action ) ) return false;
|
||||
if( blockSizeExpression != null) if( !blockSizeExpression.accept( action ) ) return false;
|
||||
|
||||
if( action.shouldVisitDeclSpecifiers ){
|
||||
switch( action.leave( this ) ){
|
||||
case ASTVisitor.PROCESS_ABORT : return false;
|
||||
case ASTVisitor.PROCESS_SKIP : return true;
|
||||
default : break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue