KDevelop API Documentation

TreeParser Class Reference

#include <TreeParser.hpp>

Inheritance diagram for TreeParser:

ComputeRecoveryPoints StoreWalker TagCreator List of all members.

Public Member Functions

 TreeParser ()
 TreeParser (const TreeParserSharedInputState &state)
virtual ~TreeParser ()
RefAST getAST () const
 Get the AST return value squirreled away in the parser.

virtual void match (RefAST t, const BitSet &b)
 Make sure current lookahead symbol matches the given set Throw an exception upon mismatch, which is catch by either the error handler or by the syntactic predicate.

virtual void setASTFactory (ASTFactory *factory)
 Specify the AST factory to be used during tree building.

virtual ASTFactorygetASTFactory () const
 Return pointer to ASTFactory.

virtual const char * getTokenName (int num) const =0
 Get the name for token 'num'.

virtual int getNumTokens () const =0
virtual void reportError (const RecognitionException &ex)
 Parser error-reporting function can be overridden in subclass.

virtual void reportError (const std::string &s)
 Parser error-reporting function can be overridden in subclass.

virtual void reportWarning (const std::string &s)
 Parser warning-reporting function can be overridden in subclass.

virtual void traceIndent ()
 These are used during when traceTreeParser commandline option is passed.

virtual void traceIn (const char *rname, RefAST t)
virtual void traceOut (const char *rname, RefAST t)
 TreeParser ()
virtual ~TreeParser ()
virtual void parseTranslationUnit (TranslationUnitAST *)
virtual void parseDeclaration (DeclarationAST *)
virtual void parseLinkageSpecification (LinkageSpecificationAST *)
virtual void parseNamespace (NamespaceAST *)
virtual void parseNamespaceAlias (NamespaceAliasAST *)
virtual void parseUsing (UsingAST *)
virtual void parseUsingDirective (UsingDirectiveAST *)
virtual void parseTypedef (TypedefAST *)
virtual void parseTemplateDeclaration (TemplateDeclarationAST *)
virtual void parseSimpleDeclaration (SimpleDeclarationAST *)
virtual void parseFunctionDefinition (FunctionDefinitionAST *)
virtual void parseLinkageBody (LinkageBodyAST *)
virtual void parseAccessDeclaration (AccessDeclarationAST *)
virtual void parseTypeSpecifier (TypeSpecifierAST *)
virtual void parseClassSpecifier (ClassSpecifierAST *)
virtual void parseEnumSpecifier (EnumSpecifierAST *)
virtual void parseElaboratedTypeSpecifier (ElaboratedTypeSpecifierAST *)

Static Public Member Functions

void panic ()
 Give panic message and exit the program. can be overridden in subclass.


Static Public Attributes

RefAST ASTNULL
 The AST Null object; the parsing cursor is set to this when it is found to be null.


Protected Member Functions

virtual void match (RefAST t, int ttype)
 Get the AST return value squirreled away in the parser.

virtual void matchNot (RefAST t, int ttype)

Protected Attributes

RefAST _retTree
 Where did this rule leave off parsing; avoids a return parameter.

RefAST returnAST
 AST return value for a rule is squirreled away here.

ASTFactoryastFactory
 AST support code; parser and treeparser delegate to this object.

TreeParserSharedInputState inputState
 The input state of this tree parser.

int traceDepth
 Used to keep track of indent depth with -traceTreeParser.


Private Member Functions

 TreeParser (const TreeParser &other)
TreeParseroperator= (const TreeParser &other)
 TreeParser (const TreeParser &source)
void operator= (const TreeParser &source)

Constructor & Destructor Documentation

TreeParser::TreeParser  ) 
 

Definition at line 20 of file TreeParser.cpp.

TreeParser::TreeParser const TreeParserSharedInputState state  ) 
 

Definition at line 25 of file TreeParser.cpp.

TreeParser::~TreeParser  )  [virtual]
 

Definition at line 30 of file TreeParser.cpp.

TreeParser::TreeParser const TreeParser other  )  [private]
 

TreeParser::TreeParser  ) 
 

virtual TreeParser::~TreeParser  )  [virtual]
 

TreeParser::TreeParser const TreeParser source  )  [private]
 


Member Function Documentation

RefAST TreeParser::getAST  )  const [inline]
 

Get the AST return value squirreled away in the parser.

Definition at line 29 of file TreeParser.hpp.

References RefAST.

virtual ASTFactory* TreeParser::getASTFactory  )  const [inline, virtual]
 

Return pointer to ASTFactory.

Definition at line 51 of file TreeParser.hpp.

virtual int TreeParser::getNumTokens  )  const [pure virtual]
 

virtual const char* TreeParser::getTokenName int  num  )  const [pure virtual]
 

Get the name for token 'num'.

void TreeParser::match RefAST  t,
int  ttype
[protected, virtual]
 

Get the AST return value squirreled away in the parser.

Definition at line 46 of file TreeParser.cpp.

References ASTNULL, and match().

void TreeParser::match RefAST  t,
const BitSet b
[virtual]
 

Make sure current lookahead symbol matches the given set Throw an exception upon mismatch, which is catch by either the error handler or by the syntactic predicate.

Definition at line 56 of file TreeParser.cpp.

References ASTNULL, match(), and BitSet::member().

Referenced by match().

void TreeParser::matchNot RefAST  t,
int  ttype
[protected, virtual]
 

Definition at line 63 of file TreeParser.cpp.

References ASTNULL, and matchNot().

Referenced by matchNot().

void TreeParser::operator= const TreeParser source  )  [private]
 

TreeParser& TreeParser::operator= const TreeParser other  )  [private]
 

void TreeParser::panic  )  [static]
 

Give panic message and exit the program. can be overridden in subclass.

Definition at line 71 of file TreeParser.cpp.

References ANTLR_USE_NAMESPACE, and endl().

void TreeParser::parseAccessDeclaration AccessDeclarationAST  )  [virtual]
 

Reimplemented in StoreWalker, and TagCreator.

Definition at line 202 of file tree_parser.cpp.

References parseAccessDeclaration().

Referenced by parseAccessDeclaration(), and parseDeclaration().

void TreeParser::parseClassSpecifier ClassSpecifierAST  )  [virtual]
 

Reimplemented in ComputeRecoveryPoints, StoreWalker, and TagCreator.

Definition at line 181 of file tree_parser.cpp.

References ClassSpecifierAST::declarationList(), parseClassSpecifier(), and parseDeclaration().

Referenced by parseClassSpecifier(), and parseTypeSpecifier().

void TreeParser::parseDeclaration DeclarationAST  )  [virtual]
 

Reimplemented in StoreWalker, and TagCreator.

Definition at line 43 of file tree_parser.cpp.

References AST::nodeType(), NodeType_AccessDeclaration, NodeType_FunctionDefinition, NodeType_LinkageSpecification, NodeType_Namespace, NodeType_NamespaceAlias, NodeType_SimpleDeclaration, NodeType_TemplateDeclaration, NodeType_Typedef, NodeType_Using, NodeType_UsingDirective, parseAccessDeclaration(), parseDeclaration(), parseFunctionDefinition(), parseLinkageSpecification(), parseNamespace(), parseNamespaceAlias(), parseSimpleDeclaration(), parseTemplateDeclaration(), parseTypedef(), parseUsing(), and parseUsingDirective().

Referenced by parseClassSpecifier(), parseDeclaration(), parseLinkageBody(), parseLinkageSpecification(), and parseTranslationUnit().

void TreeParser::parseElaboratedTypeSpecifier ElaboratedTypeSpecifierAST  )  [virtual]
 

Reimplemented in StoreWalker, and TagCreator.

Definition at line 196 of file tree_parser.cpp.

References parseElaboratedTypeSpecifier().

Referenced by parseElaboratedTypeSpecifier(), and parseTypeSpecifier().

void TreeParser::parseEnumSpecifier EnumSpecifierAST  )  [virtual]
 

Reimplemented in StoreWalker, and TagCreator.

Definition at line 190 of file tree_parser.cpp.

References parseEnumSpecifier().

Referenced by parseEnumSpecifier(), and parseTypeSpecifier().

void TreeParser::parseFunctionDefinition FunctionDefinitionAST  )  [virtual]
 

Reimplemented in ComputeRecoveryPoints, StoreWalker, and TagCreator.

Definition at line 147 of file tree_parser.cpp.

References parseFunctionDefinition().

Referenced by parseDeclaration(), and parseFunctionDefinition().

void TreeParser::parseLinkageBody LinkageBodyAST  )  [virtual]
 

Reimplemented in StoreWalker, and TagCreator.

Definition at line 153 of file tree_parser.cpp.

References LinkageBodyAST::declarationList(), parseDeclaration(), and parseLinkageBody().

Referenced by parseLinkageBody(), parseLinkageSpecification(), and parseNamespace().

void TreeParser::parseLinkageSpecification LinkageSpecificationAST  )  [virtual]
 

Reimplemented in StoreWalker.

Definition at line 94 of file tree_parser.cpp.

References LinkageSpecificationAST::declaration(), LinkageSpecificationAST::linkageBody(), parseDeclaration(), parseLinkageBody(), and parseLinkageSpecification().

Referenced by parseDeclaration(), and parseLinkageSpecification().

void TreeParser::parseNamespace NamespaceAST  )  [virtual]
 

Reimplemented in ComputeRecoveryPoints, StoreWalker, and TagCreator.

Definition at line 103 of file tree_parser.cpp.

References NamespaceAST::linkageBody(), parseLinkageBody(), and parseNamespace().

Referenced by parseDeclaration(), and parseNamespace().

void TreeParser::parseNamespaceAlias NamespaceAliasAST  )  [virtual]
 

Reimplemented in StoreWalker.

Definition at line 110 of file tree_parser.cpp.

References parseNamespaceAlias().

Referenced by parseDeclaration(), and parseNamespaceAlias().

void TreeParser::parseSimpleDeclaration SimpleDeclarationAST  )  [virtual]
 

Reimplemented in ComputeRecoveryPoints, StoreWalker, and TagCreator.

Definition at line 141 of file tree_parser.cpp.

References parseSimpleDeclaration().

Referenced by parseDeclaration(), and parseSimpleDeclaration().

void TreeParser::parseTemplateDeclaration TemplateDeclarationAST  )  [virtual]
 

Reimplemented in StoreWalker, and TagCreator.

Definition at line 135 of file tree_parser.cpp.

References parseTemplateDeclaration().

Referenced by parseDeclaration(), and parseTemplateDeclaration().

void TreeParser::parseTranslationUnit TranslationUnitAST  )  [virtual]
 

Reimplemented in ComputeRecoveryPoints, StoreWalker, and TagCreator.

Definition at line 31 of file tree_parser.cpp.

References TranslationUnitAST::declarationList(), parseDeclaration(), and parseTranslationUnit().

Referenced by parseTranslationUnit().

void TreeParser::parseTypedef TypedefAST  )  [virtual]
 

Reimplemented in StoreWalker, and TagCreator.

Definition at line 128 of file tree_parser.cpp.

References parseTypedef(), parseTypeSpecifier(), and TypedefAST::typeSpec().

Referenced by parseDeclaration(), and parseTypedef().

void TreeParser::parseTypeSpecifier TypeSpecifierAST  )  [virtual]
 

Reimplemented in StoreWalker.

Definition at line 162 of file tree_parser.cpp.

References AST::nodeType(), NodeType_ClassSpecifier, NodeType_ElaboratedTypeSpecifier, NodeType_EnumSpecifier, parseClassSpecifier(), parseElaboratedTypeSpecifier(), parseEnumSpecifier(), and parseTypeSpecifier().

Referenced by parseTypedef(), and parseTypeSpecifier().

void TreeParser::parseUsing UsingAST  )  [virtual]
 

Reimplemented in StoreWalker.

Definition at line 116 of file tree_parser.cpp.

References parseUsing().

Referenced by parseDeclaration(), and parseUsing().

void TreeParser::parseUsingDirective UsingDirectiveAST  )  [virtual]
 

Reimplemented in ComputeRecoveryPoints, StoreWalker, and TagCreator.

Definition at line 122 of file tree_parser.cpp.

References parseUsingDirective().

Referenced by parseDeclaration(), and parseUsingDirective().

void TreeParser::reportError const std::string &  s  )  [virtual]
 

Parser error-reporting function can be overridden in subclass.

Definition at line 84 of file TreeParser.cpp.

References ANTLR_USE_NAMESPACE, endl(), and reportError().

void TreeParser::reportError const RecognitionException ex  )  [virtual]
 

Parser error-reporting function can be overridden in subclass.

Definition at line 78 of file TreeParser.cpp.

References ANTLR_USE_NAMESPACE, endl(), reportError(), and RecognitionException::toString().

Referenced by reportError().

void TreeParser::reportWarning const std::string &  s  )  [virtual]
 

Parser warning-reporting function can be overridden in subclass.

Definition at line 90 of file TreeParser.cpp.

References ANTLR_USE_NAMESPACE, endl(), and reportWarning().

Referenced by reportWarning().

virtual void TreeParser::setASTFactory ASTFactory factory  )  [inline, virtual]
 

Specify the AST factory to be used during tree building.

(Compulsory) Setting the factory is compulsory (if you intend to modify the tree in the treeparser). The AST Factory is shared between parser (who builds the initial AST) and treeparser.

See also:
Parser::getASTFactory()

Definition at line 46 of file TreeParser.hpp.

void TreeParser::traceIn const char *  rname,
RefAST  t
[virtual]
 

Definition at line 102 of file TreeParser.cpp.

References ANTLR_USE_NAMESPACE, endl(), inputState, traceDepth, traceIn(), and traceIndent().

Referenced by traceIn(), and TreeParser::Tracer::Tracer().

void TreeParser::traceIndent  )  [virtual]
 

These are used during when traceTreeParser commandline option is passed.

Definition at line 96 of file TreeParser.cpp.

References ANTLR_USE_NAMESPACE, and traceDepth.

Referenced by traceIn(), and traceOut().

void TreeParser::traceOut const char *  rname,
RefAST  t
[virtual]
 

Definition at line 113 of file TreeParser.cpp.

References ANTLR_USE_NAMESPACE, endl(), inputState, traceDepth, traceIndent(), and traceOut().

Referenced by traceOut(), and TreeParser::Tracer::~Tracer().


Member Data Documentation

RefAST TreeParser::_retTree [protected]
 

Where did this rule leave off parsing; avoids a return parameter.

Definition at line 85 of file TreeParser.hpp.

ASTFactory* TreeParser::astFactory [protected]
 

AST support code; parser and treeparser delegate to this object.

Definition at line 89 of file TreeParser.hpp.

RefAST TreeParser::ASTNULL [static]
 

The AST Null object; the parsing cursor is set to this when it is found to be null.

This way, we can test the token type of a node without having to have tests for 0 everywhere.

Referenced by match(), and matchNot().

TreeParserSharedInputState TreeParser::inputState [protected]
 

The input state of this tree parser.

Definition at line 92 of file TreeParser.hpp.

Referenced by traceIn(), and traceOut().

RefAST TreeParser::returnAST [protected]
 

AST return value for a rule is squirreled away here.

Definition at line 87 of file TreeParser.hpp.

int TreeParser::traceDepth [protected]
 

Used to keep track of indent depth with -traceTreeParser.

Definition at line 95 of file TreeParser.hpp.

Referenced by traceIn(), traceIndent(), and traceOut().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for KDevelop Version 3.0.4.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Oct 6 17:39:31 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003