Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Kucera2008-04-08 22:01:21 +0000
committerMike Kucera2008-04-08 22:01:21 +0000
commit2ae1a301ef89a1a194ddb2a8d2986da4e2cf71d3 (patch)
treea7bbf61440b82f7a0ca282280d4c25e3d175a6b1 /lrparser
parent1ca857981f6093615295f66ad67264c18b0559e5 (diff)
downloadorg.eclipse.cdt-2ae1a301ef89a1a194ddb2a8d2986da4e2cf71d3.tar.gz
org.eclipse.cdt-2ae1a301ef89a1a194ddb2a8d2986da4e2cf71d3.tar.xz
org.eclipse.cdt-2ae1a301ef89a1a194ddb2a8d2986da4e2cf71d3.zip
working on porting the UPC plugin
Diffstat (limited to 'lrparser')
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/META-INF/MANIFEST.MF3
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99Grammar.g24
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/common.g1
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/BuildASTParserAction.java3
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/c99/C99BuildASTParserAction.java60
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99ExpressionStatementParser.java1
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99NoCastExpressionParser.java1
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99Parser.java1
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99SizeofExpressionParser.java1
9 files changed, 19 insertions, 76 deletions
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/META-INF/MANIFEST.MF b/lrparser/org.eclipse.cdt.core.lrparser/META-INF/MANIFEST.MF
index 88b1935a825..907bb01f543 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/META-INF/MANIFEST.MF
+++ b/lrparser/org.eclipse.cdt.core.lrparser/META-INF/MANIFEST.MF
@@ -6,7 +6,8 @@ Bundle-Version: 4.0.1.qualifier
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.core.runtime,
+ org.apache.ant;bundle-version="1.7.0"
Export-Package: org.eclipse.cdt.core.dom.lrparser,
org.eclipse.cdt.core.dom.lrparser.action,
org.eclipse.cdt.core.dom.lrparser.action.c99,
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99Grammar.g b/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99Grammar.g
index c9795f23fe7..f591416686d 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99Grammar.g
+++ b/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/C99Grammar.g
@@ -13,6 +13,7 @@
-- TODO when the architecture has solidified try to move common
-- stuff between C99 and C++ into one file.
+
$Include
common.g
$End
@@ -117,13 +118,6 @@ $End
-
---$Start
--- translation_unit
---$End
-
-
-
$Rules
-------------------------------------------------------------------------------------------
@@ -986,19 +980,3 @@ function_body
/. $Build consumeStatementCompoundStatement(true); $EndBuild ./
$End
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/common.g b/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/common.g
index 48c4396050e..d219d3bf41b 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/common.g
+++ b/lrparser/org.eclipse.cdt.core.lrparser/grammar/c99/common.g
@@ -67,7 +67,6 @@ $Headers
private void initActions(IASTTranslationUnit tu) {
action = new $build_action_class($node_factory_create_expression, this, tu);
- action.setTokenMap($sym_type.orderedTerminalSymbols);
}
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/BuildASTParserAction.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/BuildASTParserAction.java
index b3000630440..224949acbae 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/BuildASTParserAction.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/BuildASTParserAction.java
@@ -114,9 +114,6 @@ public abstract class BuildASTParserAction {
private final IASTNodeFactory nodeFactory;
-
-
-
/**
* Completion tokens are represented by different kinds by different parsers.
*/
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/c99/C99BuildASTParserAction.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/c99/C99BuildASTParserAction.java
index 876b203715c..c9a6806c965 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/c99/C99BuildASTParserAction.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/c99/C99BuildASTParserAction.java
@@ -11,28 +11,7 @@
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.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 static org.eclipse.cdt.internal.core.dom.lrparser.c99.C99Parsersym.*;
import java.util.Collections;
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.C99Parsersym;
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;
/**
@@ -98,7 +76,7 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
@SuppressWarnings("restriction")
public class C99BuildASTParserAction extends BuildASTParserAction {
- private ITokenMap tokenMap = null;
+ private final ITokenMap tokenMap;
/** Used to create the AST node objects */
protected final IC99ASTNodeFactory nodeFactory;
@@ -111,25 +89,22 @@ public class C99BuildASTParserAction extends BuildASTParserAction {
public C99BuildASTParserAction(IC99ASTNodeFactory nodeFactory, IParserActionTokenProvider parser, IASTTranslationUnit tu) {
super(nodeFactory, parser, tu);
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;
}
- public void setTokenMap(String[] orderedTerminalSymbols) {
- this.tokenMap = new TokenMap(C99Parsersym.orderedTerminalSymbols, orderedTerminalSymbols);
- }
-
-
- int asC99Kind(IToken token) {
+ private int asC99Kind(IToken token) {
return asC99Kind(token.getKind());
}
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
*/
- public void consumeExpressionFieldReference(/*IBinding field, */ boolean isPointerDereference) {
+ public void consumeExpressionFieldReference(boolean isPointerDereference) {
if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
IASTName name = createName(parser.getRightIToken());
- //name.setBinding(field);
IASTExpression owner = (IASTExpression) astStack.pop();
IASTFieldReference expr = nodeFactory.newFieldReference(name, owner, isPointerDereference);
setOffsetAndLength(expr);
@@ -222,7 +196,7 @@ public class C99BuildASTParserAction extends BuildASTParserAction {
* In plain C99 specifiers are always just single tokens, but in language
* 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
- * and used with arbitray objects as the specifier.
+ * and used with arbitrary objects as the specifier.
*/
protected void setSpecifier(ICASTDeclSpecifier node, Object specifier) {
if(!(specifier instanceof IToken))
@@ -463,11 +437,10 @@ public class C99BuildASTParserAction extends BuildASTParserAction {
/**
* designator ::= '.' 'identifier'
*/
- public void consumeDesignatorField(/*IBinding binding*/) {
+ public void consumeDesignatorField() {
if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
- IASTName name = createName( parser.getRightIToken() );
- //name.setBinding(binding);
+ IASTName name = createName(parser.getRightIToken());
ICASTFieldDesignator designator = nodeFactory.newCFieldDesignator(name);
setOffsetAndLength(designator);
astStack.push(designator);
@@ -558,10 +531,10 @@ public class C99BuildASTParserAction extends BuildASTParserAction {
List<Object> declarators = (hasDeclaratorList) ? astStack.closeScope() : Collections.emptyList();
IASTDeclSpecifier declSpecifier = (IASTDeclSpecifier) astStack.pop();
- // do not generate nodes for extra EOC tokens
- if(matchTokens(parser.getRuleTokens(), CPPParsersym.TK_EndOfCompletion))
- return;
-
+ List<IToken> ruleTokens = parser.getRuleTokens();
+ if(ruleTokens.size() == 1 && asC99Kind(ruleTokens.get(0)) == TK_EndOfCompletion)
+ return; // do not generate nodes for extra EOC tokens
+
IASTSimpleDeclaration declaration = nodeFactory.newSimpleDeclaration(declSpecifier);
for(Object declarator : declarators)
@@ -647,11 +620,10 @@ public class C99BuildASTParserAction extends BuildASTParserAction {
*
* enum_specifier ::= 'enum' enum_identifier
*/
- public void consumeTypeSpecifierElaborated(int kind /*, IBinding binding*/) {
+ public void consumeTypeSpecifierElaborated(int kind) {
if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
IASTName name = createName(parser.getRuleTokens().get(1));
- //name.setBinding(binding);
IASTElaboratedTypeSpecifier typeSpec = nodeFactory.newElaboratedTypeSpecifier(kind, name);
setOffsetAndLength(typeSpec);
astStack.push(typeSpec);
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99ExpressionStatementParser.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99ExpressionStatementParser.java
index f29493506ac..65cf6ec9960 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99ExpressionStatementParser.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99ExpressionStatementParser.java
@@ -170,7 +170,6 @@ public C99ExpressionStatementParser() { // constructor
private void initActions(IASTTranslationUnit tu) {
action = new C99BuildASTParserAction ( C99ASTNodeFactory.DEFAULT_INSTANCE , this, tu);
- action.setTokenMap(C99ExpressionStatementParsersym.orderedTerminalSymbols);
}
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99NoCastExpressionParser.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99NoCastExpressionParser.java
index 85077dd3016..0c4ecf68d21 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99NoCastExpressionParser.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99NoCastExpressionParser.java
@@ -170,7 +170,6 @@ public C99NoCastExpressionParser() { // constructor
private void initActions(IASTTranslationUnit tu) {
action = new C99BuildASTParserAction ( C99ASTNodeFactory.DEFAULT_INSTANCE , this, tu);
- action.setTokenMap(C99NoCastExpressionParsersym.orderedTerminalSymbols);
}
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99Parser.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99Parser.java
index d7636fa486f..b636ce52e02 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99Parser.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99Parser.java
@@ -170,7 +170,6 @@ public C99Parser() { // constructor
private void initActions(IASTTranslationUnit tu) {
action = new C99BuildASTParserAction ( C99ASTNodeFactory.DEFAULT_INSTANCE , this, tu);
- action.setTokenMap(C99Parsersym.orderedTerminalSymbols);
}
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99SizeofExpressionParser.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99SizeofExpressionParser.java
index e7e5aae0f16..fc986e8087d 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99SizeofExpressionParser.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/internal/core/dom/lrparser/c99/C99SizeofExpressionParser.java
@@ -170,7 +170,6 @@ public C99SizeofExpressionParser() { // constructor
private void initActions(IASTTranslationUnit tu) {
action = new C99BuildASTParserAction ( C99ASTNodeFactory.DEFAULT_INSTANCE , this, tu);
- action.setTokenMap(C99SizeofExpressionParsersym.orderedTerminalSymbols);
}

Back to the top