WML: fix infinite loop in contexts switch & only highlight tags with valid names
Summary: BUG: 402720 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 [1]: ``` 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. **References:** * [1] Wesnoth Wiki. SyntaxWML, Tag and Attribute Structures: https://wiki.wesnoth.org/SyntaxWML#Tag_and_Attribute_Structures * [2] Wesnoth Markup Language syntax highlightning for VS Code: https://github.com/Byteron/wml , https://marketplace.visualstudio.com/items?itemName=Bitron.wml Reviewers: #framework_syntax_highlighting, dhaumann, cullmann Reviewed By: #framework_syntax_highlighting, dhaumann Subscribers: kwrite-devel, kde-frameworks-devel Tags: #kate, #frameworks Differential Revision: https://phabricator.kde.org/D17891
parent
abd1bb40
Please register or sign in to comment