[DEV] remove problematic function parsing
This commit is contained in:
parent
2c3a64933d
commit
b890f931ca
@ -28,10 +28,12 @@
|
||||
<color>keyword</color>
|
||||
<regex>[\$]+[a-zA-Z_][a-zA-Z0-9_]*</regex>
|
||||
</rule>
|
||||
<!--
|
||||
<rule name="Function name">
|
||||
<color>functionName</color>
|
||||
<regex>function (\w|_)+[ \t]*\(</regex>
|
||||
</rule>
|
||||
-->
|
||||
<rule name="condition">
|
||||
<color>boolean</color>
|
||||
<regex>==|<=|>=|!=|<{1,2}|>{1,2}|&&|\{|\}|</regex>
|
||||
|
@ -44,7 +44,7 @@
|
||||
</rule>
|
||||
<rule name="doubleQuteText">
|
||||
<color>doubleQuoteText</color>
|
||||
<regex>"(\\[\\"]|.)*"</regex>
|
||||
<regex>"(\\[\\"]|.)*"</regex><!-- " -->
|
||||
</rule>
|
||||
<rule name="simpleQuteText">
|
||||
<color>doubleQuoteText</color>
|
||||
@ -99,11 +99,14 @@
|
||||
<rule name="function input">
|
||||
<color>inputFunction</color>
|
||||
<regex>\@_[A-Za-z_0-9]*\@</regex>
|
||||
<max>false</max>
|
||||
</rule>
|
||||
<!--
|
||||
<rule name="Function name">
|
||||
<color>functionName</color>
|
||||
<regex>\@(\w|_)+[ \t]*\(</regex>
|
||||
</rule>
|
||||
-->
|
||||
<rule name="condition">
|
||||
<color>boolean</color>
|
||||
<regex>==|<=|>=|!=|<{1,2}|>{1,2}|&&|\{|\}|</regex>
|
||||
|
@ -41,10 +41,11 @@
|
||||
<color>macro</color>
|
||||
<regex>\@[A-Z_][A-Z_0-9]{3,500}\@</regex>
|
||||
</rule>
|
||||
<!--
|
||||
<rule name="Function name">
|
||||
<color>functionName</color>
|
||||
<regex>\@(\w|_)+[ \t]*\(</regex>
|
||||
</rule>
|
||||
|
||||
-->
|
||||
</pass2>
|
||||
</EdnLang>
|
||||
|
@ -64,10 +64,12 @@
|
||||
<color>macro</color>
|
||||
<regex>\@[A-Z_][A-Z_0-9]{3,500}\@</regex>
|
||||
</rule>
|
||||
<!--
|
||||
<rule name="Function name">
|
||||
<color>functionName</color>
|
||||
<regex>\@(\w|_)+[ \t]*\(</regex>
|
||||
</rule>
|
||||
-->
|
||||
<rule name="condition">
|
||||
<color>boolean</color>
|
||||
<regex>==|<=|>=|!=|<{1,2}|>{1,2}|&&|\{|\}|</regex>
|
||||
|
@ -40,10 +40,12 @@
|
||||
<color>macro</color>
|
||||
<regex>\@[A-Z_][A-Z_0-9]{3,500}\@</regex>
|
||||
</rule>
|
||||
<!--
|
||||
<rule name="Function name">
|
||||
<color>functionName</color>
|
||||
<regex>\@(\w|_)+[ \t]*\(</regex>
|
||||
</rule>
|
||||
-->
|
||||
<rule name="condition">
|
||||
<color>boolean</color>
|
||||
<regex>==|<=|>=|~=|<{1,2}|>{1,2}|&&|\{|\}|</regex>
|
||||
|
@ -33,10 +33,12 @@
|
||||
<color>boolean</color>
|
||||
<regex>\@true|false\@</regex>
|
||||
</rule>
|
||||
<!--
|
||||
<rule name="Function name">
|
||||
<color>functionName</color>
|
||||
<regex>\@(\w|_)+[ \t]*\(</regex>
|
||||
</rule>
|
||||
-->
|
||||
<rule name="condition">
|
||||
<color>boolean</color>
|
||||
<regex>==|<=|>=|!=|<{1,2}|>{1,2}|&&|\{|\}|</regex>
|
||||
|
@ -55,10 +55,12 @@
|
||||
<color>boolean</color>
|
||||
<regex>\@true|TRUE|false|FALSE\@</regex>
|
||||
</rule>
|
||||
<!--
|
||||
<rule name="Function name">
|
||||
<color>functionName</color>
|
||||
<regex>\@(\w|_)+[ \t]*\(</regex>
|
||||
</rule>
|
||||
-->
|
||||
<rule name="condition">
|
||||
<color>boolean</color>
|
||||
<regex>==|<=|>=|!=|<|>|&&|\{|\}|</regex>
|
||||
|
@ -56,10 +56,12 @@
|
||||
<color>macro</color>
|
||||
<regex>\@[A-Z_][A-Z_0-9]{3,500}\@</regex>
|
||||
</rule>
|
||||
<!--
|
||||
<rule name="Function name">
|
||||
<color>functionName</color>
|
||||
<regex>\@(\w|_)+[ \t]*\(</regex>
|
||||
</rule>
|
||||
-->
|
||||
<rule name="condition">
|
||||
<color>boolean</color>
|
||||
<regex>==|<=|>=|!=|<{1,2}|>{1,2}|&&|\{|\}|</regex>
|
||||
|
@ -25,12 +25,13 @@
|
||||
#define HL2_DEBUG APPL_VERBOSE
|
||||
|
||||
void appl::Highlight::parseRules(exml::Element* _child,
|
||||
std::vector<std::unique_ptr<HighlightPattern>>& _mListPatern,
|
||||
int32_t _level) {
|
||||
std::vector<std::unique_ptr<HighlightPattern>>& _mListPatern,
|
||||
int32_t _level,
|
||||
bool forceMaximize) {
|
||||
// Create the patern ...
|
||||
HighlightPattern *myPattern = new HighlightPattern(m_paintingProperties);
|
||||
// parse under Element
|
||||
myPattern->parseRules(_child, _level);
|
||||
myPattern->parseRules(_child, _level, forceMaximize);
|
||||
// add element in the list
|
||||
_mListPatern.push_back(std::unique_ptr<HighlightPattern>(myPattern));
|
||||
}
|
||||
@ -95,7 +96,7 @@ void appl::Highlight::init(const std::string& _xmlFilename, const std::string& _
|
||||
APPL_ERROR("(l "<< passChild->getPos() << ") node not suported : \""<< passChild->getValue() << "\" must be [rule]" );
|
||||
continue;
|
||||
}
|
||||
parseRules(passChild, m_listHighlightPass2, level2++);
|
||||
parseRules(passChild, m_listHighlightPass2, level2++, true);
|
||||
}
|
||||
} else {
|
||||
APPL_ERROR("(l "<< child->getPos() << ") node not suported : \""<< child->getValue() << "\" must be [ext,pass1,pass2]" );
|
||||
|
@ -63,7 +63,8 @@ namespace appl {
|
||||
private:
|
||||
void parseRules(exml::Element* _child,
|
||||
std::vector<std::unique_ptr<HighlightPattern>> &_mListPatern,
|
||||
int32_t _level);
|
||||
int32_t _level,
|
||||
bool forceMaximize=false);
|
||||
std::string m_styleName; //!< curent style name (like "c++" or "c" or "script Bash")
|
||||
std::vector<std::string> m_listExtentions; //!< List of possible extention for this high-light, like : ".c", ".cpp", ".h"
|
||||
std::vector<std::unique_ptr<HighlightPattern>> m_listHighlightPass1; //!< List of ALL hightlight modules (pass 1 == > when we load and wride data on the buffer)
|
||||
|
@ -26,11 +26,12 @@ appl::HighlightPattern::~HighlightPattern() {
|
||||
|
||||
}
|
||||
|
||||
void appl::HighlightPattern::setPatern(std::string& _regExp) {
|
||||
void appl::HighlightPattern::setPatern(std::string& _regExp, bool forceMaximize) {
|
||||
if (m_regExp == nullptr) {
|
||||
return;
|
||||
}
|
||||
m_regExp->compile(_regExp);
|
||||
m_regExp->setMaximize(forceMaximize);
|
||||
}
|
||||
std::string appl::HighlightPattern::getPaternString() {
|
||||
return m_regExp->getRegExDecorated();
|
||||
@ -48,12 +49,13 @@ void appl::HighlightPattern::display() {
|
||||
APPL_INFO(" == > regExp '" << m_regExp->getRegExp() << "'");
|
||||
}
|
||||
|
||||
void appl::HighlightPattern::parseRules(exml::Element* _child, int32_t _level) {
|
||||
void appl::HighlightPattern::parseRules(exml::Element* _child, int32_t _level, bool forceMaximize) {
|
||||
//--------------------------------------------------------------------------------------------
|
||||
/*
|
||||
<rule name="my preprocesseur">
|
||||
<color>preprocesseur</color>
|
||||
<regex>#</regex>
|
||||
<max>false</max>
|
||||
</rule>
|
||||
*/
|
||||
//--------------------------------------------------------------------------------------------
|
||||
@ -75,13 +77,17 @@ void appl::HighlightPattern::parseRules(exml::Element* _child, int32_t _level) {
|
||||
setColorGlyph(myEdnData);
|
||||
}
|
||||
}
|
||||
xChild = _child->getNamed("max");
|
||||
if (nullptr != xChild) {
|
||||
forceMaximize = etk::string_to_bool(xChild->getText());
|
||||
}
|
||||
xChild = _child->getNamed("regex");
|
||||
if (nullptr != xChild) {
|
||||
std::string myData = xChild->getText();
|
||||
if (myData.size() != 0) {
|
||||
//APPL_INFO(PFX"(l %d) node fined : %s=\"%s\"", xChild->Row(), xChild->Value() , myData);
|
||||
std::string myEdnData = myData;
|
||||
setPatern(myEdnData);
|
||||
setPatern(myEdnData, forceMaximize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ namespace appl {
|
||||
private:
|
||||
std::unique_ptr<etk::RegExp<etk::Buffer>> m_regExp; //!< Start of Regular expression
|
||||
public:
|
||||
void setPatern(std::string& _regExp);
|
||||
void setPatern(std::string& _regExp, bool forceMaximize=false);
|
||||
std::string getPaternString();
|
||||
private:
|
||||
std::string m_colorName; //!< Current color name
|
||||
@ -84,7 +84,7 @@ namespace appl {
|
||||
appl::HighlightInfo& _resultat,
|
||||
etk::Buffer& _buffer);
|
||||
|
||||
void parseRules(exml::Element* _child, int32_t _level);
|
||||
void parseRules(exml::Element* _child, int32_t _level, bool forceMaximize=false);
|
||||
};
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user