Show More
@@ -369,3 +369,20 b' class basealiasrules(object):' | |||||
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) |
@@ -2251,19 +2251,7 b' def _parsealiasdecl(decl):' | |||||
2251 | return parser.simplifyinfixops(tree, ('list',)) |
|
2251 | return parser.simplifyinfixops(tree, ('list',)) | |
2252 |
|
2252 | |||
2253 | def _relabelaliasargs(tree, args): |
|
2253 | def _relabelaliasargs(tree, args): | |
2254 | if not isinstance(tree, tuple): |
|
2254 | return _aliasrules._relabelargs(tree, args) | |
2255 | return tree |
|
|||
2256 | op = tree[0] |
|
|||
2257 | if op != 'symbol': |
|
|||
2258 | return (op,) + tuple(_relabelaliasargs(x, args) for x in tree[1:]) |
|
|||
2259 |
|
||||
2260 | assert len(tree) == 2 |
|
|||
2261 | sym = tree[1] |
|
|||
2262 | if sym in args: |
|
|||
2263 | op = '_aliasarg' |
|
|||
2264 | elif sym.startswith('$'): |
|
|||
2265 | raise error.ParseError(_("'$' not for alias arguments")) |
|
|||
2266 | return (op, sym) |
|
|||
2267 |
|
2255 | |||
2268 | def _parsealiasdefn(defn, args): |
|
2256 | def _parsealiasdefn(defn, args): | |
2269 | """Parse alias definition ``defn`` |
|
2257 | """Parse alias definition ``defn`` |
General Comments 0
You need to be logged in to leave comments.
Login now