D11543: Optimize many syntax highlighting files and fix the '/' char of SQL

Nibaldo González noreply at phabricator.kde.org
Wed Mar 21 10:07:44 UTC 2018


nibags created this revision.
Restricted Application added a project: Frameworks.
Restricted Application added a subscriber: Frameworks.
nibags requested review of this revision.

REVISION SUMMARY
  Some suggested optimizations of D10621 <https://phabricator.kde.org/D10621>.
  
  **Note:**
  
    <keywords additionalDeliminator="@" weakDeliminator=";" />
  
  Using KDE Frameworks 5.44, the above is only applied to the 'keywords' rules. 
  However, when you run `./bin/testhighlighter_test`,`./bin/folding_test` & `./bin/htmlhighlighter_test`, it also applies to the delimiters of the 'WordDetect' rules. 
  This generates an error when I run testing binaries on the `test.sql_oracle` file, in the last line `end; ` (`<RegExpr String="\bend\b" ../>` is changed to WordDetect and ';' is not delimiter). The test files with the problem are included.
  
  The only files where RegExpr is changed by WordDetect are `sql*.xml` and `rhtml.xml`. I do not know if it will be necessary to undo these changes or it is just a problem of the test generator.
  
  **Fix in SQL:**
  Fix bug in `sql-mysql.xml`, `sql-postgresql.xml` & `sql.xml` files: The single character '/' on a new line (rule: `<RegExpr String="^/$" ../>`) is not highlighted, because it has conflict with the '/' keyword in the "operators" list. This rule is replaced by LineContinue (with column=0) and placed before the rule `<keyword String="operators" ../>`.
  
  - sql-mysql.xml
    - [Line 481] RegExpr -> [Line 394] LineContinue.
  - sql-postgresql.xml
    - [761] RegExpr -> [744] LineContinue.
  - sql.xml
    - [914] RegExpr -> [897] LineContinue.
  
  **Files changed:**
  
  - prolog.xml
  - pug.xml
    - [Line 36] RegExpr "\belse if\b" is replaced with "\belse\s+if\b". It is much more appropriate than using WordDetect, since it is JavaScript code (is Node.js)
  - qml.xml
  - r.xml
  - rest.xml
    - [Lines 39-40] Merge RegExpr rules.
  - rhtml.xml
    - [Lines 586-587] Merge RegExpr rules.
  - rpmspec.xml
  - ruby.xml
  - sisu.xml
  - sql-mysql.xml
  - sql-oracle.xml
  - sql-postgresql.xml
  - sql.xml
  - tads3.xml
  - tcl.xml
  - template-toolkit.xml
    - Duplicate rules are deleted.
  - textile.xml
    - [Lines 36-39] Merge RegExpr rules.
  - varnishtest.xml
  - varnishtest4.xml
  - vhdl.xml
    - [Lines 511-514] Merge RegExpr rules.
  - wml.xml
  - xharbour.xml
    - [Line 491] RegExpr ("\d+") -> Int
  - xmldebug.xml
    - RegExpr ("\s+") -> DetectSpaces
  - zsh.xml
    - RegExpr ("[A-Za-z_]\w*") -> DetectIdentifier

TEST PLAN
  I tried most of the changes to avoid problems.

REPOSITORY
  R216 Syntax Highlighting

BRANCH
  optimize_many_files (branched from master)

REVISION DETAIL
  https://phabricator.kde.org/D11543

AFFECTED FILES
  autotests/folding/test.sql_oracle.fold
  autotests/html/test.sql_oracle.html
  autotests/reference/test.sql_oracle.ref
  data/syntax/prolog.xml
  data/syntax/pug.xml
  data/syntax/qml.xml
  data/syntax/r.xml
  data/syntax/rest.xml
  data/syntax/rhtml.xml
  data/syntax/rpmspec.xml
  data/syntax/ruby.xml
  data/syntax/sisu.xml
  data/syntax/sql-mysql.xml
  data/syntax/sql-oracle.xml
  data/syntax/sql-postgresql.xml
  data/syntax/sql.xml
  data/syntax/tads3.xml
  data/syntax/tcl.xml
  data/syntax/template-toolkit.xml
  data/syntax/textile.xml
  data/syntax/varnishtest.xml
  data/syntax/varnishtest4.xml
  data/syntax/vhdl.xml
  data/syntax/wml.xml
  data/syntax/xharbour.xml
  data/syntax/xmldebug.xml
  data/syntax/zsh.xml

To: nibags
Cc: #frameworks, michaelh, ngraham
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20180321/24c6e6b1/attachment.html>


More information about the Kde-frameworks-devel mailing list