Bug 380229 - syntax highlighting for zsh is broken with a mathematical expression in a substring expression
Summary: syntax highlighting for zsh is broken with a mathematical expression in a sub...
Status: RESOLVED FIXED
Alias: None
Product: frameworks-syntax-highlighting
Classification: Frameworks and Libraries
Component: syntax (other bugs)
Version First Reported In: 5.31.0
Platform: Kubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-26 15:42 UTC by Jonathan Poelen
Modified: 2017-07-23 09:23 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In: 5.37
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Poelen 2017-05-26 15:42:13 UTC
In the following zsh expression:

${str:$((${#a[1]}+1))}

The syntax highlighting is broken from '+' to the end of the document.
Comment 1 Jonathan Poelen 2017-06-03 00:22:01 UTC
I suggest replacing

<RegExpr attribute="Variable" context="VarBrace" String="\$\{&varname;" />

with

<RegExpr attribute="Variable" context="VarBrace" String="\$\{#?&varname;" />


Implemented here:

https://github.com/jonathanpoelen/syntax-highlighting/commit/f08aa02684017668738c8e8da7e64aef6100a5b5
Comment 2 Dominik Haumann 2017-07-21 17:56:36 UTC
Git commit 8947f5f06611503f802b1a5a285bf33b12ea02a4 by Dominik Haumann.
Committed on 21/07/2017 at 17:56.
Pushed by dhaumann into branch 'master'.

zsh highlighting: Fix math expression in a substring expression

Thanks to Jonathan Poelen for the initial patch.
In addition, we now also have a small unit test,
taken from http://zshwiki.org/home/examples/hardstatus

FIXED-IN: 5.37

A  +66   -0    autotests/folding/test.zsh.fold
A  +73   -0    autotests/html/test.zsh.html
A  +66   -0    autotests/input/test.zsh
A  +66   -0    autotests/reference/test.zsh.ref
M  +2    -2    data/syntax/zsh.xml

https://commits.kde.org/syntax-highlighting/8947f5f06611503f802b1a5a285bf33b12ea02a4