Stephen J. Turnbull wrote:
There's no regexp "type", but there is a more convenient way to notate
regexps: raw strings. Then this
> (if (looking-at "\\s-*\\(in\\|out\\)\\s-*") ....
becomes
(if (looking-at #r"\s-*\(in\|out\)\s-*") ....
This is better than a regular string. It cuts backslashes to a half. :)
Adding special syntax for regexps (which really are just strings as a
data type; XEmacs does compile them to a special byte code, but this is
entirely internal) would complicate lexing immensely ("/" is a valid
symbol component, so
(setq /bin/sh "/usr/local/bin/zsh-dev")
actually sets the value of the symbol `/bin/sh').
I did not really care for slash syntax. I just wanted to show an example, but it
was a bad choice.
A PCRE-compatible regular expression syntax would be far more useful
("#r" is only two extra characters), but it would require changing a
lot of things to implement, and for backward compatibility it would
have to exist alongside of the old-style regular expressions. So it
hasn't been done yet. It would be possible to do something like
Certainly, backward compatibility is important, and changing all internal code
just to support new syntax is not worth it. I did not really expecting that. But
I was hoping for something like you mentioned below. PCRE is quite powerful and
useful, though v8 seems to be too complicated and overkill to implement.
I will look into the re-builder library.
(defun pcre-compile (regexp)
"Rewrite the Perl-compatible regular expression REGEXP in Emacs syntax."
;; code goes here)
and call it
(if (looking-at (pcre-compile #r"\s-*(in|out)\s-*)) ....
as a first step in that direction. You might want to look at the
re-builder library (supplied in the XEmacs packages distribution) and
the libraries referenced in it (such as rx, sregex, and lisp-re). I
don't know whether any of them provide such translation, but it seems
quite possible.
--
--------------------------------------------------------------------
Toshi Isogai Toshi.Isogai(a)seakr.com
SEAKR Engineering, Inc.
6221 S. Racine Circle
Centennial, CO 80111
(303) 784-7674 direct
(303) 790-8499 main
--------
This e-mail may contain confidential and privileged material for the sole use of the
intended recipient. If this email is not intended for you, or you are not responsible for
the delivery of this message to the intended recipient, please note that this message may
contain SEAKR Engineering (SEAKR) Privileged/Proprietary Information. In such a case, you
are strictly prohibited from downloading, photocopying, distributing or otherwise using
this message, its contents or attachments in any way. If you have received this message
in error, please notify us immediately by replying to this e-mail and delete the message
from your mailbox. Information contained in this message that does not relate to the
business of SEAKR is neither endorsed by nor attributable to SEAKR.
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-beta