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

Authored by cullmann on Aug 14 2018, 3:04 PM.

Description

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

Summary:
Some suggested optimizations of 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 for WordDetect (with the delimiters modified) 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.

Reviewers: Framework: Syntax Highlighting, dhaumann

Reviewed By: Framework: Syntax Highlighting, dhaumann

Subscribers: kwrite-devel, kde-frameworks-devel, dhaumann

Tags: Frameworks, Framework: Syntax Highlighting, Kate

Differential Revision: https://phabricator.kde.org/D11543