Bug 387915 - Bash highlighting breaks when using \{ \} with =~ regular exp.
Summary: Bash highlighting breaks when using \{ \} with =~ regular exp.
Alias: None
Product: frameworks-syntax-highlighting
Classification: Frameworks and Libraries
Component: syntax (show other bugs)
Version: 5.28.0
Platform: openSUSE Linux
: NOR minor
Target Milestone: ---
Assignee: KWrite Developers
Depends on:
Reported: 2017-12-14 22:15 UTC by James
Modified: 2018-09-10 08:13 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 5.51.0

The script. (1.55 KB, application/x-shellscript)
2017-12-14 22:15 UTC, James

Note You need to log in before you can comment on or make changes to this bug.
Description James 2017-12-14 22:15:49 UTC
Created attachment 109381 [details]
The script.

Version 16.08.2
KDE Frameworks 5.26.0
Qt 5.6.1
Opensuse 42.2.20170721

I've written a bash script to convert .sub to .vtt Subtitle files.
The script works perfectly.
This line screws up highlighting 

[[ $line_name =~ \{([0-9]{1,})\}\{([0-9]{1,})\}(.*) ]]

From here down, Highlighting is broken.

This line reads "{123}{128}Some Subtitle text."
it's the \{ \} escapes that mess it up.

Also, I've noticed that it doesn't correctly highlight a line like this.

[[ $name =~ (.*)_(S[0-9]{2})(E[0-9]{2,3}[a-z]{0,1})_(.*) ]]

All good until {2} then all blue to the )_( near the end.
This does not break highlighting in the rest of the file.

I'm new to this, So be kind ;)

Comment 1 Nibaldo G. 2018-09-10 08:10:28 UTC
Git commit b8a7413fc560e254cda2c7c0903b157c71b9f836 by Nibaldo González.
Committed on 10/09/2018 at 08:10.
Pushed by ngonzalez into branch 'master'.

Bash: fix parameter & brace expansion


Sometimes, the content in braces `{ ... }` is not correctly highlighted, since the RegExpr rule that detects it is very general.

Also, some parameter expressions are added, such as `${parameter^^pattern}`, `${parameter,,pattern}` & `${parameter@operator}` (before, that was highlighted as "Error"). In the expressions `${parameter:offset:length}`, spaces are allowed after ":" and +/- signs in numbers.

* Bash Reference Manual: https://www.gnu.org/software/bash/manual/bashref.html#Brace-Expansion

Reviewers: cullmann, dhaumann, #framework_syntax_highlighting

Reviewed By: cullmann, dhaumann, #framework_syntax_highlighting

Subscribers: kwrite-devel, kde-frameworks-devel

Tags: #kate, #frameworks

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

M  +11   -0    autotests/folding/test.bash.fold
M  +11   -0    autotests/html/test.bash.html
M  +11   -0    autotests/input/test.bash
M  +11   -0    autotests/reference/test.bash.ref
M  +21   -6    data/syntax/bash.xml