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.