On Sun, 13 Jan 2019 18:53:13 +0900, Yuya Nishihara wrote:
> So here we have string to parse, b''.join(ret), and replacements, inputs.
> If b''.join(ret) contained '$0' instead of 'internal(0)', and if inputs
> were dict of {'$0': alias('$0', ..., ('smartset', inputs[0]))}, we can just
> feed them to _aliasrules.
> 
>   aliases = build_dict_of_inputs(inputs)
>   tree = _parsewith(b''.join(ret), syminitletters=_aliassyminitletters)
>   tree = _aliasrules.expand(aliases, tree)

Actually there's a simpler tool, parser.buildtree(). We still need an invalid
placeholder symbol that can be parsed, e.g. '$', but we don't have to care
about the internals of the alias expansion.

  tree = _parsewith(b''.join(ret), syminitletters=_aliassyminitletters)
  tree = parser.buildtree(tree, ('symbol', '$'), ('smartset', inputs[0]), ...)
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to