[DEBUG/DEV] correct parsing of second pass of highlight and add qml paesing
This commit is contained in:
parent
e34df50369
commit
43c841608e
133
data/languages/qml/highlight.xml
Normal file
133
data/languages/qml/highlight.xml
Normal file
@ -0,0 +1,133 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<EdnLang version="0.1" lang="QML">
|
||||
<ext>(qml)</ext>
|
||||
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
||||
<rule name="doxygen multiline">
|
||||
<color>commentDoxygen</color>
|
||||
<regex>
|
||||
<start>/\*(\*|!)</start>
|
||||
<stop>\*/</stop>
|
||||
</regex>
|
||||
<sub>doxyparse</sub>
|
||||
</rule>
|
||||
<rule name="comment multiline">
|
||||
<color>comment</color>
|
||||
<regex>
|
||||
<start>/\*</start>
|
||||
<stop>\*/</stop>
|
||||
</regex>
|
||||
<sub>TODO</sub>
|
||||
</rule>
|
||||
<rule name="comment multiline ERROR">
|
||||
<color>SYNTAX_ERROR</color>
|
||||
<regex>
|
||||
<start>/\*</start>
|
||||
</regex>
|
||||
</rule>
|
||||
<rule name="inline doxygen">
|
||||
<color>commentDoxygen</color>
|
||||
<regex>//!.*$</regex>
|
||||
<sub>doxyparse</sub>
|
||||
</rule>
|
||||
<rule name="inline comment">
|
||||
<color>comment</color>
|
||||
<regex>//.*$</regex>
|
||||
<sub>TODO</sub>
|
||||
</rule>
|
||||
<rule name="double quote text">
|
||||
<color>doubleQuoteText</color>
|
||||
<regex>"(\\(n|t|v|b|r|f|a|\\|\?|"|0|o[0-7]{2}|x[0-9a-fA-F]{2}|u[0-9]{4}|U[0-9]{8})|.)*"</regex>
|
||||
</rule>
|
||||
<rule name="simple quote text">
|
||||
<color>doubleQuoteText</color>
|
||||
<regex>'(\\(n|t|v|b|r|f|a|\\|\?|'|0|o[0-7]{2}|x[0-9a-fA-F]{2}|u[0-9]{4}|U[0-9]{8})|.)*'</regex>
|
||||
</rule>
|
||||
</pass1>
|
||||
<pass2> <!-- Parse on display data ==> nor regenerate every display but every time modification apear -->
|
||||
|
||||
<rule name="my keyword">
|
||||
<color>keyword</color>
|
||||
<regex>\{|\}|\[|\]</regex>
|
||||
</rule>
|
||||
<rule name="numeric constant">
|
||||
<color>number</color>
|
||||
<regex>\@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@</regex>
|
||||
</rule>
|
||||
<rule name="my boolean">
|
||||
<color>boolean</color>
|
||||
<regex>\@true|false\@</regex>
|
||||
</rule>
|
||||
<rule name="my keyword special">
|
||||
<color>keyword</color>
|
||||
<regex>\@return|if|else|case|default|switch|break|continue|while|do|for|let|var|function|typeof|alert\@</regex>
|
||||
</rule>
|
||||
<rule name="my storage keyword">
|
||||
<color>storageKeyword</color>
|
||||
<regex>\@import|property|string|bool|int|as|signal|readonly|alias\@</regex>
|
||||
</rule>
|
||||
<rule name="property name">
|
||||
<color>memberClass</color>
|
||||
<regex>\@(\w|_)(\w|_|\.)+[ \t]*:</regex>
|
||||
</rule>
|
||||
<rule name="Object Name">
|
||||
<color>memberClassPrivate</color>
|
||||
<regex>\@(\w|_)(\w|_|\.)+[ \t]*\{</regex>
|
||||
</rule>
|
||||
<rule name="BIG LETTER">
|
||||
<color>macro</color>
|
||||
<regex>\@[A-Z_][A-Z_0-9]{3,500}\@</regex>
|
||||
</rule>
|
||||
<rule name="function input">
|
||||
<color>inputFunction</color>
|
||||
<regex>\@_\w+\@</regex>
|
||||
</rule>
|
||||
<rule name="Function name">
|
||||
<color>functionName</color>
|
||||
<regex>\@((\w|_)+[ \t]*\()</regex>
|
||||
</rule>
|
||||
<rule name="object Name">
|
||||
<color>error</color>
|
||||
<regex>:|,</regex>
|
||||
</rule>
|
||||
<rule name="lambda">
|
||||
<color>boolean</color>
|
||||
<regex>=></regex>
|
||||
</rule>
|
||||
<rule name="condition">
|
||||
<color>boolean</color>
|
||||
<regex>===|==|<=|>=|!==|!=|<{1,2}|>{1,2}|&&|\{|\}</regex>
|
||||
</rule>
|
||||
<rule name="simple operator">
|
||||
<color>preprocesseur</color>
|
||||
<regex>=|\+|\-|&|\|</regex>
|
||||
</rule>
|
||||
<rule name="simpleQuteTextError">
|
||||
<color>SYNTAX_ERROR</color>
|
||||
<regex>'|"</regex>
|
||||
</rule>
|
||||
</pass2>
|
||||
<pass name="doxyparse">
|
||||
<rule name="knownkey">
|
||||
<color>doxygen-key-known</color>
|
||||
<regex>(\@|\\)[\t ]*(addindex|addtogroup|anchor|arg|attention|author|authors|a|brief|bug|b|callgraph|category|cite|class|code|cond|copybrief|copydetails|copydoc|copyright|date|def|defgroup|deprecated|details|diafile|dir|docbookonly|dontinclude|dot|dotfile|else|elseif|em|endcode|endcond|enddocbookonly|enddot|endhtmlonly|endif|endinternal|endlatexonly|endlink|endmanonly|endmsc|endparblock|endrtfonly|endsecreflist|endverbatim|enduml|endxmlonly|enum|example|exception|extends|e|file|fn|headerfile|hidecallergraph|hidecallgraph|hideinitializer|htmlinclude|htmlonly|idlexcept|ifnot|if|image|implements|includelineno|include|ingroup|internal|invariant|interface|latexinclude|latexonly|line|link|license|li|mainpage|manonly|memberof|msc|mscfile|name|namespace|nosubgrouping|note|n|overload|package|page|paragraph|param|parblock|par|post|pre|private|privatesection|property|protected|protectedsection|protocol|public|publicsection|pure|p|refitem|ref|related|relates|relatedalso|relatesalso|remark|remarks|result|return|returns|retval|rtfonly|sa|secreflist|section|see|short|showinitializer|since|skip|skipline|snippet|startuml|struct|subpage|subsection|subsubsection|tableofcontents|test|throw|throws|todo|tparam|typedef|union|until|var|verbatim|verbinclude|version|vhdlflow|warning|weakgroup|xmlonly|xrefitem)</regex>
|
||||
</rule>
|
||||
<rule name="key">
|
||||
<color>doxygen-key</color>
|
||||
<regex>(\@|\\)[\t ]*\w+</regex>
|
||||
</rule>
|
||||
<rule name="in-out">
|
||||
<color>doxygen-in-out</color>
|
||||
<regex>\[(in|in,out|out)\]</regex>
|
||||
</rule>
|
||||
<rule name="function input">
|
||||
<color>inputFunction</color>
|
||||
<regex>\@_\w+\@</regex>
|
||||
</rule>
|
||||
</pass>
|
||||
<pass name="TODO">
|
||||
<rule name="function input">
|
||||
<color>SYNTAX_ERROR</color>
|
||||
<regex>TODO[ \t]*:.*$</regex>
|
||||
</rule>
|
||||
</pass>
|
||||
</EdnLang>
|
@ -94,6 +94,7 @@ def configure(target, my_module):
|
||||
my_module.copy_path('data/languages/in/*.xml','languages/in/')
|
||||
my_module.copy_path('data/languages/java/*.xml','languages/java/')
|
||||
my_module.copy_path('data/languages/js/*.xml','languages/js/')
|
||||
my_module.copy_path('data/languages/qml/*.xml','languages/qml/')
|
||||
my_module.copy_path('data/languages/json/*.xml','languages/json/')
|
||||
my_module.copy_path('data/languages/lua/*.xml','languages/lua/')
|
||||
my_module.copy_path('data/languages/makefile/*.xml','languages/makefile/')
|
||||
|
@ -635,6 +635,7 @@ bool appl::Buffer::write(const etk::String& _data, const appl::Buffer::Iterator&
|
||||
if (m_cursorPos < 0) {
|
||||
m_cursorPos = 0;
|
||||
}
|
||||
//APPL_VERBOSE("******* Regenerate after write");
|
||||
regenerateHighLightAt(position, 0, _data.size());
|
||||
m_selectMode = false;
|
||||
moveCursor(position+_data.size());
|
||||
@ -649,6 +650,7 @@ bool appl::Buffer::replace(const etk::String& _data, const appl::Buffer::Iterato
|
||||
position = 0;
|
||||
}
|
||||
m_data.replace(position, (int64_t)_posEnd-(int64_t)_pos, (int8_t*)(_data.c_str()), _data.size());
|
||||
//APPL_VERBOSE("******* Regenerate after replace pos=" << position << " size remove=" << (int64_t)_posEnd-(int64_t)_pos << " size add=" << _data.size());
|
||||
regenerateHighLightAt(position, (int64_t)_posEnd-(int64_t)_pos, _data.size());
|
||||
m_selectMode = false;
|
||||
moveCursor(position+_data.size());
|
||||
@ -664,6 +666,7 @@ void appl::Buffer::removeSelection() {
|
||||
int64_t startPos = getStartSelectionPos();
|
||||
int64_t endPos = getStopSelectionPos();
|
||||
m_data.remove(startPos, endPos-startPos);
|
||||
//APPL_VERBOSE("******* Regenerate after remove");
|
||||
regenerateHighLightAt(startPos, endPos-startPos, 0);
|
||||
m_selectMode = false;
|
||||
moveCursor(startPos);
|
||||
@ -691,6 +694,7 @@ void appl::Buffer::setHighlightType(const etk::String& _type) {
|
||||
}
|
||||
m_highlightType = _type;
|
||||
m_highlight = appl::Highlight::create(resourceName);
|
||||
//APPL_VERBOSE("******* Regenerate after set type HL");
|
||||
generateHighLightAt(0, m_data.size());
|
||||
}
|
||||
|
||||
@ -708,8 +712,8 @@ void appl::Buffer::regenerateHighLightAt(int64_t _pos, int64_t _nbDeleted, int64
|
||||
APPL_VERBOSE("(_pos="<<_pos<<", _nbDeleted="<<_nbDeleted<<", _nbAdded=" << _nbAdded << "\");");
|
||||
int64_t posEnd = _pos + _nbDeleted;
|
||||
// search position of the old element to reparse IT...
|
||||
int64_t startId;
|
||||
int64_t stopId;
|
||||
int64_t startId = -1;
|
||||
int64_t stopId = -1;
|
||||
// clean data if needed
|
||||
if (m_HLDataPass1.size() == 0) {
|
||||
// Parse the new element ...
|
||||
@ -753,11 +757,21 @@ void appl::Buffer::regenerateHighLightAt(int64_t _pos, int64_t _nbDeleted, int64
|
||||
}
|
||||
}
|
||||
APPL_VERBOSE(" list afterRemove:");
|
||||
for (auto &elem : m_HLDataPass1) {
|
||||
APPL_VERBOSE(" " << elem.start << "=>" << elem.stop);
|
||||
if (m_HLDataPass1.size() != 0) {
|
||||
for (auto &elem : m_HLDataPass1) {
|
||||
APPL_VERBOSE(" " << elem.start << "=>" << elem.stop);
|
||||
}
|
||||
} else {
|
||||
APPL_VERBOSE(" EMPTY");
|
||||
}
|
||||
|
||||
// update position after the range position :
|
||||
// Check Range guard
|
||||
if (startId >= m_HLDataPass1.size()) {
|
||||
startId = int64_t(m_HLDataPass1.size())-1;
|
||||
}
|
||||
if (stopId >= m_HLDataPass1.size()) {
|
||||
stopId = -1;
|
||||
}
|
||||
// update position after the range position:
|
||||
int64_t elemStart;
|
||||
if (startId <= -1) {
|
||||
elemStart = 0;
|
||||
@ -863,7 +877,7 @@ void appl::Buffer::generateHighLightAt(int64_t _pos, int64_t _endPos, int64_t _a
|
||||
if (m_highlight == nullptr) {
|
||||
return;
|
||||
}
|
||||
//APPL_DEBUG("area : ("<<pos<<","<<endPos<<") insert at : " << addingPos);
|
||||
//APPL_DEBUG("area : (" << _pos << "," << _endPos << ") insert at : " << _addingPos);
|
||||
m_highlight->parse(_pos, _endPos, m_HLDataPass1, _addingPos, m_data);
|
||||
}
|
||||
|
||||
@ -906,7 +920,7 @@ void appl::Buffer::hightlightGenerateLines(appl::DisplayHLData& _MData, const ap
|
||||
// find element previous
|
||||
findMainHighLightPosition(_HLStart, HLStop, startId, stopId, true);
|
||||
|
||||
//APPL_DEBUG("List of section between : "<< startId << " & " << stopId);
|
||||
//APPL_DEBUG("List of section between : "<< startId << " & " << stopId << " pass1 store size=" << m_HLDataPass1.size());
|
||||
int64_t endSearch = stopId+1;
|
||||
if (stopId == -1) {
|
||||
endSearch = m_HLDataPass1.size();
|
||||
|
@ -288,8 +288,8 @@ void appl::Highlight::parse2(int64_t _start,
|
||||
int64_t _stop,
|
||||
etk::Vector<appl::HighlightInfo>& _metaData,
|
||||
etk::Buffer& _buffer) {
|
||||
HL2_DEBUG("Parse element 0 => " << m_listHighlightPass2.size() <<
|
||||
" == > position search: (" << _start << "," << _stop << ")" );
|
||||
HL2_DEBUG("Parse RegEx (sub) 0 => " << m_listHighlightPass2.size() <<
|
||||
" == > position search: (" << _start << "," << _stop << ") metaDataSize=" << _metaData.size() << " bufferSize=" << _buffer.size());
|
||||
int64_t elementStart = _start;
|
||||
int64_t elementStop = _stop;
|
||||
appl::HighlightInfo resultat;
|
||||
|
Loading…
x
Reference in New Issue
Block a user