[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 12-eregexp-2.patch
From: |
Gary V. Vaughan |
Subject: |
Re: 12-eregexp-2.patch |
Date: |
Wed, 3 Oct 2001 18:41:30 +0100 |
User-agent: |
Mutt/1.3.16i |
On Tue, Oct 02, 2001 at 04:16:55PM +0200, Akim Demaille wrote:
>
> Here is my lost proposal for ERE macros, updated to
> post-post-m4_token_data changes.
This is excellent Akim, thankyou for implementing it! And do commit
at your earliest convenience.
I am mostly nit picking over your English here. Please forgive me...
> Index: NEWS
> --- NEWS Mon, 01 Oct 2001 16:22:19 +0200 akim
> +++ NEWS Mon, 01 Oct 2001 16:27:32 +0200 akim
> +* Support for the experimental `changeword' has been dropped.
> +
> [[snip]]
>
> -* `configure --with-modules="gnu m4 traditional load changeword"', for
> +* `configure --with-modules="gnu m4 traditional load"', for example,
The changeword amendments to NEWS should have gone in when I removed
that builtin. Mea Culpe. Please make a separate commit for them.
> +* New builtins `eregexp' and `epatsubst' to use Extended Regular Expressions
> + syntax in lieu of Basic Regular Expressions as used by `regexp' and
> + `patsubst'.
Ofcourse this part should be commited with the eregexp changes.
> -syntax for regular expressions is the same as in GNU Emacs.
> address@hidden, , Syntax of Regular Expressions, emacs, The GNU Emacs
> -Manual}.
> +syntax for regular expressions is similar to that of GNU Awk, Perl,
> +Egrep: so called ``Extended Regular Expression''.
... Perl, @sc{gnu} Awk and Egrep ...
> +Original regular expressions were much less powerful (basically only
> address@hidden was available), and as new operators were implemented, to keep
> +backward compatibility, they were mapped onto invalid sequences, such as
> address@hidden(}. The following macro is the exact peer of @code{eregexp},
> but
> +using this old and clumsy syntax.
Originally, regular expressions were much less powerful (basically only
@samp{*} was available), but to keep backward compatibility, new
operators were implemented with previously invalid sequences, such as
@samp{\(}. The following macro is exactly equivalent to
@code{eregexp}, but using the old, clumsy syntax.
> address@hidden {Builtin (gnu)} regexp (@var{string}, @var{regexp}, @w{opt
> @var{replacement})}
> +Same a @code{eregexp}, but using the old and clumsy ``Basic Regular
...Same as...
> +Expression'' syntax, the same as in GNU Emacs. @xref{Regexps, , Syntax
...as used in @sc{gnu} Emacs...
> +Here is a slightly more realistic example, which capitalizes individual
> +word or whole sentences, by substituting calls of the macros
...words...
> address@hidden
> +The syntax for regular expression has never clearly formalized for M4.
The syntax of regular expressions in M4 was never clearly formalized.
> +While Open BSD M4 uses extended regular expressions for @code{regexp}
> +and @code{patsubst}, @sc{gnu} M4 uses basic regular expression. Use
> address@hidden (@pxref{Eregexp and Regexp}) and @code{epatsubst}
> +(@pxref{Epatsubst and Patsubst}) for extended regular expressions.
An example of using ifelse(__gnu__, [], [regexp(...)], [eregexp(...)])
or suchlike might be good here?
Cheers,
Gary.
--
())_. Gary V. Vaughan gary@(oranda.demon.co.uk|gnu.org)
( '/ Research Scientist http://www.oranda.demon.co.uk ,_())____
/ )= GNU Hacker http://www.gnu.org/software/libtool \' `&
`(_~)_ Tech' Author http://sources.redhat.com/autobook =`---d__/