mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-10 17:55:39 +02:00
Merge Parser_SymbolTable branch into HEAD.
This commit is contained in:
parent
c2348df608
commit
89913324d4
120 changed files with 8380 additions and 3194 deletions
|
@ -1,5 +1,7 @@
|
||||||
package org.eclipse.cdt.internal.core.dom;
|
package org.eclipse.cdt.internal.core.dom;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.core.parser.Name;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author dschaefe
|
* @author dschaefe
|
||||||
|
|
|
@ -4,6 +4,7 @@ import java.util.Collections;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.core.parser.Name;
|
||||||
import org.eclipse.cdt.internal.core.parser.Token;
|
import org.eclipse.cdt.internal.core.parser.Token;
|
||||||
|
|
||||||
public class ClassSpecifier extends TypeSpecifier implements IScope, IOffsetable, IAccessable {
|
public class ClassSpecifier extends TypeSpecifier implements IScope, IOffsetable, IAccessable {
|
||||||
|
|
|
@ -16,6 +16,8 @@ import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.core.parser.Name;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
|
|
|
@ -1,16 +1,39 @@
|
||||||
package org.eclipse.cdt.internal.core.dom;
|
package org.eclipse.cdt.internal.core.dom;
|
||||||
|
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.core.parser.IParser;
|
import org.eclipse.cdt.core.parser.IParser;
|
||||||
|
import org.eclipse.cdt.core.parser.IProblem;
|
||||||
|
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTConstructor;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTEnumSpecifier;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTEnumerator;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTField;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTFunction;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTInclusion;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTMacro;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTMethod;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTTypedef;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTVariable;
|
||||||
import org.eclipse.cdt.internal.core.parser.IParserCallback;
|
import org.eclipse.cdt.internal.core.parser.IParserCallback;
|
||||||
|
import org.eclipse.cdt.internal.core.parser.Name;
|
||||||
import org.eclipse.cdt.internal.core.parser.Token;
|
import org.eclipse.cdt.internal.core.parser.Token;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the parser callback that creates objects in the DOM.
|
* This is the parser callback that creates objects in the DOM.
|
||||||
*/
|
*/
|
||||||
public class DOMBuilder implements IParserCallback
|
public class DOMBuilder implements IParserCallback, ISourceElementRequestor
|
||||||
{
|
{
|
||||||
protected DOMBuilder()
|
public DOMBuilder()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,6 +84,7 @@ public class DOMBuilder implements IParserCallback
|
||||||
|
|
||||||
classSpecifier.setClassKeyToken( classKey );
|
classSpecifier.setClassKeyToken( classKey );
|
||||||
decl.setTypeSpecifier(classSpecifier);
|
decl.setTypeSpecifier(classSpecifier);
|
||||||
|
domScopes.push( classSpecifier );
|
||||||
return classSpecifier;
|
return classSpecifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,6 +101,7 @@ public class DOMBuilder implements IParserCallback
|
||||||
public void classSpecifierEnd(Object classSpecifier, Token closingBrace) {
|
public void classSpecifierEnd(Object classSpecifier, Token closingBrace) {
|
||||||
ClassSpecifier c = (ClassSpecifier)classSpecifier;
|
ClassSpecifier c = (ClassSpecifier)classSpecifier;
|
||||||
c.setTotalLength( closingBrace.getOffset() + closingBrace.getLength() - c.getStartingOffset() );
|
c.setTotalLength( closingBrace.getOffset() + closingBrace.getLength() - c.getStartingOffset() );
|
||||||
|
domScopes.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -162,14 +187,15 @@ public class DOMBuilder implements IParserCallback
|
||||||
* @see org.eclipse.cdt.internal.core.newparser.IParserCallback#inclusionBegin(java.lang.String)
|
* @see org.eclipse.cdt.internal.core.newparser.IParserCallback#inclusionBegin(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public Object inclusionBegin(String includeFile, int offset, int inclusionBeginOffset, boolean local) {
|
public Object inclusionBegin(String includeFile, int offset, int inclusionBeginOffset, boolean local) {
|
||||||
Inclusion inclusion = new Inclusion(
|
// Inclusion inclusion = new Inclusion(
|
||||||
includeFile,
|
// includeFile,
|
||||||
offset,
|
// offset,
|
||||||
inclusionBeginOffset,
|
// inclusionBeginOffset,
|
||||||
offset - inclusionBeginOffset + includeFile.length() + 1,
|
// offset - inclusionBeginOffset + includeFile.length() + 1,
|
||||||
local );
|
// local );
|
||||||
translationUnit.addInclusion( inclusion );
|
// translationUnit.addInclusion( inclusion );
|
||||||
return inclusion;
|
// return inclusion;
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -182,18 +208,18 @@ public class DOMBuilder implements IParserCallback
|
||||||
* @see org.eclipse.cdt.internal.core.newparser.IParserCallback#macro(java.lang.String)
|
* @see org.eclipse.cdt.internal.core.newparser.IParserCallback#macro(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public Object macro(String macroName, int offset, int macroBeginOffset, int macroEndOffset) {
|
public Object macro(String macroName, int offset, int macroBeginOffset, int macroEndOffset) {
|
||||||
Macro macro = new Macro( macroName, offset, macroBeginOffset, macroEndOffset - macroBeginOffset);
|
// Macro macro = new Macro( macroName, offset, macroBeginOffset, macroEndOffset - macroBeginOffset);
|
||||||
translationUnit.addMacro( macro );
|
// translationUnit.addMacro( macro );
|
||||||
return macro;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.internal.core.newparser.IParserCallback#simpleDeclarationBegin(org.eclipse.cdt.internal.core.newparser.Token)
|
* @see org.eclipse.cdt.internal.core.newparser.IParserCallback#simpleDeclarationBegin(org.eclipse.cdt.internal.core.newparser.Token)
|
||||||
*/
|
*/
|
||||||
public Object simpleDeclarationBegin(Object container, Token firstToken) {
|
public Object simpleDeclarationBegin(Object container, Token firstToken) {
|
||||||
SimpleDeclaration decl = new SimpleDeclaration((IScope)container);
|
SimpleDeclaration decl = new SimpleDeclaration( getCurrentDOMScope() );
|
||||||
if( container instanceof IAccessable )
|
if( getCurrentDOMScope() instanceof IAccessable )
|
||||||
decl.setAccessSpecifier(new AccessSpecifier( ((IAccessable)container).getVisibility() ));
|
decl.setAccessSpecifier(new AccessSpecifier( ((IAccessable)getCurrentDOMScope()).getVisibility() ));
|
||||||
((IOffsetable)decl).setStartingOffset( firstToken.getOffset() );
|
((IOffsetable)decl).setStartingOffset( firstToken.getOffset() );
|
||||||
return decl;
|
return decl;
|
||||||
}
|
}
|
||||||
|
@ -205,7 +231,7 @@ public class DOMBuilder implements IParserCallback
|
||||||
SimpleDeclaration decl = (SimpleDeclaration)declaration;
|
SimpleDeclaration decl = (SimpleDeclaration)declaration;
|
||||||
IOffsetable offsetable = (IOffsetable)decl;
|
IOffsetable offsetable = (IOffsetable)decl;
|
||||||
offsetable.setTotalLength( lastToken.getOffset() + lastToken.getLength() - offsetable.getStartingOffset());
|
offsetable.setTotalLength( lastToken.getOffset() + lastToken.getLength() - offsetable.getStartingOffset());
|
||||||
decl.getOwnerScope().addDeclaration(decl);
|
getCurrentDOMScope().addDeclaration(decl);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -321,6 +347,7 @@ public class DOMBuilder implements IParserCallback
|
||||||
public void classSpecifierAbort(Object classSpecifier) {
|
public void classSpecifierAbort(Object classSpecifier) {
|
||||||
ClassSpecifier cs = (ClassSpecifier)classSpecifier;
|
ClassSpecifier cs = (ClassSpecifier)classSpecifier;
|
||||||
cs.getOwner().setTypeSpecifier(null);
|
cs.getOwner().setTypeSpecifier(null);
|
||||||
|
domScopes.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -518,20 +545,20 @@ public class DOMBuilder implements IParserCallback
|
||||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#namespaceDeclarationBegin(java.lang.Object)
|
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#namespaceDeclarationBegin(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
public Object namespaceDefinitionBegin(Object container, Token namespace) {
|
public Object namespaceDefinitionBegin(Object container, Token namespace) {
|
||||||
IScope ownerScope = (IScope)container;
|
// IScope ownerScope = (IScope)container;
|
||||||
NamespaceDefinition namespaceDef = new NamespaceDefinition(ownerScope);
|
// NamespaceDefinition namespaceDef = new NamespaceDefinition(ownerScope);
|
||||||
namespaceDef.setStartToken(namespace);
|
// namespaceDef.setStartToken(namespace);
|
||||||
((IOffsetable)namespaceDef).setStartingOffset( namespace.getOffset() );
|
// ((IOffsetable)namespaceDef).setStartingOffset( namespace.getOffset() );
|
||||||
return namespaceDef;
|
// return namespaceDef;
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#namespaceDeclarationId(java.lang.Object)
|
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#namespaceDeclarationId(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
public void namespaceDefinitionId(Object namespace) {
|
public void namespaceDefinitionId(Object namespace) {
|
||||||
NamespaceDefinition ns = (NamespaceDefinition)namespace;
|
// NamespaceDefinition ns = (NamespaceDefinition)namespace;
|
||||||
ns.setName( currName );
|
// ns.setName( currName );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -544,77 +571,80 @@ public class DOMBuilder implements IParserCallback
|
||||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#namespaceDeclarationEnd(java.lang.Object)
|
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#namespaceDeclarationEnd(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
public void namespaceDefinitionEnd(Object namespace, Token closingBrace) {
|
public void namespaceDefinitionEnd(Object namespace, Token closingBrace) {
|
||||||
NamespaceDefinition ns = (NamespaceDefinition)namespace;
|
// NamespaceDefinition ns = (NamespaceDefinition)namespace;
|
||||||
ns.setTotalLength( closingBrace.getOffset() + closingBrace.getLength() - ns.getStartingOffset() );
|
// ns.setTotalLength( closingBrace.getOffset() + closingBrace.getLength() - ns.getStartingOffset() );
|
||||||
ns.getOwnerScope().addDeclaration(ns);
|
// ns.getOwnerScope().addDeclaration(ns);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#linkageSpecificationBegin(java.lang.Object, java.lang.String)
|
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#linkageSpecificationBegin(java.lang.Object, java.lang.String)
|
||||||
*/
|
*/
|
||||||
public Object linkageSpecificationBegin(Object container, String literal) {
|
public Object linkageSpecificationBegin(Object container, String literal) {
|
||||||
IScope scope = (IScope)container;
|
// IScope scope = (IScope)container;
|
||||||
LinkageSpecification linkage = new LinkageSpecification( scope, literal );
|
// LinkageSpecification linkage = new LinkageSpecification( scope, literal );
|
||||||
return linkage;
|
// domScopes.push( linkage );
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#linkageSpecificationEnd(java.lang.Object)
|
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#linkageSpecificationEnd(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
public void linkageSpecificationEnd(Object linkageSpec) {
|
public void linkageSpecificationEnd(Object linkageSpec) {
|
||||||
LinkageSpecification linkage = (LinkageSpecification)linkageSpec;
|
// LinkageSpecification linkage = (LinkageSpecification)domScopes.pop();
|
||||||
linkage.getOwnerScope().addDeclaration(linkage );
|
// linkage.getOwnerScope().addDeclaration(linkage );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDirectiveBegin(java.lang.Object)
|
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDirectiveBegin(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
public Object usingDirectiveBegin(Object container) {
|
public Object usingDirectiveBegin(Object container) {
|
||||||
IScope scope = (IScope)container;
|
// IScope scope = (IScope)container;
|
||||||
UsingDirective directive = new UsingDirective( scope );
|
// UsingDirective directive = new UsingDirective( scope );
|
||||||
return directive;
|
// return directive;
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDirectiveNamespaceId(java.lang.Object)
|
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDirectiveNamespaceId(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
public void usingDirectiveNamespaceId(Object dir) {
|
public void usingDirectiveNamespaceId(Object dir) {
|
||||||
UsingDirective directive = (UsingDirective)dir;
|
// UsingDirective directive = (UsingDirective)dir;
|
||||||
directive.setNamespaceName( currName );
|
// directive.setNamespaceName( currName );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDirectiveEnd(java.lang.Object)
|
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDirectiveEnd(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
public void usingDirectiveEnd(Object dir) {
|
public void usingDirectiveEnd(Object dir) {
|
||||||
UsingDirective directive = (UsingDirective)dir;
|
// UsingDirective directive = (UsingDirective)dir;
|
||||||
directive.getOwnerScope().addDeclaration( directive );
|
// directive.getOwnerScope().addDeclaration( directive );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDeclarationBegin(java.lang.Object)
|
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDeclarationBegin(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
public Object usingDeclarationBegin(Object container) {
|
public Object usingDeclarationBegin(Object container) {
|
||||||
IScope scope = (IScope)container;
|
// IScope scope = (IScope)container;
|
||||||
UsingDeclaration declaration = new UsingDeclaration( scope );
|
// UsingDeclaration declaration = new UsingDeclaration( scope );
|
||||||
return declaration;
|
// return declaration;
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDeclarationMapping(java.lang.Object)
|
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDeclarationMapping(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
public void usingDeclarationMapping(Object decl, boolean isTypename) {
|
public void usingDeclarationMapping(Object decl, boolean isTypename) {
|
||||||
UsingDeclaration declaration = (UsingDeclaration)decl;
|
// UsingDeclaration declaration = (UsingDeclaration)decl;
|
||||||
declaration.setMappedName( currName );
|
// declaration.setMappedName( currName );
|
||||||
declaration.setTypename( isTypename );
|
// declaration.setTypename( isTypename );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDeclarationEnd(java.lang.Object)
|
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDeclarationEnd(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
public void usingDeclarationEnd(Object decl) {
|
public void usingDeclarationEnd(Object decl) {
|
||||||
UsingDeclaration declaration = (UsingDeclaration)decl;
|
// UsingDeclaration declaration = (UsingDeclaration)decl;
|
||||||
declaration.getOwnerScope().addDeclaration( declaration );
|
// declaration.getOwnerScope().addDeclaration( declaration );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -696,9 +726,9 @@ public class DOMBuilder implements IParserCallback
|
||||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#asmDefinition(java.lang.String)
|
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#asmDefinition(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public void asmDefinition(Object container, String assemblyCode) {
|
public void asmDefinition(Object container, String assemblyCode) {
|
||||||
IScope scope = (IScope)container;
|
// IScope scope = (IScope)container;
|
||||||
ASMDefinition definition = new ASMDefinition( scope, assemblyCode );
|
// ASMDefinition definition = new ASMDefinition( scope, assemblyCode );
|
||||||
scope.addDeclaration( definition );
|
// scope.addDeclaration( definition );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -767,8 +797,8 @@ public class DOMBuilder implements IParserCallback
|
||||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#explicitInstantiationBegin(java.lang.Object)
|
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#explicitInstantiationBegin(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
public Object explicitInstantiationBegin(Object container) {
|
public Object explicitInstantiationBegin(Object container) {
|
||||||
IScope scope = (IScope)container;
|
ExplicitTemplateDeclaration etd = new ExplicitTemplateDeclaration( getCurrentDOMScope(), ExplicitTemplateDeclaration.k_instantiation );
|
||||||
ExplicitTemplateDeclaration etd = new ExplicitTemplateDeclaration( scope, ExplicitTemplateDeclaration.k_instantiation );
|
domScopes.push( etd );
|
||||||
return etd;
|
return etd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -776,7 +806,7 @@ public class DOMBuilder implements IParserCallback
|
||||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#explicitInstantiationEnd(java.lang.Object)
|
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#explicitInstantiationEnd(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
public void explicitInstantiationEnd(Object instantiation) {
|
public void explicitInstantiationEnd(Object instantiation) {
|
||||||
ExplicitTemplateDeclaration declaration = (ExplicitTemplateDeclaration)instantiation;
|
ExplicitTemplateDeclaration declaration = (ExplicitTemplateDeclaration)domScopes.pop();
|
||||||
declaration.getOwnerScope().addDeclaration(declaration);
|
declaration.getOwnerScope().addDeclaration(declaration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -784,8 +814,8 @@ public class DOMBuilder implements IParserCallback
|
||||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#explicitSpecializationBegin(java.lang.Object)
|
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#explicitSpecializationBegin(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
public Object explicitSpecializationBegin(Object container) {
|
public Object explicitSpecializationBegin(Object container) {
|
||||||
IScope scope = (IScope)container;
|
ExplicitTemplateDeclaration etd = new ExplicitTemplateDeclaration( getCurrentDOMScope(), ExplicitTemplateDeclaration.k_specialization);
|
||||||
ExplicitTemplateDeclaration etd = new ExplicitTemplateDeclaration( scope, ExplicitTemplateDeclaration.k_specialization);
|
domScopes.push( etd );
|
||||||
return etd;
|
return etd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -793,7 +823,7 @@ public class DOMBuilder implements IParserCallback
|
||||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#explicitSpecializationEnd(java.lang.Object)
|
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#explicitSpecializationEnd(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
public void explicitSpecializationEnd(Object instantiation) {
|
public void explicitSpecializationEnd(Object instantiation) {
|
||||||
ExplicitTemplateDeclaration etd = (ExplicitTemplateDeclaration)instantiation;
|
ExplicitTemplateDeclaration etd = (ExplicitTemplateDeclaration)domScopes.pop();
|
||||||
etd.getOwnerScope().addDeclaration(etd);
|
etd.getOwnerScope().addDeclaration(etd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -809,10 +839,11 @@ public class DOMBuilder implements IParserCallback
|
||||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#templateDeclarationBegin(java.lang.Object, boolean)
|
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#templateDeclarationBegin(java.lang.Object, boolean)
|
||||||
*/
|
*/
|
||||||
public Object templateDeclarationBegin(Object container, Token exported) {
|
public Object templateDeclarationBegin(Object container, Token exported) {
|
||||||
TemplateDeclaration d = new TemplateDeclaration( (IScope)container, exported );
|
TemplateDeclaration d = new TemplateDeclaration( (IScope)getCurrentDOMScope(), exported );
|
||||||
if( container instanceof IAccessable )
|
if( getCurrentDOMScope() instanceof IAccessable )
|
||||||
d.setVisibility( ((IAccessable)container).getVisibility() );
|
d.setVisibility( ((IAccessable)container).getVisibility() );
|
||||||
d.setStartingOffset( exported.getOffset() );
|
d.setStartingOffset( exported.getOffset() );
|
||||||
|
domScopes.push( d );
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -820,14 +851,14 @@ public class DOMBuilder implements IParserCallback
|
||||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#templateDeclarationAbort(java.lang.Object)
|
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#templateDeclarationAbort(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
public void templateDeclarationAbort(Object templateDecl) {
|
public void templateDeclarationAbort(Object templateDecl) {
|
||||||
templateDecl = null;
|
domScopes.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#templateDeclarationEnd(java.lang.Object)
|
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#templateDeclarationEnd(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
public void templateDeclarationEnd(Object templateDecl, Token lastToken) {
|
public void templateDeclarationEnd(Object templateDecl, Token lastToken) {
|
||||||
TemplateDeclaration decl = (TemplateDeclaration)templateDecl;
|
TemplateDeclaration decl = (TemplateDeclaration)domScopes.pop();
|
||||||
decl.setLastToken(lastToken);
|
decl.setLastToken(lastToken);
|
||||||
decl.getOwnerScope().addDeclaration(decl);
|
decl.getOwnerScope().addDeclaration(decl);
|
||||||
decl.setTotalLength(lastToken.getOffset() + lastToken.getLength() - decl.getStartingOffset() );
|
decl.setTotalLength(lastToken.getOffset() + lastToken.getLength() - decl.getStartingOffset() );
|
||||||
|
@ -951,4 +982,294 @@ public class DOMBuilder implements IParserCallback
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptProblem(org.eclipse.cdt.core.parser.IProblem)
|
||||||
|
*/
|
||||||
|
public void acceptProblem(IProblem problem) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptMacro(org.eclipse.cdt.core.parser.ast.IASTMacro)
|
||||||
|
*/
|
||||||
|
public void acceptMacro(IASTMacro macro) {
|
||||||
|
Macro m = new Macro( macro.getName(), macro.getElementNameOffset(), macro.getElementStartingOffset(),
|
||||||
|
macro.getElementEndingOffset() - macro.getElementStartingOffset());
|
||||||
|
translationUnit.addMacro( m );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptVariable(org.eclipse.cdt.core.parser.ast.IASTVariable)
|
||||||
|
*/
|
||||||
|
public void acceptVariable(IASTVariable variable) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptFunctionDeclaration(org.eclipse.cdt.core.parser.ast.IASTFunction)
|
||||||
|
*/
|
||||||
|
public void acceptFunctionDeclaration(IASTFunction function) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptUsageDirective(org.eclipse.cdt.core.parser.ast.IASTUsageDirective)
|
||||||
|
*/
|
||||||
|
public void acceptUsingDirective(IASTUsingDirective usageDirective) {
|
||||||
|
UsingDirective directive = new UsingDirective( getCurrentDOMScope() );
|
||||||
|
directive.setNamespaceName( usageDirective.getNamespaceName() );
|
||||||
|
directive.getOwnerScope().addDeclaration( directive );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptUsageDeclaration(org.eclipse.cdt.core.parser.ast.IASTUsageDeclaration)
|
||||||
|
*/
|
||||||
|
public void acceptUsingDeclaration(IASTUsingDeclaration usageDeclaration) {
|
||||||
|
UsingDeclaration declaration = new UsingDeclaration( getCurrentDOMScope() );
|
||||||
|
declaration.setTypename( usageDeclaration.isTypename());
|
||||||
|
declaration.setMappedName(usageDeclaration.usingTypeName());
|
||||||
|
declaration.getOwnerScope().addDeclaration( declaration );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptASMDefinition(org.eclipse.cdt.core.parser.ast.IASTASMDefinition)
|
||||||
|
*/
|
||||||
|
public void acceptASMDefinition(IASTASMDefinition asmDefinition) {
|
||||||
|
IScope scope = getCurrentDOMScope();
|
||||||
|
ASMDefinition definition = new ASMDefinition( scope, asmDefinition.getBody() );
|
||||||
|
scope.addDeclaration( definition );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptTypedef(org.eclipse.cdt.core.parser.ast.IASTTypedef)
|
||||||
|
*/
|
||||||
|
public void acceptTypedef(IASTTypedef typedef) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterEnumSpecifier(org.eclipse.cdt.core.parser.ast.IASTEnumSpecifier)
|
||||||
|
*/
|
||||||
|
public void enterEnumSpecifier(IASTEnumSpecifier enumSpec) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptEnumerator(org.eclipse.cdt.core.parser.ast.IASTEnumerator)
|
||||||
|
*/
|
||||||
|
public void acceptEnumerator(IASTEnumerator enumerator) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitEnumSpecifier(org.eclipse.cdt.core.parser.ast.IASTEnumSpecifier)
|
||||||
|
*/
|
||||||
|
public void exitEnumSpecifier(IASTEnumSpecifier enumSpec) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterFunctionBody(org.eclipse.cdt.core.parser.ast.IASTFunction)
|
||||||
|
*/
|
||||||
|
public void enterFunctionBody(IASTFunction function) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitFunctionBody(org.eclipse.cdt.core.parser.ast.IASTFunction)
|
||||||
|
*/
|
||||||
|
public void exitFunctionBody(IASTFunction function) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterCompilationUnit(org.eclipse.cdt.core.parser.ast.IASTCompilationUnit)
|
||||||
|
*/
|
||||||
|
public void enterCompilationUnit(IASTCompilationUnit compilationUnit) {
|
||||||
|
domScopes.push( translationUnit );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterInclusion(org.eclipse.cdt.core.parser.ast.IASTInclusion)
|
||||||
|
*/
|
||||||
|
public void enterInclusion(IASTInclusion inclusion) {
|
||||||
|
Inclusion i = new Inclusion(
|
||||||
|
inclusion.getName(),
|
||||||
|
inclusion.getElementNameOffset(),
|
||||||
|
inclusion.getElementStartingOffset(),
|
||||||
|
inclusion.getElementEndingOffset(),
|
||||||
|
inclusion.isLocal() );
|
||||||
|
translationUnit.addInclusion( i );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterNamespaceDefinition(org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition)
|
||||||
|
*/
|
||||||
|
public void enterNamespaceDefinition(IASTNamespaceDefinition namespaceDefinition) {
|
||||||
|
NamespaceDefinition namespaceDef = new NamespaceDefinition(getCurrentDOMScope());
|
||||||
|
namespaceDef.setName( namespaceDefinition.getName() );
|
||||||
|
((IOffsetable)namespaceDef).setStartingOffset( namespaceDefinition.getElementStartingOffset() );
|
||||||
|
if( ! namespaceDefinition.getName().equals( "" ))
|
||||||
|
namespaceDef.setNameOffset( namespaceDefinition.getElementNameOffset() );
|
||||||
|
this.domScopes.push( namespaceDef );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterClassSpecifier(org.eclipse.cdt.core.parser.ast.IASTClassSpecification)
|
||||||
|
*/
|
||||||
|
public void enterClassSpecifier(IASTClassSpecifier classSpecification) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterLinkageSpecification(org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification)
|
||||||
|
*/
|
||||||
|
public void enterLinkageSpecification(IASTLinkageSpecification linkageSpec) {
|
||||||
|
LinkageSpecification linkage = new LinkageSpecification( getCurrentDOMScope(), linkageSpec.getLinkageString() );
|
||||||
|
domScopes.push( linkage );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterTemplateDeclaration(org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration)
|
||||||
|
*/
|
||||||
|
public void enterTemplateDeclaration(IASTTemplateDeclaration declaration) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterTemplateSpecialization(org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization)
|
||||||
|
*/
|
||||||
|
public void enterTemplateSpecialization(IASTTemplateSpecialization specialization) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterTemplateExplicitInstantiation(org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation)
|
||||||
|
*/
|
||||||
|
public void enterTemplateExplicitInstantiation(IASTTemplateInstantiation instantiation) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptMethodDeclaration(org.eclipse.cdt.core.parser.ast.IASTMethod)
|
||||||
|
*/
|
||||||
|
public void acceptMethodDeclaration(IASTMethod method) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterMethodBody(org.eclipse.cdt.core.parser.ast.IASTMethod)
|
||||||
|
*/
|
||||||
|
public void enterMethodBody(IASTMethod method) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitMethodBody(org.eclipse.cdt.core.parser.ast.IASTMethod)
|
||||||
|
*/
|
||||||
|
public void exitMethodBody(IASTMethod method) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptField(org.eclipse.cdt.core.parser.ast.IASTField)
|
||||||
|
*/
|
||||||
|
public void acceptField(IASTField field) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptConstructor(org.eclipse.cdt.core.parser.ast.IASTConstructor)
|
||||||
|
*/
|
||||||
|
public void acceptConstructor(IASTConstructor constructor) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitTemplateDeclaration(org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration)
|
||||||
|
*/
|
||||||
|
public void exitTemplateDeclaration(IASTTemplateDeclaration declaration) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitTemplateSpecialization(org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization)
|
||||||
|
*/
|
||||||
|
public void exitTemplateSpecialization(IASTTemplateSpecialization specialization) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitTemplateExplicitInstantiation(org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation)
|
||||||
|
*/
|
||||||
|
public void exitTemplateExplicitInstantiation(IASTTemplateInstantiation instantiation) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitLinkageSpecification(org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification)
|
||||||
|
*/
|
||||||
|
public void exitLinkageSpecification(IASTLinkageSpecification linkageSpec) {
|
||||||
|
LinkageSpecification linkage = (LinkageSpecification)domScopes.pop();
|
||||||
|
getCurrentDOMScope().addDeclaration(linkage );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitClassSpecifier(org.eclipse.cdt.core.parser.ast.IASTClassSpecification)
|
||||||
|
*/
|
||||||
|
public void exitClassSpecifier(IASTClassSpecifier classSpecification) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitNamespaceDefinition(org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition)
|
||||||
|
*/
|
||||||
|
public void exitNamespaceDefinition(IASTNamespaceDefinition namespaceDefinition) {
|
||||||
|
NamespaceDefinition definition = (NamespaceDefinition)domScopes.pop();
|
||||||
|
definition.setTotalLength( namespaceDefinition.getElementEndingOffset() - namespaceDefinition.getElementStartingOffset());
|
||||||
|
getCurrentDOMScope().addDeclaration( definition );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitInclusion(org.eclipse.cdt.core.parser.ast.IASTInclusion)
|
||||||
|
*/
|
||||||
|
public void exitInclusion(IASTInclusion inclusion) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitCompilationUnit(org.eclipse.cdt.core.parser.ast.IASTCompilationUnit)
|
||||||
|
*/
|
||||||
|
public void exitCompilationUnit(IASTCompilationUnit compilationUnit) {
|
||||||
|
domScopes.pop();
|
||||||
|
}
|
||||||
|
|
||||||
|
private ScopeStack domScopes = new ScopeStack();
|
||||||
|
|
||||||
|
private IScope getCurrentDOMScope()
|
||||||
|
{
|
||||||
|
return domScopes.peek();
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -2,6 +2,7 @@ package org.eclipse.cdt.internal.core.dom;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.core.parser.Name;
|
||||||
import org.eclipse.cdt.internal.core.parser.Token;
|
import org.eclipse.cdt.internal.core.parser.Token;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -4,6 +4,8 @@ import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.core.parser.Name;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class Declarator implements IExpressionOwner, IDeclaratorOwner {
|
public class Declarator implements IExpressionOwner, IDeclaratorOwner {
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package org.eclipse.cdt.internal.core.dom;
|
package org.eclipse.cdt.internal.core.dom;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.core.parser.Name;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
|
|
|
@ -16,6 +16,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.core.parser.Name;
|
||||||
import org.eclipse.cdt.internal.core.parser.Token;
|
import org.eclipse.cdt.internal.core.parser.Token;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom;
|
package org.eclipse.cdt.internal.core.dom;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.core.parser.Name;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
|
|
|
@ -16,6 +16,8 @@ import java.util.Collections;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.core.parser.Name;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
|
|
|
@ -15,6 +15,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.core.parser.Name;
|
||||||
import org.eclipse.cdt.internal.core.parser.Token;
|
import org.eclipse.cdt.internal.core.parser.Token;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -16,8 +16,6 @@ import java.util.Collections;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.core.parser.Token;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*
|
*
|
||||||
|
@ -25,8 +23,10 @@ import org.eclipse.cdt.internal.core.parser.Token;
|
||||||
public class NamespaceDefinition extends Declaration implements IScope {
|
public class NamespaceDefinition extends Declaration implements IScope {
|
||||||
|
|
||||||
private List declarations = new LinkedList();
|
private List declarations = new LinkedList();
|
||||||
private Name name = null;
|
private String name = "namespace";
|
||||||
private Token startToken = null;
|
int startingOffset = 0;
|
||||||
|
int nameOffset = 0;
|
||||||
|
int endOffset = 0;
|
||||||
|
|
||||||
public NamespaceDefinition( IScope owner )
|
public NamespaceDefinition( IScope owner )
|
||||||
{
|
{
|
||||||
|
@ -52,7 +52,7 @@ public class NamespaceDefinition extends Declaration implements IScope {
|
||||||
/**
|
/**
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
public Name getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,25 +60,44 @@ public class NamespaceDefinition extends Declaration implements IScope {
|
||||||
* Sets the name.
|
* Sets the name.
|
||||||
* @param name The name to set
|
* @param name The name to set
|
||||||
*/
|
*/
|
||||||
public void setName(Name name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int getStartOffset()
|
||||||
|
{
|
||||||
|
return startingOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNameOffset()
|
||||||
|
{
|
||||||
|
return nameOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getEndOffset()
|
||||||
|
{
|
||||||
|
return endOffset;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Returns the startToken.
|
* @param i
|
||||||
* @return Token
|
|
||||||
*/
|
*/
|
||||||
public Token getStartToken() {
|
public void setEndOffset(int i) {
|
||||||
return startToken;
|
endOffset = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the startToken.
|
* @param i
|
||||||
* @param startToken The startToken to set
|
|
||||||
*/
|
*/
|
||||||
public void setStartToken(Token startToken) {
|
public void setNameOffset(int i) {
|
||||||
this.startToken = startToken;
|
nameOffset = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param i
|
||||||
|
*/
|
||||||
|
public void setStartingOffset(int i) {
|
||||||
|
startingOffset = i;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.dom;
|
||||||
|
|
||||||
|
import java.util.Stack;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ScopeStack {
|
||||||
|
|
||||||
|
public IScope peek()
|
||||||
|
{
|
||||||
|
return (IScope)scopes.peek();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IScope pop()
|
||||||
|
{
|
||||||
|
return (IScope)scopes.pop();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void push( IScope scope )
|
||||||
|
{
|
||||||
|
scopes.push( scope );
|
||||||
|
}
|
||||||
|
|
||||||
|
private Stack scopes = new Stack();
|
||||||
|
|
||||||
|
}
|
|
@ -12,6 +12,8 @@
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom;
|
package org.eclipse.cdt.internal.core.dom;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.core.parser.Name;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
|
|
|
@ -13,13 +13,14 @@
|
||||||
package org.eclipse.cdt.internal.core.dom;
|
package org.eclipse.cdt.internal.core.dom;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class UsingDeclaration extends Declaration {
|
public class UsingDeclaration extends Declaration {
|
||||||
|
|
||||||
private Name mappedName;
|
private String mappedName;
|
||||||
boolean isTypename = false;
|
boolean isTypename = false;
|
||||||
|
|
||||||
public UsingDeclaration( IScope owner )
|
public UsingDeclaration( IScope owner )
|
||||||
|
@ -29,7 +30,7 @@ public class UsingDeclaration extends Declaration {
|
||||||
/**
|
/**
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
public Name getMappedName() {
|
public String getMappedName() {
|
||||||
return mappedName;
|
return mappedName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +38,7 @@ public class UsingDeclaration extends Declaration {
|
||||||
* Sets the mapping.
|
* Sets the mapping.
|
||||||
* @param mapping The mapping to set
|
* @param mapping The mapping to set
|
||||||
*/
|
*/
|
||||||
public void setMappedName(Name mapping) {
|
public void setMappedName(String mapping) {
|
||||||
this.mappedName = mapping;
|
this.mappedName = mapping;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom;
|
package org.eclipse.cdt.internal.core.dom;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.core.parser.Name;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
|
@ -19,7 +21,7 @@ package org.eclipse.cdt.internal.core.dom;
|
||||||
*/
|
*/
|
||||||
public class UsingDirective extends Declaration {
|
public class UsingDirective extends Declaration {
|
||||||
|
|
||||||
private Name namespaceName;
|
private String namespaceName;
|
||||||
|
|
||||||
public UsingDirective( IScope owner )
|
public UsingDirective( IScope owner )
|
||||||
{
|
{
|
||||||
|
@ -29,7 +31,7 @@ public class UsingDirective extends Declaration {
|
||||||
/**
|
/**
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
public Name getNamespaceName() {
|
public String getNamespaceName() {
|
||||||
return namespaceName;
|
return namespaceName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +39,7 @@ public class UsingDirective extends Declaration {
|
||||||
* Sets the namespaceName.
|
* Sets the namespaceName.
|
||||||
* @param namespaceName The namespaceName to set
|
* @param namespaceName The namespaceName to set
|
||||||
*/
|
*/
|
||||||
public void setNamespaceName(Name namespaceName) {
|
public void setNamespaceName(String namespaceName) {
|
||||||
this.namespaceName = namespaceName;
|
this.namespaceName = namespaceName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@ package org.eclipse.cdt.core.model;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.IPath;
|
|
||||||
import org.eclipse.core.runtime.IAdaptable;
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Common protocol for all elements provided by the C model.
|
* Common protocol for all elements provided by the C model.
|
||||||
|
|
|
@ -1,3 +1,22 @@
|
||||||
|
2003-06-13 John Camelon
|
||||||
|
Merged ParserSymbolTable branch back into HEAD.
|
||||||
|
|
||||||
|
2003-06-12 John Camelon
|
||||||
|
Get rest of JUnit tests working, will merge back to HEAD branch.
|
||||||
|
|
||||||
|
2003-06-12 John Camelon
|
||||||
|
Introduction of ASTFactory strategy, some restructuring of packages and interfaces.
|
||||||
|
|
||||||
|
2003-06-10 John Camelon
|
||||||
|
Futher pursuit of the golden hammer, symbol table integration.
|
||||||
|
|
||||||
|
2003-06-09 John Camelon
|
||||||
|
First step in replacing IParserCallback with ISourceElementRequestor.
|
||||||
|
|
||||||
|
2003-06-05 Andrew Niefer
|
||||||
|
Begin implementation of functions for template specializations: deduceTemplateArgument,
|
||||||
|
classTemplateSpecializationToFunctionTemplate, transformFunctionTemplateForOrdering
|
||||||
|
|
||||||
2003-06-09 Victor Mozgin
|
2003-06-09 Victor Mozgin
|
||||||
Fixed for conversion operator declarations.
|
Fixed for conversion operator declarations.
|
||||||
This fixes PR 36769 (finally) and PR 38657.
|
This fixes PR 36769 (finally) and PR 38657.
|
||||||
|
@ -20,6 +39,31 @@
|
||||||
2003-06-05 John Camelon
|
2003-06-05 John Camelon
|
||||||
Fix Bug 38380 "Include" class public methods fails JUnit tests
|
Fix Bug 38380 "Include" class public methods fails JUnit tests
|
||||||
|
|
||||||
|
2003-05-29 Andrew Niefer
|
||||||
|
new Class eType for stronger type safety in TypeInfo
|
||||||
|
new class PtrOp for better handling of pointer operators and cv qualifiers
|
||||||
|
new class TemplateInstance to support templates
|
||||||
|
Start of implementation for templates & specializations
|
||||||
|
|
||||||
|
2003-05-29 John Camelon
|
||||||
|
Remove all AST components.
|
||||||
|
|
||||||
|
2003-05-26 John Camelon
|
||||||
|
Rollback PST/Parser integration.
|
||||||
|
|
||||||
|
2003-05-13 Andrew Niefer
|
||||||
|
Moved symbol table to org.eclipse.cdt.internal.core.pst
|
||||||
|
Created interface for symbol table: ISymbol, IContainerSymbol, IDerivableContainerSymbol,
|
||||||
|
IParameterizedSymbol, and ISpecializedSymbol. These are all implemented by Declaration
|
||||||
|
The symbol table itself uses this interface instead of using its Declaration directly
|
||||||
|
(with the exception of the undo command framework)
|
||||||
|
|
||||||
|
2003-05-08 Andrew Niefer
|
||||||
|
Added a basic command structure to support rollbacks
|
||||||
|
|
||||||
|
2003-05-06 John Camelon
|
||||||
|
Further integration of SymbolTable into Parser, some refactoring.
|
||||||
|
|
||||||
2003-05-05 John Camelon/Andrew Niefer
|
2003-05-05 John Camelon/Andrew Niefer
|
||||||
Added Symboltable infrastructure into main parser.
|
Added Symboltable infrastructure into main parser.
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Rational Software - Initial API and implementation
|
* Rational Software - Initial API and implementation
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.parser;
|
package org.eclipse.cdt.core.parser;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.core.parser.Parser.Backtrack;
|
import org.eclipse.cdt.internal.core.parser.Parser.Backtrack;
|
||||||
|
|
||||||
|
@ -82,4 +82,7 @@ public interface IParser {
|
||||||
*/
|
*/
|
||||||
public int getLastErrorOffset();
|
public int getLastErrorOffset();
|
||||||
|
|
||||||
|
|
||||||
|
public void setRequestor( ISourceElementRequestor r );
|
||||||
|
|
||||||
}
|
}
|
|
@ -8,14 +8,12 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Rational Software - Initial API and implementation
|
* IBM Rational Software - Initial API and implementation
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.parser;
|
package org.eclipse.cdt.core.parser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface ISymbol {
|
public interface IProblem {
|
||||||
|
|
||||||
public Object getObject();
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,16 +1,18 @@
|
||||||
package org.eclipse.cdt.internal.core.parser;
|
package org.eclipse.cdt.core.parser;
|
||||||
|
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
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
|
* @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 {
|
public interface IScanner {
|
||||||
|
|
||||||
|
@ -33,4 +35,6 @@ public interface IScanner {
|
||||||
public void mapLineNumbers( boolean value );
|
public void mapLineNumbers( boolean value );
|
||||||
public void setQuickScan(boolean qs);
|
public void setQuickScan(boolean qs);
|
||||||
public void setCallback(IParserCallback c);
|
public void setCallback(IParserCallback c);
|
||||||
|
public void setRequestor( ISourceElementRequestor r );
|
||||||
|
public void setASTFactory( IASTFactory f );
|
||||||
}
|
}
|
|
@ -0,0 +1,82 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTConstructor;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTEnumSpecifier;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTEnumerator;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTField;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTFunction;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTInclusion;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTMacro;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTMethod;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTTypedef;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTVariable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface ISourceElementRequestor {
|
||||||
|
|
||||||
|
public void acceptProblem( IProblem problem );
|
||||||
|
|
||||||
|
public void acceptMacro( IASTMacro macro );
|
||||||
|
public void acceptVariable( IASTVariable variable );
|
||||||
|
public void acceptFunctionDeclaration( IASTFunction function );
|
||||||
|
public void acceptUsingDirective( IASTUsingDirective usageDirective );
|
||||||
|
public void acceptUsingDeclaration( IASTUsingDeclaration usageDeclaration );
|
||||||
|
public void acceptASMDefinition( IASTASMDefinition asmDefinition );
|
||||||
|
public void acceptTypedef( IASTTypedef typedef );
|
||||||
|
|
||||||
|
public void enterEnumSpecifier( IASTEnumSpecifier enumSpec );
|
||||||
|
public void acceptEnumerator( IASTEnumerator enumerator );
|
||||||
|
public void exitEnumSpecifier( IASTEnumSpecifier enumSpec );
|
||||||
|
|
||||||
|
public void enterFunctionBody( IASTFunction function );
|
||||||
|
public void exitFunctionBody( IASTFunction function );
|
||||||
|
|
||||||
|
public void enterCompilationUnit( IASTCompilationUnit compilationUnit );
|
||||||
|
public void enterInclusion( IASTInclusion inclusion );
|
||||||
|
public void enterNamespaceDefinition( IASTNamespaceDefinition namespaceDefinition );
|
||||||
|
public void enterClassSpecifier( IASTClassSpecifier classSpecification );
|
||||||
|
public void enterLinkageSpecification( IASTLinkageSpecification linkageSpec );
|
||||||
|
|
||||||
|
public void enterTemplateDeclaration( IASTTemplateDeclaration declaration );
|
||||||
|
public void enterTemplateSpecialization( IASTTemplateSpecialization specialization );
|
||||||
|
public void enterTemplateExplicitInstantiation( IASTTemplateInstantiation instantiation );
|
||||||
|
|
||||||
|
public void acceptMethodDeclaration( IASTMethod method );
|
||||||
|
public void enterMethodBody( IASTMethod method );
|
||||||
|
public void exitMethodBody( IASTMethod method );
|
||||||
|
public void acceptField( IASTField field );
|
||||||
|
public void acceptConstructor( IASTConstructor constructor );
|
||||||
|
|
||||||
|
public void exitTemplateDeclaration( IASTTemplateDeclaration declaration );
|
||||||
|
public void exitTemplateSpecialization( IASTTemplateSpecialization specialization );
|
||||||
|
public void exitTemplateExplicitInstantiation( IASTTemplateInstantiation instantiation );
|
||||||
|
|
||||||
|
public void exitLinkageSpecification( IASTLinkageSpecification linkageSpec );
|
||||||
|
public void exitClassSpecifier( IASTClassSpecifier classSpecification );
|
||||||
|
public void exitNamespaceDefinition( IASTNamespaceDefinition namespaceDefinition );
|
||||||
|
public void exitInclusion( IASTInclusion inclusion );
|
||||||
|
public void exitCompilationUnit( IASTCompilationUnit compilationUnit );
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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 class AccessVisibility {
|
||||||
|
|
||||||
|
public static final AccessVisibility v_public = new AccessVisibility( 1 );
|
||||||
|
public static final AccessVisibility v_protected = new AccessVisibility( 2 );
|
||||||
|
public static final AccessVisibility v_private = new AccessVisibility( 3 );
|
||||||
|
|
||||||
|
private AccessVisibility( int constant)
|
||||||
|
{
|
||||||
|
value = constant;
|
||||||
|
}
|
||||||
|
|
||||||
|
private final int value;
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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 class ClassKind {
|
||||||
|
|
||||||
|
public final static ClassKind k_class = new ClassKind( 1 );
|
||||||
|
public final static ClassKind k_struct = new ClassKind( 2 );
|
||||||
|
public final static ClassKind k_union = new ClassKind( 3 );
|
||||||
|
|
||||||
|
private ClassKind( int value )
|
||||||
|
{
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private final int value;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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 class ClassNameType {
|
||||||
|
|
||||||
|
public static final ClassNameType t_identifier = new ClassNameType( 1 );
|
||||||
|
public static final ClassNameType t_template = new ClassNameType( 2 );
|
||||||
|
|
||||||
|
private final int type;
|
||||||
|
private ClassNameType( int t )
|
||||||
|
{
|
||||||
|
type = t;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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 IASTASMDefinition extends IASTOffsetableElement, IASTDeclaration {
|
||||||
|
|
||||||
|
public String getBody();
|
||||||
|
|
||||||
|
}
|
|
@ -8,18 +8,17 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Rational Software - Initial API and implementation
|
* IBM Rational Software - Initial API and implementation
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom;
|
package org.eclipse.cdt.core.parser.ast;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
public class DOMFactory {
|
public interface IASTBaseSpecifier {
|
||||||
|
|
||||||
|
public AccessVisibility getAccess();
|
||||||
|
public boolean isVirtual();
|
||||||
|
public IASTClassSpecifier getParent();
|
||||||
|
|
||||||
public static DOMBuilder createDOMBuilder( boolean lineNumbers )
|
|
||||||
{
|
|
||||||
if( lineNumbers )
|
|
||||||
return new LineNumberedDOMBuilder();
|
|
||||||
else
|
|
||||||
return new DOMBuilder();
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface IASTClassSpecifier extends IASTScope, IASTOffsetableNamedElement, IASTTemplatedDeclaration {
|
||||||
|
|
||||||
|
public ClassNameType getClassNameType();
|
||||||
|
|
||||||
|
public ClassKind getClassKind();
|
||||||
|
|
||||||
|
public Iterator getBaseClauses();
|
||||||
|
|
||||||
|
}
|
|
@ -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 IASTCompilationUnit extends IASTScope {
|
||||||
|
|
||||||
|
}
|
|
@ -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 IASTConstructor {
|
||||||
|
|
||||||
|
}
|
|
@ -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();
|
||||||
|
|
||||||
|
}
|
|
@ -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 IASTEnumSpecifier {
|
||||||
|
|
||||||
|
}
|
|
@ -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 IASTEnumerator {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.core.parser.TokenDuple;
|
||||||
|
import org.eclipse.cdt.internal.core.parser.Parser.Backtrack;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface IASTFactory {
|
||||||
|
|
||||||
|
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 IASTUsingDeclaration createUsingDeclaration(
|
||||||
|
IASTScope scope,
|
||||||
|
boolean isTypeName,
|
||||||
|
TokenDuple name );
|
||||||
|
|
||||||
|
|
||||||
|
public IASTASMDefinition createASMDefinition(
|
||||||
|
IASTScope scope,
|
||||||
|
String assembly,
|
||||||
|
int first,
|
||||||
|
int last);
|
||||||
|
|
||||||
|
public IASTNamespaceDefinition createNamespaceDefinition(
|
||||||
|
IASTScope scope,
|
||||||
|
String identifier,
|
||||||
|
int startingOffset, int nameOffset);
|
||||||
|
|
||||||
|
public IASTCompilationUnit createCompilationUnit();
|
||||||
|
|
||||||
|
public IASTLinkageSpecification createLinkageSpecification(IASTScope scope, String spec);
|
||||||
|
|
||||||
|
}
|
|
@ -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 IASTField {
|
||||||
|
|
||||||
|
}
|
|
@ -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 IASTFunction {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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 IASTInclusion extends IASTOffsetableNamedElement {
|
||||||
|
|
||||||
|
public String getName();
|
||||||
|
|
||||||
|
public String getFullFileName();
|
||||||
|
|
||||||
|
public boolean isLocal();
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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 IASTLinkageSpecification extends IASTScope, IASTDeclaration {
|
||||||
|
|
||||||
|
public String getLinkageString();
|
||||||
|
}
|
|
@ -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 IASTMacro extends IASTOffsetableNamedElement {
|
||||||
|
|
||||||
|
public String getName();
|
||||||
|
|
||||||
|
}
|
|
@ -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 IASTMethod {
|
||||||
|
|
||||||
|
}
|
|
@ -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 IASTNamespaceDefinition extends IASTOffsetableNamedElement, IASTScope, IASTDeclaration {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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 IASTOffsetableElement {
|
||||||
|
|
||||||
|
public void setStartingOffset( int o );
|
||||||
|
public void setEndingOffset( int o );
|
||||||
|
|
||||||
|
public int getElementStartingOffset();
|
||||||
|
public int getElementEndingOffset();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -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.core.parser.ast;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface IASTOffsetableNamedElement extends IASTOffsetableElement {
|
||||||
|
|
||||||
|
public String getName();
|
||||||
|
public int getElementNameOffset();
|
||||||
|
public void setNameOffset( int o );
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface IASTScope {
|
||||||
|
|
||||||
|
public Iterator getDeclarations();
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface IASTTemplateDeclaration {
|
||||||
|
|
||||||
|
public TemplateDeclarationType getTemplateDeclarationType();
|
||||||
|
public Iterator getTemplateParameters();
|
||||||
|
|
||||||
|
}
|
|
@ -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 IASTTemplateInstantiation {
|
||||||
|
|
||||||
|
public TemplateDeclarationType getTemplateDeclarationType();
|
||||||
|
public IASTTemplateDeclaration getTemplateDeclaration();
|
||||||
|
}
|
|
@ -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 {
|
||||||
|
|
||||||
|
}
|
|
@ -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 IASTTemplateSpecialization {
|
||||||
|
|
||||||
|
public TemplateDeclarationType getTemplateDeclarationType();
|
||||||
|
public IASTTemplateDeclaration getTemplateDeclaration();
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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 IASTTemplatedDeclaration {
|
||||||
|
|
||||||
|
public IASTTemplateDeclaration getOwnerTemplateDeclaration();
|
||||||
|
}
|
|
@ -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 IASTTypedef {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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 IASTUsingDeclaration extends IASTDeclaration {
|
||||||
|
|
||||||
|
public boolean isTypename();
|
||||||
|
public String usingTypeName();
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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 IASTUsingDirective extends IASTDeclaration {
|
||||||
|
|
||||||
|
public String getNamespaceName();
|
||||||
|
}
|
|
@ -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 IASTVariable {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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 class TemplateDeclarationType {
|
||||||
|
|
||||||
|
public static final TemplateDeclarationType t_class = new TemplateDeclarationType(1);
|
||||||
|
public static final TemplateDeclarationType t_function = new TemplateDeclarationType( 2 );
|
||||||
|
public static final TemplateDeclarationType t_memberClass = new TemplateDeclarationType( 3 );
|
||||||
|
public static final TemplateDeclarationType t_method = new TemplateDeclarationType( 4 );
|
||||||
|
public static final TemplateDeclarationType t_field = new TemplateDeclarationType( 5 );
|
||||||
|
|
||||||
|
|
||||||
|
private final int type;
|
||||||
|
private TemplateDeclarationType( int t )
|
||||||
|
{
|
||||||
|
type = t;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -24,11 +24,11 @@ import org.eclipse.cdt.core.model.IParent;
|
||||||
import org.eclipse.cdt.core.model.IStructure;
|
import org.eclipse.cdt.core.model.IStructure;
|
||||||
import org.eclipse.cdt.core.model.ITemplate;
|
import org.eclipse.cdt.core.model.ITemplate;
|
||||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
|
import org.eclipse.cdt.core.parser.IParser;
|
||||||
import org.eclipse.cdt.internal.core.dom.ArrayQualifier;
|
import org.eclipse.cdt.internal.core.dom.ArrayQualifier;
|
||||||
import org.eclipse.cdt.internal.core.dom.ClassKey;
|
import org.eclipse.cdt.internal.core.dom.ClassKey;
|
||||||
import org.eclipse.cdt.internal.core.dom.ClassSpecifier;
|
import org.eclipse.cdt.internal.core.dom.ClassSpecifier;
|
||||||
import org.eclipse.cdt.internal.core.dom.DOMBuilder;
|
import org.eclipse.cdt.internal.core.dom.DOMBuilder;
|
||||||
import org.eclipse.cdt.internal.core.dom.DOMFactory;
|
|
||||||
import org.eclipse.cdt.internal.core.dom.DeclSpecifier;
|
import org.eclipse.cdt.internal.core.dom.DeclSpecifier;
|
||||||
import org.eclipse.cdt.internal.core.dom.Declaration;
|
import org.eclipse.cdt.internal.core.dom.Declaration;
|
||||||
import org.eclipse.cdt.internal.core.dom.Declarator;
|
import org.eclipse.cdt.internal.core.dom.Declarator;
|
||||||
|
@ -39,7 +39,6 @@ import org.eclipse.cdt.internal.core.dom.IOffsetable;
|
||||||
import org.eclipse.cdt.internal.core.dom.ITemplateParameterListOwner;
|
import org.eclipse.cdt.internal.core.dom.ITemplateParameterListOwner;
|
||||||
import org.eclipse.cdt.internal.core.dom.Inclusion;
|
import org.eclipse.cdt.internal.core.dom.Inclusion;
|
||||||
import org.eclipse.cdt.internal.core.dom.Macro;
|
import org.eclipse.cdt.internal.core.dom.Macro;
|
||||||
import org.eclipse.cdt.internal.core.dom.Name;
|
|
||||||
import org.eclipse.cdt.internal.core.dom.NamespaceDefinition;
|
import org.eclipse.cdt.internal.core.dom.NamespaceDefinition;
|
||||||
import org.eclipse.cdt.internal.core.dom.ParameterDeclaration;
|
import org.eclipse.cdt.internal.core.dom.ParameterDeclaration;
|
||||||
import org.eclipse.cdt.internal.core.dom.ParameterDeclarationClause;
|
import org.eclipse.cdt.internal.core.dom.ParameterDeclarationClause;
|
||||||
|
@ -49,7 +48,7 @@ import org.eclipse.cdt.internal.core.dom.TemplateDeclaration;
|
||||||
import org.eclipse.cdt.internal.core.dom.TemplateParameter;
|
import org.eclipse.cdt.internal.core.dom.TemplateParameter;
|
||||||
import org.eclipse.cdt.internal.core.dom.TranslationUnit;
|
import org.eclipse.cdt.internal.core.dom.TranslationUnit;
|
||||||
import org.eclipse.cdt.internal.core.dom.TypeSpecifier;
|
import org.eclipse.cdt.internal.core.dom.TypeSpecifier;
|
||||||
import org.eclipse.cdt.internal.core.parser.IParser;
|
import org.eclipse.cdt.internal.core.parser.Name;
|
||||||
import org.eclipse.cdt.internal.core.parser.Parser;
|
import org.eclipse.cdt.internal.core.parser.Parser;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
|
|
||||||
|
@ -66,7 +65,7 @@ public class CModelBuilder {
|
||||||
public Map parse(boolean requiresLineNumbers) throws Exception {
|
public Map parse(boolean requiresLineNumbers) throws Exception {
|
||||||
// Note - if a CModel client wishes to have a CModel with valid line numbers
|
// Note - if a CModel client wishes to have a CModel with valid line numbers
|
||||||
// DOMFactory.createDOMBuilder should be given the parameter 'true'
|
// DOMFactory.createDOMBuilder should be given the parameter 'true'
|
||||||
DOMBuilder domBuilder = DOMFactory.createDOMBuilder( requiresLineNumbers );
|
DOMBuilder domBuilder = new DOMBuilder();
|
||||||
String code = translationUnit.getBuffer().getContents();
|
String code = translationUnit.getBuffer().getContents();
|
||||||
IParser parser = new Parser(code, domBuilder, true);
|
IParser parser = new Parser(code, domBuilder, true);
|
||||||
parser.mapLineNumbers(requiresLineNumbers);
|
parser.mapLineNumbers(requiresLineNumbers);
|
||||||
|
@ -283,12 +282,12 @@ public class CModelBuilder {
|
||||||
parent.addChild((ICElement)element);
|
parent.addChild((ICElement)element);
|
||||||
// set element position
|
// set element position
|
||||||
if(nsDef.getName() != null){
|
if(nsDef.getName() != null){
|
||||||
element.setIdPos(nsDef.getName().getStartOffset(), nsDef.getName().length());
|
element.setIdPos(nsDef.getNameOffset(), nsDef.getName().length());
|
||||||
}else{
|
}else{
|
||||||
element.setIdPos(nsDef.getStartToken().getOffset(), nsDef.getStartToken().getLength());
|
element.setIdPos(nsDef.getStartingOffset(), new String( "namespace").length());
|
||||||
}
|
}
|
||||||
element.setPos(nsDef.getStartingOffset(), nsDef.getTotalLength());
|
element.setPos(nsDef.getStartingOffset(), nsDef.getTotalLength());
|
||||||
element.setTypeName(nsDef.getStartToken().getImage());
|
element.setTypeName(new String( "namespace"));
|
||||||
// set the element lines
|
// set the element lines
|
||||||
element.setLines(nsDef.getTopLine(), nsDef.getBottomLine());
|
element.setLines(nsDef.getTopLine(), nsDef.getBottomLine());
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,9 @@ import java.util.LinkedList;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.Stack;
|
import java.util.Stack;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTInclusion;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author aniefer
|
* @author aniefer
|
||||||
*
|
*
|
||||||
|
@ -31,18 +34,20 @@ public class ContextStack {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateContext(Reader reader, String filename, int type) throws ScannerException {
|
public void updateContext(Reader reader, String filename, int type, IASTInclusion inclusion, ISourceElementRequestor requestor) throws ScannerException {
|
||||||
undoStack.clear();
|
undoStack.clear();
|
||||||
|
push( new ScannerContext().initialize(reader, filename, type, null ), requestor );
|
||||||
push( new ScannerContext().initialize(reader, filename, type ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void push( IScannerContext context ) throws ScannerException
|
protected void push( IScannerContext context, ISourceElementRequestor requestor ) throws ScannerException
|
||||||
{
|
{
|
||||||
if( context.getKind() == IScannerContext.INCLUSION )
|
if( context.getKind() == IScannerContext.INCLUSION )
|
||||||
{
|
{
|
||||||
if( !inclusions.add( context.getFilename() ) )
|
if( !inclusions.add( context.getFilename() ) )
|
||||||
throw new ScannerException( "Inclusion " + context.getFilename() + " already encountered." );
|
throw new ScannerException( "Inclusion " + context.getFilename() + " already encountered." );
|
||||||
|
if( requestor != null )
|
||||||
|
requestor.enterInclusion( context.getExtension() );
|
||||||
|
|
||||||
} else if( context.getKind() == IScannerContext.MACROEXPANSION )
|
} else if( context.getKind() == IScannerContext.MACROEXPANSION )
|
||||||
{
|
{
|
||||||
if( !defines.add( context.getFilename() ) )
|
if( !defines.add( context.getFilename() ) )
|
||||||
|
@ -56,7 +61,7 @@ public class ContextStack {
|
||||||
topContext = context;
|
topContext = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean rollbackContext() {
|
public boolean rollbackContext(ISourceElementRequestor requestor) {
|
||||||
try {
|
try {
|
||||||
currentContext.getReader().close();
|
currentContext.getReader().close();
|
||||||
} catch (IOException ie) {
|
} catch (IOException ie) {
|
||||||
|
@ -66,6 +71,8 @@ public class ContextStack {
|
||||||
if( currentContext.getKind() == IScannerContext.INCLUSION )
|
if( currentContext.getKind() == IScannerContext.INCLUSION )
|
||||||
{
|
{
|
||||||
inclusions.remove( currentContext.getFilename() );
|
inclusions.remove( currentContext.getFilename() );
|
||||||
|
if( requestor != null )
|
||||||
|
requestor.exitInclusion( currentContext.getExtension() );
|
||||||
} else if( currentContext.getKind() == IScannerContext.MACROEXPANSION )
|
} else if( currentContext.getKind() == IScannerContext.MACROEXPANSION )
|
||||||
{
|
{
|
||||||
defines.remove( currentContext.getFilename() );
|
defines.remove( currentContext.getFilename() );
|
||||||
|
@ -82,7 +89,7 @@ public class ContextStack {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void undoRollback( IScannerContext undoTo ) throws ScannerException {
|
public void undoRollback( IScannerContext undoTo, ISourceElementRequestor requestor ) throws ScannerException {
|
||||||
if( currentContext == undoTo ){
|
if( currentContext == undoTo ){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -93,7 +100,7 @@ public class ContextStack {
|
||||||
Iterator iter = undoStack.iterator();
|
Iterator iter = undoStack.iterator();
|
||||||
for( int i = size; i > 0; i-- )
|
for( int i = size; i > 0; i-- )
|
||||||
{
|
{
|
||||||
push( (IScannerContext) undoStack.removeFirst() );
|
push( (IScannerContext) undoStack.removeFirst(), requestor );
|
||||||
|
|
||||||
if( currentContext == undoTo )
|
if( currentContext == undoTo )
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -13,7 +13,8 @@ package org.eclipse.cdt.internal.core.parser;
|
||||||
import java.util.EmptyStackException;
|
import java.util.EmptyStackException;
|
||||||
import java.util.Stack;
|
import java.util.Stack;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.core.dom.Name;
|
import org.eclipse.cdt.core.parser.IParser;
|
||||||
|
|
||||||
|
|
||||||
public class ExpressionEvaluator implements IParserCallback {
|
public class ExpressionEvaluator implements IParserCallback {
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.parser;
|
package org.eclipse.cdt.internal.core.parser;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.parser.IParser;
|
||||||
|
|
||||||
public interface IParserCallback {
|
public interface IParserCallback {
|
||||||
|
|
||||||
public void setParser( IParser parser );
|
public void setParser( IParser parser );
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package org.eclipse.cdt.internal.core.parser;
|
package org.eclipse.cdt.internal.core.parser;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTInclusion;
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*
|
*
|
||||||
|
@ -17,17 +19,20 @@ public interface IScannerContext {
|
||||||
public static int INCLUSION = 2;
|
public static int INCLUSION = 2;
|
||||||
public static int MACROEXPANSION = 3;
|
public static int MACROEXPANSION = 3;
|
||||||
|
|
||||||
|
public IScannerContext initialize(Reader r, String f, int k, IASTInclusion i);
|
||||||
|
public int read() throws IOException;
|
||||||
|
public String getFilename();
|
||||||
|
public int getOffset();
|
||||||
|
public Reader getReader();
|
||||||
|
|
||||||
IScannerContext initialize(Reader r, String f, int k);
|
public int undoStackSize();
|
||||||
int read() throws IOException;
|
public int popUndo();
|
||||||
String getFilename();
|
public void pushUndo(int undo);
|
||||||
int getOffset();
|
|
||||||
Reader getReader();
|
|
||||||
|
|
||||||
int undoStackSize();
|
public int getKind();
|
||||||
int popUndo();
|
public void setKind( int kind );
|
||||||
void pushUndo(int undo);
|
|
||||||
|
public IASTInclusion getExtension();
|
||||||
|
public void setExtension( IASTInclusion ext );
|
||||||
|
|
||||||
int getKind();
|
|
||||||
void setKind( int kind );
|
|
||||||
}
|
}
|
|
@ -0,0 +1,75 @@
|
||||||
|
package org.eclipse.cdt.internal.core.parser;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author dschaefe
|
||||||
|
*
|
||||||
|
* 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 class Name {
|
||||||
|
|
||||||
|
private Token nameStart, nameEnd;
|
||||||
|
|
||||||
|
public Name(Token nameStart) {
|
||||||
|
this.nameStart = nameStart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Name(Token nameStart, Token nameEnd) {
|
||||||
|
this( nameStart );
|
||||||
|
setEnd( nameEnd );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setEnd(Token nameEnd) {
|
||||||
|
this.nameEnd = nameEnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getStartOffset()
|
||||||
|
{
|
||||||
|
return nameStart.offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getEndOffset()
|
||||||
|
{
|
||||||
|
return nameEnd.offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
Token t = nameStart;
|
||||||
|
StringBuffer buffer = new StringBuffer();
|
||||||
|
buffer.append( t.getImage() );
|
||||||
|
if( t.getType() == Token.t_operator )
|
||||||
|
buffer.append( " " );
|
||||||
|
|
||||||
|
while (t != nameEnd) {
|
||||||
|
t = t.getNext();
|
||||||
|
|
||||||
|
buffer.append( t.getImage() );
|
||||||
|
if (t.getType() == Token.t_operator) buffer.append( " " );
|
||||||
|
}
|
||||||
|
|
||||||
|
return buffer.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int length()
|
||||||
|
{
|
||||||
|
return getEndOffset() - getStartOffset() + nameEnd.getImage().length();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Token getNameStart() {
|
||||||
|
return nameStart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String tokensToString( Token first, Token last )
|
||||||
|
{
|
||||||
|
Name n = new Name( first, last );
|
||||||
|
return n.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,5 +1,7 @@
|
||||||
package org.eclipse.cdt.internal.core.parser;
|
package org.eclipse.cdt.internal.core.parser;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.parser.IParser;
|
||||||
|
|
||||||
public class NullParserCallback implements IParserCallback {
|
public class NullParserCallback implements IParserCallback {
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|
|
@ -15,9 +15,18 @@ import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.StringReader;
|
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.IASTUsingDeclaration;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
|
||||||
import org.eclipse.cdt.internal.core.model.Util;
|
import org.eclipse.cdt.internal.core.model.Util;
|
||||||
import org.eclipse.cdt.internal.core.parser.ParserSymbolTable.Declaration;
|
|
||||||
import org.eclipse.cdt.internal.core.parser.ParserSymbolTable.TypeInfo;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is our first implementation of the IParser interface, serving as a parser for
|
* This is our first implementation of the IParser interface, serving as a parser for
|
||||||
|
@ -35,7 +44,8 @@ public class Parser implements IParser {
|
||||||
private boolean quickParse = false; // are we doing the high-level parse, or an in depth parse?
|
private boolean quickParse = false; // are we doing the high-level parse, or an in depth parse?
|
||||||
private boolean parsePassed = true; // did the parse pass?
|
private boolean parsePassed = true; // did the parse pass?
|
||||||
private boolean cppNature = true; // true for C++, false for C
|
private boolean cppNature = true; // true for C++, false for C
|
||||||
private ParserSymbolTable pst = new ParserSymbolTable(); // names
|
private ISourceElementRequestor requestor = null; // new callback mechanism
|
||||||
|
private IASTFactory astFactory = null; // ast factory
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the single entry point for setting parsePassed to
|
* This is the single entry point for setting parsePassed to
|
||||||
|
@ -62,9 +72,13 @@ public class Parser implements IParser {
|
||||||
public Parser(IScanner s, IParserCallback c, boolean quick) {
|
public Parser(IScanner s, IParserCallback c, boolean quick) {
|
||||||
callback = c;
|
callback = c;
|
||||||
scanner = s;
|
scanner = s;
|
||||||
|
if( c instanceof ISourceElementRequestor )
|
||||||
|
setRequestor( (ISourceElementRequestor)c );
|
||||||
quickParse = quick;
|
quickParse = quick;
|
||||||
|
astFactory = ParserFactory.createASTFactory( quick );
|
||||||
scanner.setQuickScan(quick);
|
scanner.setQuickScan(quick);
|
||||||
scanner.setCallback(c);
|
scanner.setCallback(c);
|
||||||
|
scanner.setASTFactory( astFactory );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -163,13 +177,16 @@ c, quickParse);
|
||||||
try { callback.setParser( this ); } catch( Exception e) {}
|
try { callback.setParser( this ); } catch( Exception e) {}
|
||||||
Object translationUnit = null;
|
Object translationUnit = null;
|
||||||
try{ translationUnit = callback.translationUnitBegin();} catch( Exception e ) {}
|
try{ translationUnit = callback.translationUnitBegin();} catch( Exception e ) {}
|
||||||
pst.getCompilationUnit().setObject(translationUnit);
|
|
||||||
|
IASTCompilationUnit compilationUnit = astFactory.createCompilationUnit();
|
||||||
|
requestor.enterCompilationUnit( compilationUnit );
|
||||||
|
|
||||||
Token lastBacktrack = null;
|
Token lastBacktrack = null;
|
||||||
Token checkToken;
|
Token checkToken;
|
||||||
while (true) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
checkToken = LA(1);
|
checkToken = LA(1);
|
||||||
declaration( translationUnit, pst.getCompilationUnit() );
|
declaration( translationUnit, compilationUnit );
|
||||||
if( LA(1) == checkToken )
|
if( LA(1) == checkToken )
|
||||||
errorHandling();
|
errorHandling();
|
||||||
} catch (EndOfFile e) {
|
} catch (EndOfFile e) {
|
||||||
|
@ -199,8 +216,12 @@ c, quickParse);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try{ callback.translationUnitEnd(translationUnit);} catch( Exception e ) {}
|
try{ callback.translationUnitEnd(translationUnit);} catch( Exception e ) {}
|
||||||
|
requestor.exitCompilationUnit( compilationUnit );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is called whenever we encounter and error that we cannot backtrack out of and we
|
* This function is called whenever we encounter and error that we cannot backtrack out of and we
|
||||||
* still wish to try and continue on with the parse to do a best-effort parse for our client.
|
* still wish to try and continue on with the parse to do a best-effort parse for our client.
|
||||||
|
@ -240,7 +261,7 @@ c, quickParse);
|
||||||
* @param container Callback object representing the scope these definitions fall into.
|
* @param container Callback object representing the scope these definitions fall into.
|
||||||
* @throws Backtrack request for a backtrack
|
* @throws Backtrack request for a backtrack
|
||||||
*/
|
*/
|
||||||
protected void usingClause( Object container ) throws Backtrack
|
protected void usingClause( Object container, IASTScope scope ) throws Backtrack
|
||||||
{
|
{
|
||||||
Token firstToken = consume( Token.t_using );
|
Token firstToken = consume( Token.t_using );
|
||||||
|
|
||||||
|
@ -252,9 +273,10 @@ c, quickParse);
|
||||||
consume( Token.t_namespace );
|
consume( Token.t_namespace );
|
||||||
|
|
||||||
// optional :: and nested classes handled in name
|
// optional :: and nested classes handled in name
|
||||||
|
TokenDuple duple = null ;
|
||||||
if( LT(1) == Token.tIDENTIFIER || LT(1) == Token.tCOLONCOLON )
|
if( LT(1) == Token.tIDENTIFIER || LT(1) == Token.tCOLONCOLON )
|
||||||
{
|
{
|
||||||
name();
|
duple = name();
|
||||||
try{ callback.usingDirectiveNamespaceId( directive );} catch( Exception e ) {}
|
try{ callback.usingDirectiveNamespaceId( directive );} catch( Exception e ) {}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -267,6 +289,9 @@ c, quickParse);
|
||||||
{
|
{
|
||||||
consume( Token.tSEMI );
|
consume( Token.tSEMI );
|
||||||
try{ callback.usingDirectiveEnd( directive );} catch( Exception e ) {}
|
try{ callback.usingDirectiveEnd( directive );} catch( Exception e ) {}
|
||||||
|
|
||||||
|
IASTUsingDirective astUD = astFactory.createUsingDirective(scope, duple);
|
||||||
|
requestor.acceptUsingDirective( astUD );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -287,10 +312,11 @@ c, quickParse);
|
||||||
consume( Token.t_typename );
|
consume( Token.t_typename );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TokenDuple name = null;
|
||||||
if( LT(1) == Token.tIDENTIFIER || LT(1) == Token.tCOLONCOLON )
|
if( LT(1) == Token.tIDENTIFIER || LT(1) == Token.tCOLONCOLON )
|
||||||
{
|
{
|
||||||
// optional :: and nested classes handled in name
|
// optional :: and nested classes handled in name
|
||||||
name();
|
name = name();
|
||||||
try{ callback.usingDeclarationMapping( usingDeclaration, typeName ); } catch( Exception e ) {}
|
try{ callback.usingDeclarationMapping( usingDeclaration, typeName ); } catch( Exception e ) {}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -302,7 +328,11 @@ c, quickParse);
|
||||||
if( LT(1) == Token.tSEMI )
|
if( LT(1) == Token.tSEMI )
|
||||||
{
|
{
|
||||||
consume( Token.tSEMI );
|
consume( Token.tSEMI );
|
||||||
|
|
||||||
try{ callback.usingDeclarationEnd( usingDeclaration );} catch( Exception e ) {}
|
try{ callback.usingDeclarationEnd( usingDeclaration );} catch( Exception e ) {}
|
||||||
|
|
||||||
|
IASTUsingDeclaration declaration = astFactory.createUsingDeclaration( scope, typeName, name );
|
||||||
|
requestor.acceptUsingDeclaration(declaration);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -312,6 +342,7 @@ c, quickParse);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements Linkage specification in the ANSI C++ grammar.
|
* Implements Linkage specification in the ANSI C++ grammar.
|
||||||
*
|
*
|
||||||
|
@ -322,7 +353,7 @@ c, quickParse);
|
||||||
* @param container Callback object representing the scope these definitions fall into.
|
* @param container Callback object representing the scope these definitions fall into.
|
||||||
* @throws Backtrack request for a backtrack
|
* @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 );
|
consume( Token.t_extern );
|
||||||
|
|
||||||
|
@ -330,11 +361,17 @@ c, quickParse);
|
||||||
throw backtrack;
|
throw backtrack;
|
||||||
|
|
||||||
Object linkageSpec = null;
|
Object linkageSpec = null;
|
||||||
try{ linkageSpec = callback.linkageSpecificationBegin( container, consume( Token.tSTRING ).getImage() );} catch( Exception e ) {}
|
Token spec = consume( Token.tSTRING );
|
||||||
|
try{ linkageSpec = callback.linkageSpecificationBegin( container, spec.getImage() );} catch( Exception e ) {}
|
||||||
|
|
||||||
if( LT(1) == Token.tLBRACE )
|
if( LT(1) == Token.tLBRACE )
|
||||||
{
|
{
|
||||||
consume(Token.tLBRACE);
|
consume(Token.tLBRACE);
|
||||||
|
|
||||||
|
IASTLinkageSpecification linkage = astFactory.createLinkageSpecification(scope, spec.getImage());
|
||||||
|
|
||||||
|
requestor.enterLinkageSpecification( linkage );
|
||||||
|
|
||||||
linkageDeclarationLoop:
|
linkageDeclarationLoop:
|
||||||
while (LT(1) != Token.tRBRACE) {
|
while (LT(1) != Token.tRBRACE) {
|
||||||
Token checkToken = LA(1);
|
Token checkToken = LA(1);
|
||||||
|
@ -345,7 +382,7 @@ c, quickParse);
|
||||||
default:
|
default:
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
declaration(linkageSpec, null);
|
declaration(linkageSpec, linkage);
|
||||||
}
|
}
|
||||||
catch( Backtrack bt )
|
catch( Backtrack bt )
|
||||||
{
|
{
|
||||||
|
@ -360,14 +397,22 @@ c, quickParse);
|
||||||
// consume the }
|
// consume the }
|
||||||
consume();
|
consume();
|
||||||
try{ callback.linkageSpecificationEnd( linkageSpec );} catch( Exception e ) {}
|
try{ callback.linkageSpecificationEnd( linkageSpec );} catch( Exception e ) {}
|
||||||
|
requestor.exitLinkageSpecification( linkage );
|
||||||
}
|
}
|
||||||
else // single declaration
|
else // single declaration
|
||||||
{
|
{
|
||||||
declaration( linkageSpec, null );
|
|
||||||
|
IASTLinkageSpecification linkage = astFactory.createLinkageSpecification( scope, spec.getImage() );
|
||||||
|
|
||||||
|
requestor.enterLinkageSpecification( linkage );
|
||||||
|
|
||||||
|
declaration( linkageSpec );
|
||||||
try{ callback.linkageSpecificationEnd( linkageSpec );} catch( Exception e ) {}
|
try{ callback.linkageSpecificationEnd( linkageSpec );} catch( Exception e ) {}
|
||||||
|
requestor.exitLinkageSpecification( linkage );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Represents the emalgamation of template declarations, template instantiations and
|
* Represents the emalgamation of template declarations, template instantiations and
|
||||||
|
@ -397,7 +442,7 @@ c, quickParse);
|
||||||
// explicit-instantiation
|
// explicit-instantiation
|
||||||
Object instantiation = null;
|
Object instantiation = null;
|
||||||
try { instantiation = callback.explicitInstantiationBegin( container ); } catch( Exception e ) { }
|
try { instantiation = callback.explicitInstantiationBegin( container ); } catch( Exception e ) { }
|
||||||
declaration( instantiation, null );
|
declaration( instantiation );
|
||||||
try { callback.explicitInstantiationEnd( instantiation ); } catch( Exception e ) { }
|
try { callback.explicitInstantiationEnd( instantiation ); } catch( Exception e ) { }
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -410,7 +455,7 @@ c, quickParse);
|
||||||
// explicit-specialization
|
// explicit-specialization
|
||||||
Object specialization = null;
|
Object specialization = null;
|
||||||
try{ specialization = callback.explicitSpecializationBegin( container ); } catch( Exception e ) { }
|
try{ specialization = callback.explicitSpecializationBegin( container ); } catch( Exception e ) { }
|
||||||
declaration( specialization, null );
|
declaration( specialization );
|
||||||
try{ callback.explicitSpecializationEnd( specialization ); } catch( Exception e ) { }
|
try{ callback.explicitSpecializationEnd( specialization ); } catch( Exception e ) { }
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -422,7 +467,7 @@ c, quickParse);
|
||||||
try{ templateDeclaration = callback.templateDeclarationBegin( container, firstToken ); } catch ( Exception e ) {}
|
try{ templateDeclaration = callback.templateDeclarationBegin( container, firstToken ); } catch ( Exception e ) {}
|
||||||
templateParameterList( templateDeclaration );
|
templateParameterList( templateDeclaration );
|
||||||
consume( Token.tGT );
|
consume( Token.tGT );
|
||||||
declaration( templateDeclaration, null );
|
declaration( templateDeclaration );
|
||||||
try{ callback.templateDeclarationEnd( templateDeclaration, lastToken ); } catch( Exception e ) {}
|
try{ callback.templateDeclarationEnd( templateDeclaration, lastToken ); } catch( Exception e ) {}
|
||||||
|
|
||||||
} catch( Backtrack bt )
|
} catch( Backtrack bt )
|
||||||
|
@ -529,6 +574,11 @@ c, quickParse);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected void declaration( Object container ) throws Backtrack
|
||||||
|
{
|
||||||
|
declaration( container, null );
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* The most abstract construct within a translationUnit : a declaration.
|
* The most abstract construct within a translationUnit : a declaration.
|
||||||
*
|
*
|
||||||
|
@ -552,23 +602,29 @@ c, quickParse);
|
||||||
* @param container IParserCallback object which serves as the owner scope for this declaration.
|
* @param container IParserCallback object which serves as the owner scope for this declaration.
|
||||||
* @throws Backtrack request a backtrack
|
* @throws Backtrack request a backtrack
|
||||||
*/
|
*/
|
||||||
protected void declaration( Object container, Declaration scope ) throws Backtrack {
|
protected void declaration( Object container, IASTScope scope ) throws Backtrack {
|
||||||
switch (LT(1)) {
|
switch (LT(1)) {
|
||||||
case Token.t_asm:
|
case Token.t_asm:
|
||||||
consume( Token.t_asm );
|
Token first = consume( Token.t_asm );
|
||||||
consume( Token.tLPAREN );
|
consume( Token.tLPAREN );
|
||||||
String assembly = consume( Token.tSTRING ).getImage();
|
String assembly = consume( Token.tSTRING ).getImage();
|
||||||
consume( Token.tRPAREN );
|
consume( Token.tRPAREN );
|
||||||
consume( Token.tSEMI );
|
Token last = consume( Token.tSEMI );
|
||||||
|
|
||||||
|
IASTASMDefinition asmDefinition =
|
||||||
|
astFactory.createASMDefinition(scope, assembly, first.getOffset(), last.getEndOffset());
|
||||||
|
|
||||||
// if we made it this far, then we have all we need
|
// if we made it this far, then we have all we need
|
||||||
// do the callback
|
// do the callback
|
||||||
try{ callback.asmDefinition( container, assembly );} catch( Exception e ) {}
|
try{ callback.asmDefinition( container, assembly );} catch( Exception e ) {}
|
||||||
|
|
||||||
|
requestor.acceptASMDefinition( asmDefinition );
|
||||||
return;
|
return;
|
||||||
case Token.t_namespace:
|
case Token.t_namespace:
|
||||||
namespaceDefinition( container, scope );
|
namespaceDefinition( container, scope);
|
||||||
return;
|
return;
|
||||||
case Token.t_using:
|
case Token.t_using:
|
||||||
usingClause( container );
|
usingClause( container, scope );
|
||||||
return;
|
return;
|
||||||
case Token.t_export:
|
case Token.t_export:
|
||||||
case Token.t_template:
|
case Token.t_template:
|
||||||
|
@ -577,20 +633,20 @@ c, quickParse);
|
||||||
case Token.t_extern:
|
case Token.t_extern:
|
||||||
if( LT(2) == Token.tSTRING )
|
if( LT(2) == Token.tSTRING )
|
||||||
{
|
{
|
||||||
linkageSpecification( container );
|
linkageSpecification( container, scope );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
Token mark = mark();
|
Token mark = mark();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
simpleDeclaration( container, true, scope ); // try it first with the original strategy
|
simpleDeclaration( container, true ); // try it first with the original strategy
|
||||||
}
|
}
|
||||||
catch( Backtrack bt)
|
catch( Backtrack bt)
|
||||||
{
|
{
|
||||||
// did not work
|
// did not work
|
||||||
backup( mark );
|
backup( mark );
|
||||||
simpleDeclaration( container, false, scope ); // try it again with the second strategy
|
simpleDeclaration( container, false ); // try it again with the second strategy
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -606,72 +662,43 @@ c, quickParse);
|
||||||
* @throws Backtrack request a backtrack
|
* @throws Backtrack request a backtrack
|
||||||
|
|
||||||
*/
|
*/
|
||||||
protected void namespaceDefinition( Object container, Declaration scope ) throws Backtrack
|
protected void namespaceDefinition( Object container, IASTScope scope ) throws Backtrack
|
||||||
{
|
{
|
||||||
Object namespace = null;
|
Object namespace = null;
|
||||||
boolean redeclared = false;
|
Token first = consume( Token.t_namespace );
|
||||||
Token firstToken = consume( Token.t_namespace );
|
try{ namespace = callback.namespaceDefinitionBegin( container, first );} catch( Exception e ) {}
|
||||||
|
|
||||||
|
Token identifier = null;
|
||||||
// optional name
|
// optional name
|
||||||
String identifier = "";
|
|
||||||
if( LT(1) == Token.tIDENTIFIER )
|
if( LT(1) == Token.tIDENTIFIER )
|
||||||
{
|
{
|
||||||
identifier = LA(1).getImage();
|
identifier = identifier();
|
||||||
identifier();
|
try{ callback.namespaceDefinitionId( namespace );} catch( Exception e ) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( LT(1) == Token.tLBRACE )
|
if( LT(1) == Token.tLBRACE )
|
||||||
{
|
{
|
||||||
consume( Token.tLBRACE);
|
consume();
|
||||||
|
|
||||||
Declaration namespaceSymbol = null;
|
IASTNamespaceDefinition namespaceDefinition =
|
||||||
try {
|
astFactory.createNamespaceDefinition(
|
||||||
namespaceSymbol = scope.Lookup( identifier );
|
scope,
|
||||||
} catch (ParserSymbolTableException e1) {
|
( identifier == null ? "" : identifier.getImage() ),
|
||||||
// should not get ambiguity here
|
first.getOffset(), ( identifier == null ? 0 : identifier.getOffset()) );
|
||||||
}
|
|
||||||
|
|
||||||
if( namespaceSymbol == null )
|
|
||||||
{
|
|
||||||
namespaceSymbol = pst.new Declaration( identifier );
|
|
||||||
try
|
|
||||||
{
|
|
||||||
namespaceSymbol.setType( TypeInfo.t_namespace );
|
|
||||||
}
|
|
||||||
catch( ParserSymbolTableException pste )
|
|
||||||
{
|
|
||||||
// should never happen
|
|
||||||
}
|
|
||||||
try{ namespace = callback.namespaceDefinitionBegin( container, firstToken );} catch( Exception e ) {}
|
|
||||||
namespaceSymbol.setObject( namespace );
|
|
||||||
try {
|
|
||||||
scope.addDeclaration( namespaceSymbol );
|
|
||||||
} catch (ParserSymbolTableException e2) {
|
|
||||||
// TODO ambiguity?
|
|
||||||
}
|
|
||||||
if( !identifier.equals( "" ))
|
|
||||||
try{ callback.namespaceDefinitionId( namespace );} catch( Exception e ) {}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( namespaceSymbol.getType() != TypeInfo.t_namespace )
|
|
||||||
throw backtrack;
|
|
||||||
namespace = namespaceSymbol.getObject();
|
|
||||||
redeclared = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
requestor.enterNamespaceDefinition( namespaceDefinition );
|
||||||
|
|
||||||
namepsaceDeclarationLoop:
|
namepsaceDeclarationLoop:
|
||||||
while (LT(1) != Token.tRBRACE) {
|
while (LT(1) != Token.tRBRACE) {
|
||||||
Token checkToken = LA(1);
|
Token checkToken = LA(1);
|
||||||
switch (LT(1)) {
|
switch (LT(1)) {
|
||||||
case Token.tRBRACE:
|
case Token.tRBRACE:
|
||||||
consume(Token.tRBRACE);
|
//consume(Token.tRBRACE);
|
||||||
break namepsaceDeclarationLoop;
|
break namepsaceDeclarationLoop;
|
||||||
default:
|
default:
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
declaration(namespace, namespaceSymbol);
|
declaration(namespace, namespaceDefinition);
|
||||||
}
|
}
|
||||||
catch( Backtrack bt )
|
catch( Backtrack bt )
|
||||||
{
|
{
|
||||||
|
@ -685,9 +712,11 @@ c, quickParse);
|
||||||
}
|
}
|
||||||
// consume the }
|
// consume the }
|
||||||
|
|
||||||
Token lastToken =consume( Token.tRBRACE );
|
Token last = consume( Token.tRBRACE );
|
||||||
if( ! redeclared )
|
try{ callback.namespaceDefinitionEnd( namespace, last);} catch( Exception e ) {}
|
||||||
try{ callback.namespaceDefinitionEnd( namespace, lastToken );} catch( Exception e ) {}
|
|
||||||
|
namespaceDefinition.setEndingOffset( last.getOffset() + last.getLength());
|
||||||
|
requestor.exitNamespaceDefinition( namespaceDefinition );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -715,10 +744,10 @@ c, quickParse);
|
||||||
* @param tryConstructor true == take strategy1 (constructor ) : false == take strategy 2 ( pointer to function)
|
* @param tryConstructor true == take strategy1 (constructor ) : false == take strategy 2 ( pointer to function)
|
||||||
* @throws Backtrack request a backtrack
|
* @throws Backtrack request a backtrack
|
||||||
*/
|
*/
|
||||||
protected void simpleDeclaration( Object container, boolean tryConstructor, Declaration scope ) throws Backtrack {
|
protected void simpleDeclaration( Object container, boolean tryConstructor ) throws Backtrack {
|
||||||
Object simpleDecl = null;
|
Object simpleDecl = null;
|
||||||
try{ simpleDecl = callback.simpleDeclarationBegin( container, LA(1));} catch( Exception e ) {}
|
try{ simpleDecl = callback.simpleDeclarationBegin( container, LA(1));} catch( Exception e ) {}
|
||||||
declSpecifierSeq(simpleDecl, false, tryConstructor, scope);
|
declSpecifierSeq(simpleDecl, false, tryConstructor);
|
||||||
Object declarator = null;
|
Object declarator = null;
|
||||||
|
|
||||||
if (LT(1) != Token.tSEMI)
|
if (LT(1) != Token.tSEMI)
|
||||||
|
@ -846,7 +875,7 @@ c, quickParse);
|
||||||
Token current = LA(1);
|
Token current = LA(1);
|
||||||
Object parameterDecl = null;
|
Object parameterDecl = null;
|
||||||
try{ parameterDecl = callback.parameterDeclarationBegin( containerObject );} catch( Exception e ) {}
|
try{ parameterDecl = callback.parameterDeclarationBegin( containerObject );} catch( Exception e ) {}
|
||||||
declSpecifierSeq( parameterDecl, true, false, null );
|
declSpecifierSeq( parameterDecl, true, false );
|
||||||
|
|
||||||
if (LT(1) != Token.tSEMI)
|
if (LT(1) != Token.tSEMI)
|
||||||
try {
|
try {
|
||||||
|
@ -1029,7 +1058,7 @@ c, quickParse);
|
||||||
* @param tryConstructor true for constructor, false for pointer to function strategy
|
* @param tryConstructor true for constructor, false for pointer to function strategy
|
||||||
* @throws Backtrack request a backtrack
|
* @throws Backtrack request a backtrack
|
||||||
*/
|
*/
|
||||||
protected void declSpecifierSeq( Object decl, boolean parm, boolean tryConstructor, Declaration scope ) throws Backtrack {
|
protected void declSpecifierSeq( Object decl, boolean parm, boolean tryConstructor ) throws Backtrack {
|
||||||
Flags flags = new Flags( parm, tryConstructor );
|
Flags flags = new Flags( parm, tryConstructor );
|
||||||
declSpecifiers:
|
declSpecifiers:
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
@ -1097,7 +1126,6 @@ c, quickParse);
|
||||||
return;
|
return;
|
||||||
if ( lookAheadForDeclarator( flags ) )
|
if ( lookAheadForDeclarator( flags ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
try{ callback.simpleDeclSpecifier(decl,LA(1));} catch( Exception e ) {}
|
try{ callback.simpleDeclSpecifier(decl,LA(1));} catch( Exception e ) {}
|
||||||
name();
|
name();
|
||||||
try{ callback.simpleDeclSpecifierName( decl );} catch( Exception e ) {}
|
try{ callback.simpleDeclSpecifierName( decl );} catch( Exception e ) {}
|
||||||
|
@ -1112,7 +1140,7 @@ c, quickParse);
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
classSpecifier(decl, scope);
|
classSpecifier(decl);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
catch( Backtrack bt )
|
catch( Backtrack bt )
|
||||||
|
@ -1173,6 +1201,7 @@ c, quickParse);
|
||||||
} catch( Exception e ) {}
|
} catch( Exception e ) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Consumes template parameters.
|
* Consumes template parameters.
|
||||||
*
|
*
|
||||||
|
@ -1210,13 +1239,14 @@ c, quickParse);
|
||||||
*
|
*
|
||||||
* @throws Backtrack request a backtrack
|
* @throws Backtrack request a backtrack
|
||||||
*/
|
*/
|
||||||
protected void identifier() throws Backtrack {
|
protected Token identifier() throws Backtrack {
|
||||||
Token first = consume(Token.tIDENTIFIER); // throws backtrack if its not that
|
Token first = consume(Token.tIDENTIFIER); // throws backtrack if its not that
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
callback.nameBegin(first);
|
callback.nameBegin(first);
|
||||||
callback.nameEnd(first);
|
callback.nameEnd(first);
|
||||||
} catch( Exception e ) {}
|
} catch( Exception e ) {}
|
||||||
|
return first;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1274,7 +1304,7 @@ c, quickParse);
|
||||||
*
|
*
|
||||||
* @throws Backtrack request a backtrack
|
* @throws Backtrack request a backtrack
|
||||||
*/
|
*/
|
||||||
protected void name() throws Backtrack {
|
protected TokenDuple name() throws Backtrack {
|
||||||
Token first = LA(1);
|
Token first = LA(1);
|
||||||
Token last = null;
|
Token last = null;
|
||||||
|
|
||||||
|
@ -1318,6 +1348,7 @@ c, quickParse);
|
||||||
}
|
}
|
||||||
|
|
||||||
try{ callback.nameEnd(last);} catch( Exception e ) {}
|
try{ callback.nameEnd(last);} catch( Exception e ) {}
|
||||||
|
return new TokenDuple( first, last );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1873,7 +1904,7 @@ c, quickParse);
|
||||||
* @param owner IParserCallback object that represents the declaration that owns this classSpecifier
|
* @param owner IParserCallback object that represents the declaration that owns this classSpecifier
|
||||||
* @throws Backtrack request a backtrack
|
* @throws Backtrack request a backtrack
|
||||||
*/
|
*/
|
||||||
protected void classSpecifier( Object owner, Declaration scope ) throws Backtrack {
|
protected void classSpecifier( Object owner ) throws Backtrack {
|
||||||
Token classKey = null;
|
Token classKey = null;
|
||||||
|
|
||||||
Token mark = mark();
|
Token mark = mark();
|
||||||
|
@ -1931,7 +1962,7 @@ c, quickParse);
|
||||||
default:
|
default:
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
declaration(classSpec, scope);
|
declaration(classSpec);
|
||||||
}
|
}
|
||||||
catch( Backtrack bt )
|
catch( Backtrack bt )
|
||||||
{
|
{
|
||||||
|
@ -2115,7 +2146,7 @@ c, quickParse);
|
||||||
while (LT(1) == Token.t_catch) {
|
while (LT(1) == Token.t_catch) {
|
||||||
consume();
|
consume();
|
||||||
consume(Token.tLPAREN);
|
consume(Token.tLPAREN);
|
||||||
declaration(null, null); // was exceptionDeclaration
|
declaration(null); // was exceptionDeclaration
|
||||||
consume(Token.tRPAREN);
|
consume(Token.tRPAREN);
|
||||||
compoundStatement();
|
compoundStatement();
|
||||||
}
|
}
|
||||||
|
@ -2147,7 +2178,7 @@ c, quickParse);
|
||||||
}
|
}
|
||||||
|
|
||||||
// declarationStatement
|
// declarationStatement
|
||||||
declaration(null, null);
|
declaration(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3121,4 +3152,14 @@ c, quickParse);
|
||||||
public int getLastErrorOffset() {
|
public int getLastErrorOffset() {
|
||||||
return firstErrorOffset;
|
return firstErrorOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.IParser#setRequestor(org.eclipse.cdt.core.parser.ISourceElementRequestor)
|
||||||
|
*/
|
||||||
|
public void setRequestor(ISourceElementRequestor r) {
|
||||||
|
requestor = r;
|
||||||
|
if( scanner != null )
|
||||||
|
scanner.setRequestor(r);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ParserFactory {
|
||||||
|
|
||||||
|
public static IASTFactory createASTFactory( boolean quickParse )
|
||||||
|
{
|
||||||
|
if( quickParse )
|
||||||
|
return new QuickParseASTFactory();
|
||||||
|
else
|
||||||
|
return new FullParseASTFactory();
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load diff
|
@ -24,6 +24,13 @@ import java.util.List;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
import java.util.Vector;
|
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*
|
*
|
||||||
|
@ -43,12 +50,12 @@ public class Scanner implements IScanner {
|
||||||
new ScannerContext().initialize(
|
new ScannerContext().initialize(
|
||||||
new StringReader("\n"),
|
new StringReader("\n"),
|
||||||
START,
|
START,
|
||||||
ScannerContext.SENTINEL));
|
ScannerContext.SENTINEL, null), requestor);
|
||||||
|
|
||||||
if (filename == null)
|
if (filename == null)
|
||||||
contextStack.push( new ScannerContext().initialize(reader, TEXT, ScannerContext.TOP ) );
|
contextStack.push( new ScannerContext().initialize(reader, TEXT, ScannerContext.TOP, null ), requestor );
|
||||||
else
|
else
|
||||||
contextStack.push( new ScannerContext().initialize(reader, filename, ScannerContext.TOP ) );
|
contextStack.push( new ScannerContext().initialize(reader, filename, ScannerContext.TOP, null ), requestor );
|
||||||
} catch( ScannerException se ) {
|
} catch( ScannerException se ) {
|
||||||
//won't happen since we aren't adding an include or a macro
|
//won't happen since we aren't adding an include or a macro
|
||||||
}
|
}
|
||||||
|
@ -255,8 +262,10 @@ public class Scanner implements IScanner {
|
||||||
return buffer.toString();
|
return buffer.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void handleInclusion(String fileName, boolean useIncludePaths ) throws ScannerException {
|
protected void handleInclusion(String fileName, boolean useIncludePaths, int nameOffset, int beginOffset, int endOffset ) throws ScannerException {
|
||||||
|
|
||||||
|
FileReader inclusionReader = null;
|
||||||
|
String newPath = null;
|
||||||
if( useIncludePaths ) // search include paths for this file
|
if( useIncludePaths ) // search include paths for this file
|
||||||
{
|
{
|
||||||
// iterate through the include paths
|
// iterate through the include paths
|
||||||
|
@ -266,16 +275,12 @@ public class Scanner implements IScanner {
|
||||||
|
|
||||||
File pathFile = (File)iter.next();
|
File pathFile = (File)iter.next();
|
||||||
if (pathFile.isDirectory()) {
|
if (pathFile.isDirectory()) {
|
||||||
String newPath = pathFile.getPath() + File.separatorChar + fileName;
|
newPath = pathFile.getPath() + File.separatorChar + fileName;
|
||||||
|
|
||||||
File includeFile = new File(newPath);
|
File includeFile = new File(newPath);
|
||||||
|
|
||||||
if (includeFile.exists() && includeFile.isFile()) {
|
if (includeFile.exists() && includeFile.isFile()) {
|
||||||
try {
|
try {
|
||||||
FileReader inclusionReader =
|
inclusionReader = new FileReader(includeFile);
|
||||||
new FileReader(includeFile);
|
break;
|
||||||
contextStack.updateContext(inclusionReader, newPath, ScannerContext.INCLUSION );
|
|
||||||
return;
|
|
||||||
} catch (FileNotFoundException fnf) {
|
} catch (FileNotFoundException fnf) {
|
||||||
// do nothing - check the next directory
|
// do nothing - check the next directory
|
||||||
}
|
}
|
||||||
|
@ -289,14 +294,12 @@ public class Scanner implements IScanner {
|
||||||
File currentIncludeFile = new File( currentFilename );
|
File currentIncludeFile = new File( currentFilename );
|
||||||
String parentDirectory = currentIncludeFile.getParent();
|
String parentDirectory = currentIncludeFile.getParent();
|
||||||
currentIncludeFile = null;
|
currentIncludeFile = null;
|
||||||
String fullPath = parentDirectory + File.separatorChar + fileName;
|
newPath = parentDirectory + File.separatorChar + fileName;
|
||||||
File includeFile = new File( fullPath );
|
File includeFile = new File( newPath );
|
||||||
if (includeFile.exists() && includeFile.isFile()) {
|
if (includeFile.exists() && includeFile.isFile()) {
|
||||||
try {
|
try {
|
||||||
FileReader inclusionReader =
|
inclusionReader =
|
||||||
new FileReader(includeFile);
|
new FileReader(includeFile);
|
||||||
contextStack.updateContext(inclusionReader, fullPath, ScannerContext.INCLUSION );
|
|
||||||
return;
|
|
||||||
} catch (FileNotFoundException fnf) {
|
} catch (FileNotFoundException fnf) {
|
||||||
if (throwExceptionOnInclusionNotFound)
|
if (throwExceptionOnInclusionNotFound)
|
||||||
throw new ScannerException("Cannot find inclusion " + fileName);
|
throw new ScannerException("Cannot find inclusion " + fileName);
|
||||||
|
@ -304,8 +307,11 @@ public class Scanner implements IScanner {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (throwExceptionOnInclusionNotFound)
|
if (throwExceptionOnInclusionNotFound && inclusionReader == null )
|
||||||
throw new ScannerException("Cannot find inclusion " + fileName);
|
throw new ScannerException("Cannot find inclusion " + fileName);
|
||||||
|
|
||||||
|
IASTInclusion inclusion = astFactory.createInclusion( fileName, newPath, !useIncludePaths, beginOffset, endOffset, nameOffset );
|
||||||
|
contextStack.updateContext(inclusionReader, newPath, ScannerContext.INCLUSION, inclusion, requestor );
|
||||||
}
|
}
|
||||||
|
|
||||||
// constants
|
// constants
|
||||||
|
@ -390,7 +396,7 @@ public class Scanner implements IScanner {
|
||||||
try {
|
try {
|
||||||
c = contextStack.getCurrentContext().read();
|
c = contextStack.getCurrentContext().read();
|
||||||
if (c == NOCHAR) {
|
if (c == NOCHAR) {
|
||||||
if (contextStack.rollbackContext() == false) {
|
if (contextStack.rollbackContext(requestor) == false) {
|
||||||
c = NOCHAR;
|
c = NOCHAR;
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
|
@ -398,7 +404,7 @@ public class Scanner implements IScanner {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
if (contextStack.rollbackContext() == false) {
|
if (contextStack.rollbackContext(requestor) == false) {
|
||||||
c = NOCHAR;
|
c = NOCHAR;
|
||||||
} else {
|
} else {
|
||||||
done = false;
|
done = false;
|
||||||
|
@ -442,7 +448,7 @@ public class Scanner implements IScanner {
|
||||||
private void ungetChar(int c) throws ScannerException{
|
private void ungetChar(int c) throws ScannerException{
|
||||||
contextStack.getCurrentContext().pushUndo(c);
|
contextStack.getCurrentContext().pushUndo(c);
|
||||||
if( c == '\n' ) contextStack.recantNewline();
|
if( c == '\n' ) contextStack.recantNewline();
|
||||||
contextStack.undoRollback( lastContext );
|
contextStack.undoRollback( lastContext, requestor );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean lookAheadForTokenPasting() throws ScannerException
|
protected boolean lookAheadForTokenPasting() throws ScannerException
|
||||||
|
@ -652,7 +658,7 @@ public class Scanner implements IScanner {
|
||||||
if( storageBuffer != null )
|
if( storageBuffer != null )
|
||||||
{
|
{
|
||||||
storageBuffer.append( ident );
|
storageBuffer.append( ident );
|
||||||
contextStack.updateContext( new StringReader( storageBuffer.toString()), PASTING, IScannerContext.MACROEXPANSION );
|
contextStack.updateContext( new StringReader( storageBuffer.toString()), PASTING, IScannerContext.MACROEXPANSION, null, requestor );
|
||||||
storageBuffer = null;
|
storageBuffer = null;
|
||||||
c = getChar();
|
c = getChar();
|
||||||
continue;
|
continue;
|
||||||
|
@ -788,7 +794,7 @@ public class Scanner implements IScanner {
|
||||||
{
|
{
|
||||||
if( storageBuffer != null )
|
if( storageBuffer != null )
|
||||||
{
|
{
|
||||||
contextStack.updateContext( new StringReader( buff.toString()), PASTING, IScannerContext.MACROEXPANSION );
|
contextStack.updateContext( new StringReader( buff.toString()), PASTING, IScannerContext.MACROEXPANSION, null, requestor );
|
||||||
storageBuffer = null;
|
storageBuffer = null;
|
||||||
c = getChar();
|
c = getChar();
|
||||||
continue;
|
continue;
|
||||||
|
@ -1776,17 +1782,26 @@ public class Scanner implements IScanner {
|
||||||
}
|
}
|
||||||
|
|
||||||
String f = fileName.toString();
|
String f = fileName.toString();
|
||||||
|
offset = contextStack.getCurrentContext().getOffset() - f.length() - 1; // -1 for the end quote
|
||||||
|
|
||||||
if( quickScan )
|
if( quickScan )
|
||||||
{
|
{
|
||||||
if( callback != null )
|
if( callback != null )
|
||||||
{
|
{
|
||||||
offset = contextStack.getCurrentContext().getOffset() - f.length() - 1; // -1 for the end quote
|
|
||||||
callback.inclusionEnd(callback.inclusionBegin( f, offset, beginningOffset, !useIncludePath ));
|
callback.inclusionEnd(callback.inclusionBegin( f, offset, beginningOffset, !useIncludePath ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( requestor != null )
|
||||||
|
{
|
||||||
|
IASTInclusion i = astFactory.createInclusion( f, "", !useIncludePath, beginningOffset,
|
||||||
|
contextStack.getCurrentContext().getOffset(), offset );
|
||||||
|
requestor.enterInclusion(i);
|
||||||
|
requestor.exitInclusion(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
handleInclusion(f.trim(), useIncludePath );
|
handleInclusion(f.trim(), useIncludePath, offset, beginningOffset, contextStack.getCurrentContext().getOffset() );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void poundDefine(int beginning) throws ScannerException, Parser.EndOfFile {
|
protected void poundDefine(int beginning) throws ScannerException, Parser.EndOfFile {
|
||||||
|
@ -1952,6 +1967,12 @@ public class Scanner implements IScanner {
|
||||||
// NOTE: return value is ignored!
|
// NOTE: return value is ignored!
|
||||||
callback.macro( key, offset, beginning, contextStack.getCurrentContext().getOffset() );
|
callback.macro( key, offset, beginning, contextStack.getCurrentContext().getOffset() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( requestor != null )
|
||||||
|
{
|
||||||
|
IASTMacro m = astFactory.createMacro( key, beginning, contextStack.getCurrentContext().getOffset(), offset );
|
||||||
|
requestor.acceptMacro(m);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Vector getMacroParameters (String params, boolean forStringizing) throws ScannerException {
|
protected Vector getMacroParameters (String params, boolean forStringizing) throws ScannerException {
|
||||||
|
@ -2000,7 +2021,7 @@ public class Scanner implements IScanner {
|
||||||
throws ScannerException {
|
throws ScannerException {
|
||||||
if (expansion instanceof String ) {
|
if (expansion instanceof String ) {
|
||||||
String replacementValue = (String) expansion;
|
String replacementValue = (String) expansion;
|
||||||
contextStack.updateContext( new StringReader(replacementValue), (POUND_DEFINE + symbol ), ScannerContext.MACROEXPANSION );
|
contextStack.updateContext( new StringReader(replacementValue), (POUND_DEFINE + symbol ), ScannerContext.MACROEXPANSION, null, requestor );
|
||||||
} else if (expansion instanceof IMacroDescriptor ) {
|
} else if (expansion instanceof IMacroDescriptor ) {
|
||||||
IMacroDescriptor macro = (IMacroDescriptor) expansion;
|
IMacroDescriptor macro = (IMacroDescriptor) expansion;
|
||||||
skipOverWhitespace();
|
skipOverWhitespace();
|
||||||
|
@ -2117,7 +2138,7 @@ public class Scanner implements IScanner {
|
||||||
String finalString = buffer.toString();
|
String finalString = buffer.toString();
|
||||||
contextStack.updateContext(
|
contextStack.updateContext(
|
||||||
new StringReader(finalString),
|
new StringReader(finalString),
|
||||||
POUND_DEFINE + macro.getSignature(), ScannerContext.MACROEXPANSION );
|
POUND_DEFINE + macro.getSignature(), ScannerContext.MACROEXPANSION, null, requestor );
|
||||||
} else
|
} else
|
||||||
if (throwExceptionOnBadMacroExpansion)
|
if (throwExceptionOnBadMacroExpansion)
|
||||||
throw new ScannerException(
|
throw new ScannerException(
|
||||||
|
@ -2185,4 +2206,21 @@ public class Scanner implements IScanner {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean mapLineNumbers = false;
|
private boolean mapLineNumbers = false;
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.internal.core.parser.IScanner#setRequestor(org.eclipse.cdt.core.parser.ISourceElementRequestor)
|
||||||
|
*/
|
||||||
|
public void setRequestor(ISourceElementRequestor r) {
|
||||||
|
requestor = r;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,8 @@ import java.io.IOException;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.util.Stack;
|
import java.util.Stack;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTInclusion;
|
||||||
|
|
||||||
public class ScannerContext implements IScannerContext
|
public class ScannerContext implements IScannerContext
|
||||||
{
|
{
|
||||||
private Reader reader;
|
private Reader reader;
|
||||||
|
@ -23,12 +25,13 @@ public class ScannerContext implements IScannerContext
|
||||||
private int kind;
|
private int kind;
|
||||||
|
|
||||||
public ScannerContext(){}
|
public ScannerContext(){}
|
||||||
public IScannerContext initialize(Reader r, String f, int k)
|
public IScannerContext initialize(Reader r, String f, int k, IASTInclusion i)
|
||||||
{
|
{
|
||||||
reader = r;
|
reader = r;
|
||||||
filename = f;
|
filename = f;
|
||||||
offset = 0;
|
offset = 0;
|
||||||
kind = k;
|
kind = k;
|
||||||
|
inc = i;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,6 +106,20 @@ public class ScannerContext implements IScannerContext
|
||||||
public void setKind(int kind) {
|
public void setKind(int kind) {
|
||||||
this.kind = kind;
|
this.kind = kind;
|
||||||
}
|
}
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.internal.core.parser.IScannerContext#getExtension()
|
||||||
|
*/
|
||||||
|
public IASTInclusion getExtension() {
|
||||||
|
return inc;
|
||||||
|
}
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.internal.core.parser.IScannerContext#setExtension(org.eclipse.cdt.core.parser.ast.IASTInclusion)
|
||||||
|
*/
|
||||||
|
public void setExtension(IASTInclusion ext) {
|
||||||
|
inc = ext;
|
||||||
|
}
|
||||||
|
|
||||||
|
private IASTInclusion inc = null;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,8 @@ public class Token {
|
||||||
public int offset;
|
public int offset;
|
||||||
public int getOffset() { return offset; }
|
public int getOffset() { return offset; }
|
||||||
public int getLength() { return image.length(); }
|
public int getLength() { return image.length(); }
|
||||||
|
public int getEndOffset() { return getOffset() + getLength(); }
|
||||||
|
|
||||||
|
|
||||||
public int getDelta( Token other )
|
public int getDelta( Token other )
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,87 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class TokenDuple {
|
||||||
|
|
||||||
|
public TokenDuple( Token first, Token last )
|
||||||
|
{
|
||||||
|
firstToken = first;
|
||||||
|
lastToken = last;
|
||||||
|
}
|
||||||
|
private final Token firstToken, lastToken;
|
||||||
|
/**
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Token getFirstToken() {
|
||||||
|
return firstToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Token getLastToken() {
|
||||||
|
return lastToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Iterator iterator()
|
||||||
|
{
|
||||||
|
return new TokenIterator();
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TokenIterator implements Iterator
|
||||||
|
{
|
||||||
|
private Token iter = TokenDuple.this.firstToken;
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see java.util.Iterator#hasNext()
|
||||||
|
*/
|
||||||
|
public boolean hasNext() {
|
||||||
|
return ( iter != TokenDuple.this.lastToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see java.util.Iterator#next()
|
||||||
|
*/
|
||||||
|
public Object next() {
|
||||||
|
Token temp = iter;
|
||||||
|
iter = iter.getNext();
|
||||||
|
return temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see java.util.Iterator#remove()
|
||||||
|
*/
|
||||||
|
public void remove() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
StringBuffer buff = new StringBuffer();
|
||||||
|
Token iter = firstToken;
|
||||||
|
for( ; ; )
|
||||||
|
{
|
||||||
|
buff.append( iter.getImage() );
|
||||||
|
if( iter == lastToken ) break;
|
||||||
|
iter = iter.getNext();
|
||||||
|
}
|
||||||
|
return buff.toString();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.parser.ast.AccessVisibility;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ASTBaseSpecifier implements IASTBaseSpecifier {
|
||||||
|
|
||||||
|
private final IASTClassSpecifier baseClass;
|
||||||
|
private final boolean isVirtual;
|
||||||
|
private final AccessVisibility visibility;
|
||||||
|
|
||||||
|
public ASTBaseSpecifier( IASTClassSpecifier c, AccessVisibility a, boolean virtual )
|
||||||
|
{
|
||||||
|
isVirtual = virtual;
|
||||||
|
baseClass = c;
|
||||||
|
visibility = a;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier#getAccess()
|
||||||
|
*/
|
||||||
|
public AccessVisibility getAccess() {
|
||||||
|
return visibility;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier#isVirtual()
|
||||||
|
*/
|
||||||
|
public boolean isVirtual() {
|
||||||
|
return isVirtual;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier#getParent()
|
||||||
|
*/
|
||||||
|
public IASTClassSpecifier getParent() {
|
||||||
|
return baseClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,97 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTInclusion;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ASTInclusion implements IASTInclusion {
|
||||||
|
|
||||||
|
public ASTInclusion( String name, String fileName, boolean local )
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
this.fileName = fileName;
|
||||||
|
this.local = local;
|
||||||
|
}
|
||||||
|
|
||||||
|
private final String name, fileName;
|
||||||
|
private final boolean local;
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTInclusion#getName()
|
||||||
|
*/
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTInclusion#getFullFileName()
|
||||||
|
*/
|
||||||
|
public String getFullFileName() {
|
||||||
|
return fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTInclusion#isLocal()
|
||||||
|
*/
|
||||||
|
public boolean isLocal() {
|
||||||
|
return local;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private int startingOffset = 0, nameOffset = 0, endingOffset = 0;
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IOffsetableElement#getElementStartingOffset()
|
||||||
|
*/
|
||||||
|
public int getElementStartingOffset() {
|
||||||
|
return startingOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IOffsetableElement#getElementEndingOffset()
|
||||||
|
*/
|
||||||
|
public int getElementEndingOffset() {
|
||||||
|
return endingOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IOffsetableElement#getElementNameOffset()
|
||||||
|
*/
|
||||||
|
public int getElementNameOffset() {
|
||||||
|
return nameOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.internal.core.parser.ast.IOffsetableElementRW#setStartingOffset(int)
|
||||||
|
*/
|
||||||
|
public void setStartingOffset(int o) {
|
||||||
|
startingOffset = o;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.internal.core.parser.ast.IOffsetableElementRW#setEndingOffset(int)
|
||||||
|
*/
|
||||||
|
public void setEndingOffset(int o) {
|
||||||
|
endingOffset = o;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.internal.core.parser.ast.IOffsetableElementRW#setNameOffset(int)
|
||||||
|
*/
|
||||||
|
public void setNameOffset(int o) {
|
||||||
|
nameOffset = o;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,72 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTMacro;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ASTMacro implements IASTMacro {
|
||||||
|
|
||||||
|
private final String name;
|
||||||
|
public ASTMacro( String name )
|
||||||
|
{
|
||||||
|
this.name =name;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int startingOffset = 0, endingOffset = 0, nameOffset = 0;
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTMacro#getName()
|
||||||
|
*/
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IOffsetableElementRW#setStartingOffset(int)
|
||||||
|
*/
|
||||||
|
public void setStartingOffset(int o) {
|
||||||
|
startingOffset = o;
|
||||||
|
}
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IOffsetableElementRW#setEndingOffset(int)
|
||||||
|
*/
|
||||||
|
public void setEndingOffset(int o) {
|
||||||
|
endingOffset = o;
|
||||||
|
}
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IOffsetableElementRW#setNameOffset(int)
|
||||||
|
*/
|
||||||
|
public void setNameOffset(int o) {
|
||||||
|
nameOffset = o;
|
||||||
|
}
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IOffsetableElement#getElementStartingOffset()
|
||||||
|
*/
|
||||||
|
public int getElementStartingOffset() {
|
||||||
|
return startingOffset;
|
||||||
|
}
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IOffsetableElement#getElementEndingOffset()
|
||||||
|
*/
|
||||||
|
public int getElementEndingOffset() {
|
||||||
|
return endingOffset;
|
||||||
|
}
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IOffsetableElement#getElementNameOffset()
|
||||||
|
*/
|
||||||
|
public int getElementNameOffset() {
|
||||||
|
return nameOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTInclusion;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTMacro;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,78 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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.full;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTScope;
|
||||||
|
import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ASTASMDefinition implements IASTFASMDefinition {
|
||||||
|
|
||||||
|
private final String body;
|
||||||
|
|
||||||
|
public ASTASMDefinition( ISymbol s, String body )
|
||||||
|
{
|
||||||
|
this.symbol = s;
|
||||||
|
this.body = body;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int startingOffset, endingOffset;
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTASMDefinition#getBody()
|
||||||
|
*/
|
||||||
|
public String getBody() {
|
||||||
|
return body;
|
||||||
|
}
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IOffsetableElement#setStartingOffset(int)
|
||||||
|
*/
|
||||||
|
public void setStartingOffset(int o) {
|
||||||
|
startingOffset = o;
|
||||||
|
|
||||||
|
}
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IOffsetableElement#setEndingOffset(int)
|
||||||
|
*/
|
||||||
|
public void setEndingOffset(int o) {
|
||||||
|
endingOffset = o;
|
||||||
|
|
||||||
|
}
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IOffsetableElement#getElementStartingOffset()
|
||||||
|
*/
|
||||||
|
public int getElementStartingOffset() {
|
||||||
|
return startingOffset;
|
||||||
|
}
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IOffsetableElement#getElementEndingOffset()
|
||||||
|
*/
|
||||||
|
public int getElementEndingOffset() {
|
||||||
|
return endingOffset;
|
||||||
|
}
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.internal.core.parser.ast.ISymbolTableExtension#getSymbol()
|
||||||
|
*/
|
||||||
|
|
||||||
|
private final ISymbol symbol;
|
||||||
|
public ISymbol getSymbol() {
|
||||||
|
return symbol;
|
||||||
|
}
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTDeclaration#getOwnerScope()
|
||||||
|
*/
|
||||||
|
public IASTScope getOwnerScope() {
|
||||||
|
return (IPSTContainerExtension)symbol.getContainingSymbol().getASTNode();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,137 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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.full;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.parser.ast.ClassKind;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.ClassNameType;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
|
||||||
|
import org.eclipse.cdt.internal.core.parser.pst.IDerivableContainerSymbol;
|
||||||
|
import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
|
||||||
|
import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ASTClassSpecifier implements IASTFClassSpecifier, IPSTSymbolExtension {
|
||||||
|
|
||||||
|
private final IDerivableContainerSymbol symbol;
|
||||||
|
private final ClassKind classKind;
|
||||||
|
private final ClassNameType type;
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
public ASTClassSpecifier( IDerivableContainerSymbol symbol, String name, ClassNameType type, ClassKind kind )
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
this.symbol = symbol;
|
||||||
|
this.classKind = kind;
|
||||||
|
this.type = type;
|
||||||
|
symbol.setASTNode( this );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTScope#getDeclarations()
|
||||||
|
*/
|
||||||
|
public Iterator getDeclarations() {
|
||||||
|
return new ScopeIterator( symbol.getContainedSymbols());
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTClassSpecifier#getClassNameType()
|
||||||
|
*/
|
||||||
|
public ClassNameType getClassNameType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTClassSpecifier#getClassKind()
|
||||||
|
*/
|
||||||
|
public ClassKind getClassKind() {
|
||||||
|
return classKind;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTClassSpecifier#getBaseClauses()
|
||||||
|
*/
|
||||||
|
public Iterator getBaseClauses() {
|
||||||
|
return new BaseIterator( symbol.getParents() );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getName()
|
||||||
|
*/
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int nameOffset = 0, startingOffset = 0, endingOffset = 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTTemplatedDeclaration#getOwnerTemplateDeclaration()
|
||||||
|
*/
|
||||||
|
public IASTTemplateDeclaration getOwnerTemplateDeclaration() {
|
||||||
|
if( getSymbol().getContainingSymbol().getType() == ParserSymbolTable.TypeInfo.t_template )
|
||||||
|
return (IASTTemplateDeclaration)getSymbol().getContainingSymbol().getASTNode();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
|
||||||
|
*/
|
||||||
|
public void setStartingOffset(int o) {
|
||||||
|
startingOffset = o;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
|
||||||
|
*/
|
||||||
|
public void setEndingOffset(int o) {
|
||||||
|
endingOffset = o;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
|
||||||
|
*/
|
||||||
|
public int getElementStartingOffset() {
|
||||||
|
return startingOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
|
||||||
|
*/
|
||||||
|
public int getElementEndingOffset() {
|
||||||
|
return endingOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.internal.core.parser.ast.IPSTSymbolExtension#getSymbol()
|
||||||
|
*/
|
||||||
|
public ISymbol getSymbol() {
|
||||||
|
return symbol;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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.full;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol;
|
||||||
|
import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ASTCompilationUnit implements IASTFCompilationUnit {
|
||||||
|
|
||||||
|
public ASTCompilationUnit( IContainerSymbol symbol )
|
||||||
|
{
|
||||||
|
this.symbol = symbol;
|
||||||
|
symbol.setASTNode( this );
|
||||||
|
}
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IScope#getDeclarations()
|
||||||
|
*/
|
||||||
|
public Iterator getDeclarations() {
|
||||||
|
return new ScopeIterator( symbol.getContainedSymbols() );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.internal.core.parser.ast.ISymbolTableExtension#getSymbol()
|
||||||
|
*/
|
||||||
|
public IContainerSymbol getContainerSymbol() {
|
||||||
|
return symbol;
|
||||||
|
}
|
||||||
|
|
||||||
|
private final IContainerSymbol symbol;
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.internal.core.parser.ast.IPSTSymbolExtension#getSymbol()
|
||||||
|
*/
|
||||||
|
public ISymbol getSymbol() {
|
||||||
|
return symbol;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,68 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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.full;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTScope;
|
||||||
|
import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol;
|
||||||
|
import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ASTLinkageSpecification implements IASTFLinkageSpecification {
|
||||||
|
|
||||||
|
public ASTLinkageSpecification( IContainerSymbol symbol, String linkage )
|
||||||
|
{
|
||||||
|
this.symbol = symbol;
|
||||||
|
symbol.setASTNode( this );
|
||||||
|
this.linkage = linkage;
|
||||||
|
}
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTScope#getDeclarations()
|
||||||
|
*/
|
||||||
|
public Iterator getDeclarations() {
|
||||||
|
return new ScopeIterator( symbol.getContainedSymbols() );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.internal.core.parser.ast.IPSTSymbolExtension#getSymbol()
|
||||||
|
*/
|
||||||
|
public IContainerSymbol getContainerSymbol() {
|
||||||
|
return symbol;
|
||||||
|
}
|
||||||
|
|
||||||
|
private final IContainerSymbol symbol;
|
||||||
|
private final String linkage;
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification#getLinkageString()
|
||||||
|
*/
|
||||||
|
public String getLinkageString() {
|
||||||
|
return linkage;
|
||||||
|
}
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.internal.core.parser.ast.IPSTSymbolExtension#getSymbol()
|
||||||
|
*/
|
||||||
|
public ISymbol getSymbol() {
|
||||||
|
return symbol;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTDeclaration#getOwnerScope()
|
||||||
|
*/
|
||||||
|
public IASTScope getOwnerScope() {
|
||||||
|
return (IPSTContainerExtension)symbol.getContainingSymbol().getASTNode();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,112 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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.full;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTScope;
|
||||||
|
import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol;
|
||||||
|
import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ASTNamespaceDefinition implements IASTFNamespaceDefinition {
|
||||||
|
|
||||||
|
public ASTNamespaceDefinition( IContainerSymbol symbol, String name )
|
||||||
|
{
|
||||||
|
this.symbol = symbol;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
private final String name;
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition#getName()
|
||||||
|
*/
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTScope#getDeclarations()
|
||||||
|
*/
|
||||||
|
public Iterator getDeclarations() {
|
||||||
|
return new ScopeIterator( symbol.getContainedSymbols() );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.internal.core.parser.ast.IPSTSymbolExtension#getSymbol()
|
||||||
|
*/
|
||||||
|
public ISymbol getSymbol() {
|
||||||
|
return symbol;
|
||||||
|
}
|
||||||
|
|
||||||
|
private final IContainerSymbol symbol;
|
||||||
|
|
||||||
|
private int nameOffset = 0, startingOffset = 0, endingOffset = 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
|
||||||
|
*/
|
||||||
|
public void setStartingOffset(int o) {
|
||||||
|
startingOffset = o;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
|
||||||
|
*/
|
||||||
|
public void setEndingOffset(int o) {
|
||||||
|
endingOffset = o;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
|
||||||
|
*/
|
||||||
|
public int getElementStartingOffset() {
|
||||||
|
return startingOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
|
||||||
|
*/
|
||||||
|
public int getElementEndingOffset() {
|
||||||
|
return endingOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.internal.core.parser.ast.IPSTContainerExtension#getContainerSymbol()
|
||||||
|
*/
|
||||||
|
public IContainerSymbol getContainerSymbol() {
|
||||||
|
return symbol;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTDeclaration#getOwnerScope()
|
||||||
|
*/
|
||||||
|
public IASTScope getOwnerScope() {
|
||||||
|
return (IPSTContainerExtension)symbol.getContainingSymbol().getASTNode();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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.full;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTScope;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ASTUsingDirective implements IASTUsingDirective {
|
||||||
|
|
||||||
|
private final String namespaceName;
|
||||||
|
|
||||||
|
public ASTUsingDirective( String namespace )
|
||||||
|
{
|
||||||
|
namespaceName = namespace;
|
||||||
|
}
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTUsingDirective#getNamespaceName()
|
||||||
|
*/
|
||||||
|
public String getNamespaceName() {
|
||||||
|
return namespaceName;
|
||||||
|
}
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTDeclaration#getOwnerScope()
|
||||||
|
*/
|
||||||
|
public IASTScope getOwnerScope() {
|
||||||
|
return null; //TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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.full;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.core.parser.ast.ASTBaseSpecifier;
|
||||||
|
import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class BaseIterator implements Iterator {
|
||||||
|
|
||||||
|
private final Iterator rawIter;
|
||||||
|
public BaseIterator( List bases )
|
||||||
|
{
|
||||||
|
rawIter = bases.iterator();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see java.util.Iterator#hasNext()
|
||||||
|
*/
|
||||||
|
public boolean hasNext() {
|
||||||
|
return rawIter.hasNext();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see java.util.Iterator#next()
|
||||||
|
*/
|
||||||
|
public Object next() {
|
||||||
|
ParserSymbolTable.Declaration.ParentWrapper wrapper = (ParserSymbolTable.Declaration.ParentWrapper)rawIter.next();
|
||||||
|
return new ASTBaseSpecifier( (IASTFClassSpecifier)wrapper.getParent().getASTNode(), wrapper.getAccess(), wrapper.isVirtual());
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see java.util.Iterator#remove()
|
||||||
|
*/
|
||||||
|
public void remove() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,148 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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.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.IASTUsingDeclaration;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
|
||||||
|
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.pst.IContainerSymbol;
|
||||||
|
import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
|
||||||
|
import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTable;
|
||||||
|
import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTableException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class FullParseASTFactory extends BaseASTFactory implements IASTFactory {
|
||||||
|
|
||||||
|
private ParserSymbolTable pst = new ParserSymbolTable(); // symbol table
|
||||||
|
|
||||||
|
public IASTUsingDirective createUsingDirective(
|
||||||
|
IASTScope scope,
|
||||||
|
TokenDuple duple)
|
||||||
|
throws Backtrack {
|
||||||
|
Iterator iter = duple.iterator();
|
||||||
|
Token t1 = (Token)iter.next();
|
||||||
|
IContainerSymbol symbol = null;
|
||||||
|
|
||||||
|
if( t1.getType() == Token.tCOLONCOLON )
|
||||||
|
symbol = pst.getCompilationUnit();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
symbol = (IContainerSymbol)((IASTFScope)scope).getContainerSymbol().Lookup( t1.getImage() );
|
||||||
|
}
|
||||||
|
catch( ParserSymbolTableException pste )
|
||||||
|
{
|
||||||
|
handlePSTException( pste );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while( iter.hasNext() )
|
||||||
|
{
|
||||||
|
Token t = (Token)iter.next();
|
||||||
|
if( t.getType() == Token.tCOLONCOLON ) continue;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
symbol = symbol.LookupNestedNameSpecifier( t.getImage() );
|
||||||
|
}
|
||||||
|
catch( ParserSymbolTableException pste )
|
||||||
|
{
|
||||||
|
handlePSTException( pste );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
((IASTFScope)scope).getContainerSymbol().addUsingDirective( symbol );
|
||||||
|
} catch (ParserSymbolTableException pste) {
|
||||||
|
handlePSTException( pste );
|
||||||
|
}
|
||||||
|
|
||||||
|
IASTUsingDirective astUD = new ASTUsingDirective( duple.toString() );
|
||||||
|
return astUD;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTASMDefinition createASMDefinition(
|
||||||
|
IASTScope scope,
|
||||||
|
String assembly,
|
||||||
|
int first,
|
||||||
|
int last) {
|
||||||
|
IContainerSymbol containerSymbol = (IContainerSymbol)((IASTFScope)scope).getSymbol();
|
||||||
|
ISymbol asmSymbol = pst.newSymbol( "", ParserSymbolTable.TypeInfo.t_asm );
|
||||||
|
IASTFASMDefinition asmDefinition = new ASTASMDefinition( asmSymbol, assembly );
|
||||||
|
asmSymbol.setASTNode( asmDefinition );
|
||||||
|
|
||||||
|
try {
|
||||||
|
containerSymbol.addSymbol(asmSymbol);
|
||||||
|
} catch (ParserSymbolTableException e1) {
|
||||||
|
//?
|
||||||
|
}
|
||||||
|
|
||||||
|
asmDefinition.setStartingOffset( first );
|
||||||
|
asmDefinition.setEndingOffset( last );
|
||||||
|
return asmDefinition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTNamespaceDefinition createNamespaceDefinition(
|
||||||
|
IASTScope scope,
|
||||||
|
String identifier,
|
||||||
|
int first, int nameOffset ) {
|
||||||
|
|
||||||
|
IContainerSymbol namespaceSymbol = null;
|
||||||
|
|
||||||
|
pst.newContainerSymbol( identifier, ParserSymbolTable.TypeInfo.t_namespace );
|
||||||
|
IASTFNamespaceDefinition namespaceDefinition = new ASTNamespaceDefinition( namespaceSymbol, identifier );
|
||||||
|
namespaceDefinition.setStartingOffset( first );
|
||||||
|
if( identifier != "" )
|
||||||
|
namespaceDefinition.setNameOffset( nameOffset );
|
||||||
|
return namespaceDefinition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTCompilationUnit createCompilationUnit() {
|
||||||
|
IASTFCompilationUnit compilationUnit = new ASTCompilationUnit( pst.getCompilationUnit() );
|
||||||
|
return compilationUnit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IASTLinkageSpecification createLinkageSpecification(IASTScope scope, String spec) {
|
||||||
|
IContainerSymbol symbol = pst.newContainerSymbol("", ParserSymbolTable.TypeInfo.t_linkage );
|
||||||
|
IASTFLinkageSpecification linkage = new ASTLinkageSpecification( symbol, spec);
|
||||||
|
return linkage;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param pste
|
||||||
|
*/
|
||||||
|
private void handlePSTException(ParserSymbolTableException pste) throws Backtrack {
|
||||||
|
throw new Backtrack();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createUsingDeclaration(org.eclipse.cdt.core.parser.ast.IASTScope, boolean, org.eclipse.cdt.internal.core.parser.TokenDuple)
|
||||||
|
*/
|
||||||
|
public IASTUsingDeclaration createUsingDeclaration(IASTScope scope, boolean isTypeName, TokenDuple name) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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.internal.core.parser.ast.full;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface IASTFASMDefinition
|
||||||
|
extends org.eclipse.cdt.core.parser.ast.IASTASMDefinition, IPSTSymbolExtension {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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.full;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTScope;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface IASTFClassSpecifier
|
||||||
|
extends IASTScope, org.eclipse.cdt.core.parser.ast.IASTClassSpecifier {
|
||||||
|
|
||||||
|
}
|
|
@ -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.full;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface IASTFCompilationUnit
|
||||||
|
extends
|
||||||
|
org.eclipse.cdt.core.parser.ast.IASTCompilationUnit,
|
||||||
|
IASTFScope {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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.full;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface IASTFLinkageSpecification
|
||||||
|
extends org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification, IASTFScope {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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.full;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface IASTFNamespaceDefinition
|
||||||
|
extends IASTFScope, org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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.full;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface IASTFScope
|
||||||
|
extends org.eclipse.cdt.core.parser.ast.IASTScope, IPSTContainerExtension {
|
||||||
|
|
||||||
|
}
|
|
@ -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.full;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTScope;
|
||||||
|
import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface IPSTContainerExtension extends IPSTSymbolExtension, IASTScope {
|
||||||
|
|
||||||
|
public IContainerSymbol getContainerSymbol();
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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.full;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface IPSTSymbolExtension {
|
||||||
|
|
||||||
|
ISymbol getSymbol();
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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.full;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ScopeIterator implements Iterator {
|
||||||
|
|
||||||
|
private final Map sourceMap;
|
||||||
|
private final Iterator keyIter;
|
||||||
|
|
||||||
|
public ScopeIterator( Map in )
|
||||||
|
{
|
||||||
|
sourceMap = in;
|
||||||
|
keyIter = in.keySet().iterator();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see java.util.Iterator#hasNext()
|
||||||
|
*/
|
||||||
|
public boolean hasNext() {
|
||||||
|
return keyIter.hasNext();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see java.util.Iterator#next()
|
||||||
|
*/
|
||||||
|
public Object next() {
|
||||||
|
ISymbol symbol = (ISymbol)sourceMap.get( keyIter.next() );
|
||||||
|
return symbol.getASTNode();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see java.util.Iterator#remove()
|
||||||
|
*/
|
||||||
|
public void remove() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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 );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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 );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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 );
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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.IASTUsingDeclaration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ASTUsingDeclaration
|
||||||
|
extends ASTDeclaration
|
||||||
|
implements IASTUsingDeclaration {
|
||||||
|
|
||||||
|
private final boolean isTypename;
|
||||||
|
private final String mappingName;
|
||||||
|
|
||||||
|
public ASTUsingDeclaration( IASTScope scope, boolean isTypeName, String mappingName )
|
||||||
|
{
|
||||||
|
super( scope );
|
||||||
|
isTypename = isTypeName;
|
||||||
|
this.mappingName = mappingName;
|
||||||
|
}
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration#isTypename()
|
||||||
|
*/
|
||||||
|
public boolean isTypename() {
|
||||||
|
return isTypename;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration#usingTypeName()
|
||||||
|
*/
|
||||||
|
public String usingTypeName() {
|
||||||
|
return mappingName;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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 );
|
||||||
|
}
|
|
@ -0,0 +1,79 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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.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.IASTUsingDeclaration;
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory {
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @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 {
|
||||||
|
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) {
|
||||||
|
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(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() {
|
||||||
|
return new ASTCompilationUnit();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.internal.core.parser.ast.IASTFactory#createLinkageSpecification(java.lang.String)
|
||||||
|
*/
|
||||||
|
public IASTLinkageSpecification createLinkageSpecification(IASTScope scope, String spec) {
|
||||||
|
return new ASTLinkageSpecification( scope, spec );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createUsingDeclaration(org.eclipse.cdt.core.parser.ast.IASTScope, boolean, org.eclipse.cdt.internal.core.parser.TokenDuple)
|
||||||
|
*/
|
||||||
|
public IASTUsingDeclaration createUsingDeclaration(IASTScope scope, boolean isTypeName, TokenDuple name) {
|
||||||
|
return new ASTUsingDeclaration( scope, isTypeName, name.toString() );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue