Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Camelon2003-06-12 15:21:46 -0400
committerJohn Camelon2003-06-12 15:21:46 -0400
commit7fb1f3201b8c44ec55ef2d4e72f70122b8ee46b7 (patch)
treeca0492868656a16e1ff28b5687c7563a361c313b
parent3d373aa26c0df41a99f52e968ccfc58550b5981f (diff)
downloadorg.eclipse.cdt-7fb1f3201b8c44ec55ef2d4e72f70122b8ee46b7.tar.gz
org.eclipse.cdt-7fb1f3201b8c44ec55ef2d4e72f70122b8ee46b7.tar.xz
org.eclipse.cdt-7fb1f3201b8c44ec55ef2d4e72f70122b8ee46b7.zip
Fleshing out QuickParseASTFactory and supporting classes.
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/IScanner.java (renamed from core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/IScanner.java)15
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTDeclaration.java21
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTFactory.java (renamed from core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/IASTFactory.java)31
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTLinkageSpecification.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTNamespaceDefinition.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTTemplateParameter.java19
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java31
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ParserFactory.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Scanner.java30
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/BaseASTFactory.java25
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/NamedOffsets.java37
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/Offsets.java39
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/ASTASMDefinition.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/ASTClassSpecifier.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/ASTCompilationUnit.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/ASTLinkageSpecification.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/ASTNamespaceDefinition.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/BaseIterator.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/FullParseASTFactory.java29
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/IASTFASMDefinition.java (renamed from core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/IASTASMDefinition.java)2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/IASTFClassSpecifier.java (renamed from core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/IASTClassSpecifier.java)2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/IASTFCompilationUnit.java (renamed from core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/IASTCompilationUnit.java)4
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/IASTFLinkageSpecification.java (renamed from core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/IASTLinkageSpecification.java)4
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/IASTFNamespaceDefinition.java (renamed from core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/IASTNamespaceDefinition.java)4
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/IASTFScope.java (renamed from core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/IASTScope.java)2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTASMDefinition.java70
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTCompilationUnit.java40
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTDeclaration.java35
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTLinkageSpecification.java59
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTNamespaceDefinition.java99
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTUsingDirective.java38
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/IASTQScope.java23
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/QuickParseASTFactory.java39
-rw-r--r--core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/BaseDOMTest.java2
-rw-r--r--core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTest.java4
35 files changed, 622 insertions, 100 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/IScanner.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/IScanner.java
index 0911259fa8..abb56ac846 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/IScanner.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/IScanner.java
@@ -1,18 +1,18 @@
-package org.eclipse.cdt.internal.core.parser;
+package org.eclipse.cdt.core.parser;
import java.io.Reader;
import java.util.List;
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
+import org.eclipse.cdt.core.parser.ast.IASTFactory;
+import org.eclipse.cdt.internal.core.parser.IMacroDescriptor;
+import org.eclipse.cdt.internal.core.parser.IParserCallback;
+import org.eclipse.cdt.internal.core.parser.Parser;
+import org.eclipse.cdt.internal.core.parser.ScannerException;
+import org.eclipse.cdt.internal.core.parser.Token;
/**
* @author jcamelon
*
- * To change this generated comment edit the template variable
-"typecomment":
- * Window>Preferences>Java>Templates.
- * To enable and disable the creation of type comments go to
- * Window>Preferences>Java>Code Generation.
*/
public interface IScanner {
@@ -36,4 +36,5 @@ public interface IScanner {
public void setQuickScan(boolean qs);
public void setCallback(IParserCallback c);
public void setRequestor( ISourceElementRequestor r );
+ public void setASTFactory( IASTFactory f );
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTDeclaration.java
new file mode 100644
index 0000000000..569b6b1da1
--- /dev/null
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTDeclaration.java
@@ -0,0 +1,21 @@
+/**********************************************************************
+ * Copyright (c) 2002,2003 Rational Software Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM Rational Software - Initial API and implementation
+***********************************************************************/
+package org.eclipse.cdt.core.parser.ast;
+
+/**
+ * @author jcamelon
+ *
+ */
+public interface IASTDeclaration {
+
+ IASTScope getOwnerScope();
+
+}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/IASTFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTFactory.java
index ba1600e615..69766cb12a 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/IASTFactory.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTFactory.java
@@ -8,35 +8,38 @@
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
-package org.eclipse.cdt.internal.core.parser.ast;
+package org.eclipse.cdt.core.parser.ast;
-import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
import org.eclipse.cdt.internal.core.parser.TokenDuple;
import org.eclipse.cdt.internal.core.parser.Parser.Backtrack;
-import org.eclipse.cdt.internal.core.parser.ast.full.IASTASMDefinition;
-import org.eclipse.cdt.internal.core.parser.ast.full.IASTCompilationUnit;
-import org.eclipse.cdt.internal.core.parser.ast.full.IASTLinkageSpecification;
-import org.eclipse.cdt.internal.core.parser.ast.full.IASTNamespaceDefinition;
-import org.eclipse.cdt.internal.core.parser.ast.full.IASTScope;
/**
* @author jcamelon
*
*/
public interface IASTFactory {
- public abstract IASTUsingDirective createUsingDirective(
+
+ public IASTMacro createMacro( String name, int startingOffset, int endingOffset, int nameOffset );
+ public IASTInclusion createInclusion( String name, String fileName, boolean local, int startingOffset, int endingOffset, int nameOffset );
+
+ public IASTUsingDirective createUsingDirective(
IASTScope scope,
TokenDuple duple)
throws Backtrack;
- public abstract IASTASMDefinition createASMDefinition(
+
+ public IASTASMDefinition createASMDefinition(
IASTScope scope,
String assembly,
int first,
int last);
- public abstract IASTNamespaceDefinition createNamespaceDefinition(
- int first,
+
+ public IASTNamespaceDefinition createNamespaceDefinition(
+ IASTScope scope,
String identifier,
- int nameOffset);
- public abstract IASTCompilationUnit createCompilationUnit();
- public abstract IASTLinkageSpecification createLinkageSpecification(String spec);
+ int startingOffset, int nameOffset);
+
+ public IASTCompilationUnit createCompilationUnit();
+
+ public IASTLinkageSpecification createLinkageSpecification(IASTScope scope, String spec);
+
} \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTLinkageSpecification.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTLinkageSpecification.java
index fe55bf95e4..17d391eee6 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTLinkageSpecification.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTLinkageSpecification.java
@@ -14,7 +14,7 @@ package org.eclipse.cdt.core.parser.ast;
* @author jcamelon
*
*/
-public interface IASTLinkageSpecification {
+public interface IASTLinkageSpecification extends IASTScope {
public String getLinkageString();
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTNamespaceDefinition.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTNamespaceDefinition.java
index 88e4f5b748..dc1513c1ad 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTNamespaceDefinition.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTNamespaceDefinition.java
@@ -14,6 +14,6 @@ package org.eclipse.cdt.core.parser.ast;
* @author jcamelon
*
*/
-public interface IASTNamespaceDefinition extends IASTOffsetableNamedElement {
+public interface IASTNamespaceDefinition extends IASTOffsetableNamedElement, IASTScope {
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTTemplateParameter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTTemplateParameter.java
new file mode 100644
index 0000000000..a0d3ebd956
--- /dev/null
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTTemplateParameter.java
@@ -0,0 +1,19 @@
+/**********************************************************************
+ * Copyright (c) 2002,2003 Rational Software Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM Rational Software - Initial API and implementation
+***********************************************************************/
+package org.eclipse.cdt.core.parser.ast;
+
+/**
+ * @author jcamelon
+ *
+ */
+public interface IASTTemplateParameter {
+
+}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java
index 0813f0e685..3960e7bf69 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java
@@ -16,15 +16,17 @@ import java.io.InputStreamReader;
import java.io.StringReader;
import org.eclipse.cdt.core.parser.IParser;
+import org.eclipse.cdt.core.parser.IScanner;
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
+import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
+import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
+import org.eclipse.cdt.core.parser.ast.IASTFactory;
+import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
+import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
+import org.eclipse.cdt.core.parser.ast.IASTScope;
import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
import org.eclipse.cdt.internal.core.model.Util;
-import org.eclipse.cdt.internal.core.parser.ast.IASTFactory;
-import org.eclipse.cdt.internal.core.parser.ast.full.IASTASMDefinition;
-import org.eclipse.cdt.internal.core.parser.ast.full.IASTCompilationUnit;
-import org.eclipse.cdt.internal.core.parser.ast.full.IASTLinkageSpecification;
-import org.eclipse.cdt.internal.core.parser.ast.full.IASTNamespaceDefinition;
-import org.eclipse.cdt.internal.core.parser.ast.full.IASTScope;
+import org.eclipse.cdt.internal.core.parser.ast.full.IASTFScope;
/**
* This is our first implementation of the IParser interface, serving as a parser for
@@ -43,7 +45,7 @@ public class Parser implements IParser {
private boolean parsePassed = true; // did the parse pass?
private boolean cppNature = true; // true for C++, false for C
private ISourceElementRequestor requestor = null; // new callback mechanism
- private IASTFactory astFactory = ParserFactory.createASTFactory( false );
+ private IASTFactory astFactory = null; // ast factory
/**
* This is the single entry point for setting parsePassed to
@@ -76,6 +78,7 @@ public class Parser implements IParser {
astFactory = ParserFactory.createASTFactory( quick );
scanner.setQuickScan(quick);
scanner.setCallback(c);
+ scanner.setASTFactory( astFactory );
}
@@ -345,7 +348,7 @@ c, quickParse);
* @param container Callback object representing the scope these definitions fall into.
* @throws Backtrack request for a backtrack
*/
- protected void linkageSpecification( Object container ) throws Backtrack
+ protected void linkageSpecification( Object container, IASTScope scope ) throws Backtrack
{
consume( Token.t_extern );
@@ -360,7 +363,7 @@ c, quickParse);
{
consume(Token.tLBRACE);
- IASTLinkageSpecification linkage = astFactory.createLinkageSpecification(spec.getImage());
+ IASTLinkageSpecification linkage = astFactory.createLinkageSpecification(scope, spec.getImage());
requestor.enterLinkageSpecification( linkage );
@@ -394,7 +397,7 @@ c, quickParse);
else // single declaration
{
- IASTLinkageSpecification linkage = astFactory.createLinkageSpecification( spec.getImage() );
+ IASTLinkageSpecification linkage = astFactory.createLinkageSpecification( scope, spec.getImage() );
requestor.enterLinkageSpecification( linkage );
@@ -625,7 +628,7 @@ c, quickParse);
case Token.t_extern:
if( LT(2) == Token.tSTRING )
{
- linkageSpecification( container );
+ linkageSpecification( container, scope );
return;
}
default:
@@ -673,8 +676,10 @@ c, quickParse);
consume();
IASTNamespaceDefinition namespaceDefinition =
- astFactory.createNamespaceDefinition(first.getOffset(), identifier.getImage(),
- ( identifier == null ? 0 : identifier.getOffset()) );
+ astFactory.createNamespaceDefinition(
+ scope,
+ ( identifier == null ? "" : identifier.getImage() ),
+ first.getOffset(), ( identifier == null ? 0 : identifier.getOffset()) );
requestor.enterNamespaceDefinition( namespaceDefinition );
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ParserFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ParserFactory.java
index 2ecfd6b075..e97c8b7786 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ParserFactory.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ParserFactory.java
@@ -10,7 +10,7 @@
***********************************************************************/
package org.eclipse.cdt.internal.core.parser;
-import org.eclipse.cdt.internal.core.parser.ast.IASTFactory;
+import org.eclipse.cdt.core.parser.ast.IASTFactory;
import org.eclipse.cdt.internal.core.parser.ast.full.FullParseASTFactory;
import org.eclipse.cdt.internal.core.parser.ast.quick.QuickParseASTFactory;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Scanner.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Scanner.java
index eaf9180163..d4daad8e5b 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Scanner.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Scanner.java
@@ -25,11 +25,11 @@ import java.util.StringTokenizer;
import java.util.Vector;
import org.eclipse.cdt.core.parser.IParser;
+import org.eclipse.cdt.core.parser.IScanner;
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
+import org.eclipse.cdt.core.parser.ast.IASTFactory;
import org.eclipse.cdt.core.parser.ast.IASTInclusion;
import org.eclipse.cdt.core.parser.ast.IASTMacro;
-import org.eclipse.cdt.internal.core.parser.ast.ASTInclusion;
-import org.eclipse.cdt.internal.core.parser.ast.ASTMacro;
/**
* @author jcamelon
@@ -310,10 +310,7 @@ public class Scanner implements IScanner {
if (throwExceptionOnInclusionNotFound && inclusionReader == null )
throw new ScannerException("Cannot find inclusion " + fileName);
- IASTInclusion inclusion = new ASTInclusion( fileName, newPath, !useIncludePaths );
- inclusion.setNameOffset(nameOffset);
- inclusion.setStartingOffset(beginOffset);
- inclusion.setEndingOffset( endOffset);
+ IASTInclusion inclusion = astFactory.createInclusion( fileName, newPath, !useIncludePaths, beginOffset, endOffset, nameOffset );
contextStack.updateContext(inclusionReader, newPath, ScannerContext.INCLUSION, inclusion, requestor );
}
@@ -1796,10 +1793,8 @@ public class Scanner implements IScanner {
if( requestor != null )
{
- IASTInclusion i = new ASTInclusion(f,"",!useIncludePath);
- i.setStartingOffset( beginningOffset );
- i.setNameOffset( offset );
- i.setEndingOffset( contextStack.getCurrentContext().getOffset() );
+ IASTInclusion i = astFactory.createInclusion( f, "", !useIncludePath, beginningOffset,
+ contextStack.getCurrentContext().getOffset(), offset );
requestor.enterInclusion(i);
requestor.exitInclusion(i);
}
@@ -1975,10 +1970,7 @@ public class Scanner implements IScanner {
if( requestor != null )
{
- IASTMacro m = new ASTMacro(key);
- m.setStartingOffset(beginning);
- m.setNameOffset(offset);
- m.setEndingOffset(contextStack.getCurrentContext().getOffset());
+ IASTMacro m = astFactory.createMacro( key, beginning, contextStack.getCurrentContext().getOffset(), offset );
requestor.acceptMacro(m);
}
}
@@ -2222,5 +2214,13 @@ public class Scanner implements IScanner {
requestor = r;
}
- private ISourceElementRequestor requestor = null;
+ private ISourceElementRequestor requestor = null;
+ private IASTFactory astFactory = null;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.IScanner#setASTFactory(org.eclipse.cdt.internal.core.parser.ast.IASTFactory)
+ */
+ public void setASTFactory(IASTFactory f) {
+ astFactory = f;
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/BaseASTFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/BaseASTFactory.java
index 4fc1dd3420..9ed2cc25f6 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/BaseASTFactory.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/BaseASTFactory.java
@@ -10,6 +10,9 @@
***********************************************************************/
package org.eclipse.cdt.internal.core.parser.ast;
+import org.eclipse.cdt.core.parser.ast.IASTInclusion;
+import org.eclipse.cdt.core.parser.ast.IASTMacro;
+
/**
* @author jcamelon
@@ -17,5 +20,27 @@ package org.eclipse.cdt.internal.core.parser.ast;
*/
public class BaseASTFactory {
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.internal.core.parser.ast.IASTFactory#createMacro(java.lang.String, int, int, int)
+ */
+ public IASTMacro createMacro(String name, int startingOffset, int endingOffset, int nameOffset) {
+ IASTMacro m = new ASTMacro( name );
+ m.setStartingOffset( startingOffset );
+ m.setEndingOffset( endingOffset );
+ m.setNameOffset( nameOffset );
+ return m;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.internal.core.parser.ast.IASTFactory#createInclusion(java.lang.String, java.lang.String, boolean)
+ */
+ public IASTInclusion createInclusion(String name, String fileName, boolean local, int startingOffset, int endingOffset, int nameOffset) {
+ IASTInclusion inclusion = new ASTInclusion( name, fileName, local );
+ inclusion.setStartingOffset( startingOffset );
+ inclusion.setEndingOffset( endingOffset );
+ inclusion.setNameOffset( nameOffset );
+ return inclusion;
+ }
+
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/NamedOffsets.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/NamedOffsets.java
new file mode 100644
index 0000000000..124daeb747
--- /dev/null
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/NamedOffsets.java
@@ -0,0 +1,37 @@
+/**********************************************************************
+ * Copyright (c) 2002,2003 Rational Software Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM Rational Software - Initial API and implementation
+***********************************************************************/
+package org.eclipse.cdt.internal.core.parser.ast;
+
+
+/**
+ * @author jcamelon
+ *
+ */
+public class NamedOffsets extends Offsets {
+
+ private int nameOffset = 0;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getElementNameOffset()
+ */
+ public int getElementNameOffset() {
+ return nameOffset;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameOffset(int)
+ */
+ public void setNameOffset(int o) {
+ nameOffset = o;
+ }
+
+
+}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/Offsets.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/Offsets.java
new file mode 100644
index 0000000000..a42238be23
--- /dev/null
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/Offsets.java
@@ -0,0 +1,39 @@
+/**********************************************************************
+ * Copyright (c) 2002,2003 Rational Software Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM Rational Software - Initial API and implementation
+***********************************************************************/
+package org.eclipse.cdt.internal.core.parser.ast;
+
+/**
+ * @author jcamelon
+ *
+ */
+public class Offsets {
+
+ protected int startingOffset = 0;
+
+ protected int endingOffset = 0;
+
+ public void setStartingOffset(int o) {
+ startingOffset = o;
+ }
+
+ public void setEndingOffset(int o) {
+ endingOffset = o;
+ }
+
+ public int getElementStartingOffset() {
+ return startingOffset;
+ }
+
+ public int getElementEndingOffset() {
+ return endingOffset;
+ }
+
+}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/ASTASMDefinition.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/ASTASMDefinition.java
index 6ef1c9020b..9229291431 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/ASTASMDefinition.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/ASTASMDefinition.java
@@ -17,7 +17,7 @@ import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
* @author jcamelon
*
*/
-public class ASTASMDefinition implements IASTASMDefinition {
+public class ASTASMDefinition implements IASTFASMDefinition {
private final String body;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/ASTClassSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/ASTClassSpecifier.java
index 32ebf53e03..1125ace1a1 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/ASTClassSpecifier.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/ASTClassSpecifier.java
@@ -23,7 +23,7 @@ import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTable;
* @author jcamelon
*
*/
-public class ASTClassSpecifier implements IASTClassSpecifier, IPSTSymbolExtension {
+public class ASTClassSpecifier implements IASTFClassSpecifier, IPSTSymbolExtension {
private final IDerivableContainerSymbol symbol;
private final ClassKind classKind;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/ASTCompilationUnit.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/ASTCompilationUnit.java
index a2750c38a3..8c97fde9af 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/ASTCompilationUnit.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/ASTCompilationUnit.java
@@ -19,7 +19,7 @@ import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
* @author jcamelon
*
*/
-public class ASTCompilationUnit implements IASTCompilationUnit {
+public class ASTCompilationUnit implements IASTFCompilationUnit {
public ASTCompilationUnit( IContainerSymbol symbol )
{
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/ASTLinkageSpecification.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/ASTLinkageSpecification.java
index 5ba5c4549f..628c7b1e0e 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/ASTLinkageSpecification.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/ASTLinkageSpecification.java
@@ -19,7 +19,7 @@ import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
* @author jcamelon
*
*/
-public class ASTLinkageSpecification implements IASTLinkageSpecification {
+public class ASTLinkageSpecification implements IASTFLinkageSpecification {
public ASTLinkageSpecification( IContainerSymbol symbol, String linkage )
{
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/ASTNamespaceDefinition.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/ASTNamespaceDefinition.java
index df5ccb9172..eb3c03d9d7 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/ASTNamespaceDefinition.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/ASTNamespaceDefinition.java
@@ -20,7 +20,7 @@ import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
* @author jcamelon
*
*/
-public class ASTNamespaceDefinition implements IASTNamespaceDefinition {
+public class ASTNamespaceDefinition implements IASTFNamespaceDefinition {
public ASTNamespaceDefinition( IContainerSymbol symbol, String name )
{
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/BaseIterator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/BaseIterator.java
index ccc278b65e..8c176e9054 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/BaseIterator.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/BaseIterator.java
@@ -40,7 +40,7 @@ public class BaseIterator implements Iterator {
*/
public Object next() {
ParserSymbolTable.Declaration.ParentWrapper wrapper = (ParserSymbolTable.Declaration.ParentWrapper)rawIter.next();
- return new ASTBaseSpecifier( (IASTClassSpecifier)wrapper.getParent().getASTNode(), wrapper.getAccess(), wrapper.isVirtual());
+ return new ASTBaseSpecifier( (IASTFClassSpecifier)wrapper.getParent().getASTNode(), wrapper.getAccess(), wrapper.isVirtual());
}
/* (non-Javadoc)
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/FullParseASTFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/FullParseASTFactory.java
index 1d54bbc781..e382724d92 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/FullParseASTFactory.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/FullParseASTFactory.java
@@ -12,13 +12,18 @@ package org.eclipse.cdt.internal.core.parser.ast.full;
import java.util.Iterator;
+import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
+import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
+import org.eclipse.cdt.core.parser.ast.IASTFactory;
+import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
+import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
+import org.eclipse.cdt.core.parser.ast.IASTScope;
import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
import org.eclipse.cdt.internal.core.parser.ASTUsingDirective;
import org.eclipse.cdt.internal.core.parser.Token;
import org.eclipse.cdt.internal.core.parser.TokenDuple;
import org.eclipse.cdt.internal.core.parser.Parser.Backtrack;
import org.eclipse.cdt.internal.core.parser.ast.BaseASTFactory;
-import org.eclipse.cdt.internal.core.parser.ast.IASTFactory;
import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol;
import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTable;
@@ -46,7 +51,7 @@ public class FullParseASTFactory extends BaseASTFactory implements IASTFactory {
{
try
{
- symbol = (IContainerSymbol)scope.getContainerSymbol().Lookup( t1.getImage() );
+ symbol = (IContainerSymbol)((IASTFScope)scope).getContainerSymbol().Lookup( t1.getImage() );
}
catch( ParserSymbolTableException pste )
{
@@ -69,7 +74,7 @@ public class FullParseASTFactory extends BaseASTFactory implements IASTFactory {
}
try {
- scope.getContainerSymbol().addUsingDirective( symbol );
+ ((IASTFScope)scope).getContainerSymbol().addUsingDirective( symbol );
} catch (ParserSymbolTableException pste) {
handlePSTException( pste );
}
@@ -83,9 +88,9 @@ public class FullParseASTFactory extends BaseASTFactory implements IASTFactory {
String assembly,
int first,
int last) {
- IContainerSymbol containerSymbol = (IContainerSymbol)scope.getSymbol();
+ IContainerSymbol containerSymbol = (IContainerSymbol)((IASTFScope)scope).getSymbol();
ISymbol asmSymbol = pst.newSymbol( "", ParserSymbolTable.TypeInfo.t_asm );
- IASTASMDefinition asmDefinition = new ASTASMDefinition( asmSymbol, assembly );
+ IASTFASMDefinition asmDefinition = new ASTASMDefinition( asmSymbol, assembly );
asmSymbol.setASTNode( asmDefinition );
try {
@@ -100,13 +105,14 @@ public class FullParseASTFactory extends BaseASTFactory implements IASTFactory {
}
public IASTNamespaceDefinition createNamespaceDefinition(
- int first,
+ IASTScope scope,
String identifier,
- int nameOffset ) {
+ int first, int nameOffset ) {
+
IContainerSymbol namespaceSymbol = null;
pst.newContainerSymbol( identifier, ParserSymbolTable.TypeInfo.t_namespace );
- IASTNamespaceDefinition namespaceDefinition = new ASTNamespaceDefinition( namespaceSymbol, identifier );
+ IASTFNamespaceDefinition namespaceDefinition = new ASTNamespaceDefinition( namespaceSymbol, identifier );
namespaceDefinition.setStartingOffset( first );
if( identifier != "" )
namespaceDefinition.setNameOffset( nameOffset );
@@ -114,13 +120,13 @@ public class FullParseASTFactory extends BaseASTFactory implements IASTFactory {
}
public IASTCompilationUnit createCompilationUnit() {
- IASTCompilationUnit compilationUnit = new ASTCompilationUnit( pst.getCompilationUnit() );
+ IASTFCompilationUnit compilationUnit = new ASTCompilationUnit( pst.getCompilationUnit() );
return compilationUnit;
}
- public IASTLinkageSpecification createLinkageSpecification(String spec) {
+ public IASTLinkageSpecification createLinkageSpecification(IASTScope scope, String spec) {
IContainerSymbol symbol = pst.newContainerSymbol("", ParserSymbolTable.TypeInfo.t_linkage );
- IASTLinkageSpecification linkage = new ASTLinkageSpecification( symbol, spec);
+ IASTFLinkageSpecification linkage = new ASTLinkageSpecification( symbol, spec);
return linkage;
}
@@ -130,4 +136,5 @@ public class FullParseASTFactory extends BaseASTFactory implements IASTFactory {
private void handlePSTException(ParserSymbolTableException pste) throws Backtrack {
throw new Backtrack();
}
+
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/IASTASMDefinition.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/IASTFASMDefinition.java
index a81074dd0f..403f9aaa43 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/IASTASMDefinition.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/IASTFASMDefinition.java
@@ -15,7 +15,7 @@ package org.eclipse.cdt.internal.core.parser.ast.full;
* @author jcamelon
*
*/
-public interface IASTASMDefinition
+public interface IASTFASMDefinition
extends org.eclipse.cdt.core.parser.ast.IASTASMDefinition, IPSTSymbolExtension {
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/IASTClassSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/IASTFClassSpecifier.java
index 71bfe6629d..b1fe026039 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/IASTClassSpecifier.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/IASTFClassSpecifier.java
@@ -16,7 +16,7 @@ import org.eclipse.cdt.core.parser.ast.IASTScope;
* @author jcamelon
*
*/
-public interface IASTClassSpecifier
+public interface IASTFClassSpecifier
extends IASTScope, org.eclipse.cdt.core.parser.ast.IASTClassSpecifier {
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/IASTCompilationUnit.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/IASTFCompilationUnit.java
index 24270372d6..3be4e2291f 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/IASTCompilationUnit.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/IASTFCompilationUnit.java
@@ -15,9 +15,9 @@ package org.eclipse.cdt.internal.core.parser.ast.full;
* @author jcamelon
*
*/
-public interface IASTCompilationUnit
+public interface IASTFCompilationUnit
extends
org.eclipse.cdt.core.parser.ast.IASTCompilationUnit,
- IASTScope {
+ IASTFScope {
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/IASTLinkageSpecification.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/IASTFLinkageSpecification.java
index cbf6f88e88..e1f9683821 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/IASTLinkageSpecification.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/IASTFLinkageSpecification.java
@@ -14,7 +14,7 @@ package org.eclipse.cdt.internal.core.parser.ast.full;
* @author jcamelon
*
*/
-public interface IASTLinkageSpecification
- extends org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification, IASTScope {
+public interface IASTFLinkageSpecification
+ extends org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification, IASTFScope {
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/IASTNamespaceDefinition.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/IASTFNamespaceDefinition.java
index f5cca31a82..bc85f9121c 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/IASTNamespaceDefinition.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/IASTFNamespaceDefinition.java
@@ -14,7 +14,7 @@ package org.eclipse.cdt.internal.core.parser.ast.full;
* @author jcamelon
*
*/
-public interface IASTNamespaceDefinition
- extends IASTScope, org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition {
+public interface IASTFNamespaceDefinition
+ extends IASTFScope, org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition {
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/IASTScope.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/IASTFScope.java
index 3435aabc03..80ea582be9 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/IASTScope.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/full/IASTFScope.java
@@ -14,7 +14,7 @@ package org.eclipse.cdt.internal.core.parser.ast.full;
* @author jcamelon
*
*/
-public interface IASTScope
+public interface IASTFScope
extends org.eclipse.cdt.core.parser.ast.IASTScope, IPSTContainerExtension {
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTASMDefinition.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTASMDefinition.java
new file mode 100644
index 0000000000..02835fe124
--- /dev/null
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTASMDefinition.java
@@ -0,0 +1,70 @@
+/**********************************************************************
+ * Copyright (c) 2002,2003 Rational Software Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM Rational Software - Initial API and implementation
+***********************************************************************/
+package org.eclipse.cdt.internal.core.parser.ast.quick;
+
+import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
+import org.eclipse.cdt.core.parser.ast.IASTScope;
+import org.eclipse.cdt.internal.core.parser.ast.Offsets;
+
+/**
+ * @author jcamelon
+ *
+ */
+public class ASTASMDefinition
+ extends ASTDeclaration
+ implements IASTASMDefinition {
+
+ private Offsets offsets = new Offsets();
+ private final String assembly;
+ /**
+ * @param scope
+ */
+ public ASTASMDefinition(IASTScope scope, String assembly) {
+ super(scope);
+ this.assembly = assembly;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTASMDefinition#getBody()
+ */
+ public String getBody() {
+ return assembly;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
+ */
+ public void setStartingOffset(int o) {
+ offsets.setStartingOffset(o);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
+ */
+ public void setEndingOffset(int o) {
+ offsets.setEndingOffset( o );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
+ */
+ public int getElementStartingOffset() {
+ return offsets.getElementStartingOffset();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
+ */
+ public int getElementEndingOffset() {
+ return offsets.getElementEndingOffset();
+ }
+
+}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTCompilationUnit.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTCompilationUnit.java
new file mode 100644
index 0000000000..33bb1aa97a
--- /dev/null
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTCompilationUnit.java
@@ -0,0 +1,40 @@
+/**********************************************************************
+ * Copyright (c) 2002,2003 Rational Software Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM Rational Software - Initial API and implementation
+***********************************************************************/
+package org.eclipse.cdt.internal.core.parser.ast.quick;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
+import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
+
+/**
+ * @author jcamelon
+ *
+ */
+public class ASTCompilationUnit implements IASTCompilationUnit, IASTQScope {
+
+ private List declarations = new ArrayList();
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTScope#getDeclarations()
+ */
+ public Iterator getDeclarations() {
+ return declarations.iterator();
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.internal.core.parser.ast.quick.IASTQScope#addDeclaration(org.eclipse.cdt.core.parser.ast.IASTDeclaration)
+ */
+ public void addDeclaration(IASTDeclaration declaration) {
+ declarations.add( declaration );
+ }
+
+}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTDeclaration.java
new file mode 100644
index 0000000000..4fb3635bcb
--- /dev/null
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTDeclaration.java
@@ -0,0 +1,35 @@
+/**********************************************************************
+ * Copyright (c) 2002,2003 Rational Software Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM Rational Software - Initial API and implementation
+***********************************************************************/
+package org.eclipse.cdt.internal.core.parser.ast.quick;
+
+import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
+import org.eclipse.cdt.core.parser.ast.IASTScope;
+
+/**
+ * @author jcamelon
+ *
+ */
+public class ASTDeclaration implements IASTDeclaration {
+
+ private final IASTScope scope;
+ public ASTDeclaration( IASTScope scope )
+ {
+ this.scope = scope;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTDeclaration#getOwnerScope()
+ */
+ public IASTScope getOwnerScope() {
+ return scope;
+ }
+
+}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTLinkageSpecification.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTLinkageSpecification.java
new file mode 100644
index 0000000000..499695fc91
--- /dev/null
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTLinkageSpecification.java
@@ -0,0 +1,59 @@
+/**********************************************************************
+ * Copyright (c) 2002,2003 Rational Software Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM Rational Software - Initial API and implementation
+***********************************************************************/
+package org.eclipse.cdt.internal.core.parser.ast.quick;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
+import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
+import org.eclipse.cdt.core.parser.ast.IASTScope;
+
+/**
+ * @author jcamelon
+ *
+ */
+public class ASTLinkageSpecification
+ extends ASTDeclaration
+ implements IASTDeclaration, IASTLinkageSpecification, IASTQScope {
+
+ private final String linkage;
+
+ public ASTLinkageSpecification( IASTScope scope, String linkage )
+ {
+ super( scope );
+ this.linkage = linkage;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification#getLinkageString()
+ */
+ public String getLinkageString() {
+ return linkage;
+ }
+
+ private List declarations = new ArrayList();
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTScope#getDeclarations()
+ */
+ public Iterator getDeclarations() {
+ return declarations.iterator();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.internal.core.parser.ast.quick.IASTQScope#addDeclaration(org.eclipse.cdt.core.parser.ast.IASTDeclaration)
+ */
+ public void addDeclaration(IASTDeclaration declaration) {
+ declarations.add( declaration );
+ }
+
+}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTNamespaceDefinition.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTNamespaceDefinition.java
new file mode 100644
index 0000000000..6622e23da8
--- /dev/null
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTNamespaceDefinition.java
@@ -0,0 +1,99 @@
+/**********************************************************************
+ * Copyright (c) 2002,2003 Rational Software Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM Rational Software - Initial API and implementation
+***********************************************************************/
+package org.eclipse.cdt.internal.core.parser.ast.quick;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
+import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
+import org.eclipse.cdt.core.parser.ast.IASTScope;
+import org.eclipse.cdt.internal.core.parser.ast.NamedOffsets;
+
+/**
+ * @author jcamelon
+ *
+ */
+public class ASTNamespaceDefinition extends ASTDeclaration implements IASTNamespaceDefinition, IASTQScope {
+
+ private final String name;
+ private NamedOffsets offsets = new NamedOffsets();
+
+ public ASTNamespaceDefinition( IASTScope scope, String name )
+ {
+ super( scope );
+ this.name = name;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getName()
+ */
+ public String getName() {
+ return name;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getElementNameOffset()
+ */
+ public int getElementNameOffset() {
+ return offsets.getElementNameOffset();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameOffset(int)
+ */
+ public void setNameOffset(int o) {
+ offsets.setNameOffset( o );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
+ */
+ public void setStartingOffset(int o) {
+ offsets.setStartingOffset(o);
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
+ */
+ public void setEndingOffset(int o) {
+ offsets.setEndingOffset(o);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
+ */
+ public int getElementStartingOffset() {
+ return offsets.getElementStartingOffset();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
+ */
+ public int getElementEndingOffset() {
+ return offsets.getElementEndingOffset();
+ }
+
+ private List declarations = new ArrayList();
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTScope#getDeclarations()
+ */
+ public Iterator getDeclarations() {
+ return declarations.iterator();
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.internal.core.parser.ast.quick.IASTQScope#addDeclaration(org.eclipse.cdt.core.parser.ast.IASTDeclaration)
+ */
+ public void addDeclaration(IASTDeclaration declaration) {
+ declarations.add( declaration );
+ }
+}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTUsingDirective.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTUsingDirective.java
new file mode 100644
index 0000000000..16c8d46439
--- /dev/null
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTUsingDirective.java
@@ -0,0 +1,38 @@
+/**********************************************************************
+ * Copyright (c) 2002,2003 Rational Software Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM Rational Software - Initial API and implementation
+***********************************************************************/
+package org.eclipse.cdt.internal.core.parser.ast.quick;
+
+import org.eclipse.cdt.core.parser.ast.IASTScope;
+import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
+
+/**
+ * @author jcamelon
+ *
+ */
+public class ASTUsingDirective
+ extends ASTDeclaration
+ implements IASTUsingDirective {
+
+
+ public ASTUsingDirective( IASTScope scope, String name )
+ {
+ super( scope );
+ this.namespaceName = name;
+ }
+ private final String namespaceName;
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTUsingDirective#getNamespaceName()
+ */
+ public String getNamespaceName() {
+ return namespaceName;
+ }
+
+}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/IASTQScope.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/IASTQScope.java
new file mode 100644
index 0000000000..a0ce2007e5
--- /dev/null
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/IASTQScope.java
@@ -0,0 +1,23 @@
+/**********************************************************************
+ * Copyright (c) 2002,2003 Rational Software Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM Rational Software - Initial API and implementation
+***********************************************************************/
+package org.eclipse.cdt.internal.core.parser.ast.quick;
+
+import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
+import org.eclipse.cdt.core.parser.ast.IASTScope;
+
+/**
+ * @author jcamelon
+ *
+ */
+public interface IASTQScope extends IASTScope {
+
+ public void addDeclaration( IASTDeclaration declaration );
+}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/QuickParseASTFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/QuickParseASTFactory.java
index b1d222e75f..31407a9955 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/QuickParseASTFactory.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/QuickParseASTFactory.java
@@ -10,16 +10,16 @@
***********************************************************************/
package org.eclipse.cdt.internal.core.parser.ast.quick;
+import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
+import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
+import org.eclipse.cdt.core.parser.ast.IASTFactory;
+import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
+import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
+import org.eclipse.cdt.core.parser.ast.IASTScope;
import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
import org.eclipse.cdt.internal.core.parser.TokenDuple;
import org.eclipse.cdt.internal.core.parser.Parser.Backtrack;
import org.eclipse.cdt.internal.core.parser.ast.BaseASTFactory;
-import org.eclipse.cdt.internal.core.parser.ast.IASTFactory;
-import org.eclipse.cdt.internal.core.parser.ast.full.IASTASMDefinition;
-import org.eclipse.cdt.internal.core.parser.ast.full.IASTCompilationUnit;
-import org.eclipse.cdt.internal.core.parser.ast.full.IASTLinkageSpecification;
-import org.eclipse.cdt.internal.core.parser.ast.full.IASTNamespaceDefinition;
-import org.eclipse.cdt.internal.core.parser.ast.full.IASTScope;
/**
* @author jcamelon
@@ -31,40 +31,41 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory
* @see org.eclipse.cdt.internal.core.parser.ast.IASTFactory#createUsingDirective(org.eclipse.cdt.internal.core.parser.ast.IASTScope, org.eclipse.cdt.internal.core.parser.TokenDuple)
*/
public IASTUsingDirective createUsingDirective(IASTScope scope, TokenDuple duple) throws Backtrack {
- // TODO Auto-generated method stub
- return null;
+ return new ASTUsingDirective( scope, duple.toString() );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.parser.ast.IASTFactory#createASMDefinition(org.eclipse.cdt.internal.core.parser.ast.IASTScope, java.lang.String, int, int)
*/
- public IASTASMDefinition createASMDefinition(IASTScope scope, String assembly, int first, int last) {
- // TODO Auto-generated method stub
- return null;
+ public IASTASMDefinition createASMDefinition(IASTScope scope, String assembly, int first, int last) {
+ IASTASMDefinition definition = new ASTASMDefinition( scope, assembly );
+ definition.setStartingOffset( first );
+ definition.setEndingOffset( last );
+ return definition;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.parser.ast.IASTFactory#createNamespaceDefinition(int, java.lang.String, int)
*/
- public IASTNamespaceDefinition createNamespaceDefinition(int first, String identifier, int nameOffset) {
- // TODO Auto-generated method stub
- return null;
+ public IASTNamespaceDefinition createNamespaceDefinition(IASTScope scope, String identifier, int first, int nameOffset) {
+ IASTNamespaceDefinition definition = new ASTNamespaceDefinition( scope, identifier );
+ definition.setStartingOffset( first );
+ definition.setNameOffset( nameOffset );
+ return definition;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.parser.ast.IASTFactory#createCompilationUnit()
*/
public IASTCompilationUnit createCompilationUnit() {
- // TODO Auto-generated method stub
- return null;
+ return new ASTCompilationUnit();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.parser.ast.IASTFactory#createLinkageSpecification(java.lang.String)
*/
- public IASTLinkageSpecification createLinkageSpecification(String spec) {
- // TODO Auto-generated method stub
- return null;
+ public IASTLinkageSpecification createLinkageSpecification(IASTScope scope, String spec) {
+ return new ASTLinkageSpecification( scope, spec );
}
}
diff --git a/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/BaseDOMTest.java b/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/BaseDOMTest.java
index 6efba56ce6..1a050925a0 100644
--- a/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/BaseDOMTest.java
+++ b/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/BaseDOMTest.java
@@ -31,7 +31,7 @@ public class BaseDOMTest extends TestCase {
public TranslationUnit parse( String code ) throws Exception
{
- return parse( code, false, true );
+ return parse( code, true, true );
}
public TranslationUnit parse(String code, boolean quickParse, boolean throwOnError ) throws Exception {
diff --git a/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTest.java b/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTest.java
index c192ff814b..9286512118 100644
--- a/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTest.java
+++ b/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTest.java
@@ -19,7 +19,7 @@ import junit.framework.TestCase;
import org.eclipse.cdt.core.parser.ast.AccessVisibility;
import org.eclipse.cdt.internal.core.parser.ast.full.ASTCompilationUnit;
-import org.eclipse.cdt.internal.core.parser.ast.full.IASTCompilationUnit;
+import org.eclipse.cdt.internal.core.parser.ast.full.IASTFCompilationUnit;
import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol;
import org.eclipse.cdt.internal.core.parser.pst.IDerivableContainerSymbol;
import org.eclipse.cdt.internal.core.parser.pst.IParameterizedSymbol;
@@ -107,7 +107,7 @@ public class ParserSymbolTableTest extends TestCase {
IContainerSymbol x = table.new Declaration("x");
- IASTCompilationUnit obj = new ASTCompilationUnit( x );
+ IASTFCompilationUnit obj = new ASTCompilationUnit( x );
x.setASTNode( obj );
table.getCompilationUnit().addSymbol( x );

Back to the top