edbee - Qt Editor Library
Public Member Functions | Protected Member Functions | List of all members
edbee::TmLanguageParser Class Reference

For parsing a Textmate Language. More...

#include <tmlanguageparser.h>

+ Inheritance diagram for edbee::TmLanguageParser:
+ Collaboration diagram for edbee::TmLanguageParser:

Public Member Functions

 TmLanguageParser ()
 Parses a textmate language. More...
 
TextGrammarparse (QIODevice *device)
 reads the content of a single file More...
 
TextGrammarparse (const QFile &file)
 
TextGrammarparse (const QString &fileName)
 parses the given grammar file More...
 
- Public Member Functions inherited from edbee::BasePListParser
 BasePListParser ()
 The constructor for the parser. More...
 
virtual ~BasePListParser ()
 the default desctructor More...
 
QString lastErrorMessage () const
 Returns the last error message of the parsed file. More...
 

Protected Member Functions

void addCapturesToGrammarRule (TextGrammarRule *rule, QHash< QString, QVariant > captures, bool endCapture=false)
 sets the captures More...
 
void addPatternsToGrammarRule (TextGrammarRule *rule, QList< QVariant > patterns)
 Adds all patterns to the grammar rules. More...
 
TextGrammarRulecreateGrammarRule (TextGrammar *grammar, const QVariant &data)
 creates a grammar rue More...
 
TextGrammarcreateLanguage (QVariant &data)
 
- Protected Member Functions inherited from edbee::BasePListParser
void setLastErrorMessage (const QString &str)
 Sets the last error message. To correctly set the last error message while parsing please use raiseError. More...
 
bool beginParsing (QIODevice *device)
 Start the parsing of the plist. If it isn't a valid plist this method return false. (it only checks and reads the existence of <plist>) More...
 
bool endParsing ()
 Closes the parsers. More...
 
void raiseError (const QString &str)
 Call this method to raise an error and stop the xml parsing. More...
 
QList< QVariant > readList ()
 reads a list of qvariants More...
 
QHash< QString, QVariant > readDict ()
 reads a dictionary More...
 
QVariant readNextPlistType (int level=-1)
 reads the next plist type More...
 
bool readNextElement (const QString &name, int level=-1)
 Reads the next element and optionally expects it to be the given name. More...
 
QString readElementText ()
 Reads the element text contents. More...
 
int currentStackLevel ()
 returns the current stack-level More...
 

Detailed Description

For parsing a Textmate Language.

Constructor & Destructor Documentation

◆ TmLanguageParser()

edbee::TmLanguageParser::TmLanguageParser ( )

Parses a textmate language.

Member Function Documentation

◆ addCapturesToGrammarRule()

void edbee::TmLanguageParser::addCapturesToGrammarRule ( TextGrammarRule rule,
QHash< QString, QVariant >  captures,
bool  endCapture = false 
)
protected

sets the captures

◆ addPatternsToGrammarRule()

void edbee::TmLanguageParser::addPatternsToGrammarRule ( TextGrammarRule rule,
QList< QVariant >  patterns 
)
protected

Adds all patterns to the grammar rules.

◆ createGrammarRule()

TextGrammarRule * edbee::TmLanguageParser::createGrammarRule ( TextGrammar grammar,
const QVariant &  data 
)
protected

creates a grammar rue

Todo:
: contentScopeName

◆ createLanguage()

TextGrammar * edbee::TmLanguageParser::createLanguage ( QVariant &  data)
protected

◆ parse() [1/3]

TextGrammar * edbee::TmLanguageParser::parse ( QIODevice *  device)

reads the content of a single file

Parameters
devicethe device to read from. The device NEEDS to be open!!
Returns
the language grammar or 0 on error

◆ parse() [2/3]

TextGrammar* edbee::TmLanguageParser::parse ( const QFile &  file)

◆ parse() [3/3]

TextGrammar * edbee::TmLanguageParser::parse ( const QString &  fileName)

parses the given grammar file

Parameters
filethe file to read
Returns
the language grammar or 0 on error

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