D17891: WML: fix infinite loop in contexts switch & only highlight tags with valid names
noreply at phabricator.kde.org
Mon Dec 31 20:03:18 GMT 2018
nibags created this revision.
nibags added reviewers: Framework: Syntax Highlighting, dhaumann, cullmann.
Herald added projects: Kate, Frameworks.
Herald added subscribers: kde-frameworks-devel, kwrite-devel.
nibags requested review of this revision.
In the `wml.xml` file an infinite context switch between `section` and `error` is generated, through `lineEndContext`: in a line break, the `section` context sends to `error` and then this is #poped in the line break, causing an infinite cycle. This causes that Kate freezes.
This is reproducible by typing the `[` character and then a line break.
This bug is reproducible only in KSyntaxHighlighting, since in KF5.48 there is no problem. It's probably necessary to add a guard that avoids infinite context changes.
Also, the WML highlighter is a little old and I have seen some problems in sample files. The highlighter considers all content between `[` and `]` as tag. According to the documentation :
Also, tag and key names follow a special format. They will contain only alphanumeric characters and underscores; in particular, they will not contain +, -, or whitespace.
Considering this, and based on the VSCode highlighter, I modified the code so that only tags with valid names are highlighted.
-  Wesnoth Wiki. SyntaxWML, Tag and Attribute Structures: https://wiki.wesnoth.org/SyntaxWML#Tag_and_Attribute_Structures
-  Wesnoth Markup Language syntax highlightning for VS Code: https://github.com/Byteron/wml , https://marketplace.visualstudio.com/items?itemName=Bitron.wml
R216 Syntax Highlighting
To: nibags, #framework_syntax_highlighting, dhaumann, cullmann
Cc: kwrite-devel, kde-frameworks-devel, hase, michaelh, ngraham, bruns, demsking, cullmann, sars, dhaumann
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the KWrite-Devel