[RFC] [PATCH] Support arguments in template expandos (v3)

Rocco Rutte pdmef at gmx.net
Thu May 28 07:11:16 CDT 2009


Hi,

* Martin Geisler wrote:
> Rocco Rutte <pdmef at gmx.net> writes:

> Heh, me too! If I understand it correctly, then there will be no way to
> include a litteral " in the arguments?

Yes, plus |, { and } and likely %. I still didn't read Brendan's
implementation carefully, but from what I saw it rolls out a complete
new parser for templates. This has the advantage that you can use pretty
much every character in templates. Using the regex approach on the
contrary means you need to add every character and character class to
the regex for allowed characters that want to allow in arguments.

I've updated mine to current crew and templater refactorings, please let
me know if I should send it to the list.

I also have a version that parses arguments more carefully, uses
"{key|foo(bar,baz)}" syntax which shows almost no slowdown compared to
the untouched version. It also supports escaping, so spaces, brackets,
and commas are possible in arguments. But it still has the problem that
every allowed character needs to be in the templater regex... :-(

Another idea I had is put Brendan's implementation in pure/ and write a
fast parser in C.

Rocco


More information about the Mercurial-devel mailing list