comparison mercurial/parser.py @ 28872:5f31d2248745

parser: move _relabelaliasargs() to common rule-set class This has no doctest because it will be covered by _builddefn() introduced by the next patch. revset._relabelaliasargs() will be removed soon.
author Yuya Nishihara <yuya@tcha.org>
date Mon, 29 Feb 2016 18:00:51 +0900
parents 6d6201fc5aae
children 2ca3b7c563f3
comparison
equal deleted inserted replaced
28871:6d6201fc5aae 28872:5f31d2248745
367 return (name, None, None, 367 return (name, None, None,
368 _("argument names collide with each other")) 368 _("argument names collide with each other"))
369 return (name, tree[:2], args, None) 369 return (name, tree[:2], args, None)
370 370
371 return (decl, None, None, _("invalid format")) 371 return (decl, None, None, _("invalid format"))
372
373 @classmethod
374 def _relabelargs(cls, tree, args):
375 """Mark alias arguments as ``_aliasarg``"""
376 if not isinstance(tree, tuple):
377 return tree
378 op = tree[0]
379 if op != cls._symbolnode:
380 return (op,) + tuple(cls._relabelargs(x, args) for x in tree[1:])
381
382 assert len(tree) == 2
383 sym = tree[1]
384 if sym in args:
385 op = '_aliasarg'
386 elif sym.startswith('$'):
387 raise error.ParseError(_("'$' not for alias arguments"))
388 return (op, sym)