Re: [code] [textadept] Textadept 9 poll: Lua patterns or Regex?

From: Mitchell <m.att.foicica.com>
Date: Tue, 5 Jul 2016 21:07:42 -0400 (EDT)

Hi Chris,

On Sun, 3 Jul 2016, Chris Emerson wrote:

> Hi Mitchell,
>
> On Sat, Jul 02, 2016 at 11:07:10PM -0400, Mitchell wrote:
>> The question I have for you is would you prefer to have Regex
>> searches instead of Lua pattern searches?
>
> [snip]
>
> If this happens I'm personally all that interested in the UI end of it,
> but more the API. The things I'm likely to want to use it for:
>
> * search for next match
> * find all non-overlapping matches
> * highlight all matches
> * match against one line (including returning captures) for implementing
> the vi "s/(.*)-(.*)/\2_\1/" type of operation. If compiling the regex
> isn't very fast I'd ideally want to be able to re-use the same compiled
> regex each time.

The regex capabilities would be built into Scintilla's search/replace API,
so I believe all of your criteria will be met. I have a working "Find in
Files" implementation that hits the first 3 points, and Textadept provides
the `buffer.tag[]` table for retrieving tagged matches/captures from a
regex search you just performed.

Also, my prototype implementation only recompiles a given regex if it is
different than the one used previously ("different" in terms of C's
`strlen()` and `strcmp()` functions). Once again, my "Find in Files"
implementation only compiles the search regex once before running it over
all files. Performance should not be a problem in this case.

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 Tue 05 Jul 2016 - 21:07:42 EDT

This archive was generated by hypermail 2.2.0 : Wed 06 Jul 2016 - 06:52:58 EDT