[PATCH 1 of 6] revset: make tokenize extensible to parse alias declarations and definitions
FUJIWARA Katsunori
foozy at lares.dti.ne.jp
Fri Jan 9 03:07:33 CST 2015
At Thu, 08 Jan 2015 14:35:04 -0600,
Matt Mackall wrote:
>
> On Thu, 2015-01-08 at 19:37 +0900, FUJIWARA Katsunori wrote:
> > + if not syminitletter:
> > + syminitletter = lambda c: c.isalnum() or c in '._@' or ord(c) > 127
> > + if not symletter:
> > + symletter = lambda i, c: c.isalnum() or c in "-._/@" or ord(c) > 127
>
> You don't explain what "i" is used for.
Oops, I forgot explanation about it, sorry.
I intend "i" to pass the initial character of the symbol in parsing.
This can switch the policy of "valid symbol name" according to the
initial letter of the symbol. For example:
def symletter(i, c):
if i == '$':
return c.isalnum() or ord(c) > 127
else:
return c.isalnum() or c in "-._/@" or ord(c) > 127
> Ideally, we'd make these checks a trivial set lookup, which is much
> faster than a function call to a complex conditional and also tweakable.
I'll make "tokenize" take 2 optional sets "syminitletters" and
"symletters" for looking valid letters up, if switching the policy
above is too much for revset tokenization.
> --
> Mathematics is the supreme nostalgia of our time.
>
>
>
----------------------------------------------------------------------
[FUJIWARA Katsunori] foozy at lares.dti.ne.jp
More information about the Mercurial-devel
mailing list