mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 22:22:11 +02:00
working on porting the UPC plugin
This commit is contained in:
parent
1ca857981f
commit
2ae1a301ef
17 changed files with 3014 additions and 3135 deletions
|
@ -6,7 +6,8 @@ Bundle-Version: 4.0.1.qualifier
|
||||||
Bundle-ClassPath: .
|
Bundle-ClassPath: .
|
||||||
Require-Bundle: org.eclipse.cdt.core,
|
Require-Bundle: org.eclipse.cdt.core,
|
||||||
net.sourceforge.lpg.lpgjavaruntime;bundle-version="1.1.0";visibility:=reexport,
|
net.sourceforge.lpg.lpgjavaruntime;bundle-version="1.1.0";visibility:=reexport,
|
||||||
org.eclipse.core.runtime
|
org.eclipse.core.runtime,
|
||||||
|
org.apache.ant;bundle-version="1.7.0"
|
||||||
Export-Package: org.eclipse.cdt.core.dom.lrparser,
|
Export-Package: org.eclipse.cdt.core.dom.lrparser,
|
||||||
org.eclipse.cdt.core.dom.lrparser.action,
|
org.eclipse.cdt.core.dom.lrparser.action,
|
||||||
org.eclipse.cdt.core.dom.lrparser.action.c99,
|
org.eclipse.cdt.core.dom.lrparser.action.c99,
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
-- TODO when the architecture has solidified try to move common
|
-- TODO when the architecture has solidified try to move common
|
||||||
-- stuff between C99 and C++ into one file.
|
-- stuff between C99 and C++ into one file.
|
||||||
|
|
||||||
$Include
|
$Include
|
||||||
common.g
|
common.g
|
||||||
$End
|
$End
|
||||||
|
@ -117,13 +118,6 @@ $End
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--$Start
|
|
||||||
-- translation_unit
|
|
||||||
--$End
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$Rules
|
$Rules
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------
|
||||||
|
@ -986,19 +980,3 @@ function_body
|
||||||
/. $Build consumeStatementCompoundStatement(true); $EndBuild ./
|
/. $Build consumeStatementCompoundStatement(true); $EndBuild ./
|
||||||
|
|
||||||
$End
|
$End
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,6 @@ $Headers
|
||||||
|
|
||||||
private void initActions(IASTTranslationUnit tu) {
|
private void initActions(IASTTranslationUnit tu) {
|
||||||
action = new $build_action_class($node_factory_create_expression, this, tu);
|
action = new $build_action_class($node_factory_create_expression, this, tu);
|
||||||
action.setTokenMap($sym_type.orderedTerminalSymbols);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -114,9 +114,6 @@ public abstract class BuildASTParserAction {
|
||||||
private final IASTNodeFactory nodeFactory;
|
private final IASTNodeFactory nodeFactory;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Completion tokens are represented by different kinds by different parsers.
|
* Completion tokens are represented by different kinds by different parsers.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -11,28 +11,7 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.core.dom.lrparser.action.c99;
|
package org.eclipse.cdt.core.dom.lrparser.action.c99;
|
||||||
|
|
||||||
import static org.eclipse.cdt.internal.core.dom.lrparser.c99.C99Parsersym.TK_Completion;
|
import static org.eclipse.cdt.internal.core.dom.lrparser.c99.C99Parsersym.*;
|
||||||
import static org.eclipse.cdt.internal.core.dom.lrparser.c99.C99Parsersym.TK__Bool;
|
|
||||||
import static org.eclipse.cdt.internal.core.dom.lrparser.c99.C99Parsersym.TK__Complex;
|
|
||||||
import static org.eclipse.cdt.internal.core.dom.lrparser.c99.C99Parsersym.TK_auto;
|
|
||||||
import static org.eclipse.cdt.internal.core.dom.lrparser.c99.C99Parsersym.TK_char;
|
|
||||||
import static org.eclipse.cdt.internal.core.dom.lrparser.c99.C99Parsersym.TK_const;
|
|
||||||
import static org.eclipse.cdt.internal.core.dom.lrparser.c99.C99Parsersym.TK_double;
|
|
||||||
import static org.eclipse.cdt.internal.core.dom.lrparser.c99.C99Parsersym.TK_extern;
|
|
||||||
import static org.eclipse.cdt.internal.core.dom.lrparser.c99.C99Parsersym.TK_float;
|
|
||||||
import static org.eclipse.cdt.internal.core.dom.lrparser.c99.C99Parsersym.TK_identifier;
|
|
||||||
import static org.eclipse.cdt.internal.core.dom.lrparser.c99.C99Parsersym.TK_inline;
|
|
||||||
import static org.eclipse.cdt.internal.core.dom.lrparser.c99.C99Parsersym.TK_int;
|
|
||||||
import static org.eclipse.cdt.internal.core.dom.lrparser.c99.C99Parsersym.TK_long;
|
|
||||||
import static org.eclipse.cdt.internal.core.dom.lrparser.c99.C99Parsersym.TK_register;
|
|
||||||
import static org.eclipse.cdt.internal.core.dom.lrparser.c99.C99Parsersym.TK_restrict;
|
|
||||||
import static org.eclipse.cdt.internal.core.dom.lrparser.c99.C99Parsersym.TK_short;
|
|
||||||
import static org.eclipse.cdt.internal.core.dom.lrparser.c99.C99Parsersym.TK_signed;
|
|
||||||
import static org.eclipse.cdt.internal.core.dom.lrparser.c99.C99Parsersym.TK_static;
|
|
||||||
import static org.eclipse.cdt.internal.core.dom.lrparser.c99.C99Parsersym.TK_typedef;
|
|
||||||
import static org.eclipse.cdt.internal.core.dom.lrparser.c99.C99Parsersym.TK_unsigned;
|
|
||||||
import static org.eclipse.cdt.internal.core.dom.lrparser.c99.C99Parsersym.TK_void;
|
|
||||||
import static org.eclipse.cdt.internal.core.dom.lrparser.c99.C99Parsersym.TK_volatile;
|
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -87,7 +66,6 @@ import org.eclipse.cdt.internal.core.dom.lrparser.c99.C99ExpressionStatementPars
|
||||||
import org.eclipse.cdt.internal.core.dom.lrparser.c99.C99NoCastExpressionParser;
|
import org.eclipse.cdt.internal.core.dom.lrparser.c99.C99NoCastExpressionParser;
|
||||||
import org.eclipse.cdt.internal.core.dom.lrparser.c99.C99Parsersym;
|
import org.eclipse.cdt.internal.core.dom.lrparser.c99.C99Parsersym;
|
||||||
import org.eclipse.cdt.internal.core.dom.lrparser.c99.C99SizeofExpressionParser;
|
import org.eclipse.cdt.internal.core.dom.lrparser.c99.C99SizeofExpressionParser;
|
||||||
import org.eclipse.cdt.internal.core.dom.lrparser.cpp.CPPParsersym;
|
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -98,7 +76,7 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||||
@SuppressWarnings("restriction")
|
@SuppressWarnings("restriction")
|
||||||
public class C99BuildASTParserAction extends BuildASTParserAction {
|
public class C99BuildASTParserAction extends BuildASTParserAction {
|
||||||
|
|
||||||
private ITokenMap tokenMap = null;
|
private final ITokenMap tokenMap;
|
||||||
|
|
||||||
/** Used to create the AST node objects */
|
/** Used to create the AST node objects */
|
||||||
protected final IC99ASTNodeFactory nodeFactory;
|
protected final IC99ASTNodeFactory nodeFactory;
|
||||||
|
@ -111,25 +89,22 @@ public class C99BuildASTParserAction extends BuildASTParserAction {
|
||||||
public C99BuildASTParserAction(IC99ASTNodeFactory nodeFactory, IParserActionTokenProvider parser, IASTTranslationUnit tu) {
|
public C99BuildASTParserAction(IC99ASTNodeFactory nodeFactory, IParserActionTokenProvider parser, IASTTranslationUnit tu) {
|
||||||
super(nodeFactory, parser, tu);
|
super(nodeFactory, parser, tu);
|
||||||
this.nodeFactory = nodeFactory;
|
this.nodeFactory = nodeFactory;
|
||||||
|
this.tokenMap = new TokenMap(C99Parsersym.orderedTerminalSymbols, parser.getOrderedTerminalSymbols());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override protected boolean isCompletionToken(IToken token) {
|
@Override
|
||||||
|
protected boolean isCompletionToken(IToken token) {
|
||||||
return asC99Kind(token) == TK_Completion;
|
return asC99Kind(token) == TK_Completion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setTokenMap(String[] orderedTerminalSymbols) {
|
private int asC99Kind(IToken token) {
|
||||||
this.tokenMap = new TokenMap(C99Parsersym.orderedTerminalSymbols, orderedTerminalSymbols);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int asC99Kind(IToken token) {
|
|
||||||
return asC99Kind(token.getKind());
|
return asC99Kind(token.getKind());
|
||||||
}
|
}
|
||||||
|
|
||||||
private int asC99Kind(int tokenKind) {
|
private int asC99Kind(int tokenKind) {
|
||||||
return tokenMap == null ? tokenKind : tokenMap.mapKind(tokenKind);
|
return tokenMap.mapKind(tokenKind);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -161,11 +136,10 @@ public class C99BuildASTParserAction extends BuildASTParserAction {
|
||||||
* postfix_expression ::= postfix_expression '.' ident
|
* postfix_expression ::= postfix_expression '.' ident
|
||||||
* postfix_expression ::= postfix_expression '->' ident
|
* postfix_expression ::= postfix_expression '->' ident
|
||||||
*/
|
*/
|
||||||
public void consumeExpressionFieldReference(/*IBinding field, */ boolean isPointerDereference) {
|
public void consumeExpressionFieldReference(boolean isPointerDereference) {
|
||||||
if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
|
if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
|
||||||
|
|
||||||
IASTName name = createName(parser.getRightIToken());
|
IASTName name = createName(parser.getRightIToken());
|
||||||
//name.setBinding(field);
|
|
||||||
IASTExpression owner = (IASTExpression) astStack.pop();
|
IASTExpression owner = (IASTExpression) astStack.pop();
|
||||||
IASTFieldReference expr = nodeFactory.newFieldReference(name, owner, isPointerDereference);
|
IASTFieldReference expr = nodeFactory.newFieldReference(name, owner, isPointerDereference);
|
||||||
setOffsetAndLength(expr);
|
setOffsetAndLength(expr);
|
||||||
|
@ -222,7 +196,7 @@ public class C99BuildASTParserAction extends BuildASTParserAction {
|
||||||
* In plain C99 specifiers are always just single tokens, but in language
|
* In plain C99 specifiers are always just single tokens, but in language
|
||||||
* extensions specifiers may be more complex. Thats why this method takes
|
* extensions specifiers may be more complex. Thats why this method takes
|
||||||
* Object as the type of the specifier, so that it may be overridden in subclasses
|
* Object as the type of the specifier, so that it may be overridden in subclasses
|
||||||
* and used with arbitray objects as the specifier.
|
* and used with arbitrary objects as the specifier.
|
||||||
*/
|
*/
|
||||||
protected void setSpecifier(ICASTDeclSpecifier node, Object specifier) {
|
protected void setSpecifier(ICASTDeclSpecifier node, Object specifier) {
|
||||||
if(!(specifier instanceof IToken))
|
if(!(specifier instanceof IToken))
|
||||||
|
@ -463,11 +437,10 @@ public class C99BuildASTParserAction extends BuildASTParserAction {
|
||||||
/**
|
/**
|
||||||
* designator ::= '.' 'identifier'
|
* designator ::= '.' 'identifier'
|
||||||
*/
|
*/
|
||||||
public void consumeDesignatorField(/*IBinding binding*/) {
|
public void consumeDesignatorField() {
|
||||||
if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
|
if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
|
||||||
|
|
||||||
IASTName name = createName( parser.getRightIToken() );
|
IASTName name = createName(parser.getRightIToken());
|
||||||
//name.setBinding(binding);
|
|
||||||
ICASTFieldDesignator designator = nodeFactory.newCFieldDesignator(name);
|
ICASTFieldDesignator designator = nodeFactory.newCFieldDesignator(name);
|
||||||
setOffsetAndLength(designator);
|
setOffsetAndLength(designator);
|
||||||
astStack.push(designator);
|
astStack.push(designator);
|
||||||
|
@ -558,10 +531,10 @@ public class C99BuildASTParserAction extends BuildASTParserAction {
|
||||||
List<Object> declarators = (hasDeclaratorList) ? astStack.closeScope() : Collections.emptyList();
|
List<Object> declarators = (hasDeclaratorList) ? astStack.closeScope() : Collections.emptyList();
|
||||||
IASTDeclSpecifier declSpecifier = (IASTDeclSpecifier) astStack.pop();
|
IASTDeclSpecifier declSpecifier = (IASTDeclSpecifier) astStack.pop();
|
||||||
|
|
||||||
// do not generate nodes for extra EOC tokens
|
List<IToken> ruleTokens = parser.getRuleTokens();
|
||||||
if(matchTokens(parser.getRuleTokens(), CPPParsersym.TK_EndOfCompletion))
|
if(ruleTokens.size() == 1 && asC99Kind(ruleTokens.get(0)) == TK_EndOfCompletion)
|
||||||
return;
|
return; // do not generate nodes for extra EOC tokens
|
||||||
|
|
||||||
IASTSimpleDeclaration declaration = nodeFactory.newSimpleDeclaration(declSpecifier);
|
IASTSimpleDeclaration declaration = nodeFactory.newSimpleDeclaration(declSpecifier);
|
||||||
|
|
||||||
for(Object declarator : declarators)
|
for(Object declarator : declarators)
|
||||||
|
@ -647,11 +620,10 @@ public class C99BuildASTParserAction extends BuildASTParserAction {
|
||||||
*
|
*
|
||||||
* enum_specifier ::= 'enum' enum_identifier
|
* enum_specifier ::= 'enum' enum_identifier
|
||||||
*/
|
*/
|
||||||
public void consumeTypeSpecifierElaborated(int kind /*, IBinding binding*/) {
|
public void consumeTypeSpecifierElaborated(int kind) {
|
||||||
if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
|
if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
|
||||||
|
|
||||||
IASTName name = createName(parser.getRuleTokens().get(1));
|
IASTName name = createName(parser.getRuleTokens().get(1));
|
||||||
//name.setBinding(binding);
|
|
||||||
IASTElaboratedTypeSpecifier typeSpec = nodeFactory.newElaboratedTypeSpecifier(kind, name);
|
IASTElaboratedTypeSpecifier typeSpec = nodeFactory.newElaboratedTypeSpecifier(kind, name);
|
||||||
setOffsetAndLength(typeSpec);
|
setOffsetAndLength(typeSpec);
|
||||||
astStack.push(typeSpec);
|
astStack.push(typeSpec);
|
||||||
|
|
|
@ -170,7 +170,6 @@ public C99ExpressionStatementParser() { // constructor
|
||||||
|
|
||||||
private void initActions(IASTTranslationUnit tu) {
|
private void initActions(IASTTranslationUnit tu) {
|
||||||
action = new C99BuildASTParserAction ( C99ASTNodeFactory.DEFAULT_INSTANCE , this, tu);
|
action = new C99BuildASTParserAction ( C99ASTNodeFactory.DEFAULT_INSTANCE , this, tu);
|
||||||
action.setTokenMap(C99ExpressionStatementParsersym.orderedTerminalSymbols);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -170,7 +170,6 @@ public C99NoCastExpressionParser() { // constructor
|
||||||
|
|
||||||
private void initActions(IASTTranslationUnit tu) {
|
private void initActions(IASTTranslationUnit tu) {
|
||||||
action = new C99BuildASTParserAction ( C99ASTNodeFactory.DEFAULT_INSTANCE , this, tu);
|
action = new C99BuildASTParserAction ( C99ASTNodeFactory.DEFAULT_INSTANCE , this, tu);
|
||||||
action.setTokenMap(C99NoCastExpressionParsersym.orderedTerminalSymbols);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -170,7 +170,6 @@ public C99Parser() { // constructor
|
||||||
|
|
||||||
private void initActions(IASTTranslationUnit tu) {
|
private void initActions(IASTTranslationUnit tu) {
|
||||||
action = new C99BuildASTParserAction ( C99ASTNodeFactory.DEFAULT_INSTANCE , this, tu);
|
action = new C99BuildASTParserAction ( C99ASTNodeFactory.DEFAULT_INSTANCE , this, tu);
|
||||||
action.setTokenMap(C99Parsersym.orderedTerminalSymbols);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -170,7 +170,6 @@ public C99SizeofExpressionParser() { // constructor
|
||||||
|
|
||||||
private void initActions(IASTTranslationUnit tu) {
|
private void initActions(IASTTranslationUnit tu) {
|
||||||
action = new C99BuildASTParserAction ( C99ASTNodeFactory.DEFAULT_INSTANCE , this, tu);
|
action = new C99BuildASTParserAction ( C99ASTNodeFactory.DEFAULT_INSTANCE , this, tu);
|
||||||
action.setTokenMap(C99SizeofExpressionParsersym.orderedTerminalSymbols);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#Tue Apr 08 11:17:06 EDT 2008
|
#Tue Apr 08 17:05:16 EDT 2008
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
|
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
|
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
|
||||||
|
@ -48,7 +48,7 @@ org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
|
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
|
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
|
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedImport=error
|
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
|
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
|
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
|
org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
|
||||||
|
|
82
upc/org.eclipse.cdt.core.parser.upc/grammar/build.xml
Normal file
82
upc/org.eclipse.cdt.core.parser.upc/grammar/build.xml
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
<!--
|
||||||
|
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
|
||||||
|
-->
|
||||||
|
|
||||||
|
<project name="UPC Parser" default="upc" basedir=".">
|
||||||
|
<description>Generates the UPC parser from LPG grammar files</description>
|
||||||
|
|
||||||
|
<fail unless="lpg_exe">
|
||||||
|
Property $${lpg_exe} not set.
|
||||||
|
This property must be set to the full path to the LPG generator executable.
|
||||||
|
</fail>
|
||||||
|
|
||||||
|
<fail unless="lpg_template">
|
||||||
|
Property $${lpg_template} not set.
|
||||||
|
This property must be set to the full path to the LPG templates folder.
|
||||||
|
</fail>
|
||||||
|
|
||||||
|
<property name="upc_location" value="../src/org/eclipse/cdt/internal/core/dom/parser/upc"/>
|
||||||
|
|
||||||
|
<target name="upc">
|
||||||
|
<description>Generate the UPC parser</description>
|
||||||
|
<!-- Generate main parser -->
|
||||||
|
<antcall target="generate_upc">
|
||||||
|
<param name="grammar_name" value="UPCParser"/>
|
||||||
|
</antcall>
|
||||||
|
<!-- Generate parser for disambiguating declarations vs expression statements -->
|
||||||
|
<!--
|
||||||
|
<antcall target="generate_upc">
|
||||||
|
<param name="grammar_name" value="C99ExpressionStatementParser"/>
|
||||||
|
</antcall>
|
||||||
|
-->
|
||||||
|
<!-- Generate parser for disambiguating cast expressions vs binary expressions-->
|
||||||
|
<!--
|
||||||
|
<antcall target="generate_upc">
|
||||||
|
<param name="grammar_name" value="C99NoCastExpressionParser"/>
|
||||||
|
</antcall>
|
||||||
|
-->
|
||||||
|
<!-- Generate parser for disambiguating sizeof expressions -->
|
||||||
|
<!--
|
||||||
|
<antcall target="generate_upc">
|
||||||
|
<param name="grammar_name" value="C99SizeofExpressionParser"/>
|
||||||
|
</antcall>
|
||||||
|
-->
|
||||||
|
</target>
|
||||||
|
|
||||||
|
|
||||||
|
<target name="generate_upc">
|
||||||
|
<antcall target="generate">
|
||||||
|
<param name="grammar_dir" value="upc"/>
|
||||||
|
<param name="output_dir" value="${upc_location}"/>
|
||||||
|
<param name="grammar_name" value="${grammar_name}"/>
|
||||||
|
</antcall>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
|
||||||
|
<target name="generate">
|
||||||
|
<property name="grammar_file" value="${grammar_dir}/${grammar_name}.g"/>
|
||||||
|
<echo message="lpg_exe=${lpg_exe}"/>
|
||||||
|
<echo message="lpg_template=${lpg_template}"/>
|
||||||
|
<echo message="grammar_file=${grammar_file}.g"/>
|
||||||
|
<echo message="output_dir=${output_dir}"/>
|
||||||
|
|
||||||
|
<exec executable="${lpg_exe}">
|
||||||
|
<arg value="${grammar_file}"/>
|
||||||
|
<env key="LPG_TEMPLATE" path="${lpg_template}"/>
|
||||||
|
</exec>
|
||||||
|
|
||||||
|
<move overwrite="true" toDir="${output_dir}">
|
||||||
|
<fileset dir=".">
|
||||||
|
<include name="${grammar_name}*.*"/>
|
||||||
|
</fileset>
|
||||||
|
</move>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
</project>
|
|
@ -12,35 +12,34 @@
|
||||||
%options la=2
|
%options la=2
|
||||||
%options package=org.eclipse.cdt.internal.core.dom.parser.upc
|
%options package=org.eclipse.cdt.internal.core.dom.parser.upc
|
||||||
%options template=btParserTemplateD.g
|
%options template=btParserTemplateD.g
|
||||||
%options import_terminals=UPCLexer.g
|
|
||||||
|
|
||||||
|
|
||||||
-- Unified Parallel C (UPC) is an extension of C99.
|
-- Unified Parallel C (UPC) is an extension of C99.
|
||||||
-- Must set LPG_INCLUDE environment variable to the location of C99Parser.g
|
-- Must set LPG_INCLUDE environment variable to the location of C99Parser.g
|
||||||
$Import
|
$Import
|
||||||
C99Parser.g
|
C99Grammar.g
|
||||||
|
$End
|
||||||
|
|
||||||
|
$Start
|
||||||
|
translation_unit
|
||||||
|
$End
|
||||||
|
|
||||||
|
|
||||||
|
$Define
|
||||||
|
$build_action_class /. UPCParserAction ./
|
||||||
|
$node_factory_create_expression /. UPCASTNodeFactory.DEFAULT_INSTANCE ./
|
||||||
$End
|
$End
|
||||||
|
|
||||||
$Globals
|
$Globals
|
||||||
/.
|
/.
|
||||||
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTKeywordExpression;
|
import org.eclipse.cdt.core.dom.parser.upc.UPCASTNodeFactory;
|
||||||
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;
|
import org.eclipse.cdt.core.dom.parser.upc.UPCParserAction;
|
||||||
import org.eclipse.cdt.core.dom.c99.IPreprocessorTokenCollector;
|
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTKeywordExpression;
|
||||||
|
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTSynchronizationStatement;
|
||||||
|
import org.eclipse.cdt.core.dom.upc.ast.IUPCASTUnaryExpression;
|
||||||
./
|
./
|
||||||
$End
|
$End
|
||||||
|
|
||||||
$Define
|
|
||||||
$action_class /. UPCParserAction ./
|
|
||||||
$keyword_map_class /. UPCKeywordMap ./
|
|
||||||
$token_map_class /. UPCTokenMap ./
|
|
||||||
$lexer_class /. UPCLexer ./
|
|
||||||
$End
|
|
||||||
|
|
||||||
|
|
||||||
$Terminals -- Additional keywords defined by UPC
|
$Terminals -- Additional keywords defined by UPC
|
||||||
MYTHREAD
|
MYTHREAD
|
||||||
|
@ -67,40 +66,30 @@ $Rules -- UPC grammar extensions to C99
|
||||||
-- Expressions
|
-- 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
|
literal
|
||||||
-- 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'
|
::= 'MYTHREAD'
|
||||||
/.$ba consumeKeywordExpression(IUPCASTKeywordExpression.kw_mythread); $ea./
|
/. $Build consumeKeywordExpression(IUPCASTKeywordExpression.kw_mythread); $EndBuild ./
|
||||||
| 'THREADS'
|
| 'THREADS'
|
||||||
/.$ba consumeKeywordExpression(IUPCASTKeywordExpression.kw_threads); $ea./
|
/. $Build consumeKeywordExpression(IUPCASTKeywordExpression.kw_threads); $EndBuild ./
|
||||||
| 'UPC_MAX_BLOCKSIZE'
|
| 'UPC_MAX_BLOCKSIZE'
|
||||||
/.$ba consumeKeywordExpression(IUPCASTKeywordExpression.kw_upc_max_block_size); $ea./
|
/. $Build consumeKeywordExpression(IUPCASTKeywordExpression.kw_upc_max_block_size); $EndBuild ./
|
||||||
|
|
||||||
|
|
||||||
-- 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
|
||||||
/.$ba consumeExpressionUpcSizeofOperator(IUPCASTSizeofExpression.op_upc_localsizeof); $ea./
|
/. $Build consumeExpressionUpcSizeofOperator(IUPCASTUnaryExpression.op_upc_localsizeof); $EndBuild ./
|
||||||
| 'upc_localsizeof' '(' type_name ')'
|
| 'upc_localsizeof' '(' type_name ')'
|
||||||
/.$ba consumeExpressionUpcSizeofTypeName(IUPCASTSizeofExpression.op_upc_localsizeof); $ea./
|
/. $Build consumeExpressionUpcSizeofTypeName(IUPCASTUnaryExpression.op_upc_localsizeof); $EndBuild ./
|
||||||
| 'upc_blocksizeof' unary_expression
|
| 'upc_blocksizeof' unary_expression
|
||||||
/.$ba consumeExpressionUpcSizeofOperator(IUPCASTSizeofExpression.op_upc_blocksizeof); $ea./
|
/. $Build consumeExpressionUpcSizeofOperator(IUPCASTUnaryExpression.op_upc_blocksizeof); $EndBuild ./
|
||||||
| 'upc_blocksizeof' '(' type_name ')'
|
| 'upc_blocksizeof' '(' type_name ')'
|
||||||
/.$ba consumeExpressionUpcSizeofTypeName(IUPCASTSizeofExpression.op_upc_blocksizeof); $ea./
|
/. $Build consumeExpressionUpcSizeofTypeName(IUPCASTUnaryExpression.op_upc_blocksizeof); $EndBuild ./
|
||||||
| 'upc_elemsizeof' unary_expression
|
| 'upc_elemsizeof' unary_expression
|
||||||
/.$ba consumeExpressionUpcSizeofOperator(IUPCASTSizeofExpression.op_upc_elemsizeof); $ea./
|
/. $Build consumeExpressionUpcSizeofOperator(IUPCASTUnaryExpression.op_upc_elemsizeof); $EndBuild ./
|
||||||
| 'upc_elemsizeof' '(' type_name ')'
|
| 'upc_elemsizeof' '(' type_name ')'
|
||||||
/.$ba consumeExpressionUpcSizeofTypeName(IUPCASTSizeofExpression.op_upc_elemsizeof); $ea./
|
/. $Build consumeExpressionUpcSizeofTypeName(IUPCASTUnaryExpression.op_upc_elemsizeof); $EndBuild ./
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------
|
||||||
|
@ -120,19 +109,19 @@ type_qualifier
|
||||||
shared_type_qualifier
|
shared_type_qualifier
|
||||||
::= 'shared' layout_qualifier -- don't consume anything, the presense of the
|
::= 'shared' layout_qualifier -- don't consume anything, the presense of the
|
||||||
-- layout_qualifier will determine that 'shared' token was encountered
|
-- layout_qualifier will determine that 'shared' token was encountered
|
||||||
| 'shared' /.$ba consumeToken(); $ea./
|
| 'shared' /. $Build consumeToken(); $EndBuild ./
|
||||||
|
|
||||||
reference_type_qualifier
|
reference_type_qualifier
|
||||||
::= 'relaxed' /.$ba consumeToken(); $ea./
|
::= 'relaxed' /. $Build consumeToken(); $EndBuild ./
|
||||||
| 'strict' /.$ba consumeToken(); $ea./
|
| 'strict' /. $Build consumeToken(); $EndBuild ./
|
||||||
|
|
||||||
layout_qualifier
|
layout_qualifier
|
||||||
::= '[' constant_expression ']'
|
::= '[' constant_expression ']'
|
||||||
/.$ba consumeLayoutQualifier(true, false); $ea./
|
/. $Build consumeLayoutQualifier(true, false); $EndBuild ./
|
||||||
| '[' '*' ']'
|
| '[' '*' ']'
|
||||||
/.$ba consumeLayoutQualifier(false, true); $ea./
|
/. $Build consumeLayoutQualifier(false, true); $EndBuild ./
|
||||||
| '[' ']'
|
| '[' ']'
|
||||||
/.$ba consumeLayoutQualifier(false, false); $ea./
|
/. $Build consumeLayoutQualifier(false, false); $EndBuild ./
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -145,98 +134,98 @@ statement
|
||||||
|
|
||||||
synchronization_statement
|
synchronization_statement
|
||||||
::= 'upc_notify' expression ';'
|
::= 'upc_notify' expression ';'
|
||||||
/.$ba consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_notify, true); $ea./
|
/. $Build consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_notify, true); $EndBuild ./
|
||||||
| 'upc_notify' ';'
|
| 'upc_notify' ';'
|
||||||
/.$ba consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_notify, false); $ea./
|
/. $Build consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_notify, false); $EndBuild ./
|
||||||
| 'upc_wait' expression ';'
|
| 'upc_wait' expression ';'
|
||||||
/.$ba consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_wait, true); $ea./
|
/. $Build consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_wait, true); $EndBuild ./
|
||||||
| 'upc_wait' ';'
|
| 'upc_wait' ';'
|
||||||
/.$ba consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_wait, false); $ea./
|
/. $Build consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_wait, false); $EndBuild ./
|
||||||
| 'upc_barrier' expression ';'
|
| 'upc_barrier' expression ';'
|
||||||
/.$ba consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_barrier, true); $ea./
|
/. $Build consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_barrier, true); $EndBuild ./
|
||||||
| 'upc_barrier' ';'
|
| 'upc_barrier' ';'
|
||||||
/.$ba consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_barrier, false); $ea./
|
/. $Build consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_barrier, false); $EndBuild ./
|
||||||
| 'upc_fence' ';'
|
| 'upc_fence' ';'
|
||||||
/.$ba consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_fence, false); $ea./
|
/. $Build consumeStatementSynchronizationStatement(IUPCASTSynchronizationStatement.st_upc_fence, false); $EndBuild ./
|
||||||
|
|
||||||
|
|
||||||
iteration_statement
|
iteration_statement
|
||||||
::= 'upc_forall' '(' expression ';' expression ';' expression ';' affinity ')' statement
|
::= 'upc_forall' '(' expression ';' expression ';' expression ';' affinity ')' statement
|
||||||
/.$ba consumeStatementUPCForallLoop(true, true, true, true); $ea./
|
/. $Build consumeStatementUPCForallLoop(true, true, true, true); $EndBuild ./
|
||||||
|
|
||||||
| 'upc_forall' '(' expression ';' expression ';' expression ';' ')' statement
|
| 'upc_forall' '(' expression ';' expression ';' expression ';' ')' statement
|
||||||
/.$ba consumeStatementUPCForallLoop(true, true, true, false); $ea./
|
/. $Build consumeStatementUPCForallLoop(true, true, true, false); $EndBuild ./
|
||||||
|
|
||||||
| 'upc_forall' '(' expression ';' expression ';' ';' affinity ')' statement
|
| 'upc_forall' '(' expression ';' expression ';' ';' affinity ')' statement
|
||||||
/.$ba consumeStatementUPCForallLoop(true, true, false, true); $ea./
|
/. $Build consumeStatementUPCForallLoop(true, true, false, true); $EndBuild ./
|
||||||
|
|
||||||
| 'upc_forall' '(' expression ';' expression ';' ';' ')' statement
|
| 'upc_forall' '(' expression ';' expression ';' ';' ')' statement
|
||||||
/.$ba consumeStatementUPCForallLoop(true, true, false, false); $ea./
|
/. $Build consumeStatementUPCForallLoop(true, true, false, false); $EndBuild ./
|
||||||
|
|
||||||
| 'upc_forall' '(' expression ';' ';' expression ';' affinity ')' statement
|
| 'upc_forall' '(' expression ';' ';' expression ';' affinity ')' statement
|
||||||
/.$ba consumeStatementUPCForallLoop(true, false, true, true); $ea./
|
/. $Build consumeStatementUPCForallLoop(true, false, true, true); $EndBuild ./
|
||||||
|
|
||||||
| 'upc_forall' '(' expression ';' ';' expression ';' ')' statement
|
| 'upc_forall' '(' expression ';' ';' expression ';' ')' statement
|
||||||
/.$ba consumeStatementUPCForallLoop(true, false, true, false); $ea./
|
/. $Build consumeStatementUPCForallLoop(true, false, true, false); $EndBuild ./
|
||||||
|
|
||||||
| 'upc_forall' '(' expression ';' ';' ';' affinity ')' statement
|
| 'upc_forall' '(' expression ';' ';' ';' affinity ')' statement
|
||||||
/.$ba consumeStatementUPCForallLoop(true, false, false, true); $ea./
|
/. $Build consumeStatementUPCForallLoop(true, false, false, true); $EndBuild ./
|
||||||
|
|
||||||
| 'upc_forall' '(' expression ';' ';' ';' ')' statement
|
| 'upc_forall' '(' expression ';' ';' ';' ')' statement
|
||||||
/.$ba consumeStatementUPCForallLoop(true, false, false, false); $ea./
|
/. $Build consumeStatementUPCForallLoop(true, false, false, false); $EndBuild ./
|
||||||
|
|
||||||
| 'upc_forall' '(' ';' expression ';' expression ';' affinity ')' statement
|
| 'upc_forall' '(' ';' expression ';' expression ';' affinity ')' statement
|
||||||
/.$ba consumeStatementUPCForallLoop(false, true, true, true); $ea./
|
/. $Build consumeStatementUPCForallLoop(false, true, true, true); $EndBuild ./
|
||||||
|
|
||||||
| 'upc_forall' '(' ';' expression ';' expression ';' ')' statement
|
| 'upc_forall' '(' ';' expression ';' expression ';' ')' statement
|
||||||
/.$ba consumeStatementUPCForallLoop(false, true, true, false); $ea./
|
/. $Build consumeStatementUPCForallLoop(false, true, true, false); $EndBuild ./
|
||||||
|
|
||||||
| 'upc_forall' '(' ';' expression ';' ';' affinity ')' statement
|
| 'upc_forall' '(' ';' expression ';' ';' affinity ')' statement
|
||||||
/.$ba consumeStatementUPCForallLoop(false, true, false, true); $ea./
|
/. $Build consumeStatementUPCForallLoop(false, true, false, true); $EndBuild ./
|
||||||
|
|
||||||
| 'upc_forall' '(' ';' expression ';' ';' ')' statement
|
| 'upc_forall' '(' ';' expression ';' ';' ')' statement
|
||||||
/.$ba consumeStatementUPCForallLoop(false, true, false, false); $ea./
|
/. $Build consumeStatementUPCForallLoop(false, true, false, false); $EndBuild ./
|
||||||
|
|
||||||
| 'upc_forall' '(' ';' ';' expression ';' affinity ')' statement
|
| 'upc_forall' '(' ';' ';' expression ';' affinity ')' statement
|
||||||
/.$ba consumeStatementUPCForallLoop(false, false, true, true); $ea./
|
/. $Build consumeStatementUPCForallLoop(false, false, true, true); $EndBuild ./
|
||||||
|
|
||||||
| 'upc_forall' '(' ';' ';' expression ';' ')' statement
|
| 'upc_forall' '(' ';' ';' expression ';' ')' statement
|
||||||
/.$ba consumeStatementUPCForallLoop(false, false, true, false); $ea./
|
/. $Build consumeStatementUPCForallLoop(false, false, true, false); $EndBuild ./
|
||||||
|
|
||||||
| 'upc_forall' '(' ';' ';' ';' affinity ')' statement
|
| 'upc_forall' '(' ';' ';' ';' affinity ')' statement
|
||||||
/.$ba consumeStatementUPCForallLoop(false, false, false, true); $ea./
|
/. $Build consumeStatementUPCForallLoop(false, false, false, true); $EndBuild ./
|
||||||
|
|
||||||
| 'upc_forall' '(' ';' ';' ';' ')' statement
|
| 'upc_forall' '(' ';' ';' ';' ')' statement
|
||||||
/.$ba consumeStatementUPCForallLoop(false, false, false, false); $ea./
|
/. $Build consumeStatementUPCForallLoop(false, false, false, false); $EndBuild ./
|
||||||
|
|
||||||
| 'upc_forall' '(' declaration expression ';' expression ';' affinity ')' statement
|
| 'upc_forall' '(' declaration expression ';' expression ';' affinity ')' statement
|
||||||
/.$ba consumeStatementUPCForallLoop(true, true, true, true); $ea./
|
/. $Build consumeStatementUPCForallLoop(true, true, true, true); $EndBuild ./
|
||||||
|
|
||||||
| 'upc_forall' '(' declaration expression ';' expression ';' ')' statement
|
| 'upc_forall' '(' declaration expression ';' expression ';' ')' statement
|
||||||
/.$ba consumeStatementUPCForallLoop(true, true, true, false); $ea./
|
/. $Build consumeStatementUPCForallLoop(true, true, true, false); $EndBuild ./
|
||||||
|
|
||||||
| 'upc_forall' '(' declaration expression ';' ';' affinity ')' statement
|
| 'upc_forall' '(' declaration expression ';' ';' affinity ')' statement
|
||||||
/.$ba consumeStatementUPCForallLoop(true, true, false, true); $ea./
|
/. $Build consumeStatementUPCForallLoop(true, true, false, true); $EndBuild ./
|
||||||
|
|
||||||
| 'upc_forall' '(' declaration expression ';' ';' ')' statement
|
| 'upc_forall' '(' declaration expression ';' ';' ')' statement
|
||||||
/.$ba consumeStatementUPCForallLoop(true, true, false, false); $ea./
|
/. $Build consumeStatementUPCForallLoop(true, true, false, false); $EndBuild ./
|
||||||
|
|
||||||
| 'upc_forall' '(' declaration ';' expression ';' affinity ')' statement
|
| 'upc_forall' '(' declaration ';' expression ';' affinity ')' statement
|
||||||
/.$ba consumeStatementUPCForallLoop(true, false, true, true); $ea./
|
/. $Build consumeStatementUPCForallLoop(true, false, true, true); $EndBuild ./
|
||||||
|
|
||||||
| 'upc_forall' '(' declaration ';' expression ';' ')' statement
|
| 'upc_forall' '(' declaration ';' expression ';' ')' statement
|
||||||
/.$ba consumeStatementUPCForallLoop(true, false, true, false); $ea./
|
/. $Build consumeStatementUPCForallLoop(true, false, true, false); $EndBuild ./
|
||||||
|
|
||||||
| 'upc_forall' '(' declaration ';' ';' affinity ')' statement
|
| 'upc_forall' '(' declaration ';' ';' affinity ')' statement
|
||||||
/.$ba consumeStatementUPCForallLoop(true, false, false, true); $ea./
|
/. $Build consumeStatementUPCForallLoop(true, false, false, true); $EndBuild ./
|
||||||
|
|
||||||
| 'upc_forall' '(' declaration ';' ';' ')' statement
|
| 'upc_forall' '(' declaration ';' ';' ')' statement
|
||||||
/.$ba consumeStatementUPCForallLoop(true, false, false, false); $ea./
|
/. $Build consumeStatementUPCForallLoop(true, false, false, false); $EndBuild ./
|
||||||
|
|
||||||
affinity
|
affinity
|
||||||
::= expression
|
::= expression
|
||||||
| 'continue'
|
| 'continue'
|
||||||
/.$ba consumeToken(); $ea./
|
/. $Build consumeToken(); $EndBuild ./
|
||||||
|
|
||||||
$End
|
$End
|
||||||
|
|
|
@ -47,6 +47,9 @@ import org.eclipse.cdt.internal.core.dom.parser.upc.ast.UPCASTUnaryExpression;
|
||||||
*/
|
*/
|
||||||
public class UPCASTNodeFactory extends C99ASTNodeFactory {
|
public class UPCASTNodeFactory extends C99ASTNodeFactory {
|
||||||
|
|
||||||
|
public static final UPCASTNodeFactory DEFAULT_INSTANCE = new UPCASTNodeFactory();
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IASTTypeIdExpression newTypeIdExpression(int operator, IASTTypeId typeId) {
|
public IASTTypeIdExpression newTypeIdExpression(int operator, IASTTypeId typeId) {
|
||||||
return new UPCASTTypeIdExpression(operator, typeId);
|
return new UPCASTTypeIdExpression(operator, typeId);
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.dom.parser.upc;
|
package org.eclipse.cdt.core.dom.parser.upc;
|
||||||
|
|
||||||
|
|
||||||
import lpg.lpgjavaruntime.IToken;
|
import lpg.lpgjavaruntime.IToken;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||||
|
@ -40,11 +41,15 @@ public class UPCParserAction extends C99BuildASTParserAction {
|
||||||
|
|
||||||
public UPCParserAction(UPCASTNodeFactory nodeFactory, IParserActionTokenProvider parser, IASTTranslationUnit tu) {
|
public UPCParserAction(UPCASTNodeFactory nodeFactory, IParserActionTokenProvider parser, IASTTranslationUnit tu) {
|
||||||
super(nodeFactory, parser, tu);
|
super(nodeFactory, parser, tu);
|
||||||
super.setTokenMap(UPCParsersym.orderedTerminalSymbols);
|
|
||||||
this.nodeFactory = nodeFactory;
|
this.nodeFactory = nodeFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isCompletionToken(IToken token) {
|
||||||
|
return token.getKind() == UPCParsersym.TK_Completion;
|
||||||
|
}
|
||||||
|
|
||||||
/**************************************************************************************
|
/**************************************************************************************
|
||||||
* Semantic actions
|
* Semantic actions
|
||||||
**************************************************************************************/
|
**************************************************************************************/
|
||||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -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
|
||||||
|
@ -15,60 +15,68 @@ package org.eclipse.cdt.internal.core.dom.parser.upc;
|
||||||
|
|
||||||
public interface UPCParsersym {
|
public interface UPCParsersym {
|
||||||
public final static int
|
public final static int
|
||||||
TK_auto = 35,
|
TK_auto = 50,
|
||||||
TK_break = 64,
|
TK_break = 29,
|
||||||
TK_case = 65,
|
TK_case = 30,
|
||||||
TK_char = 41,
|
TK_char = 55,
|
||||||
TK_const = 25,
|
TK_const = 43,
|
||||||
TK_continue = 59,
|
TK_continue = 27,
|
||||||
TK_default = 66,
|
TK_default = 31,
|
||||||
TK_do = 67,
|
TK_do = 32,
|
||||||
TK_double = 42,
|
TK_double = 56,
|
||||||
TK_else = 93,
|
TK_else = 93,
|
||||||
TK_enum = 54,
|
TK_enum = 68,
|
||||||
TK_extern = 36,
|
TK_extern = 51,
|
||||||
TK_float = 43,
|
TK_float = 57,
|
||||||
TK_for = 68,
|
TK_for = 33,
|
||||||
TK_goto = 69,
|
TK_goto = 34,
|
||||||
TK_if = 70,
|
TK_if = 35,
|
||||||
TK_inline = 37,
|
TK_inline = 52,
|
||||||
TK_int = 44,
|
TK_int = 58,
|
||||||
TK_long = 45,
|
TK_long = 59,
|
||||||
TK_register = 38,
|
TK_register = 53,
|
||||||
TK_restrict = 26,
|
TK_restrict = 44,
|
||||||
TK_return = 71,
|
TK_return = 36,
|
||||||
TK_short = 46,
|
TK_short = 60,
|
||||||
TK_signed = 47,
|
TK_signed = 61,
|
||||||
TK_sizeof = 11,
|
TK_sizeof = 12,
|
||||||
TK_static = 32,
|
TK_static = 49,
|
||||||
TK_struct = 55,
|
TK_struct = 69,
|
||||||
TK_switch = 72,
|
TK_switch = 37,
|
||||||
TK_typedef = 39,
|
TK_typedef = 54,
|
||||||
TK_union = 56,
|
TK_union = 70,
|
||||||
TK_unsigned = 48,
|
TK_unsigned = 62,
|
||||||
TK_void = 49,
|
TK_void = 63,
|
||||||
TK_volatile = 27,
|
TK_volatile = 45,
|
||||||
TK_while = 60,
|
TK_while = 28,
|
||||||
TK__Bool = 50,
|
TK__Bool = 64,
|
||||||
TK__Complex = 51,
|
TK__Complex = 65,
|
||||||
TK__Imaginary = 52,
|
TK__Imaginary = 66,
|
||||||
TK_LeftBracket = 31,
|
TK_integer = 13,
|
||||||
TK_LeftParen = 1,
|
TK_floating = 14,
|
||||||
TK_LeftBrace = 24,
|
TK_charconst = 15,
|
||||||
|
TK_stringlit = 16,
|
||||||
|
TK_identifier = 1,
|
||||||
|
TK_Completion = 3,
|
||||||
|
TK_EndOfCompletion = 4,
|
||||||
|
TK_Invalid = 107,
|
||||||
|
TK_LeftBracket = 67,
|
||||||
|
TK_LeftParen = 2,
|
||||||
|
TK_LeftBrace = 6,
|
||||||
TK_Dot = 80,
|
TK_Dot = 80,
|
||||||
TK_Arrow = 94,
|
TK_Arrow = 94,
|
||||||
TK_PlusPlus = 9,
|
TK_PlusPlus = 10,
|
||||||
TK_MinusMinus = 10,
|
TK_MinusMinus = 11,
|
||||||
TK_And = 8,
|
TK_And = 9,
|
||||||
TK_Star = 3,
|
TK_Star = 5,
|
||||||
TK_Plus = 6,
|
TK_Plus = 7,
|
||||||
TK_Minus = 7,
|
TK_Minus = 8,
|
||||||
TK_Tilde = 12,
|
TK_Tilde = 17,
|
||||||
TK_Bang = 13,
|
TK_Bang = 18,
|
||||||
TK_Slash = 81,
|
TK_Slash = 81,
|
||||||
TK_Percent = 82,
|
TK_Percent = 82,
|
||||||
TK_RightShift = 61,
|
TK_RightShift = 76,
|
||||||
TK_LeftShift = 62,
|
TK_LeftShift = 77,
|
||||||
TK_LT = 83,
|
TK_LT = 83,
|
||||||
TK_GT = 84,
|
TK_GT = 84,
|
||||||
TK_LE = 85,
|
TK_LE = 85,
|
||||||
|
@ -80,9 +88,9 @@ public interface UPCParsersym {
|
||||||
TK_AndAnd = 92,
|
TK_AndAnd = 92,
|
||||||
TK_OrOr = 95,
|
TK_OrOr = 95,
|
||||||
TK_Question = 96,
|
TK_Question = 96,
|
||||||
TK_Colon = 57,
|
TK_Colon = 74,
|
||||||
TK_DotDotDot = 73,
|
TK_DotDotDot = 79,
|
||||||
TK_Assign = 74,
|
TK_Assign = 75,
|
||||||
TK_StarAssign = 97,
|
TK_StarAssign = 97,
|
||||||
TK_SlashAssign = 98,
|
TK_SlashAssign = 98,
|
||||||
TK_PercentAssign = 99,
|
TK_PercentAssign = 99,
|
||||||
|
@ -93,155 +101,137 @@ public interface UPCParsersym {
|
||||||
TK_AndAssign = 104,
|
TK_AndAssign = 104,
|
||||||
TK_CaretAssign = 105,
|
TK_CaretAssign = 105,
|
||||||
TK_OrAssign = 106,
|
TK_OrAssign = 106,
|
||||||
TK_Comma = 33,
|
TK_Comma = 72,
|
||||||
TK_Hash = 107,
|
TK_RightBracket = 78,
|
||||||
TK_HashHash = 108,
|
TK_RightParen = 73,
|
||||||
TK_NewLine = 109,
|
TK_RightBrace = 71,
|
||||||
TK_MYTHREAD = 14,
|
TK_SemiColon = 25,
|
||||||
TK_THREADS = 15,
|
TK_MYTHREAD = 19,
|
||||||
TK_UPC_MAX_BLOCKSIZE = 16,
|
TK_THREADS = 20,
|
||||||
TK_relaxed = 28,
|
TK_UPC_MAX_BLOCKSIZE = 21,
|
||||||
TK_shared = 29,
|
TK_relaxed = 46,
|
||||||
TK_strict = 30,
|
TK_shared = 47,
|
||||||
TK_upc_barrier = 75,
|
TK_strict = 48,
|
||||||
TK_upc_localsizeof = 17,
|
TK_upc_barrier = 38,
|
||||||
TK_upc_blocksizeof = 18,
|
TK_upc_localsizeof = 22,
|
||||||
TK_upc_elemsizeof = 19,
|
TK_upc_blocksizeof = 23,
|
||||||
TK_upc_notify = 76,
|
TK_upc_elemsizeof = 24,
|
||||||
TK_upc_fence = 77,
|
TK_upc_notify = 39,
|
||||||
TK_upc_wait = 78,
|
TK_upc_fence = 40,
|
||||||
TK_upc_forall = 79,
|
TK_upc_wait = 41,
|
||||||
TK_EOF_TOKEN = 87,
|
TK_upc_forall = 42,
|
||||||
TK_identifier = 2,
|
TK_ERROR_TOKEN = 26,
|
||||||
TK_integer = 20,
|
TK_EOF_TOKEN = 87;
|
||||||
TK_floating = 21,
|
|
||||||
TK_charconst = 22,
|
|
||||||
TK_stringlit = 23,
|
|
||||||
TK_RightBracket = 63,
|
|
||||||
TK_RightParen = 53,
|
|
||||||
TK_RightBrace = 40,
|
|
||||||
TK_SemiColon = 34,
|
|
||||||
TK_Invalid = 110,
|
|
||||||
TK_Completion = 5,
|
|
||||||
TK_EndOfCompletion = 4,
|
|
||||||
TK_SingleLineComment = 111,
|
|
||||||
TK_MultiLineComment = 112,
|
|
||||||
TK_ERROR_TOKEN = 58;
|
|
||||||
|
|
||||||
public final static String orderedTerminalSymbols[] = {
|
public final static String orderedTerminalSymbols[] = {
|
||||||
"",//$NON-NLS-1$
|
"",
|
||||||
"LeftParen",//$NON-NLS-1$
|
"identifier",
|
||||||
"identifier",//$NON-NLS-1$
|
"LeftParen",
|
||||||
"Star",//$NON-NLS-1$
|
"Completion",
|
||||||
"EndOfCompletion",//$NON-NLS-1$
|
"EndOfCompletion",
|
||||||
"Completion",//$NON-NLS-1$
|
"Star",
|
||||||
"Plus",//$NON-NLS-1$
|
"LeftBrace",
|
||||||
"Minus",//$NON-NLS-1$
|
"Plus",
|
||||||
"And",//$NON-NLS-1$
|
"Minus",
|
||||||
"PlusPlus",//$NON-NLS-1$
|
"And",
|
||||||
"MinusMinus",//$NON-NLS-1$
|
"PlusPlus",
|
||||||
"sizeof",//$NON-NLS-1$
|
"MinusMinus",
|
||||||
"Tilde",//$NON-NLS-1$
|
"sizeof",
|
||||||
"Bang",//$NON-NLS-1$
|
"integer",
|
||||||
"MYTHREAD",//$NON-NLS-1$
|
"floating",
|
||||||
"THREADS",//$NON-NLS-1$
|
"charconst",
|
||||||
"UPC_MAX_BLOCKSIZE",//$NON-NLS-1$
|
"stringlit",
|
||||||
"upc_localsizeof",//$NON-NLS-1$
|
"Tilde",
|
||||||
"upc_blocksizeof",//$NON-NLS-1$
|
"Bang",
|
||||||
"upc_elemsizeof",//$NON-NLS-1$
|
"MYTHREAD",
|
||||||
"integer",//$NON-NLS-1$
|
"THREADS",
|
||||||
"floating",//$NON-NLS-1$
|
"UPC_MAX_BLOCKSIZE",
|
||||||
"charconst",//$NON-NLS-1$
|
"upc_localsizeof",
|
||||||
"stringlit",//$NON-NLS-1$
|
"upc_blocksizeof",
|
||||||
"LeftBrace",//$NON-NLS-1$
|
"upc_elemsizeof",
|
||||||
"const",//$NON-NLS-1$
|
"SemiColon",
|
||||||
"restrict",//$NON-NLS-1$
|
"ERROR_TOKEN",
|
||||||
"volatile",//$NON-NLS-1$
|
"continue",
|
||||||
"relaxed",//$NON-NLS-1$
|
"while",
|
||||||
"shared",//$NON-NLS-1$
|
"break",
|
||||||
"strict",//$NON-NLS-1$
|
"case",
|
||||||
"LeftBracket",//$NON-NLS-1$
|
"default",
|
||||||
"static",//$NON-NLS-1$
|
"do",
|
||||||
"Comma",//$NON-NLS-1$
|
"for",
|
||||||
"SemiColon",//$NON-NLS-1$
|
"goto",
|
||||||
"auto",//$NON-NLS-1$
|
"if",
|
||||||
"extern",//$NON-NLS-1$
|
"return",
|
||||||
"inline",//$NON-NLS-1$
|
"switch",
|
||||||
"register",//$NON-NLS-1$
|
"upc_barrier",
|
||||||
"typedef",//$NON-NLS-1$
|
"upc_notify",
|
||||||
"RightBrace",//$NON-NLS-1$
|
"upc_fence",
|
||||||
"char",//$NON-NLS-1$
|
"upc_wait",
|
||||||
"double",//$NON-NLS-1$
|
"upc_forall",
|
||||||
"float",//$NON-NLS-1$
|
"const",
|
||||||
"int",//$NON-NLS-1$
|
"restrict",
|
||||||
"long",//$NON-NLS-1$
|
"volatile",
|
||||||
"short",//$NON-NLS-1$
|
"relaxed",
|
||||||
"signed",//$NON-NLS-1$
|
"shared",
|
||||||
"unsigned",//$NON-NLS-1$
|
"strict",
|
||||||
"void",//$NON-NLS-1$
|
"static",
|
||||||
"_Bool",//$NON-NLS-1$
|
"auto",
|
||||||
"_Complex",//$NON-NLS-1$
|
"extern",
|
||||||
"_Imaginary",//$NON-NLS-1$
|
"inline",
|
||||||
"RightParen",//$NON-NLS-1$
|
"register",
|
||||||
"enum",//$NON-NLS-1$
|
"typedef",
|
||||||
"struct",//$NON-NLS-1$
|
"char",
|
||||||
"union",//$NON-NLS-1$
|
"double",
|
||||||
"Colon",//$NON-NLS-1$
|
"float",
|
||||||
"ERROR_TOKEN",//$NON-NLS-1$
|
"int",
|
||||||
"continue",//$NON-NLS-1$
|
"long",
|
||||||
"while",//$NON-NLS-1$
|
"short",
|
||||||
"RightShift",//$NON-NLS-1$
|
"signed",
|
||||||
"LeftShift",//$NON-NLS-1$
|
"unsigned",
|
||||||
"RightBracket",//$NON-NLS-1$
|
"void",
|
||||||
"break",//$NON-NLS-1$
|
"_Bool",
|
||||||
"case",//$NON-NLS-1$
|
"_Complex",
|
||||||
"default",//$NON-NLS-1$
|
"_Imaginary",
|
||||||
"do",//$NON-NLS-1$
|
"LeftBracket",
|
||||||
"for",//$NON-NLS-1$
|
"enum",
|
||||||
"goto",//$NON-NLS-1$
|
"struct",
|
||||||
"if",//$NON-NLS-1$
|
"union",
|
||||||
"return",//$NON-NLS-1$
|
"RightBrace",
|
||||||
"switch",//$NON-NLS-1$
|
"Comma",
|
||||||
"DotDotDot",//$NON-NLS-1$
|
"RightParen",
|
||||||
"Assign",//$NON-NLS-1$
|
"Colon",
|
||||||
"upc_barrier",//$NON-NLS-1$
|
"Assign",
|
||||||
"upc_notify",//$NON-NLS-1$
|
"RightShift",
|
||||||
"upc_fence",//$NON-NLS-1$
|
"LeftShift",
|
||||||
"upc_wait",//$NON-NLS-1$
|
"RightBracket",
|
||||||
"upc_forall",//$NON-NLS-1$
|
"DotDotDot",
|
||||||
"Dot",//$NON-NLS-1$
|
"Dot",
|
||||||
"Slash",//$NON-NLS-1$
|
"Slash",
|
||||||
"Percent",//$NON-NLS-1$
|
"Percent",
|
||||||
"LT",//$NON-NLS-1$
|
"LT",
|
||||||
"GT",//$NON-NLS-1$
|
"GT",
|
||||||
"LE",//$NON-NLS-1$
|
"LE",
|
||||||
"GE",//$NON-NLS-1$
|
"GE",
|
||||||
"EOF_TOKEN",//$NON-NLS-1$
|
"EOF_TOKEN",
|
||||||
"EQ",//$NON-NLS-1$
|
"EQ",
|
||||||
"NE",//$NON-NLS-1$
|
"NE",
|
||||||
"Caret",//$NON-NLS-1$
|
"Caret",
|
||||||
"Or",//$NON-NLS-1$
|
"Or",
|
||||||
"AndAnd",//$NON-NLS-1$
|
"AndAnd",
|
||||||
"else",//$NON-NLS-1$
|
"else",
|
||||||
"Arrow",//$NON-NLS-1$
|
"Arrow",
|
||||||
"OrOr",//$NON-NLS-1$
|
"OrOr",
|
||||||
"Question",//$NON-NLS-1$
|
"Question",
|
||||||
"StarAssign",//$NON-NLS-1$
|
"StarAssign",
|
||||||
"SlashAssign",//$NON-NLS-1$
|
"SlashAssign",
|
||||||
"PercentAssign",//$NON-NLS-1$
|
"PercentAssign",
|
||||||
"PlusAssign",//$NON-NLS-1$
|
"PlusAssign",
|
||||||
"MinusAssign",//$NON-NLS-1$
|
"MinusAssign",
|
||||||
"RightShiftAssign",//$NON-NLS-1$
|
"RightShiftAssign",
|
||||||
"LeftShiftAssign",//$NON-NLS-1$
|
"LeftShiftAssign",
|
||||||
"AndAssign",//$NON-NLS-1$
|
"AndAssign",
|
||||||
"CaretAssign",//$NON-NLS-1$
|
"CaretAssign",
|
||||||
"OrAssign",//$NON-NLS-1$
|
"OrAssign",
|
||||||
"Hash",//$NON-NLS-1$
|
"Invalid"
|
||||||
"HashHash",//$NON-NLS-1$
|
|
||||||
"NewLine",//$NON-NLS-1$
|
|
||||||
"Invalid",//$NON-NLS-1$
|
|
||||||
"SingleLineComment",//$NON-NLS-1$
|
|
||||||
"MultiLineComment"//$NON-NLS-1$
|
|
||||||
};
|
};
|
||||||
|
|
||||||
public final static boolean isValidForParser = true;
|
public final static boolean isValidForParser = true;
|
||||||
|
|
Loading…
Add table
Reference in a new issue