edbee - Qt Editor Library
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
edbee::TextGrammarRule Class Reference

defines a single grammar rule More...

#include <textgrammar.h>

+ Collaboration diagram for edbee::TextGrammarRule:

Classes

class  Iterator
 

Public Types

enum  Instruction {
  MainRule, RuleList, SingleLineRegExp, MultiLineRegExp,
  IncludeCall, Parser
}
 the instructions More...
 

Public Member Functions

 TextGrammarRule (TextGrammar *grammar, Instruction instruction)
 The text grammar rule constructor. More...
 
 ~TextGrammarRule ()
 The tex text grammar rule. More...
 
bool isMainRule ()
 
bool isRuleList ()
 
bool isMultiLineRegExp ()
 
bool isSingleLineRegExp ()
 
bool isIncludeCall ()
 
int ruleCount () const
 
TextGrammarRulerule (int idx) const
 returns the child rule at the given index More...
 
void giveRule (TextGrammarRule *rule)
 Gives the rulle to the rule-list of the grammar rule. More...
 
void giveMatchRegExp (RegExp *regExp)
 Gives the main regular expression. More...
 
void setEndRegExpString (const QString &str)
 Sets the ends regular expression(only for multi-line regexp rules. More...
 
Instruction instruction () const
 
void setInstruction (Instruction ins)
 
QString scopeName () const
 
void setScopeName (const QString &scopeName)
 
RegExpmatchRegExp () const
 
QString endRegExpString () const
 
const QMap< int, QString > & matchCaptures ()
 
const QMap< int, QString > & endCaptures ()
 
QString contentScopeName () const
 
void setContentScopeName (const QString &name)
 
QString includeName ()
 the include name is stored in the content-scopename More...
 
void setIncludeName (const QString &name)
 
void setCapture (int idx, const QString &name)
 
void setEndCapture (int idx, const QString &name)
 
QString toString (bool includePatterns=true)
 convers the curent object toString (for debugging purposes) More...
 
IteratorcreateIterator ()
 
TextGrammargrammar ()
 

Static Public Member Functions

static TextGrammarRulecreateMainRule (TextGrammar *grammar, const QString &scopeName)
 Creates a main grammar rule. More...
 
static TextGrammarRulecreateRuleList (TextGrammar *grammar)
 Creates a grammar rule list. More...
 
static TextGrammarRulecreateSingleLineRegExp (TextGrammar *grammar, const QString &scopeName, const QString &regExp)
 Creates an single line regexp. More...
 
static TextGrammarRulecreateMultiLineRegExp (TextGrammar *grammar, const QString &scopeName, const QString &contentScopeName, const QString &beginRegExp, const QString &endRegExp)
 Creates a multiline regexp. More...
 
static TextGrammarRulecreateIncludeRule (TextGrammar *grammar, const QString &includeName)
 Creates an include rule. More...
 

Detailed Description

defines a single grammar rule

Member Enumeration Documentation

◆ Instruction

the instructions

Enumerator
MainRule 

The main rule has no regexp matches.

RuleList 

A list of rules (no regexp)

SingleLineRegExp 

A single line regexp.

MultiLineRegExp 

A multi-line regexp (begin end)

IncludeCall 

Includes another scope.

Parser 

A full parser (not yet supported, by added as idea for the future). But could be marked by multiple regexps.

Constructor & Destructor Documentation

◆ TextGrammarRule()

edbee::TextGrammarRule::TextGrammarRule ( TextGrammar grammar,
Instruction  instruction 
)

The text grammar rule constructor.

Parameters
grammarthe grammar this rule belongs to
instructionthe type of instruction this is

◆ ~TextGrammarRule()

edbee::TextGrammarRule::~TextGrammarRule ( )

The tex text grammar rule.

Member Function Documentation

◆ contentScopeName()

QString edbee::TextGrammarRule::contentScopeName ( ) const
inline

◆ createIncludeRule()

TextGrammarRule * edbee::TextGrammarRule::createIncludeRule ( TextGrammar grammar,
const QString &  includeName 
)
static

Creates an include rule.

Parameters
grammarthe grammar this rules belongs to
includeNamethe name to include
Returns
an include grammar rule

◆ createIterator()

Iterator* edbee::TextGrammarRule::createIterator ( )
inline

◆ createMainRule()

TextGrammarRule * edbee::TextGrammarRule::createMainRule ( TextGrammar grammar,
const QString &  scopeName 
)
static

Creates a main grammar rule.

Parameters
grammarthe grammar this main rule belongs to
scopeNamethe name of the scope
Returns
the main grammar rule

◆ createMultiLineRegExp()

TextGrammarRule * edbee::TextGrammarRule::createMultiLineRegExp ( TextGrammar grammar,
const QString &  scopeName,
const QString &  contentScopeName,
const QString &  beginRegExp,
const QString &  endRegExp 
)
static

Creates a multiline regexp.

Parameters
scopeNamethe name of the scope
contentScopeNamethe scope name of the content
beginRegExpthe start regexp to use
endRegExpthe end regular expression to use
Returns
TextGrammarRule the multiple grammar rule

◆ createRuleList()

TextGrammarRule * edbee::TextGrammarRule::createRuleList ( TextGrammar grammar)
static

Creates a grammar rule list.

Parameters
grammarthe grammar this rule list belongs to
Returns
the TextGrammarRule that include the rule list

◆ createSingleLineRegExp()

TextGrammarRule * edbee::TextGrammarRule::createSingleLineRegExp ( TextGrammar grammar,
const QString &  scopeName,
const QString &  regExp 
)
static

Creates an single line regexp.

Parameters
grammarthe grammar this rule belongs to
scopeNamethe scopename of this rule
regExpthe regular expression used for this rule
Returns
the created grammar rule

◆ endCaptures()

const QMap<int,QString>& edbee::TextGrammarRule::endCaptures ( )
inline

◆ endRegExpString()

QString edbee::TextGrammarRule::endRegExpString ( ) const
inline

◆ giveMatchRegExp()

void edbee::TextGrammarRule::giveMatchRegExp ( RegExp regExp)

Gives the main regular expression.

Parameters
regExpthe regular expression to give

◆ giveRule()

void edbee::TextGrammarRule::giveRule ( TextGrammarRule rule)

Gives the rulle to the rule-list of the grammar rule.

Parameters
therule to give (ownership is transfered to this object)

◆ grammar()

TextGrammar* edbee::TextGrammarRule::grammar ( )
inline

◆ includeName()

QString edbee::TextGrammarRule::includeName ( )
inline

the include name is stored in the content-scopename

◆ instruction()

Instruction edbee::TextGrammarRule::instruction ( ) const
inline

◆ isIncludeCall()

bool edbee::TextGrammarRule::isIncludeCall ( )
inline

◆ isMainRule()

bool edbee::TextGrammarRule::isMainRule ( )
inline

◆ isMultiLineRegExp()

bool edbee::TextGrammarRule::isMultiLineRegExp ( )
inline

◆ isRuleList()

bool edbee::TextGrammarRule::isRuleList ( )
inline

◆ isSingleLineRegExp()

bool edbee::TextGrammarRule::isSingleLineRegExp ( )
inline

◆ matchCaptures()

const QMap<int,QString>& edbee::TextGrammarRule::matchCaptures ( )
inline

◆ matchRegExp()

RegExp* edbee::TextGrammarRule::matchRegExp ( ) const
inline

◆ rule()

TextGrammarRule * edbee::TextGrammarRule::rule ( int  idx) const

returns the child rule at the given index

Parameters
idxthe index of the grammar rule

◆ ruleCount()

int edbee::TextGrammarRule::ruleCount ( ) const
inline

◆ scopeName()

QString edbee::TextGrammarRule::scopeName ( ) const
inline

◆ setCapture()

void edbee::TextGrammarRule::setCapture ( int  idx,
const QString &  name 
)
inline

◆ setContentScopeName()

void edbee::TextGrammarRule::setContentScopeName ( const QString &  name)
inline

◆ setEndCapture()

void edbee::TextGrammarRule::setEndCapture ( int  idx,
const QString &  name 
)
inline

◆ setEndRegExpString()

void edbee::TextGrammarRule::setEndRegExpString ( const QString &  str)

Sets the ends regular expression(only for multi-line regexp rules.

Parameters
strthe end regular expression

◆ setIncludeName()

void edbee::TextGrammarRule::setIncludeName ( const QString &  name)
inline

◆ setInstruction()

void edbee::TextGrammarRule::setInstruction ( Instruction  ins)
inline

◆ setScopeName()

void edbee::TextGrammarRule::setScopeName ( const QString &  scopeName)
inline

◆ toString()

QString edbee::TextGrammarRule::toString ( bool  includePatterns = true)

convers the curent object toString (for debugging purposes)

Parameters
includePattersshould the patterns be included

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