Re: [code] [textadept] reset lexer when highlighting is wrong

From: Mitchell <m.att.foicica.com>
Date: Thu, 24 Dec 2015 09:20:38 -0500 (EST)

Hi Thorsten,

On Thu, 24 Dec 2015, Thorsten Kampe wrote:

> Hi,
>
> I have a bash script that ends like this:
>
> ```
> # enable history and completion for `sqlplus` if possible
> if which rlwrap &> /dev/null
> then
> alias sqlplus='rlwrap -D2 -irc -b'\''"@(){}[],+=&^%#;|\'\''
                    ^ ^ ^^^

I've marked the points of interest to the lexer in order to help shed
light on this (it will only show up correctly if your mail client shows
monospace text):

1. The beginning of a quoted string.
2. The end of the quoted string.
3. The beginning of the next quoted string (note the leading '\' is
ignored).
4. The end of that quoted string (empty).
5. The beginning of a double-quoted string.

Since (5) has no end delimitter, that is why the rest of the file shows up
green. I assume your code is valid bash, so the lexer has a bug. I'm just
not sure what it is (perhaps #3?).

> sqlplus'
> fi
> [...]
> ```
>
> After the `alias` line textadept displays everything in green as if
> it's part of the alias string. Obviously the lexer definition gets
> confused by the sheer number of ' and \ characters.
>
> Is there a way to tell the lexer in the script to restart the
> lexing/tokenizing at a certain line?

No this is not possible. The lexer needs to be fixed.

Cheers,
Mitchell

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Thu 24 Dec 2015 - 09:20:38 EST

This archive was generated by hypermail 2.2.0 : Fri 25 Dec 2015 - 06:30:58 EST