Re: [code] [scintillua] attempting to use alnum or underscore following word_match()

From: Mitchell <m.att.foicica.com>
Date: Mon, 20 Mar 2017 21:47:28 -0400 (EDT)

Hi Justin,

On Mon, 20 Mar 2017, Justin Dailey wrote:

> I'm not sure if this is something I'm simply overlooking or a bug. I'm
> attempting to use something like this:

> local macro = token('macro', '__' * word_match({'FILE', 'LINE'}, nil, true) * "__")

> However this never seems to match anything. It seems to be due to
> whatever is following the word_match(). If it is anything in "%w_" then
> it doesn't work as expected. If other symbols are used, such as:

> local macro = token('macro', '__' * word_match({'FILE', 'LINE'}, nil, true) * "##")

> Then it works as expected. (Of course this can be simply worked around
> if needed).

Your intuition is correct. `word_match()` uses "%w_" internally to find
candidate words, and then uses a hashmap lookup for the match. In your
case, the trailing "__" is also being included in the check. I'd recommend
including the leading and trailing "__" in your word list.

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 Mon 20 Mar 2017 - 21:47:28 EDT

This archive was generated by hypermail 2.2.0 : Tue 21 Mar 2017 - 06:53:04 EDT