[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: modern regexes in emacs
From: |
Mattias Engdegård |
Subject: |
Re: modern regexes in emacs |
Date: |
Wed, 27 Feb 2019 13:09:23 +0100 |
26 feb. 2019 kl. 15.33 skrev Andreas Schwab <address@hidden>:
>
> If you want to byte-compile a form that contains a regexp object, a
> proper read syntax is required.
>
> The object types without read syntax are rather ephemeral, unlikely to
> occur in byte-compiled forms.
Thanks for pointing that out. I'm not sure how it would work -- please bear
with me.
Suppose we want to write (looking-at (pcre "a(b|c)")).
Then `pcre' is a macro returning a mutable object with the regexp in some
canonical form -- a traditional Emacs regexp, perhaps, or normalised rx or
something else. The object also has space for the internal compiled pattern,
roughly struct re_pattern_buffer today.
As Richard pointed out, it is polite to make the object human-readable (for
debugging, if nothing else). This means that we are either satisfied with the
readability of the canonical form, or the original pattern is included around
for this purpose.
Then (pcre "a(b|c)") might produce #s(regexp "a\\(b\\|c\\)" nil), which can be
serialised and read, even by humans.
After its first use, the last slot would have become something like
#<compiled-regexp 0xabc123>, but that would not occur in byte-compiled elisp
code.
- Re: modern regexes in emacs, (continued)
- Re: modern regexes in emacs, Mattias Engdegård, 2019/02/15
- Re: modern regexes in emacs, Eli Zaretskii, 2019/02/15
- Re: modern regexes in emacs, Richard Stallman, 2019/02/16
- Re: modern regexes in emacs, Lars Ingebrigtsen, 2019/02/25
- Re: modern regexes in emacs, Clément Pit-Claudel, 2019/02/25
- Re: modern regexes in emacs, Richard Stallman, 2019/02/25
- Re: modern regexes in emacs, Lars Ingebrigtsen, 2019/02/26
- Re: modern regexes in emacs, Troy Hinckley, 2019/02/26
- Re: modern regexes in emacs, Lars Ingebrigtsen, 2019/02/26
- Re: modern regexes in emacs, Andreas Schwab, 2019/02/26
- Re: modern regexes in emacs,
Mattias Engdegård <=
- Re: modern regexes in emacs, Daniel Pittman, 2019/02/27
- Re: modern regexes in emacs, Eli Zaretskii, 2019/02/26
- Re: modern regexes in emacs, Richard Stallman, 2019/02/26
- Re: modern regexes in emacs, Elias Mårtenson, 2019/02/25
- Re: modern regexes in emacs, Mattias Engdegård, 2019/02/26
- Re: modern regexes in emacs, Perry E. Metzger, 2019/02/15
- Re: modern regexes in emacs, Juri Linkov, 2019/02/17
- Re: modern regexes in emacs, Stefan Monnier, 2019/02/17
- Re: modern regexes in emacs, Clément Pit-Claudel, 2019/02/15
- Re: modern regexes in emacs, Eli Zaretskii, 2019/02/15