diff --git a/data/languages/qml/highlight.xml b/data/languages/qml/highlight.xml new file mode 100644 index 0000000..5775b7f --- /dev/null +++ b/data/languages/qml/highlight.xml @@ -0,0 +1,133 @@ + + + (qml) + + + commentDoxygen + + /\*(\*|!) + \*/ + + doxyparse + + + comment + + /\* + \*/ + + TODO + + + SYNTAX_ERROR + + /\* + + + + commentDoxygen + //!.*$ + doxyparse + + + comment + //.*$ + TODO + + + doubleQuoteText + "(\\(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})|.)*" + + + doubleQuoteText + '(\\(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})|.)*' + + + + + + keyword + \{|\}|\[|\] + + + number + \@((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?\@ + + + boolean + \@true|false\@ + + + keyword + \@return|if|else|case|default|switch|break|continue|while|do|for|let|var|function|typeof|alert\@ + + + storageKeyword + \@import|property|string|bool|int|as|signal|readonly|alias\@ + + + memberClass + \@(\w|_)(\w|_|\.)+[ \t]*: + + + memberClassPrivate + \@(\w|_)(\w|_|\.)+[ \t]*\{ + + + macro + \@[A-Z_][A-Z_0-9]{3,500}\@ + + + inputFunction + \@_\w+\@ + + + functionName + \@((\w|_)+[ \t]*\() + + + error + :|, + + + boolean + => + + + boolean + ===|==|<=|>=|!==|!=|<{1,2}|>{1,2}|&&|\{|\} + + + preprocesseur + =|\+|\-|&|\| + + + SYNTAX_ERROR + '|" + + + + + doxygen-key-known + (\@|\\)[\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) + + + doxygen-key + (\@|\\)[\t ]*\w+ + + + doxygen-in-out + \[(in|in,out|out)\] + + + inputFunction + \@_\w+\@ + + + + + SYNTAX_ERROR + TODO[ \t]*:.*$ + + + \ No newline at end of file diff --git a/lutin_edn.py b/lutin_edn.py index 07fdd0a..0e13a93 100644 --- a/lutin_edn.py +++ b/lutin_edn.py @@ -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/') diff --git a/sources/appl/Buffer.cpp b/sources/appl/Buffer.cpp index ac58b53..fa39bb3 100644 --- a/sources/appl/Buffer.cpp +++ b/sources/appl/Buffer.cpp @@ -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 : ("<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(); diff --git a/sources/appl/Highlight.cpp b/sources/appl/Highlight.cpp index e0e4d37..e3cfa52 100644 --- a/sources/appl/Highlight.cpp +++ b/sources/appl/Highlight.cpp @@ -288,8 +288,8 @@ void appl::Highlight::parse2(int64_t _start, int64_t _stop, etk::Vector& _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;