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".
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
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.
I have updated the Bash lexer to use ILexer4 interface, and added substyling for identifiers and scalars. Patch attached.
A new version with a minor fix where substyler will skip the '$' when matching scalars.
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.
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.
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.
Version 3 with anonymous namespace and fix for initStyle.
That looks good from my point of view.
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.
Committed as [a581d5].
Removed description of fold.comment as [16fd3e].
Related
Commit: [16fd3e]
Commit: [a581d5]