Menu

#2054 BASH lexer does not provide "fold" or "fold.compact" properties

Bug
closed-fixed
nobody
5
2019-01-11
2018-10-19
skunkos
No

It seems that BASH lexer offers folding functionality, but its "SCI_PROPERTYNAMES" returns empty string. I would expect it to return at least "fold.comment" and "fold.compact".

Am I right here?

Related

Feature Requests: #1052

Discussion

  • Neil Hodgson

    Neil Hodgson - 2018-10-19

    The Bash lexer is an older style 'function lexer' not a newer 'object lexer' so can not implement the PropertyNames method used for the SCI_PROPERTYNAMES API.

    It is possible to search the lexer source code for property names and this is done by the scintilla\scripts\ScintillaData.py script.

     
  • Kacper Kasper

    Kacper Kasper - 2018-11-24

    I have updated the Bash lexer to use ILexer4 interface, and added substyling for identifiers and scalars. Patch attached.

     
  • Kacper Kasper

    Kacper Kasper - 2018-11-24

    A new version with a minor fix where substyler will skip the '$' when matching scalars.

     
    • Kein-Hong Man

      Kein-Hong Man - 2018-11-24

      I will mostly leave this to Neil, since I am really behind on ILexer4 and stuff like that. Looks to me like behaviour will be mostly identical, I will have to read up on what some of those things do first. Anyway I will try it out on my test cases in 1-2 days and will report any issues here.

       
      • Neil Hodgson

        Neil Hodgson - 2018-11-25

        The main difference appears to be that there can be 'arbitrary' number of sets of keywords using the substyles feature. Search the section of python.properties for "substyles" for an example use in SciTE.

         
  • Neil Hodgson

    Neil Hodgson - 2018-11-25

    I'll leave the behaviour checking to Kein-Hong Man as my use of bash is very simple.

    It looks mostly good with some minor warnings.

    There is a possibility of name clashes for symbols that don't need to be exported from this file. Either add 'static' to local symbols or wrap most of the file (except for the LexerModule definition) in an unnamed namespace like LexCPP.cxx does.

    There's an unreferenced parameter warning:
    1>c:\u\hg\scintilla\lexers\lexbash.cxx(991): warning C4100: 'initStyle': unreferenced formal parameter
    The normal way to avoid this is to declare the parameter with no name.

     
  • Kacper Kasper

    Kacper Kasper - 2018-11-25

    Version 3 with anonymous namespace and fix for initStyle.

     
    • Neil Hodgson

      Neil Hodgson - 2018-11-25

      That looks good from my point of view.

       
    • Kein-Hong Man

      Kein-Hong Man - 2018-11-27

      Just tried this latest patch and it works fine on my MSYS2 compile. Now I will go learn the ILexer4 stuff in the Scintilla docs, heh. Attached is a copy of all my bash test files.

       
  • Neil Hodgson

    Neil Hodgson - 2018-11-27
    • labels: --> scintilla, lexer, bash
    • status: open --> open-fixed
     
  • Neil Hodgson

    Neil Hodgson - 2018-11-27

    Committed as [a581d5].

    Removed description of fold.comment as [16fd3e].

     

    Related

    Commit: [16fd3e]
    Commit: [a581d5]

  • Neil Hodgson

    Neil Hodgson - 2019-01-11
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.