mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Patch for John Camelon:
- Added callback support for namespace definitions. - Updated Parser exception handling strategy. - Added callback support for linkage specifications. - Added callback support for using declarations and directives. Added callback support for enumerations. - Made DOM Name usage consistent. - Updated DOMTests
This commit is contained in:
parent
ec58acd398
commit
21e625463a
21 changed files with 1643 additions and 214 deletions
|
@ -15,8 +15,6 @@ package org.eclipse.cdt.internal.core.dom;
|
|||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
* To change this generated comment go to
|
||||
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||
*/
|
||||
public class ArrayQualifier implements IExpressionOwner {
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package org.eclipse.cdt.internal.core.dom;
|
||||
|
||||
import org.eclipse.cdt.internal.core.parser.util.Name;
|
||||
|
||||
/**
|
||||
* @author dschaefe
|
||||
*
|
||||
|
@ -38,7 +40,7 @@ public class BaseSpecifier {
|
|||
public void setAccess(int access) { this.access = access; }
|
||||
public int getAccess() { return access; }
|
||||
|
||||
private String name;
|
||||
public void setName(String name) { this.name = name; }
|
||||
public String getName() { return name; }
|
||||
private Name name;
|
||||
public void setName(Name name) { this.name = name; }
|
||||
public Name getName() { return name; }
|
||||
}
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package org.eclipse.cdt.internal.core.dom;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.internal.core.parser.IParserCallback;
|
||||
import org.eclipse.cdt.internal.core.parser.Token;
|
||||
import org.eclipse.cdt.internal.core.parser.util.DeclSpecifier;
|
||||
|
@ -14,7 +11,6 @@ import org.eclipse.cdt.internal.core.parser.util.Name;
|
|||
*/
|
||||
public class DOMBuilder implements IParserCallback
|
||||
{
|
||||
|
||||
private TranslationUnit translationUnit;
|
||||
|
||||
public TranslationUnit getTranslationUnit() {
|
||||
|
@ -120,7 +116,7 @@ public class DOMBuilder implements IParserCallback
|
|||
/**
|
||||
* @see org.eclipse.cdt.internal.core.newparser.IParserCallback#expressionOperator(org.eclipse.cdt.internal.core.newparser.Token)
|
||||
*/
|
||||
public void expressionOperator(Object expression, Token operator) throws Exception {
|
||||
public void expressionOperator(Object expression, Token operator){
|
||||
Expression e = (Expression)expression;
|
||||
e.add( operator );
|
||||
}
|
||||
|
@ -128,7 +124,7 @@ public class DOMBuilder implements IParserCallback
|
|||
/**
|
||||
* @see org.eclipse.cdt.internal.core.newparser.IParserCallback#expressionTerminal(org.eclipse.cdt.internal.core.newparser.Token)
|
||||
*/
|
||||
public void expressionTerminal(Object expression, Token terminal) throws Exception {
|
||||
public void expressionTerminal(Object expression, Token terminal){
|
||||
Expression e = (Expression)expression;
|
||||
e.add( terminal );
|
||||
}
|
||||
|
@ -251,7 +247,7 @@ public class DOMBuilder implements IParserCallback
|
|||
|
||||
public void baseSpecifierName( Object baseSpecifier )
|
||||
{
|
||||
((BaseSpecifier)baseSpecifier).setName(currName.toString());
|
||||
((BaseSpecifier)baseSpecifier).setName(currName);
|
||||
}
|
||||
|
||||
public Object parameterDeclarationBegin( Object container )
|
||||
|
@ -294,6 +290,8 @@ public class DOMBuilder implements IParserCallback
|
|||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#classSpecifierAbort(java.lang.Object)
|
||||
*/
|
||||
public void classSpecifierAbort(Object classSpecifier) {
|
||||
ClassSpecifier cs = (ClassSpecifier)classSpecifier;
|
||||
cs.getDeclaration().setTypeSpecifier(null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -306,6 +304,7 @@ public class DOMBuilder implements IParserCallback
|
|||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#elaboratedTypeSpecifierBegin(java.lang.Object)
|
||||
*/
|
||||
public Object elaboratedTypeSpecifierBegin(Object container, Token classKey) {
|
||||
SimpleDeclaration declaration = (SimpleDeclaration)container;
|
||||
int kind = ClassSpecifier.t_struct;
|
||||
|
||||
switch (classKey.getType()) {
|
||||
|
@ -320,7 +319,8 @@ public class DOMBuilder implements IParserCallback
|
|||
break;
|
||||
}
|
||||
|
||||
ElaboratedTypeSpecifier elab = new ElaboratedTypeSpecifier( kind, (SimpleDeclaration)container );
|
||||
ElaboratedTypeSpecifier elab = new ElaboratedTypeSpecifier( kind, declaration );
|
||||
declaration.setTypeSpecifier( elab );
|
||||
return elab;
|
||||
}
|
||||
|
||||
|
@ -482,4 +482,172 @@ public class DOMBuilder implements IParserCallback
|
|||
Declarator decl = (Declarator)declarator;
|
||||
decl.throwsExceptions();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#namespaceDeclarationBegin(java.lang.Object)
|
||||
*/
|
||||
public Object namespaceDefinitionBegin(Object container) {
|
||||
IScope ownerScope = (IScope)container;
|
||||
NamespaceDefinition namespace = new NamespaceDefinition(ownerScope);
|
||||
return namespace;
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#namespaceDeclarationId(java.lang.Object)
|
||||
*/
|
||||
public void namespaceDefinitionId(Object namespace) {
|
||||
NamespaceDefinition ns = (NamespaceDefinition)namespace;
|
||||
ns.setName( currName );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#namespaceDeclarationAbort(java.lang.Object)
|
||||
*/
|
||||
public void namespaceDefinitionAbort(Object namespace) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#namespaceDeclarationEnd(java.lang.Object)
|
||||
*/
|
||||
public void namespaceDefinitionEnd(Object namespace) {
|
||||
NamespaceDefinition ns = (NamespaceDefinition)namespace;
|
||||
ns.getOwnerScope().addDeclaration(ns);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#linkageSpecificationBegin(java.lang.Object, java.lang.String)
|
||||
*/
|
||||
public Object linkageSpecificationBegin(Object container, String literal) {
|
||||
IScope scope = (IScope)container;
|
||||
LinkageSpecification linkage = new LinkageSpecification( scope, literal );
|
||||
return linkage;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#linkageSpecificationEnd(java.lang.Object)
|
||||
*/
|
||||
public void linkageSpecificationEnd(Object linkageSpec) {
|
||||
LinkageSpecification linkage = (LinkageSpecification)linkageSpec;
|
||||
linkage.getOwnerScope().addDeclaration(linkage );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDirectiveBegin(java.lang.Object)
|
||||
*/
|
||||
public Object usingDirectiveBegin(Object container) {
|
||||
IScope scope = (IScope)container;
|
||||
UsingDirective directive = new UsingDirective( scope );
|
||||
return directive;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDirectiveNamespaceId(java.lang.Object)
|
||||
*/
|
||||
public void usingDirectiveNamespaceId(Object dir) {
|
||||
UsingDirective directive = (UsingDirective)dir;
|
||||
directive.setNamespaceName( currName );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDirectiveEnd(java.lang.Object)
|
||||
*/
|
||||
public void usingDirectiveEnd(Object dir) {
|
||||
UsingDirective directive = (UsingDirective)dir;
|
||||
directive.getOwnerScope().addDeclaration( directive );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDeclarationBegin(java.lang.Object)
|
||||
*/
|
||||
public Object usingDeclarationBegin(Object container) {
|
||||
IScope scope = (IScope)container;
|
||||
UsingDeclaration declaration = new UsingDeclaration( scope );
|
||||
return declaration;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDeclarationMapping(java.lang.Object)
|
||||
*/
|
||||
public void usingDeclarationMapping(Object decl, boolean isTypename) {
|
||||
UsingDeclaration declaration = (UsingDeclaration)decl;
|
||||
declaration.setMappedName( currName );
|
||||
declaration.setTypename( isTypename );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDeclarationEnd(java.lang.Object)
|
||||
*/
|
||||
public void usingDeclarationEnd(Object decl) {
|
||||
UsingDeclaration declaration = (UsingDeclaration)decl;
|
||||
declaration.getOwnerScope().addDeclaration( declaration );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDirectiveAbort(java.lang.Object)
|
||||
*/
|
||||
public void usingDirectiveAbort(Object directive) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDeclarationAbort(java.lang.Object)
|
||||
*/
|
||||
public void usingDeclarationAbort(Object declaration) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumSpecifierBegin(java.lang.Object)
|
||||
*/
|
||||
public Object enumSpecifierBegin(Object container) {
|
||||
SimpleDeclaration decl = (SimpleDeclaration)container;
|
||||
EnumerationSpecifier es = new EnumerationSpecifier( decl );
|
||||
decl.setTypeSpecifier(es);
|
||||
return es;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumSpecifierId(java.lang.Object)
|
||||
*/
|
||||
public void enumSpecifierId(Object enumSpec) {
|
||||
EnumerationSpecifier es = (EnumerationSpecifier)enumSpec;
|
||||
es.setName( currName );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumSpecifierAbort(java.lang.Object)
|
||||
*/
|
||||
public void enumSpecifierAbort(Object enumSpec) {
|
||||
EnumerationSpecifier es = (EnumerationSpecifier)enumSpec;
|
||||
es.getDeclaration().setTypeSpecifier(null);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumSpecifierEnd(java.lang.Object)
|
||||
*/
|
||||
public void enumSpecifierEnd(Object enumSpec) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumDefinitionBegin(java.lang.Object)
|
||||
*/
|
||||
public Object enumDefinitionBegin(Object enumSpec) {
|
||||
EnumerationSpecifier es = (EnumerationSpecifier)enumSpec;
|
||||
EnumeratorDefinition definition = new EnumeratorDefinition();
|
||||
es.addEnumeratorDefinition(definition);
|
||||
return definition;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumDefinitionId(java.lang.Object)
|
||||
*/
|
||||
public void enumDefinitionId(Object enumDefn) {
|
||||
EnumeratorDefinition definition = (EnumeratorDefinition)enumDefn;
|
||||
definition.setName( currName );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumDefinitionEnd(java.lang.Object)
|
||||
*/
|
||||
public void enumDefinitionEnd(Object enumDefn) {
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
/**********************************************************************
|
||||
* Created on Mar 25, 2003
|
||||
*
|
||||
* 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:
|
||||
* Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.internal.core.parser.util.Name;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public class EnumerationSpecifier extends TypeSpecifier {
|
||||
|
||||
public EnumerationSpecifier(SimpleDeclaration declaration) {
|
||||
super(declaration);
|
||||
}
|
||||
|
||||
private Name name = null;
|
||||
private List enumeratorDefinitions = new LinkedList();
|
||||
|
||||
public void addEnumeratorDefinition( EnumeratorDefinition def )
|
||||
{
|
||||
enumeratorDefinitions.add( def );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return List
|
||||
*/
|
||||
public List getEnumeratorDefinitions() {
|
||||
return enumeratorDefinitions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Name
|
||||
*/
|
||||
public Name getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the name.
|
||||
* @param name The name to set
|
||||
*/
|
||||
public void setName(Name name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
/**********************************************************************
|
||||
* Created on Mar 25, 2003
|
||||
*
|
||||
* 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:
|
||||
* Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom;
|
||||
|
||||
import org.eclipse.cdt.internal.core.parser.util.Name;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public class EnumeratorDefinition implements IExpressionOwner {
|
||||
|
||||
private Expression initialValue = null;
|
||||
private Name name = null;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.dom.IExpressionOwner#getExpression()
|
||||
*/
|
||||
public Expression getExpression() {
|
||||
return initialValue;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.dom.IExpressionOwner#setExpression(org.eclipse.cdt.internal.core.dom.Expression)
|
||||
*/
|
||||
public void setExpression(Expression exp) {
|
||||
initialValue = exp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Name
|
||||
*/
|
||||
public Name getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the name.
|
||||
* @param name The name to set
|
||||
*/
|
||||
public void setName(Name name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
|
@ -19,8 +19,6 @@ import org.eclipse.cdt.internal.core.parser.Token;
|
|||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
* To change this generated comment go to
|
||||
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||
*/
|
||||
public class Expression {
|
||||
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
/**********************************************************************
|
||||
* Created on Mar 25, 2003
|
||||
*
|
||||
* 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:
|
||||
* Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public class LinkageSpecification extends Declaration implements IScope {
|
||||
|
||||
private List declarations = new LinkedList();
|
||||
private IScope ownerScope;
|
||||
private String languageLinkage;
|
||||
|
||||
LinkageSpecification( IScope owner, String linkage )
|
||||
{
|
||||
ownerScope = owner;
|
||||
languageLinkage = linkage;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.dom.IScope#addDeclaration(org.eclipse.cdt.internal.core.dom.Declaration)
|
||||
*/
|
||||
public void addDeclaration(Declaration declaration) {
|
||||
declarations.add( declaration );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.dom.IScope#getDeclarations()
|
||||
*/
|
||||
public List getDeclarations() {
|
||||
return declarations;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return IScope
|
||||
*/
|
||||
public IScope getOwnerScope() {
|
||||
return ownerScope;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return String
|
||||
*/
|
||||
public String getLanguageLinkage() {
|
||||
return languageLinkage;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
/**********************************************************************
|
||||
* Created on Mar 25, 2003
|
||||
*
|
||||
* 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:
|
||||
* Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.internal.core.parser.util.Name;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public class NamespaceDefinition extends Declaration implements IScope {
|
||||
|
||||
private List declarations = new LinkedList();
|
||||
private IScope ownerScope;
|
||||
private Name name = null;
|
||||
|
||||
public NamespaceDefinition( IScope owner )
|
||||
{
|
||||
ownerScope = owner;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.dom.IScope#addDeclaration(org.eclipse.cdt.internal.core.dom.Declaration)
|
||||
*/
|
||||
public void addDeclaration(Declaration declaration) {
|
||||
declarations.add( declaration );
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.dom.IScope#getDeclarations()
|
||||
*/
|
||||
public List getDeclarations() {
|
||||
return declarations;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return String
|
||||
*/
|
||||
public Name getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return IScope
|
||||
*/
|
||||
public IScope getOwnerScope() {
|
||||
return ownerScope;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the name.
|
||||
* @param name The name to set
|
||||
*/
|
||||
public void setName(Name name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
|
@ -15,8 +15,6 @@ package org.eclipse.cdt.internal.core.dom;
|
|||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
* To change this generated comment go to
|
||||
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||
*/
|
||||
public class PointerOperator {
|
||||
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
/**********************************************************************
|
||||
* Created on Mar 25, 2003
|
||||
*
|
||||
* 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:
|
||||
* Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom;
|
||||
|
||||
import org.eclipse.cdt.internal.core.parser.util.Name;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public class UsingDeclaration extends Declaration {
|
||||
|
||||
private Name mappedName;
|
||||
private IScope ownerScope;
|
||||
boolean isTypename = false;
|
||||
|
||||
public UsingDeclaration( IScope owner )
|
||||
{
|
||||
ownerScope = owner;
|
||||
}
|
||||
/**
|
||||
* @return String
|
||||
*/
|
||||
public Name getMappedName() {
|
||||
return mappedName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the mapping.
|
||||
* @param mapping The mapping to set
|
||||
*/
|
||||
public void setMappedName(Name mapping) {
|
||||
this.mappedName = mapping;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return IScope
|
||||
*/
|
||||
public IScope getOwnerScope() {
|
||||
return ownerScope;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean isTypename() {
|
||||
return isTypename;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the isTypename.
|
||||
* @param isTypename The isTypename to set
|
||||
*/
|
||||
public void setTypename(boolean isTypename) {
|
||||
this.isTypename = isTypename;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
/**********************************************************************
|
||||
* Created on Mar 25, 2003
|
||||
*
|
||||
* 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:
|
||||
* Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom;
|
||||
|
||||
import org.eclipse.cdt.internal.core.parser.util.Name;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public class UsingDirective extends Declaration {
|
||||
|
||||
private Name namespaceName;
|
||||
private IScope ownerScope;
|
||||
|
||||
public UsingDirective( IScope owner )
|
||||
{
|
||||
ownerScope = owner;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return String
|
||||
*/
|
||||
public Name getNamespaceName() {
|
||||
return namespaceName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the namespaceName.
|
||||
* @param namespaceName The namespaceName to set
|
||||
*/
|
||||
public void setNamespaceName(Name namespaceName) {
|
||||
this.namespaceName = namespaceName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return IScope
|
||||
*/
|
||||
public IScope getOwnerScope() {
|
||||
return ownerScope;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,3 +1,9 @@
|
|||
2003-03-24 John Camelon
|
||||
Added callback support for namespace definitions.
|
||||
Updated Parser exception hierarchy.
|
||||
Added callback support for linkage specifications.
|
||||
Added callback support for using declarations and directives.
|
||||
|
||||
2003-03-23 John Camelon
|
||||
Added callback support for class member visibility.
|
||||
Added callback support for pointer and reference operators on declarators.
|
||||
|
|
|
@ -244,13 +244,13 @@ org.eclipse.cdt.internal.core.newparser.IParserCallback#beginSimpleDeclaration(T
|
|||
/**
|
||||
* @see org.eclipse.cdt.internal.core.newparser.IParserCallback#expressionOperator(org.eclipse.cdt.internal.core.newparser.Token)
|
||||
*/
|
||||
public void expressionOperator(Object expression, Token operator) throws Exception {
|
||||
public void expressionOperator(Object expression, Token operator) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.internal.core.newparser.IParserCallback#expressionTerminal(org.eclipse.cdt.internal.core.newparser.Token)
|
||||
*/
|
||||
public void expressionTerminal(Object expression, Token terminal) throws Exception {
|
||||
public void expressionTerminal(Object expression, Token terminal) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -467,4 +467,172 @@ org.eclipse.cdt.internal.core.newparser.IParserCallback#beginSimpleDeclaration(T
|
|||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#namespaceDeclarationBegin(java.lang.Object)
|
||||
*/
|
||||
public Object namespaceDefinitionBegin(Object container) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#namespaceDeclarationId(java.lang.Object)
|
||||
*/
|
||||
public void namespaceDefinitionId(Object namespace) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#namespaceDeclarationAbort(java.lang.Object)
|
||||
*/
|
||||
public void namespaceDefinitionAbort(Object namespace) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#namespaceDeclarationEnd(java.lang.Object)
|
||||
*/
|
||||
public void namespaceDefinitionEnd(Object namespace) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#linkageSpecificationBegin(java.lang.Object, java.lang.String)
|
||||
*/
|
||||
public Object linkageSpecificationBegin(Object container, String literal) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#linkageSpecificationEnd(java.lang.Object)
|
||||
*/
|
||||
public void linkageSpecificationEnd(Object linkageSpec) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDirectiveBegin(java.lang.Object)
|
||||
*/
|
||||
public Object usingDirectiveBegin(Object container) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDirectiveNamespaceId(java.lang.Object)
|
||||
*/
|
||||
public void usingDirectiveNamespaceId(Object container) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDirectiveEnd(java.lang.Object)
|
||||
*/
|
||||
public void usingDirectiveEnd(Object directive) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDeclarationBegin(java.lang.Object)
|
||||
*/
|
||||
public Object usingDeclarationBegin(Object container) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDeclarationMapping(java.lang.Object)
|
||||
*/
|
||||
public void usingDeclarationMapping(Object container, boolean isTypename) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDeclarationEnd(java.lang.Object)
|
||||
*/
|
||||
public void usingDeclarationEnd(Object directive) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDirectiveAbort(java.lang.Object)
|
||||
*/
|
||||
public void usingDirectiveAbort(Object directive) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDeclarationAbort(java.lang.Object)
|
||||
*/
|
||||
public void usingDeclarationAbort(Object declaration) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumSpecifierBegin(java.lang.Object)
|
||||
*/
|
||||
public Object enumSpecifierBegin(Object container) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumSpecifierId(java.lang.Object)
|
||||
*/
|
||||
public void enumSpecifierId(Object enumSpec) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumSpecifierAbort(java.lang.Object)
|
||||
*/
|
||||
public void enumSpecifierAbort(Object enumSpec) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumSpecifierEnd(java.lang.Object)
|
||||
*/
|
||||
public void enumSpecifierEnd(Object enumSpec) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumDefinitionBegin(java.lang.Object)
|
||||
*/
|
||||
public Object enumDefinitionBegin(Object enumSpec) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumDefinitionId(java.lang.Object)
|
||||
*/
|
||||
public void enumDefinitionId(Object enumDefn) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumDefinitionEnd(java.lang.Object)
|
||||
*/
|
||||
public void enumDefinitionEnd(Object enumDefn) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -79,8 +79,8 @@ public class SimpleDeclarationWrapper extends DeclSpecifier implements DeclSpeci
|
|||
|
||||
// instantiate the right element
|
||||
List clause =currentDeclarator.getParameterDeclarationClause();
|
||||
if( clause == null )
|
||||
{
|
||||
if( clause == null && !isTypedef())
|
||||
{
|
||||
// TODO - this was to get rid of the NULL pointer we've been seeing
|
||||
if (currentDeclarator.getName() == null)
|
||||
return;
|
||||
|
@ -102,6 +102,11 @@ public class SimpleDeclarationWrapper extends DeclSpecifier implements DeclSpeci
|
|||
}
|
||||
}
|
||||
}
|
||||
else if( isTypedef() )
|
||||
{
|
||||
// do nothing just yet
|
||||
//TODO : update this -- typedefs do not have a parameterdeclarationclause
|
||||
}
|
||||
else
|
||||
{
|
||||
Parameter [] parameters = (Parameter []) clause.toArray( new Parameter[ clause.size() ]);
|
||||
|
|
|
@ -30,7 +30,7 @@ public class ExpressionEvaluator implements IParserCallback {
|
|||
/**
|
||||
* @see org.eclipse.cdt.core.newparser.IParserCallback#expressionOperator(Token)
|
||||
*/
|
||||
public void expressionOperator(Object expression, Token operator) throws Exception {
|
||||
public void expressionOperator(Object expression, Token operator) {
|
||||
|
||||
int second = popInt();
|
||||
int first;
|
||||
|
@ -88,20 +88,20 @@ public class ExpressionEvaluator implements IParserCallback {
|
|||
stack.push( new Integer( ( second == 0 ) ? 1 : 0 ) );
|
||||
break;
|
||||
default:
|
||||
throw new ExpressionException("Unhandled operator: " + operator );
|
||||
// throw new ExpressionException("Unhandled operator: " + operator );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.core.newparser.IParserCallback#expressionTerminal(Token)
|
||||
*/
|
||||
public void expressionTerminal(Object expression, Token terminal) throws Exception {
|
||||
public void expressionTerminal(Object expression, Token terminal) {
|
||||
switch (terminal.getType()) {
|
||||
case Token.tINTEGER:
|
||||
stack.push(new Integer(terminal.getImage()));
|
||||
break;
|
||||
default:
|
||||
throw new ExpressionException("Unhandled terminal: " + terminal.getImage());
|
||||
// throw new ExpressionException("Unhandled terminal: " + terminal.getImage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -311,7 +311,7 @@ public class ExpressionEvaluator implements IParserCallback {
|
|||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#expressionAbort(java.lang.Object)
|
||||
*/
|
||||
public void expressionAbort(Object expression) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -319,7 +319,7 @@ public class ExpressionEvaluator implements IParserCallback {
|
|||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#classMemberVisibility(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public void classMemberVisibility(Object classSpecifier, Token visibility) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -327,7 +327,7 @@ public class ExpressionEvaluator implements IParserCallback {
|
|||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#pointerOperatorBegin(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public Object pointerOperatorBegin(Object container) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -335,7 +335,7 @@ public class ExpressionEvaluator implements IParserCallback {
|
|||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#pointerOperatorEnd(java.lang.Object)
|
||||
*/
|
||||
public void pointerOperatorEnd(Object ptrOperator) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -343,7 +343,7 @@ public class ExpressionEvaluator implements IParserCallback {
|
|||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#pointerOperatorName(java.lang.Object)
|
||||
*/
|
||||
public void pointerOperatorName(Object ptrOperator) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -351,7 +351,7 @@ public class ExpressionEvaluator implements IParserCallback {
|
|||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#pointerOperatorType(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public void pointerOperatorType(Object ptrOperator, Token type) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -359,7 +359,7 @@ public class ExpressionEvaluator implements IParserCallback {
|
|||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#pointerOperatorCVModifier(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public void pointerOperatorCVModifier(Object ptrOperator, Token modifier) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -367,7 +367,7 @@ public class ExpressionEvaluator implements IParserCallback {
|
|||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#declaratorCVModifier(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public void declaratorCVModifier(Object declarator, Token modifier) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -375,7 +375,7 @@ public class ExpressionEvaluator implements IParserCallback {
|
|||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#arrayBegin(java.lang.Object)
|
||||
*/
|
||||
public Object arrayDeclaratorBegin(Object declarator) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -383,14 +383,14 @@ public class ExpressionEvaluator implements IParserCallback {
|
|||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#arrayEnd(java.lang.Object)
|
||||
*/
|
||||
public void arrayDeclaratorEnd(Object arrayQualifier ) {
|
||||
// TODO Auto-generated method stub;
|
||||
;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#exceptionSpecificationTypename(java.lang.Object)
|
||||
*/
|
||||
public void declaratorThrowExceptionName(Object declarator) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -398,7 +398,170 @@ public class ExpressionEvaluator implements IParserCallback {
|
|||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#declaratorThrowsException(java.lang.Object)
|
||||
*/
|
||||
public void declaratorThrowsException(Object declarator) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#namespaceDeclarationBegin(java.lang.Object)
|
||||
*/
|
||||
public Object namespaceDefinitionBegin(Object container) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#namespaceDeclarationId(java.lang.Object)
|
||||
*/
|
||||
public void namespaceDefinitionId(Object namespace) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#namespaceDeclarationAbort(java.lang.Object)
|
||||
*/
|
||||
public void namespaceDefinitionAbort(Object namespace) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#namespaceDeclarationEnd(java.lang.Object)
|
||||
*/
|
||||
public void namespaceDefinitionEnd(Object namespace) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#linkageSpecificationBegin(java.lang.Object, java.lang.String)
|
||||
*/
|
||||
public Object linkageSpecificationBegin(Object container, String literal) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#linkageSpecificationEnd(java.lang.Object)
|
||||
*/
|
||||
public void linkageSpecificationEnd(Object linkageSpec) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDirectiveBegin(java.lang.Object)
|
||||
*/
|
||||
public Object usingDirectiveBegin(Object container) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDirectiveNamespaceId(java.lang.Object)
|
||||
*/
|
||||
public void usingDirectiveNamespaceId(Object container) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDirectiveEnd(java.lang.Object)
|
||||
*/
|
||||
public void usingDirectiveEnd(Object directive) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDeclarationBegin(java.lang.Object)
|
||||
*/
|
||||
public Object usingDeclarationBegin(Object container) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDeclarationMapping(java.lang.Object)
|
||||
*/
|
||||
public void usingDeclarationMapping(Object container, boolean isTypename) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDeclarationEnd(java.lang.Object)
|
||||
*/
|
||||
public void usingDeclarationEnd(Object directive) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDirectiveAbort(java.lang.Object)
|
||||
*/
|
||||
public void usingDirectiveAbort(Object directive) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDeclarationAbort(java.lang.Object)
|
||||
*/
|
||||
public void usingDeclarationAbort(Object declaration) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumSpecifierBegin(java.lang.Object)
|
||||
*/
|
||||
public Object enumSpecifierBegin(Object container) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumSpecifierId(java.lang.Object)
|
||||
*/
|
||||
public void enumSpecifierId(Object enumSpec) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumSpecifierAbort(java.lang.Object)
|
||||
*/
|
||||
public void enumSpecifierAbort(Object enumSpec) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumSpecifierEnd(java.lang.Object)
|
||||
*/
|
||||
public void enumSpecifierEnd(Object enumSpec) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumDefinitionBegin(java.lang.Object)
|
||||
*/
|
||||
public Object enumDefinitionBegin(Object enumSpec) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumDefinitionId(java.lang.Object)
|
||||
*/
|
||||
public void enumDefinitionId(Object enumDefn) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumDefinitionEnd(java.lang.Object)
|
||||
*/
|
||||
public void enumDefinitionEnd(Object enumDefn) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -67,12 +67,40 @@ public interface IParserCallback {
|
|||
public void baseSpecifierEnd( Object baseSpecifier );
|
||||
|
||||
public Object expressionBegin( Object container );
|
||||
public void expressionOperator(Object expression, Token operator) throws Exception;
|
||||
public void expressionTerminal(Object expression, Token terminal) throws Exception;
|
||||
public void expressionOperator(Object expression, Token operator);
|
||||
public void expressionTerminal(Object expression, Token terminal);
|
||||
public void expressionAbort( Object expression );
|
||||
public void expressionEnd(Object expression );
|
||||
|
||||
public Object elaboratedTypeSpecifierBegin( Object container, Token classKey );
|
||||
public void elaboratedTypeSpecifierName( Object elab );
|
||||
public void elaboratedTypeSpecifierEnd( Object elab );
|
||||
|
||||
public Object namespaceDefinitionBegin( Object container );
|
||||
public void namespaceDefinitionId( Object namespace );
|
||||
public void namespaceDefinitionAbort( Object namespace );
|
||||
public void namespaceDefinitionEnd( Object namespace );
|
||||
|
||||
public Object linkageSpecificationBegin( Object container, String literal );
|
||||
public void linkageSpecificationEnd( Object linkageSpec );
|
||||
|
||||
public Object usingDirectiveBegin( Object container );
|
||||
public void usingDirectiveNamespaceId( Object directive );
|
||||
public void usingDirectiveAbort( Object directive );
|
||||
public void usingDirectiveEnd( Object directive );
|
||||
|
||||
public Object usingDeclarationBegin( Object container );
|
||||
public void usingDeclarationMapping( Object declaration, boolean isTypeName );
|
||||
public void usingDeclarationAbort( Object declaration );
|
||||
public void usingDeclarationEnd( Object declaration );
|
||||
|
||||
public Object enumSpecifierBegin( Object container );
|
||||
public void enumSpecifierId( Object enumSpec );
|
||||
public void enumSpecifierAbort( Object enumSpec );
|
||||
public void enumSpecifierEnd( Object enumSpec );
|
||||
|
||||
public Object enumDefinitionBegin( Object enumSpec );
|
||||
public void enumDefinitionId( Object enumDefn );
|
||||
public void enumDefinitionEnd( Object enumDefn );
|
||||
|
||||
}
|
||||
|
|
|
@ -6,47 +6,37 @@ public class NullParserCallback implements IParserCallback {
|
|||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#translationUnitBegin()
|
||||
*/
|
||||
public Object translationUnitBegin() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#translationUnitEnd(java.lang.Object)
|
||||
*/
|
||||
public void translationUnitEnd(Object unit) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
public void translationUnitEnd(Object unit) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#inclusionBegin(java.lang.String, int)
|
||||
*/
|
||||
public void inclusionBegin(String includeFile, int offset) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#inclusionEnd()
|
||||
*/
|
||||
public void inclusionEnd() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#macro(java.lang.String, int)
|
||||
*/
|
||||
public void macro(String macroName, int offset) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#simpleDeclarationBegin(java.lang.Object)
|
||||
*/
|
||||
public Object simpleDeclarationBegin(Object Container) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -54,31 +44,24 @@ public class NullParserCallback implements IParserCallback {
|
|||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#simpleDeclSpecifier(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public void simpleDeclSpecifier(Object Container, Token specifier) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#simpleDeclSpecifierName(java.lang.Object)
|
||||
*/
|
||||
public void simpleDeclSpecifierName(Object declaration) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#simpleDeclarationEnd(java.lang.Object)
|
||||
*/
|
||||
public void simpleDeclarationEnd(Object declaration) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#parameterDeclarationBegin(java.lang.Object)
|
||||
*/
|
||||
public Object parameterDeclarationBegin(Object Container) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -86,31 +69,24 @@ public class NullParserCallback implements IParserCallback {
|
|||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#parameterDeclarationEnd(java.lang.Object)
|
||||
*/
|
||||
public void parameterDeclarationEnd(Object declaration) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#nameBegin(org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public void nameBegin(Token firstToken) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#nameEnd(org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public void nameEnd(Token lastToken) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#declaratorBegin(java.lang.Object)
|
||||
*/
|
||||
public Object declaratorBegin(Object container) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -118,47 +94,36 @@ public class NullParserCallback implements IParserCallback {
|
|||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#declaratorId(java.lang.Object)
|
||||
*/
|
||||
public void declaratorId(Object declarator) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#declaratorAbort(java.lang.Object, java.lang.Object)
|
||||
*/
|
||||
public void declaratorAbort(Object container, Object declarator) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#declaratorCVModifier(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public void declaratorCVModifier(Object declarator, Token modifier) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#declaratorThrowExceptionName(java.lang.Object)
|
||||
*/
|
||||
public void declaratorThrowExceptionName(Object exceptionSpec) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#declaratorEnd(java.lang.Object)
|
||||
*/
|
||||
public void declaratorEnd(Object declarator) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#arrayDeclaratorBegin(java.lang.Object)
|
||||
*/
|
||||
public Object arrayDeclaratorBegin(Object declarator) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -166,14 +131,12 @@ public class NullParserCallback implements IParserCallback {
|
|||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#arrayDeclaratorEnd(java.lang.Object)
|
||||
*/
|
||||
public void arrayDeclaratorEnd(Object arrayQualifier) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#pointerOperatorBegin(java.lang.Object)
|
||||
*/
|
||||
public Object pointerOperatorBegin(Object container) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -181,39 +144,30 @@ public class NullParserCallback implements IParserCallback {
|
|||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#pointerOperatorType(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public void pointerOperatorType(Object ptrOperator, Token type) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#pointerOperatorName(java.lang.Object)
|
||||
*/
|
||||
public void pointerOperatorName(Object ptrOperator) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#pointerOperatorCVModifier(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public void pointerOperatorCVModifier(Object ptrOperator, Token modifier) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#pointerOperatorEnd(java.lang.Object)
|
||||
*/
|
||||
public void pointerOperatorEnd(Object ptrOperator) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#argumentsBegin(java.lang.Object)
|
||||
*/
|
||||
public Object argumentsBegin(Object declarator) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -221,15 +175,12 @@ public class NullParserCallback implements IParserCallback {
|
|||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#argumentsEnd(java.lang.Object)
|
||||
*/
|
||||
public void argumentsEnd(Object parameterDeclarationClause) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#functionBodyBegin(java.lang.Object)
|
||||
*/
|
||||
public Object functionBodyBegin(Object declaration) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -237,15 +188,12 @@ public class NullParserCallback implements IParserCallback {
|
|||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#functionBodyEnd(java.lang.Object)
|
||||
*/
|
||||
public void functionBodyEnd(Object functionBody) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#classSpecifierBegin(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public Object classSpecifierBegin(Object container, Token classKey) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -253,47 +201,36 @@ public class NullParserCallback implements IParserCallback {
|
|||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#classSpecifierName(java.lang.Object)
|
||||
*/
|
||||
public void classSpecifierName(Object classSpecifier) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#classSpecifierAbort(java.lang.Object)
|
||||
*/
|
||||
public void classSpecifierAbort(Object classSpecifier) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#classSpecifierSafe(java.lang.Object)
|
||||
*/
|
||||
public void classSpecifierSafe(Object classSpecifier) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#classMemberVisibility(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public void classMemberVisibility(Object classSpecifier, Token visibility) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#classSpecifierEnd(java.lang.Object)
|
||||
*/
|
||||
public void classSpecifierEnd(Object classSpecifier) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#baseSpecifierBegin(java.lang.Object)
|
||||
*/
|
||||
public Object baseSpecifierBegin(Object containingClassSpec) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -301,79 +238,61 @@ public class NullParserCallback implements IParserCallback {
|
|||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#baseSpecifierName(java.lang.Object)
|
||||
*/
|
||||
public void baseSpecifierName(Object baseSpecifier) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#baseSpecifierVisibility(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public void baseSpecifierVisibility(Object baseSpecifier, Token visibility) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#baseSpecifierVirtual(java.lang.Object, boolean)
|
||||
*/
|
||||
public void baseSpecifierVirtual(Object baseSpecifier, boolean virtual) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#baseSpecifierEnd(java.lang.Object)
|
||||
*/
|
||||
public void baseSpecifierEnd(Object baseSpecifier) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#expressionBegin(java.lang.Object)
|
||||
*/
|
||||
public Object expressionBegin(Object container) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#expressionOperator(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public void expressionOperator(Object expression, Token operator) throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
public void expressionOperator(Object expression, Token operator) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#expressionTerminal(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public void expressionTerminal(Object expression, Token terminal) throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
public void expressionTerminal(Object expression, Token terminal) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#expressionAbort(java.lang.Object)
|
||||
*/
|
||||
public void expressionAbort(Object expression) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#expressionEnd(java.lang.Object)
|
||||
*/
|
||||
public void expressionEnd(Object expression) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#elaboratedTypeSpecifierBegin(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token)
|
||||
*/
|
||||
public Object elaboratedTypeSpecifierBegin(Object container, Token classKey) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -381,24 +300,170 @@ public class NullParserCallback implements IParserCallback {
|
|||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#elaboratedTypeSpecifierName(java.lang.Object)
|
||||
*/
|
||||
public void elaboratedTypeSpecifierName(Object elab) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#elaboratedTypeSpecifierEnd(java.lang.Object)
|
||||
*/
|
||||
public void elaboratedTypeSpecifierEnd(Object elab) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#declaratorThrowsException(java.lang.Object)
|
||||
*/
|
||||
public void declaratorThrowsException(Object declarator) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#namespaceDeclarationBegin(java.lang.Object)
|
||||
*/
|
||||
public Object namespaceDefinitionBegin(Object container) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#namespaceDeclarationId(java.lang.Object)
|
||||
*/
|
||||
public void namespaceDefinitionId(Object namespace) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#namespaceDeclarationAbort(java.lang.Object)
|
||||
*/
|
||||
public void namespaceDefinitionAbort(Object namespace) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#namespaceDeclarationEnd(java.lang.Object)
|
||||
*/
|
||||
public void namespaceDefinitionEnd(Object namespace) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#linkageSpecificationBegin(java.lang.Object, java.lang.String)
|
||||
*/
|
||||
public Object linkageSpecificationBegin(Object container, String literal) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#linkageSpecificationEnd(java.lang.Object)
|
||||
*/
|
||||
public void linkageSpecificationEnd(Object linkageSpec) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDirectiveBegin(java.lang.Object)
|
||||
*/
|
||||
public Object usingDirectiveBegin(Object container) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDirectiveNamespaceId(java.lang.Object)
|
||||
*/
|
||||
public void usingDirectiveNamespaceId(Object container) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDirectiveEnd(java.lang.Object)
|
||||
*/
|
||||
public void usingDirectiveEnd(Object directive) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDeclarationBegin(java.lang.Object)
|
||||
*/
|
||||
public Object usingDeclarationBegin(Object container) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDeclarationMapping(java.lang.Object)
|
||||
*/
|
||||
public void usingDeclarationMapping(Object container, boolean isTypename) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDeclarationEnd(java.lang.Object)
|
||||
*/
|
||||
public void usingDeclarationEnd(Object directive) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDirectiveAbort(java.lang.Object)
|
||||
*/
|
||||
public void usingDirectiveAbort(Object directive) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#usingDeclarationAbort(java.lang.Object)
|
||||
*/
|
||||
public void usingDeclarationAbort(Object declaration) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumSpecifierBegin(java.lang.Object)
|
||||
*/
|
||||
public Object enumSpecifierBegin(Object container) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumSpecifierId(java.lang.Object)
|
||||
*/
|
||||
public void enumSpecifierId(Object enumSpec) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumSpecifierAbort(java.lang.Object)
|
||||
*/
|
||||
public void enumSpecifierAbort(Object enumSpec) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumSpecifierEnd(java.lang.Object)
|
||||
*/
|
||||
public void enumSpecifierEnd(Object enumSpec) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumDefinitionBegin(java.lang.Object)
|
||||
*/
|
||||
public Object enumDefinitionBegin(Object enumSpec) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumDefinitionId(java.lang.Object)
|
||||
*/
|
||||
public void enumDefinitionId(Object enumDefn) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IParserCallback#enumDefinitionEnd(java.lang.Object)
|
||||
*/
|
||||
public void enumDefinitionEnd(Object enumDefn) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ c, quick);
|
|||
|
||||
private static int parseCount = 0;
|
||||
|
||||
public boolean parse() throws Exception {
|
||||
public boolean parse() throws Backtrack {
|
||||
long startTime = System.currentTimeMillis();
|
||||
translationUnit();
|
||||
System.out.println("Parse " + (++parseCount) + ": "
|
||||
|
@ -74,7 +74,7 @@ c, quick);
|
|||
* : (declaration)*
|
||||
*
|
||||
*/
|
||||
protected void translationUnit() throws Exception {
|
||||
protected void translationUnit() throws Backtrack {
|
||||
Object translationUnit = callback.translationUnitBegin();
|
||||
Token lastBacktrack = null;
|
||||
Token lastToken;
|
||||
|
@ -113,6 +113,137 @@ c, quick);
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* The merger of using-declaration and using-directive.
|
||||
*
|
||||
* using-declaration:
|
||||
* using typename? ::? nested-name-specifier unqualified-id ;
|
||||
* using :: unqualified-id ;
|
||||
* using-directive:
|
||||
* using namespace ::? nested-name-specifier? namespace-name ;
|
||||
*
|
||||
* @param container
|
||||
* @throws Backtrack
|
||||
*/
|
||||
protected void usingClause( Object container ) throws Backtrack
|
||||
{
|
||||
consume( Token.t_using );
|
||||
|
||||
if( LT(1) == Token.t_namespace )
|
||||
{
|
||||
Object directive = callback.usingDirectiveBegin( container );
|
||||
// using-directive
|
||||
consume( Token.t_namespace );
|
||||
|
||||
// optional :: and nested classes handled in name
|
||||
if( LT(1) == Token.tIDENTIFIER || LT(1) == Token.tCOLONCOLON )
|
||||
{
|
||||
name();
|
||||
callback.usingDirectiveNamespaceId( directive );
|
||||
}
|
||||
else
|
||||
{
|
||||
callback.usingDirectiveAbort(directive);
|
||||
throw backtrack;
|
||||
}
|
||||
|
||||
if( LT(1) == Token.tSEMI )
|
||||
{
|
||||
consume( Token.tSEMI );
|
||||
callback.usingDirectiveEnd( directive );
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
callback.usingDirectiveAbort(directive);
|
||||
throw backtrack;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Object usingDeclaration = callback.usingDeclarationBegin( container );
|
||||
|
||||
boolean typeName = false;
|
||||
if( LT(1) == Token.t_typename )
|
||||
{
|
||||
typeName = true;
|
||||
consume( Token.t_typename );
|
||||
}
|
||||
|
||||
if( LT(1) == Token.tIDENTIFIER || LT(1) == Token.tCOLONCOLON )
|
||||
{
|
||||
// optional :: and nested classes handled in name
|
||||
name();
|
||||
callback.usingDeclarationMapping( usingDeclaration, typeName );
|
||||
}
|
||||
else
|
||||
{
|
||||
callback.usingDeclarationAbort( usingDeclaration );
|
||||
throw backtrack;
|
||||
}
|
||||
|
||||
if( LT(1) == Token.tSEMI )
|
||||
{
|
||||
consume( Token.tSEMI );
|
||||
callback.usingDeclarationEnd( usingDeclaration );
|
||||
}
|
||||
else
|
||||
{
|
||||
callback.usingDeclarationAbort( usingDeclaration );
|
||||
throw backtrack;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* linkageSpecification
|
||||
* : extern "string literal" declaration
|
||||
* | extern "string literal" { declaration-seq }
|
||||
* @param container
|
||||
* @throws Exception
|
||||
*/
|
||||
protected void linkageSpecification( Object container ) throws Backtrack
|
||||
{
|
||||
consume( Token.t_extern );
|
||||
|
||||
if( LT(1) != Token.tSTRING )
|
||||
throw backtrack;
|
||||
|
||||
Object linkageSpec = callback.linkageSpecificationBegin( container, consume( Token.tSTRING ).getImage() );
|
||||
|
||||
if( LT(1) == Token.tLBRACE )
|
||||
{
|
||||
consume(Token.tLBRACE);
|
||||
linkageDeclarationLoop:
|
||||
while (LT(1) != Token.tRBRACE) {
|
||||
Token lastToken = LA(1);
|
||||
switch (LT(1)) {
|
||||
case Token.tRBRACE:
|
||||
consume(Token.tRBRACE);
|
||||
break linkageDeclarationLoop;
|
||||
default:
|
||||
declaration(linkageSpec);
|
||||
}
|
||||
if (lastToken == LA(1))
|
||||
consumeToNextSemicolon();
|
||||
}
|
||||
// consume the }
|
||||
consume();
|
||||
callback.linkageSpecificationEnd( linkageSpec );
|
||||
}
|
||||
else // single declaration
|
||||
{
|
||||
declaration( linkageSpec );
|
||||
callback.linkageSpecificationEnd( linkageSpec );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* declaration
|
||||
* : {"asm"} asmDefinition
|
||||
|
@ -131,19 +262,17 @@ c, quick);
|
|||
* - explicitInstantiation and explicitSpecialization into
|
||||
* templateDeclaration
|
||||
*/
|
||||
protected void declaration( Object container ) throws Exception {
|
||||
protected void declaration( Object container ) throws Backtrack {
|
||||
switch (LT(1)) {
|
||||
case Token.t_asm:
|
||||
// asmDefinition( );
|
||||
consume();
|
||||
return;
|
||||
case Token.t_namespace:
|
||||
// namespaceDefinition();
|
||||
consume();
|
||||
namespaceDefinition( container );
|
||||
return;
|
||||
case Token.t_using:
|
||||
// usingDeclaration();
|
||||
consume();
|
||||
usingClause( container );
|
||||
return;
|
||||
case Token.t_export:
|
||||
case Token.t_template:
|
||||
|
@ -151,19 +280,61 @@ c, quick);
|
|||
consume();
|
||||
return;
|
||||
case Token.t_extern:
|
||||
if (LT(2) == Token.tSTRING)
|
||||
{
|
||||
// linkageSpecification();
|
||||
consume();
|
||||
return;
|
||||
}
|
||||
|
||||
// else drop through
|
||||
linkageSpecification( container );
|
||||
return;
|
||||
default:
|
||||
simpleDeclaration( container );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* namespaceDefinition()
|
||||
*
|
||||
* namespace-definition:
|
||||
* namespace identifier { namespace-body } | namespace { namespace-body }
|
||||
* namespace-body:
|
||||
* declaration-seq?
|
||||
*
|
||||
*/
|
||||
|
||||
protected void namespaceDefinition( Object container ) throws Backtrack
|
||||
{
|
||||
consume( Token.t_namespace);
|
||||
Object namespace = callback.namespaceDefinitionBegin( container );
|
||||
|
||||
// optional name
|
||||
if( LT(1) == Token.tIDENTIFIER )
|
||||
{
|
||||
name();
|
||||
callback.namespaceDefinitionId( namespace );
|
||||
}
|
||||
|
||||
if( LT(1) == Token.tLBRACE )
|
||||
{
|
||||
consume();
|
||||
namepsaceDeclarationLoop:
|
||||
while (LT(1) != Token.tRBRACE) {
|
||||
Token lastToken = LA(1);
|
||||
switch (LT(1)) {
|
||||
case Token.tRBRACE:
|
||||
consume(Token.tRBRACE);
|
||||
break namepsaceDeclarationLoop;
|
||||
default:
|
||||
declaration(namespace);
|
||||
}
|
||||
if (lastToken == LA(1))
|
||||
consumeToNextSemicolon();
|
||||
}
|
||||
// consume the }
|
||||
consume();
|
||||
callback.namespaceDefinitionEnd( namespace );
|
||||
}
|
||||
else
|
||||
{
|
||||
callback.namespaceDefinitionAbort( namespace );
|
||||
throw backtrack;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
@ -177,7 +348,7 @@ c, quick);
|
|||
* To do:
|
||||
* - work in ctorInitializer and functionTryBlock
|
||||
*/
|
||||
protected void simpleDeclaration( Object container ) throws Exception {
|
||||
protected void simpleDeclaration( Object container ) throws Backtrack {
|
||||
Object simpleDecl = callback.simpleDeclarationBegin( container);
|
||||
declSpecifierSeq(simpleDecl, false);
|
||||
|
||||
|
@ -240,7 +411,7 @@ c, quick);
|
|||
}
|
||||
|
||||
|
||||
protected void parameterDeclaration( Object containerObject ) throws Exception
|
||||
protected void parameterDeclaration( Object containerObject ) throws Backtrack
|
||||
{
|
||||
Object parameterDecl = callback.parameterDeclarationBegin( containerObject );
|
||||
declSpecifierSeq( parameterDecl, true );
|
||||
|
@ -274,7 +445,7 @@ c, quick);
|
|||
* - folded elaboratedTypeSpecifier into classSpecifier and enumSpecifier
|
||||
* - find template names in name
|
||||
*/
|
||||
protected void declSpecifierSeq( Object decl, boolean parm ) throws Exception {
|
||||
protected void declSpecifierSeq( Object decl, boolean parm ) throws Backtrack {
|
||||
boolean encounteredTypename = false;
|
||||
boolean encounteredRawType = false;
|
||||
declSpecifiers:
|
||||
|
@ -345,16 +516,35 @@ c, quick);
|
|||
name();
|
||||
callback.elaboratedTypeSpecifierName( elab );
|
||||
callback.elaboratedTypeSpecifierEnd( elab );
|
||||
|
||||
break;
|
||||
}
|
||||
case Token.t_enum:
|
||||
enumSpecifier(decl);
|
||||
try
|
||||
{
|
||||
enumSpecifier(decl);
|
||||
return;
|
||||
}
|
||||
catch( Backtrack bt )
|
||||
{
|
||||
// this is an elaborated class specifier
|
||||
Object elab = callback.elaboratedTypeSpecifierBegin( decl, consume() );
|
||||
name();
|
||||
callback.elaboratedTypeSpecifierName( elab );
|
||||
callback.elaboratedTypeSpecifierEnd( elab );
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break declSpecifiers;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void identifier() throws Backtrack {
|
||||
Token first = consume(Token.tIDENTIFIER); // throws backtrack if its not that
|
||||
callback.nameBegin(first);
|
||||
callback.nameEnd(first);
|
||||
}
|
||||
|
||||
/**
|
||||
* name
|
||||
|
@ -367,7 +557,7 @@ c, quick);
|
|||
* - Handle template ids
|
||||
* - Handle unqualifiedId
|
||||
*/
|
||||
protected boolean name() throws Exception {
|
||||
protected void name() throws Backtrack {
|
||||
Token first = LA(1);
|
||||
Token last = null;
|
||||
|
||||
|
@ -402,14 +592,13 @@ c, quick);
|
|||
|
||||
callback.nameEnd(last);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* cvQualifier
|
||||
* : "const" | "volatile"
|
||||
*/
|
||||
protected void cvQualifier( Object ptrOp ) throws Exception {
|
||||
protected void cvQualifier( Object ptrOp ) throws Backtrack {
|
||||
switch (LT(1)) {
|
||||
case Token.t_const:
|
||||
case Token.t_volatile:
|
||||
|
@ -427,7 +616,7 @@ c, quick);
|
|||
* To Do:
|
||||
* - handle initializers
|
||||
*/
|
||||
protected void initDeclarator( Object owner ) throws Exception {
|
||||
protected void initDeclarator( Object owner ) throws Backtrack {
|
||||
Object declarator = declarator( owner );
|
||||
|
||||
// handle = initializerClause
|
||||
|
@ -503,7 +692,7 @@ c, quick);
|
|||
* declaratorId
|
||||
* : name
|
||||
*/
|
||||
protected Object declarator( Object container ) throws Exception {
|
||||
protected Object declarator( Object container ) throws Backtrack {
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -632,7 +821,7 @@ c, quick);
|
|||
* | "&"
|
||||
* | name "*" (cvQualifier)*
|
||||
*/
|
||||
protected void ptrOperator(Object owner) throws Exception {
|
||||
protected void ptrOperator(Object owner) throws Backtrack {
|
||||
int t = LT(1);
|
||||
Object ptrOp = callback.pointerOperatorBegin( owner );
|
||||
|
||||
|
@ -671,46 +860,84 @@ c, quick);
|
|||
|
||||
|
||||
/**
|
||||
* enumSpecifier
|
||||
* "enum" (name)? "{" (enumerator-list) "}"
|
||||
* enumSpecifier:
|
||||
* "enum" (name)? "{" (enumerator-list) "}"
|
||||
* enumerator-list:
|
||||
* enumerator-definition
|
||||
* enumerator-list , enumerator-definition
|
||||
* enumerator-definition:
|
||||
* enumerator
|
||||
* enumerator = constant-expression
|
||||
* enumerator: identifier
|
||||
*/
|
||||
protected void enumSpecifier( Object owner ) throws Exception
|
||||
protected void enumSpecifier( Object owner ) throws Backtrack
|
||||
{
|
||||
if( LT(1) != Token.t_enum )
|
||||
throw backtrack;
|
||||
consume();
|
||||
consume( Token.t_enum );
|
||||
|
||||
// insert beginEnum callback here
|
||||
Object enumSpecifier = callback.enumSpecifierBegin( owner );
|
||||
|
||||
if( LT(1) == Token.tIDENTIFIER )
|
||||
consume();
|
||||
if( LT(1) == Token.tIDENTIFIER )
|
||||
{
|
||||
identifier();
|
||||
callback.enumSpecifierId( enumSpecifier );
|
||||
}
|
||||
|
||||
|
||||
if( LT(1) == Token.tLBRACE )
|
||||
{
|
||||
consume();
|
||||
// for the time being to get the CModel working ignore the enumerator list
|
||||
int depth = 1;
|
||||
while (depth > 0) {
|
||||
switch (consume().getType()) {
|
||||
case Token.tRBRACE:
|
||||
--depth;
|
||||
break;
|
||||
case Token.tLBRACE:
|
||||
++depth;
|
||||
break;
|
||||
consume( Token.tLBRACE );
|
||||
|
||||
while( LT(1) != Token.tRBRACE )
|
||||
{
|
||||
Object defn;
|
||||
if( LT(1) == Token.tIDENTIFIER )
|
||||
{
|
||||
defn = callback.enumDefinitionBegin( enumSpecifier );
|
||||
identifier();
|
||||
callback.enumDefinitionId( defn );
|
||||
}
|
||||
else
|
||||
{
|
||||
callback.enumSpecifierAbort( enumSpecifier );
|
||||
throw backtrack;
|
||||
}
|
||||
|
||||
if( LT(1) == Token.tASSIGN )
|
||||
{
|
||||
consume( Token.tASSIGN );
|
||||
Object expression = callback.expressionBegin( defn );
|
||||
constantExpression( expression );
|
||||
callback.expressionEnd( expression );
|
||||
}
|
||||
|
||||
callback.enumDefinitionEnd( defn );
|
||||
|
||||
if( LT(1) == Token.tRBRACE )
|
||||
break;
|
||||
|
||||
if( LT(1) != Token.tCOMMA )
|
||||
{
|
||||
callback.enumSpecifierAbort( enumSpecifier );
|
||||
throw backtrack;
|
||||
}
|
||||
consume(Token.tCOMMA); // if we made it this far
|
||||
}
|
||||
consume( Token.tRBRACE );
|
||||
|
||||
callback.enumSpecifierEnd( enumSpecifier );
|
||||
}
|
||||
else
|
||||
{
|
||||
// enumSpecifierAbort
|
||||
throw backtrack;
|
||||
}
|
||||
|
||||
// insert endEnum callback here
|
||||
}
|
||||
|
||||
/**
|
||||
* classSpecifier
|
||||
* : classKey name (baseClause)? "{" (memberSpecification)* "}"
|
||||
*/
|
||||
protected void classSpecifier( Object owner ) throws Exception {
|
||||
protected void classSpecifier( Object owner ) throws Backtrack {
|
||||
Token classKey = null;
|
||||
|
||||
Token mark = mark();
|
||||
|
@ -756,7 +983,7 @@ c, quick);
|
|||
|
||||
memberDeclarationLoop:
|
||||
while (LT(1) != Token.tRBRACE) {
|
||||
Token lastToken = currToken;
|
||||
Token lastToken = LA(1);
|
||||
|
||||
switch (LT(1)) {
|
||||
case Token.t_public:
|
||||
|
@ -771,7 +998,7 @@ c, quick);
|
|||
default:
|
||||
declaration(classSpec);
|
||||
}
|
||||
if (lastToken == currToken)
|
||||
if (lastToken == LA(1))
|
||||
consumeToNextSemicolon();
|
||||
}
|
||||
// consume the }
|
||||
|
@ -781,7 +1008,7 @@ c, quick);
|
|||
callback.classSpecifierEnd(classSpec);
|
||||
}
|
||||
|
||||
protected void baseSpecifier( Object classSpecOwner ) throws Exception {
|
||||
protected void baseSpecifier( Object classSpecOwner ) throws Backtrack {
|
||||
|
||||
Object baseSpecifier = callback.baseSpecifierBegin( classSpecOwner );
|
||||
|
||||
|
@ -795,8 +1022,7 @@ c, quick);
|
|||
case Token.t_public:
|
||||
case Token.t_protected:
|
||||
case Token.t_private:
|
||||
callback.baseSpecifierVisibility( baseSpecifier, currToken );
|
||||
consume();
|
||||
callback.baseSpecifierVisibility( baseSpecifier, consume() );
|
||||
break;
|
||||
case Token.tCOLONCOLON:
|
||||
case Token.tIDENTIFIER:
|
||||
|
@ -815,12 +1041,12 @@ c, quick);
|
|||
callback.baseSpecifierEnd( baseSpecifier );
|
||||
}
|
||||
|
||||
protected void functionBody() throws Exception {
|
||||
protected void functionBody() throws Backtrack {
|
||||
compoundStatement();
|
||||
}
|
||||
|
||||
// Statements
|
||||
protected void statement() throws Exception {
|
||||
protected void statement() throws Backtrack {
|
||||
Object expression = null;
|
||||
switch (LT(1)) {
|
||||
case Token.t_case:
|
||||
|
@ -952,15 +1178,15 @@ c, quick);
|
|||
}
|
||||
}
|
||||
|
||||
protected void condition() throws Exception {
|
||||
protected void condition() throws Backtrack {
|
||||
// TO DO
|
||||
}
|
||||
|
||||
protected void forInitStatement() throws Exception {
|
||||
protected void forInitStatement() throws Backtrack {
|
||||
// TO DO
|
||||
}
|
||||
|
||||
protected void compoundStatement() throws Exception {
|
||||
protected void compoundStatement() throws Backtrack {
|
||||
consume(Token.tLBRACE);
|
||||
while (LT(1) != Token.tRBRACE)
|
||||
statement();
|
||||
|
@ -968,11 +1194,11 @@ c, quick);
|
|||
}
|
||||
|
||||
// Expressions
|
||||
protected void constantExpression( Object expression ) throws Exception {
|
||||
protected void constantExpression( Object expression ) throws Backtrack {
|
||||
conditionalExpression( expression );
|
||||
}
|
||||
|
||||
public void expression( Object expression ) throws Exception {
|
||||
public void expression( Object expression ) throws Backtrack {
|
||||
assignmentExpression( expression );
|
||||
|
||||
while (LT(1) == Token.tCOMMA) {
|
||||
|
@ -982,7 +1208,7 @@ c, quick);
|
|||
}
|
||||
}
|
||||
|
||||
protected void assignmentExpression( Object expression ) throws Exception {
|
||||
protected void assignmentExpression( Object expression ) throws Backtrack {
|
||||
if (LT(1) == Token.t_throw) {
|
||||
throwExpression(expression);
|
||||
return;
|
||||
|
@ -1010,7 +1236,7 @@ c, quick);
|
|||
}
|
||||
}
|
||||
|
||||
protected void throwExpression( Object expression ) throws Exception {
|
||||
protected void throwExpression( Object expression ) throws Backtrack {
|
||||
consume(Token.t_throw);
|
||||
|
||||
try {
|
||||
|
@ -1019,7 +1245,7 @@ c, quick);
|
|||
}
|
||||
}
|
||||
|
||||
protected boolean conditionalExpression( Object expression ) throws Exception {
|
||||
protected boolean conditionalExpression( Object expression ) throws Backtrack {
|
||||
logicalOrExpression( expression );
|
||||
|
||||
if (LT(1) == Token.tQUESTION) {
|
||||
|
@ -1032,7 +1258,7 @@ c, quick);
|
|||
return false;
|
||||
}
|
||||
|
||||
protected void logicalOrExpression( Object expression ) throws Exception {
|
||||
protected void logicalOrExpression( Object expression ) throws Backtrack {
|
||||
logicalAndExpression( expression );
|
||||
|
||||
while (LT(1) == Token.tOR) {
|
||||
|
@ -1042,7 +1268,7 @@ c, quick);
|
|||
}
|
||||
}
|
||||
|
||||
protected void logicalAndExpression( Object expression ) throws Exception {
|
||||
protected void logicalAndExpression( Object expression ) throws Backtrack {
|
||||
inclusiveOrExpression( expression );
|
||||
|
||||
while (LT(1) == Token.tAND) {
|
||||
|
@ -1052,7 +1278,7 @@ c, quick);
|
|||
}
|
||||
}
|
||||
|
||||
protected void inclusiveOrExpression( Object expression ) throws Exception {
|
||||
protected void inclusiveOrExpression( Object expression ) throws Backtrack {
|
||||
exclusiveOrExpression(expression);
|
||||
|
||||
while (LT(1) == Token.tBITOR) {
|
||||
|
@ -1062,7 +1288,7 @@ c, quick);
|
|||
}
|
||||
}
|
||||
|
||||
protected void exclusiveOrExpression( Object expression ) throws Exception {
|
||||
protected void exclusiveOrExpression( Object expression ) throws Backtrack {
|
||||
andExpression( expression );
|
||||
|
||||
while (LT(1) == Token.tXOR) {
|
||||
|
@ -1072,7 +1298,7 @@ c, quick);
|
|||
}
|
||||
}
|
||||
|
||||
protected void andExpression( Object expression ) throws Exception {
|
||||
protected void andExpression( Object expression ) throws Backtrack {
|
||||
equalityExpression(expression);
|
||||
|
||||
while (LT(1) == Token.tAMPER) {
|
||||
|
@ -1082,7 +1308,7 @@ c, quick);
|
|||
}
|
||||
}
|
||||
|
||||
protected void equalityExpression(Object expression) throws Exception {
|
||||
protected void equalityExpression(Object expression) throws Backtrack {
|
||||
relationalExpression(expression);
|
||||
|
||||
for (;;) {
|
||||
|
@ -1099,7 +1325,7 @@ c, quick);
|
|||
}
|
||||
}
|
||||
|
||||
protected void relationalExpression(Object expression) throws Exception {
|
||||
protected void relationalExpression(Object expression) throws Backtrack {
|
||||
shiftExpression(expression);
|
||||
|
||||
for (;;) {
|
||||
|
@ -1121,7 +1347,7 @@ c, quick);
|
|||
}
|
||||
}
|
||||
|
||||
protected void shiftExpression( Object expression ) throws Exception {
|
||||
protected void shiftExpression( Object expression ) throws Backtrack {
|
||||
additiveExpression(expression);
|
||||
|
||||
for (;;) {
|
||||
|
@ -1138,7 +1364,7 @@ c, quick);
|
|||
}
|
||||
}
|
||||
|
||||
protected void additiveExpression( Object expression ) throws Exception {
|
||||
protected void additiveExpression( Object expression ) throws Backtrack {
|
||||
multiplicativeExpression(expression);
|
||||
|
||||
for (;;) {
|
||||
|
@ -1155,7 +1381,7 @@ c, quick);
|
|||
}
|
||||
}
|
||||
|
||||
protected void multiplicativeExpression( Object expression ) throws Exception {
|
||||
protected void multiplicativeExpression( Object expression ) throws Backtrack {
|
||||
pmExpression( expression );
|
||||
|
||||
for (;;) {
|
||||
|
@ -1173,7 +1399,7 @@ c, quick);
|
|||
}
|
||||
}
|
||||
|
||||
protected void pmExpression( Object expression ) throws Exception {
|
||||
protected void pmExpression( Object expression ) throws Backtrack {
|
||||
castExpression( expression );
|
||||
|
||||
for (;;) {
|
||||
|
@ -1195,7 +1421,7 @@ c, quick);
|
|||
* : unaryExpression
|
||||
* | "(" typeId ")" castExpression
|
||||
*/
|
||||
protected void castExpression( Object expression ) throws Exception {
|
||||
protected void castExpression( Object expression ) throws Backtrack {
|
||||
// TO DO: we need proper symbol checkint to ensure type name
|
||||
if (false && LT(1) == Token.tLPAREN) {
|
||||
Token mark = mark();
|
||||
|
@ -1215,7 +1441,7 @@ c, quick);
|
|||
unaryExpression(expression);
|
||||
}
|
||||
|
||||
protected void typeId() throws Exception {
|
||||
protected void typeId() throws Backtrack {
|
||||
try {
|
||||
name();
|
||||
return;
|
||||
|
@ -1223,7 +1449,7 @@ c, quick);
|
|||
}
|
||||
}
|
||||
|
||||
protected void deleteExpression( Object expression ) throws Exception {
|
||||
protected void deleteExpression( Object expression ) throws Backtrack {
|
||||
if (LT(1) == Token.tCOLONCOLON) {
|
||||
// global scope
|
||||
consume();
|
||||
|
@ -1240,7 +1466,7 @@ c, quick);
|
|||
castExpression( expression );
|
||||
}
|
||||
|
||||
protected void newExpression( Object expression ) throws Exception {
|
||||
protected void newExpression( Object expression ) throws Backtrack {
|
||||
if (LT(1) == Token.tCOLONCOLON) {
|
||||
// global scope
|
||||
consume();
|
||||
|
@ -1251,7 +1477,7 @@ c, quick);
|
|||
//TODO: finish this horrible mess...
|
||||
}
|
||||
|
||||
protected void unaryExpression( Object expression ) throws Exception {
|
||||
protected void unaryExpression( Object expression ) throws Backtrack {
|
||||
switch (LT(1)) {
|
||||
case Token.tSTAR:
|
||||
case Token.tAMPER:
|
||||
|
@ -1298,7 +1524,7 @@ c, quick);
|
|||
}
|
||||
}
|
||||
|
||||
protected void postfixExpression( Object expression) throws Exception {
|
||||
protected void postfixExpression( Object expression) throws Backtrack {
|
||||
switch (LT(1)) {
|
||||
case Token.t_typename:
|
||||
consume();
|
||||
|
@ -1364,7 +1590,7 @@ c, quick);
|
|||
}
|
||||
}
|
||||
|
||||
protected void primaryExpression( Object expression ) throws Exception {
|
||||
protected void primaryExpression( Object expression ) throws Backtrack {
|
||||
int type = LT(1);
|
||||
switch (type) {
|
||||
// TO DO: we need more literals...
|
||||
|
@ -1507,7 +1733,7 @@ c, quick);
|
|||
}
|
||||
|
||||
// Utility routines that require a knowledge of the grammar
|
||||
protected static String generateName(Token startToken) throws Exception {
|
||||
protected static String generateName(Token startToken) throws ParserException {
|
||||
Token currToken = startToken.getNext();
|
||||
|
||||
if (currToken == null || currToken.getType() != Token.tCOLONCOLON)
|
||||
|
|
|
@ -46,7 +46,7 @@ public class DeclSpecifier {
|
|||
|
||||
private boolean checkBit(int mask) {
|
||||
int masked =(declSpecifierSeq & mask);
|
||||
return (masked == 1);
|
||||
return (masked != 0);
|
||||
}
|
||||
|
||||
public void setAuto(boolean b) { setBit(b, isAuto); }
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2003-03-25 John Camelon
|
||||
Added testDeclSpecifier(), testNamespaceDefinition(), testLinkageSpecification(),
|
||||
testUsingClauses() and testEnumSpecifier() to DOMTests.
|
||||
|
||||
2003-03-23 John Camelon
|
||||
Added ptrOperator() test to DOMTests.
|
||||
Added testFunctionModifiers() test to DOMTests.
|
||||
|
|
|
@ -12,12 +12,18 @@ import org.eclipse.cdt.internal.core.dom.BaseSpecifier;
|
|||
import org.eclipse.cdt.internal.core.dom.ClassSpecifier;
|
||||
import org.eclipse.cdt.internal.core.dom.DOMBuilder;
|
||||
import org.eclipse.cdt.internal.core.dom.Declarator;
|
||||
import org.eclipse.cdt.internal.core.dom.EnumerationSpecifier;
|
||||
import org.eclipse.cdt.internal.core.dom.EnumeratorDefinition;
|
||||
import org.eclipse.cdt.internal.core.dom.Expression;
|
||||
import org.eclipse.cdt.internal.core.dom.LinkageSpecification;
|
||||
import org.eclipse.cdt.internal.core.dom.NamespaceDefinition;
|
||||
import org.eclipse.cdt.internal.core.dom.ParameterDeclaration;
|
||||
import org.eclipse.cdt.internal.core.dom.ParameterDeclarationClause;
|
||||
import org.eclipse.cdt.internal.core.dom.PointerOperator;
|
||||
import org.eclipse.cdt.internal.core.dom.SimpleDeclaration;
|
||||
import org.eclipse.cdt.internal.core.dom.TranslationUnit;
|
||||
import org.eclipse.cdt.internal.core.dom.UsingDeclaration;
|
||||
import org.eclipse.cdt.internal.core.dom.UsingDirective;
|
||||
import org.eclipse.cdt.internal.core.parser.Parser;
|
||||
import org.eclipse.cdt.internal.core.parser.ParserException;
|
||||
import org.eclipse.cdt.internal.core.parser.Token;
|
||||
|
@ -42,6 +48,228 @@ public class DOMTests extends TestCase {
|
|||
return domBuilder.getTranslationUnit();
|
||||
}
|
||||
|
||||
public void testNamespaceDefinition() throws Exception
|
||||
{
|
||||
for( int i = 0; i < 2; ++i )
|
||||
{
|
||||
TranslationUnit translationUnit;
|
||||
if( i == 0 )
|
||||
translationUnit = parse("namespace KingJohn { int x; }");
|
||||
else
|
||||
translationUnit = parse("namespace { int x; }");
|
||||
|
||||
List declarations = translationUnit.getDeclarations();
|
||||
assertEquals( declarations.size(), 1 );
|
||||
NamespaceDefinition namespace = (NamespaceDefinition)declarations.get(0);
|
||||
|
||||
if( i == 0 )
|
||||
assertEquals( namespace.getName().toString(), "KingJohn" );
|
||||
else
|
||||
assertNull( namespace.getName() );
|
||||
List namespaceDeclarations = namespace.getDeclarations();
|
||||
assertEquals( namespaceDeclarations.size(), 1 );
|
||||
SimpleDeclaration simpleDec = (SimpleDeclaration)namespaceDeclarations.get(0);
|
||||
assertEquals( simpleDec.getDeclSpecifier().getType(), DeclSpecifier.t_int );
|
||||
List declarators = simpleDec.getDeclarators();
|
||||
assertEquals( declarators.size(), 1 );
|
||||
Declarator declarator = (Declarator)declarators.get(0);
|
||||
assertEquals( declarator.getName().toString(), "x");
|
||||
}
|
||||
}
|
||||
|
||||
public void testLinkageSpecification() throws Exception
|
||||
{
|
||||
for( int i = 0; i < 2; ++i )
|
||||
{
|
||||
TranslationUnit translationUnit;
|
||||
if( i == 0 )
|
||||
translationUnit = parse("extern \"C\" { int x(void); }");
|
||||
else
|
||||
translationUnit = parse("extern \"ADA\" int x(void);");
|
||||
|
||||
List declarations = translationUnit.getDeclarations();
|
||||
assertEquals( declarations.size(), 1 );
|
||||
LinkageSpecification linkage = (LinkageSpecification)declarations.get(0);
|
||||
if( i == 0 )
|
||||
assertEquals( "C", linkage.getLanguageLinkage() );
|
||||
else
|
||||
assertEquals( "ADA", linkage.getLanguageLinkage() );
|
||||
|
||||
List subDeclarations = linkage.getDeclarations();
|
||||
assertEquals( subDeclarations.size(), 1 );
|
||||
|
||||
SimpleDeclaration simpleDec = (SimpleDeclaration)subDeclarations.get(0);
|
||||
assertEquals( simpleDec.getDeclSpecifier().getType(), DeclSpecifier.t_int );
|
||||
List declarators = simpleDec.getDeclarators();
|
||||
assertEquals( declarators.size(), 1 );
|
||||
Declarator declarator = (Declarator)declarators.get(0);
|
||||
assertEquals( declarator.getName().toString(), "x" );
|
||||
assertNotNull( declarator.getParms() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void testEnumSpecifier() throws Exception
|
||||
{
|
||||
Writer code = new StringWriter();
|
||||
code.write( "enum { yo, go = 3, away };\n");
|
||||
code.write( "enum hasAName { last = 666 };");
|
||||
TranslationUnit translationUnit = parse( code.toString() );
|
||||
List declarations = translationUnit.getDeclarations();
|
||||
assertEquals( declarations.size(), 2 );
|
||||
|
||||
SimpleDeclaration declaration1 = (SimpleDeclaration)declarations.get(0);
|
||||
EnumerationSpecifier enumSpecifier = (EnumerationSpecifier)declaration1.getTypeSpecifier();
|
||||
assertNull( enumSpecifier.getName() );
|
||||
List firstEnumItems = enumSpecifier.getEnumeratorDefinitions();
|
||||
assertEquals( 3, firstEnumItems.size());
|
||||
EnumeratorDefinition enumDef1_1 = (EnumeratorDefinition)firstEnumItems.get(0);
|
||||
assertEquals( enumDef1_1.getName().toString(), "yo" );
|
||||
assertNull( enumDef1_1.getExpression() );
|
||||
|
||||
EnumeratorDefinition enumDef1_2 = (EnumeratorDefinition)firstEnumItems.get(1);
|
||||
assertEquals( enumDef1_2.getName().toString(), "go" );
|
||||
assertNotNull( enumDef1_2.getExpression() );
|
||||
|
||||
EnumeratorDefinition enumDef1_3 = (EnumeratorDefinition)firstEnumItems.get(2);
|
||||
assertEquals( enumDef1_3.getName().toString(), "away" );
|
||||
assertNull( enumDef1_3.getExpression() );
|
||||
|
||||
SimpleDeclaration declaration2 = (SimpleDeclaration)declarations.get(1);
|
||||
EnumerationSpecifier enumSpecifier2 = (EnumerationSpecifier)declaration2.getTypeSpecifier();
|
||||
assertEquals( enumSpecifier2.getName().toString(), "hasAName" );
|
||||
|
||||
}
|
||||
public void testUsingClauses() throws Exception
|
||||
{
|
||||
Writer code = new StringWriter();
|
||||
|
||||
code.write("using namespace A::B::C;\n");
|
||||
code.write("using namespace C;\n");
|
||||
code.write("using B::f;\n");
|
||||
code.write("using ::f;\n");
|
||||
code.write("using typename crap::de::crap;");
|
||||
TranslationUnit translationUnit = parse(code.toString());
|
||||
|
||||
List declarations = translationUnit.getDeclarations();
|
||||
assertEquals( declarations.size(), 5 );
|
||||
|
||||
UsingDirective first, second;
|
||||
UsingDeclaration third, fourth, fifth;
|
||||
|
||||
first = (UsingDirective) declarations.get(0);
|
||||
assertEquals( first.getNamespaceName().toString(), "A::B::C" );
|
||||
|
||||
second = (UsingDirective) declarations.get(1);
|
||||
assertEquals( second.getNamespaceName().toString(), "C" );
|
||||
|
||||
third = (UsingDeclaration) declarations.get(2);
|
||||
assertEquals( third.getMappedName().toString(), "B::f" );
|
||||
assertFalse( third.isTypename() );
|
||||
|
||||
fourth = (UsingDeclaration) declarations.get(3);
|
||||
assertEquals( fourth.getMappedName().toString(), "::f" );
|
||||
assertFalse( fourth.isTypename() );
|
||||
|
||||
fifth = (UsingDeclaration) declarations.get(4);
|
||||
assertTrue( fifth.isTypename() );
|
||||
assertEquals( fifth.getMappedName().toString(), "crap::de::crap" );
|
||||
}
|
||||
|
||||
public void testDeclSpecifier() throws Exception
|
||||
{
|
||||
DeclSpecifier d = new DeclSpecifier();
|
||||
d.setTypedef( true );
|
||||
assertTrue( d.isTypedef() );
|
||||
d.setTypedef( false );
|
||||
assertFalse( d.isTypedef() );
|
||||
d.setAuto(true);
|
||||
assertTrue( d.isAuto() );
|
||||
d.setAuto(false);
|
||||
assertFalse( d.isAuto());
|
||||
d.setRegister(true);
|
||||
assertTrue( d.isRegister() );
|
||||
d.setRegister(false);
|
||||
assertFalse( d.isRegister() );
|
||||
d.setStatic(true);
|
||||
assertTrue( d.isStatic() );
|
||||
d.setStatic(false);
|
||||
assertFalse( d.isStatic() );
|
||||
|
||||
d.setExtern(true);
|
||||
assertTrue( d.isExtern() );
|
||||
d.setExtern(false);
|
||||
assertFalse( d.isExtern() );
|
||||
|
||||
d.setMutable(true);
|
||||
assertTrue( d.isMutable() );
|
||||
d.setMutable(false);
|
||||
assertFalse( d.isMutable() );
|
||||
|
||||
d.setInline(true);
|
||||
assertTrue( d.isInline() );
|
||||
d.setInline(false);
|
||||
assertFalse( d.isInline() );
|
||||
|
||||
d.setVirtual(true);
|
||||
assertTrue( d.isVirtual() );
|
||||
d.setVirtual(false);
|
||||
assertFalse( d.isVirtual() );
|
||||
|
||||
d.setExplicit(true);
|
||||
assertTrue( d.isExplicit() );
|
||||
d.setExplicit(false);
|
||||
assertFalse( d.isExplicit() );
|
||||
|
||||
d.setTypedef(true);
|
||||
assertTrue( d.isTypedef() );
|
||||
d.setTypedef(false);
|
||||
assertFalse( d.isTypedef() );
|
||||
|
||||
d.setFriend(true);
|
||||
assertTrue( d.isFriend());
|
||||
d.setFriend(false);
|
||||
assertFalse( d.isFriend());
|
||||
|
||||
d.setConst(true);
|
||||
assertTrue( d.isConst() );
|
||||
d.setConst(false);
|
||||
assertFalse( d.isConst() );
|
||||
|
||||
d.setVolatile(true);
|
||||
assertTrue( d.isVolatile() );
|
||||
d.setVolatile(false);
|
||||
assertFalse( d.isVolatile() );
|
||||
|
||||
d.setUnsigned(true);
|
||||
assertTrue( d.isUnsigned());
|
||||
d.setUnsigned(false);
|
||||
assertFalse( d.isUnsigned());
|
||||
|
||||
d.setShort(true);
|
||||
assertTrue( d.isShort());
|
||||
d.setShort(false);
|
||||
assertFalse( d.isShort());
|
||||
|
||||
d.setLong(true);
|
||||
assertTrue( d.isLong() );
|
||||
d.setLong(false);
|
||||
assertFalse( d.isLong() );
|
||||
|
||||
for( int i = 0; i <= 7; ++i )
|
||||
{
|
||||
d.setType( i );
|
||||
for( int j = 0; j <= 7; ++j )
|
||||
{
|
||||
if( j == i )
|
||||
assertTrue( d.getType() == j );
|
||||
else
|
||||
assertFalse( d.getType() == j );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test code: int x = 5;
|
||||
* Purpose: to test the simple decaration in it's simplest form.
|
||||
|
@ -176,17 +404,17 @@ public class DOMTests extends TestCase {
|
|||
BaseSpecifier bs = (BaseSpecifier)baseClasses.get( 0 );
|
||||
assertEquals( bs.getAccess(), BaseSpecifier.t_public );
|
||||
assertEquals( bs.isVirtual(), false );
|
||||
assertEquals( bs.getName(), "B" );
|
||||
assertEquals( bs.getName().toString(), "B" );
|
||||
|
||||
bs = (BaseSpecifier)baseClasses.get( 1 );
|
||||
assertEquals( bs.getAccess(), BaseSpecifier.t_private );
|
||||
assertEquals( bs.isVirtual(), false );
|
||||
assertEquals( bs.getName(), "C" );
|
||||
assertEquals( bs.getName().toString(), "C" );
|
||||
|
||||
bs = (BaseSpecifier)baseClasses.get( 2 );
|
||||
assertEquals( bs.getAccess(), BaseSpecifier.t_protected );
|
||||
assertEquals( bs.isVirtual(), true );
|
||||
assertEquals( bs.getName(), "D" );
|
||||
assertEquals( bs.getName().toString(), "D" );
|
||||
|
||||
|
||||
// Get the member declaration
|
||||
|
|
Loading…
Add table
Reference in a new issue