Commit [c840e1] default Maximize Restore History

Bash: fix comment detection inside a word

A comment in bash is defined as "[...] a word beginning with # causes
that word and all remaining characters on that line to be ignored".

A word is defined as "a sequence of characters considered as a single
unit by the shell"; and there is a set of metacharacters defined as
"a character that, when unquoted, separates words. One of the
following: | & ; ( ) < > space tab".

In practice, "foo#bar" is one single word, not "foo" followed by a
comment. Trickier, "foo\;#bar" is also a single word, but "foo;bar"
are 2 words and a control character.

So, fix the Bash lexer to check whether the character preceding the
hash sign to be either a metacharacter or part of a word.
A maybe better fix would be to understand the Bash conception of a
word, and analyze those, but it would require a large rewrite.

Colomban Wendling Colomban Wendling 2013-11-18

changed lexers/LexBash.cxx
lexers/LexBash.cxx Diff Switch to side-by-side view
Loading...