[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Regexps and strings once again
From: |
Daniel Colascione |
Subject: |
Re: Regexps and strings once again |
Date: |
Sun, 14 Sep 2014 17:50:12 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.1 |
On 09/14/2014 04:27 PM, Lars Magne Ingebrigtsen wrote:
>
> (dom-by-id dom (regexp "I \\(couldn't\\)?haz new syntax"))
>
> It would basically just put a text property on the string, and functions
> like `dom-by-id' would just do
>
> (if (regexp-p match)
> (string-match match id)
> (string= match id))
>
> Of course, both `regexp' and the proposed new syntax could compile the
> regexp and return a regexp object and stuff if we wanted to be more
> efficient... But the regexp cache is already quite efficient, isn't it?
>
I've been working on an NFA combinator facility lately. The basic idea
is that you don't work in terms of regular expressions per se, but in
terms of state-matching machines (like the ones Ragel has) that you can
combine using the standard union, repeat, negative, and intersection
operators. You'd then build a matcher from an NFA-representation object
when you needed to build a recognizer. Stefan has something similar in
ELPA --- lex.el --- except his code seems to do the conversion in one
shot instead of supporting the incremental building of matching machines.
signature.asc
Description: OpenPGP digital signature
Re: Regexps and strings once again, Lars Magne Ingebrigtsen, 2014/09/15
Re: Regexps and strings once again, Yuri Khan, 2014/09/14