12 #include <QStringList> 68 const QMap<int,QString>&
endCaptures() {
return endCaptures_; }
76 void setCapture(
int idx,
const QString& name ) { matchCaptures_.insert(idx,name); }
77 void setEndCapture(
int idx,
const QString& name ) { endCaptures_.insert(idx,name); }
79 QString
toString(
bool includePatterns=
true);
100 static RegExp* createRegExp(
const QString& regexp );
110 QString endRegExpString_;
112 QMap<int,QString> matchCaptures_;
113 QMap<int,QString> endCaptures_;
115 QString contentScopeName_;
117 QList<TextGrammarRule*> ruleList_;
129 TextGrammar(
const QString& name,
const QString& displayName );
134 QString name()
const;
135 QString displayName()
const;
137 QStringList fileExtensions()
const;
141 void addFileExtension(
const QString& ext );
145 QString displayName_;
147 QMap<QString, TextGrammarRule*> repository_;
148 QStringList fileExtensions_;
164 TextGrammar* readGrammarFile(
const QString& file );
165 void readAllGrammarFilesInPath(
const QString& path );
170 QList<QString> grammarNames();
171 QList<TextGrammar*> grammars();
172 QList<TextGrammar*> grammarsSortedByDisplayName();
175 TextGrammar* detectGrammarWithFilename(
const QString& fileName );
177 QString lastErrorMessage()
const;
182 QMap<QString,TextGrammar*> grammarMap_;
183 QString lastErrorMessage_;
bool hasNext()
Definition: textgrammar.h:87
bool isMultiLineRegExp()
Definition: textgrammar.h:50
static TextGrammarRule * createMainRule(TextGrammar *grammar, const QString &scopeName)
Creates a main grammar rule.
Definition: textgrammar.cpp:43
void setEndRegExpString(const QString &str)
Sets the ends regular expression(only for multi-line regexp rules.
Definition: textgrammar.cpp:131
QString contentScopeName() const
Definition: textgrammar.h:69
Includes another scope.
Definition: textgrammar.h:34
void setInstruction(Instruction ins)
Definition: textgrammar.h:62
static TextGrammarRule * createRuleList(TextGrammar *grammar)
Creates a grammar rule list.
Definition: textgrammar.cpp:54
The texteditor manager, It manages all singleton objects for the editor It performs the initializatio...
Definition: edbee.h:24
const QMap< int, QString > & matchCaptures()
Definition: textgrammar.h:67
int ruleCount() const
Definition: textgrammar.h:54
Iterator(const TextGrammarRule *rule)
Definition: textgrammar.h:86
Definition: textgrammar.h:83
~TextGrammarRule()
The tex text grammar rule.
Definition: textgrammar.cpp:31
defines a single grammar rule
Definition: textgrammar.h:24
TextGrammarRule * rule(int idx) const
returns the child rule at the given index
Definition: textgrammar.cpp:106
bool isSingleLineRegExp()
Definition: textgrammar.h:51
TextGrammar * grammar()
Definition: textgrammar.h:96
void setEndCapture(int idx, const QString &name)
Definition: textgrammar.h:77
Copyright 2011-2013 - Reliable Bits Software by Blommers IT.
Definition: commentcommand.cpp:22
A class for matching QStrings with the Oniguruma API We need this Regular Expression library to be ab...
Definition: regexp.h:36
static TextGrammarRule * createIncludeRule(TextGrammar *grammar, const QString &includeName)
Creates an include rule.
Definition: textgrammar.cpp:65
A list of rules (no regexp)
Definition: textgrammar.h:31
This class defines a single language grammar.
Definition: textgrammar.h:125
QString endRegExpString() const
Definition: textgrammar.h:66
TextGrammarRule * next()
Definition: textgrammar.h:88
void setContentScopeName(const QString &name)
Definition: textgrammar.h:70
The main rule has no regexp matches.
Definition: textgrammar.h:30
const QMap< int, QString > & endCaptures()
Definition: textgrammar.h:68
Instruction
the instructions
Definition: textgrammar.h:29
void giveMatchRegExp(RegExp *regExp)
Gives the main regular expression.
Definition: textgrammar.cpp:123
bool isIncludeCall()
Definition: textgrammar.h:52
void setCapture(int idx, const QString &name)
Definition: textgrammar.h:76
QString scopeName() const
Definition: textgrammar.h:63
RegExp * matchRegExp() const
Definition: textgrammar.h:65
bool isRuleList()
Definition: textgrammar.h:49
Instruction instruction() const
Definition: textgrammar.h:61
void setIncludeName(const QString &name)
Definition: textgrammar.h:74
static TextGrammarRule * createSingleLineRegExp(TextGrammar *grammar, const QString &scopeName, const QString ®Exp)
Creates an single line regexp.
Definition: textgrammar.cpp:78
static TextGrammarRule * createMultiLineRegExp(TextGrammar *grammar, const QString &scopeName, const QString &contentScopeName, const QString &beginRegExp, const QString &endRegExp)
Creates a multiline regexp.
Definition: textgrammar.cpp:93
QString toString(bool includePatterns=true)
convers the curent object toString (for debugging purposes)
Definition: textgrammar.cpp:139
This class is used to manage all 'grammers' used by the lexers.
Definition: textgrammar.h:157
QString includeName()
the include name is stored in the content-scopename
Definition: textgrammar.h:73
void setScopeName(const QString &scopeName)
Definition: textgrammar.h:64
void giveRule(TextGrammarRule *rule)
Gives the rulle to the rule-list of the grammar rule.
Definition: textgrammar.cpp:115
A full parser (not yet supported, by added as idea for the future). But could be marked by multiple r...
Definition: textgrammar.h:35
A single line regexp.
Definition: textgrammar.h:32
TextGrammarRule(TextGrammar *grammar, Instruction instruction)
The text grammar rule constructor.
Definition: textgrammar.cpp:21
bool isMainRule()
Definition: textgrammar.h:48
A multi-line regexp (begin end)
Definition: textgrammar.h:33
TextGrammar * defaultGrammar()
Definition: textgrammar.h:174
Iterator * createIterator()
Definition: textgrammar.h:94