Menu

#1944 Incorrect syntax hightlighting of strings in bash arrays

Bug
closed-fixed
nobody
5
2017-05-27
2017-05-04
No

Scintilla highlights strings in bash arrays inconsistently.
Please see the attached screenshot. All strings should be highlighted orange.

Originally reported for Geany at https://github.com/geany/geany/issues/1308.
Also verified with SciTE 3.7.4 and GTK+ 3.22 on Arch Linux.

1 Attachments

Related

Bugs: #1963

Discussion

  • Kein-Hong Man

    Kein-Hong Man - 2017-05-05

    I agree, single quotes and double quotes should be detected in a list. I will make a patch within this week.
    Without whitespace in between parentheses, the lexer intentionally highlights the segment as part of a path spec. It does not check enough syntax yet to do absolutely precise highlighting.

    However, I would be very interested in an actual code sample if you have one, rather than artificial snippets. I haven't actually seen anyone use a command list without whitespace in there, ever..

     
  • Kein-Hong Man

    Kein-Hong Man - 2017-05-05

    It seems like a holdover from the perl lexer. Perhaps I left it there for pathspecs.
    Having checked the bash docs, taking it out completely should not break anything. In the meantime, people writing actual code should not be impacted by this bug.

     
  • Radioactiveman

    Radioactiveman - 2017-05-05

    PKGBUILD files for Arch Linux are actual code samples. These files are used to create packages which then can be installed with the package manager.

    Case example for SciTE:
    https://git.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/scite

     

    Last edit: Radioactiveman 2017-05-05
  • Kein-Hong Man

    Kein-Hong Man - 2017-05-07

    Thank you for the example, it is appreciated. My usual bash contact is with tweaking startup scripts. I have found the array part of bash syntax in the reference manual now.

    After reviewing my stuff, it turned out that there was a valid reason to put the globbing code in, it is meant to enable zsh scripts to be highlighted without serious breakage. zsh added some globbing stuff with various kinds of syntax, they used parentheses and the # character which caused breakage in bash. I did my best to shovel the whole lot of it into a single highlighting style with some simple heuristics. Too simple, it turned out...

    The next post will be the patch and test samples to be picked up and updated in the Scintilla code base.

     
  • Kein-Hong Man

    Kein-Hong Man - 2017-05-07

    Here is an update for bash lexing to fix this issue. Attach are LexBash.cxx and test samples. A few more simple rules were added so that single element arrays is highlighted correctly. zsh globs which do not have the extended # syntax will be now highlighted using normal highlighting, a minor behaviour change that perhaps can be called an improvement. Maybe someday I will actually install zsh and do some proper tests...

    Code from hg HEAD, tested on gcc version 5.1.0 (tdm-1) on Win 7 Pro.

     
  • Neil Hodgson

    Neil Hodgson - 2017-05-07
    • labels: scintilla, bash --> scintilla, bash, lexer
    • status: open --> open-fixed
     
  • Neil Hodgson

    Neil Hodgson - 2017-05-07

    Committed as [761971].

     

    Related

    Commit: [761971]

  • Radioactiveman

    Radioactiveman - 2017-05-08

    I've just compiled Geany with your patch (they bundle Scintilla in the project) and the highlighting now works flawlessly. Thanks again for the fast fix.

     
  • Neil Hodgson

    Neil Hodgson - 2017-05-27
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.

MongoDB Logo MongoDB