Show More
@@ -251,13 +251,8 b' class basealiasrules(object):' | |||
|
251 | 251 | raise TypeError("'%s' is not instantiatable" % cls.__name__) |
|
252 | 252 | |
|
253 | 253 | @staticmethod |
|
254 |
def _parse |
|
|
255 |
"""Parse an alias name |
|
|
256 | raise NotImplementedError | |
|
257 | ||
|
258 | @staticmethod | |
|
259 | def _parsedefn(spec): | |
|
260 | """Parse an alias definition""" | |
|
254 | def _parse(spec): | |
|
255 | """Parse an alias name, arguments and definition""" | |
|
261 | 256 | raise NotImplementedError |
|
262 | 257 | |
|
263 | 258 | @staticmethod |
@@ -270,7 +265,7 b' class basealiasrules(object):' | |||
|
270 | 265 | """Parse an alias declaration into ``(name, tree, args, errorstr)`` |
|
271 | 266 | |
|
272 | 267 | This function analyzes the parsed tree. The parsing rule is provided |
|
273 |
by ``_parse |
|
|
268 | by ``_parse()``. | |
|
274 | 269 | |
|
275 | 270 | - ``name``: of declared alias (may be ``decl`` itself at error) |
|
276 | 271 | - ``tree``: parse result (or ``None`` at error) |
@@ -311,7 +306,7 b' class basealiasrules(object):' | |||
|
311 | 306 | ... return list(tree[1:]) |
|
312 | 307 | ... return [tree] |
|
313 | 308 | >>> class aliasrules(basealiasrules): |
|
314 |
... _parse |
|
|
309 | ... _parse = staticmethod(parse) | |
|
315 | 310 | ... _getlist = staticmethod(getlist) |
|
316 | 311 | >>> builddecl = aliasrules._builddecl |
|
317 | 312 | >>> builddecl('foo') |
@@ -342,7 +337,7 b' class basealiasrules(object):' | |||
|
342 | 337 | ('foo', None, None, 'argument names collide with each other') |
|
343 | 338 | """ |
|
344 | 339 | try: |
|
345 |
tree = cls._parse |
|
|
340 | tree = cls._parse(decl) | |
|
346 | 341 | except error.ParseError as inst: |
|
347 | 342 | return (decl, None, None, parseerrordetail(inst)) |
|
348 | 343 | |
@@ -392,7 +387,7 b' class basealiasrules(object):' | |||
|
392 | 387 | """Parse an alias definition into a tree and marks substitutions |
|
393 | 388 | |
|
394 | 389 | This function marks alias argument references as ``_aliasarg``. The |
|
395 |
parsing rule is provided by ``_parse |
|
|
390 | parsing rule is provided by ``_parse()``. | |
|
396 | 391 | |
|
397 | 392 | ``args`` is a list of alias argument names, or None if the alias |
|
398 | 393 | is declared as a symbol. |
@@ -404,7 +399,7 b' class basealiasrules(object):' | |||
|
404 | 399 | ... '"$1" or "foo"': ('or', ('string', '$1'), ('string', 'foo')), |
|
405 | 400 | ... } |
|
406 | 401 | >>> class aliasrules(basealiasrules): |
|
407 |
... _parse |
|
|
402 | ... _parse = staticmethod(parsemap.__getitem__) | |
|
408 | 403 | ... _getlist = staticmethod(lambda x: []) |
|
409 | 404 | >>> builddefn = aliasrules._builddefn |
|
410 | 405 | >>> def pprint(tree): |
@@ -429,7 +424,7 b' class basealiasrules(object):' | |||
|
429 | 424 | ('string', '$1') |
|
430 | 425 | ('string', 'foo')) |
|
431 | 426 | """ |
|
432 |
tree = cls._parse |
|
|
427 | tree = cls._parse(defn) | |
|
433 | 428 | if args: |
|
434 | 429 | args = set(args) |
|
435 | 430 | else: |
@@ -2253,8 +2253,7 b' def _parsealias(spec):' | |||
|
2253 | 2253 | class _aliasrules(parser.basealiasrules): |
|
2254 | 2254 | """Parsing and expansion rule set of revset aliases""" |
|
2255 | 2255 | _section = _('revset alias') |
|
2256 |
_parse |
|
|
2257 | _parsedefn = staticmethod(_parsealias) | |
|
2256 | _parse = staticmethod(_parsealias) | |
|
2258 | 2257 | _getlist = staticmethod(getlist) |
|
2259 | 2258 | |
|
2260 | 2259 | class revsetalias(object): |
General Comments 0
You need to be logged in to leave comments.
Login now