umbrello 2.34.70-5524f40e1
Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology
Public Member Functions | Private Member Functions | Private Attributes | List of all members
DebugLanguageParserHelper< SessionT, TokenStreamT, TokenT, LexerT, StartAstT, DebugVisitorT, TokenTextT > Class Template Reference
Collaboration diagram for DebugLanguageParserHelper< SessionT, TokenStreamT, TokenT, LexerT, StartAstT, DebugVisitorT, TokenTextT >:

Public Member Functions

 DebugLanguageParserHelper (const bool printAst, const bool printTokens)
 
bool parseFile (const QString &fileName)
 parse contents of a file More...
 
bool parseCode (const QString &code)
 parse code directly More...
 
Php::TokenStream * tokenStream ()
 
QString contents () const
 
QStringList dependencies () const
 
StartAstT * ast () const
 
void setFed (bool state)
 
bool wasFed ()
 

Private Member Functions

bool runSession (const QString &fileName=QString())
 
void printToken (int token, const LexerT &lexer) const
 

Private Attributes

SessionT m_session
 
const bool m_printAst
 
const bool m_printTokens
 
StartAstT * m_ast
 
QStringList m_dependencies
 
bool m_isFed
 

Detailed Description

template<class SessionT, class TokenStreamT, class TokenT, class LexerT, class StartAstT, class DebugVisitorT, TokenTextFunc TokenTextT>
class DebugLanguageParserHelper< SessionT, TokenStreamT, TokenT, LexerT, StartAstT, DebugVisitorT, TokenTextT >

This class is a pure helper to use for binaries that you can run on short snippets of test code or whole files and let it print the generated tokens or AST.

It should work fine for any KDevelop-PG-Qt based parser.

Parameters
SessionTthe parse session for your language.
TokenStreamTthe token stream for your language, based on KDevPG::TokenStreamBase.
TokenTthe token class for your language, based on KDevPG::Token.
LexerTthe Lexer for your language.
StartAstTthe AST node that is returned from SessionT::parse().
DebugVisitorTthe debug visitor for your language.
TokenToTextTfunction pointer to the function that returns a string representation for an integral token.

Constructor & Destructor Documentation

◆ DebugLanguageParserHelper()

template<class SessionT , class TokenStreamT , class TokenT , class LexerT , class StartAstT , class DebugVisitorT , TokenTextFunc TokenTextT>
DebugLanguageParserHelper< SessionT, TokenStreamT, TokenT, LexerT, StartAstT, DebugVisitorT, TokenTextT >::DebugLanguageParserHelper ( const bool  printAst,
const bool  printTokens 
)
inline

Member Function Documentation

◆ ast()

template<class SessionT , class TokenStreamT , class TokenT , class LexerT , class StartAstT , class DebugVisitorT , TokenTextFunc TokenTextT>
StartAstT * DebugLanguageParserHelper< SessionT, TokenStreamT, TokenT, LexerT, StartAstT, DebugVisitorT, TokenTextT >::ast ( ) const
inline

◆ contents()

template<class SessionT , class TokenStreamT , class TokenT , class LexerT , class StartAstT , class DebugVisitorT , TokenTextFunc TokenTextT>
QString DebugLanguageParserHelper< SessionT, TokenStreamT, TokenT, LexerT, StartAstT, DebugVisitorT, TokenTextT >::contents ( ) const
inline

◆ dependencies()

template<class SessionT , class TokenStreamT , class TokenT , class LexerT , class StartAstT , class DebugVisitorT , TokenTextFunc TokenTextT>
QStringList DebugLanguageParserHelper< SessionT, TokenStreamT, TokenT, LexerT, StartAstT, DebugVisitorT, TokenTextT >::dependencies ( ) const
inline

◆ parseCode()

template<class SessionT , class TokenStreamT , class TokenT , class LexerT , class StartAstT , class DebugVisitorT , TokenTextFunc TokenTextT>
bool DebugLanguageParserHelper< SessionT, TokenStreamT, TokenT, LexerT, StartAstT, DebugVisitorT, TokenTextT >::parseCode ( const QString &  code)
inline

parse code directly

Here is the call graph for this function:

◆ parseFile()

template<class SessionT , class TokenStreamT , class TokenT , class LexerT , class StartAstT , class DebugVisitorT , TokenTextFunc TokenTextT>
bool DebugLanguageParserHelper< SessionT, TokenStreamT, TokenT, LexerT, StartAstT, DebugVisitorT, TokenTextT >::parseFile ( const QString &  fileName)
inline

parse contents of a file

Here is the call graph for this function:

◆ printToken()

template<class SessionT , class TokenStreamT , class TokenT , class LexerT , class StartAstT , class DebugVisitorT , TokenTextFunc TokenTextT>
void DebugLanguageParserHelper< SessionT, TokenStreamT, TokenT, LexerT, StartAstT, DebugVisitorT, TokenTextT >::printToken ( int  token,
const LexerT &  lexer 
) const
inlineprivate
Here is the call graph for this function:

◆ runSession()

template<class SessionT , class TokenStreamT , class TokenT , class LexerT , class StartAstT , class DebugVisitorT , TokenTextFunc TokenTextT>
bool DebugLanguageParserHelper< SessionT, TokenStreamT, TokenT, LexerT, StartAstT, DebugVisitorT, TokenTextT >::runSession ( const QString &  fileName = QString())
inlineprivate

actually run the parse session

Here is the call graph for this function:

◆ setFed()

template<class SessionT , class TokenStreamT , class TokenT , class LexerT , class StartAstT , class DebugVisitorT , TokenTextFunc TokenTextT>
void DebugLanguageParserHelper< SessionT, TokenStreamT, TokenT, LexerT, StartAstT, DebugVisitorT, TokenTextT >::setFed ( bool  state)
inline

◆ tokenStream()

template<class SessionT , class TokenStreamT , class TokenT , class LexerT , class StartAstT , class DebugVisitorT , TokenTextFunc TokenTextT>
Php::TokenStream * DebugLanguageParserHelper< SessionT, TokenStreamT, TokenT, LexerT, StartAstT, DebugVisitorT, TokenTextT >::tokenStream ( )
inline

◆ wasFed()

template<class SessionT , class TokenStreamT , class TokenT , class LexerT , class StartAstT , class DebugVisitorT , TokenTextFunc TokenTextT>
bool DebugLanguageParserHelper< SessionT, TokenStreamT, TokenT, LexerT, StartAstT, DebugVisitorT, TokenTextT >::wasFed ( )
inline

Member Data Documentation

◆ m_ast

template<class SessionT , class TokenStreamT , class TokenT , class LexerT , class StartAstT , class DebugVisitorT , TokenTextFunc TokenTextT>
StartAstT* DebugLanguageParserHelper< SessionT, TokenStreamT, TokenT, LexerT, StartAstT, DebugVisitorT, TokenTextT >::m_ast
private

◆ m_dependencies

template<class SessionT , class TokenStreamT , class TokenT , class LexerT , class StartAstT , class DebugVisitorT , TokenTextFunc TokenTextT>
QStringList DebugLanguageParserHelper< SessionT, TokenStreamT, TokenT, LexerT, StartAstT, DebugVisitorT, TokenTextT >::m_dependencies
private

◆ m_isFed

template<class SessionT , class TokenStreamT , class TokenT , class LexerT , class StartAstT , class DebugVisitorT , TokenTextFunc TokenTextT>
bool DebugLanguageParserHelper< SessionT, TokenStreamT, TokenT, LexerT, StartAstT, DebugVisitorT, TokenTextT >::m_isFed
private

◆ m_printAst

template<class SessionT , class TokenStreamT , class TokenT , class LexerT , class StartAstT , class DebugVisitorT , TokenTextFunc TokenTextT>
const bool DebugLanguageParserHelper< SessionT, TokenStreamT, TokenT, LexerT, StartAstT, DebugVisitorT, TokenTextT >::m_printAst
private

◆ m_printTokens

template<class SessionT , class TokenStreamT , class TokenT , class LexerT , class StartAstT , class DebugVisitorT , TokenTextFunc TokenTextT>
const bool DebugLanguageParserHelper< SessionT, TokenStreamT, TokenT, LexerT, StartAstT, DebugVisitorT, TokenTextT >::m_printTokens
private

◆ m_session

template<class SessionT , class TokenStreamT , class TokenT , class LexerT , class StartAstT , class DebugVisitorT , TokenTextFunc TokenTextT>
SessionT DebugLanguageParserHelper< SessionT, TokenStreamT, TokenT, LexerT, StartAstT, DebugVisitorT, TokenTextT >::m_session
private

The documentation for this class was generated from the following file: