comparison mercurial/revset.py @ 29074:e7c679738503

revset: define _parsealias() in _aliasrules class It's short. It doesn't make sense to define _parsealias() outside of the class.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 17 Apr 2016 13:06:44 +0900
parents 81bac118f9e2
children 2822e9a5263b
comparison
equal deleted inserted replaced
29073:81bac118f9e2 29074:e7c679738503
2236 syminitletters=syminitletters)) 2236 syminitletters=syminitletters))
2237 if pos != len(spec): 2237 if pos != len(spec):
2238 raise error.ParseError(_('invalid token'), pos) 2238 raise error.ParseError(_('invalid token'), pos)
2239 return parser.simplifyinfixops(tree, ('list', 'or')) 2239 return parser.simplifyinfixops(tree, ('list', 'or'))
2240 2240
2241 def _parsealias(spec):
2242 """Parse alias declaration/definition ``spec``
2243
2244 This allows symbol names to use also ``$`` as an initial letter
2245 (for backward compatibility), and callers of this function should
2246 examine whether ``$`` is used also for unexpected symbols or not.
2247 """
2248 return _parsewith(spec, syminitletters=_aliassyminitletters)
2249
2250 class _aliasrules(parser.basealiasrules): 2241 class _aliasrules(parser.basealiasrules):
2251 """Parsing and expansion rule set of revset aliases""" 2242 """Parsing and expansion rule set of revset aliases"""
2252 _section = _('revset alias') 2243 _section = _('revset alias')
2253 _parse = staticmethod(_parsealias) 2244
2245 @staticmethod
2246 def _parse(spec):
2247 """Parse alias declaration/definition ``spec``
2248
2249 This allows symbol names to use also ``$`` as an initial letter
2250 (for backward compatibility), and callers of this function should
2251 examine whether ``$`` is used also for unexpected symbols or not.
2252 """
2253 return _parsewith(spec, syminitletters=_aliassyminitletters)
2254 2254
2255 @staticmethod 2255 @staticmethod
2256 def _trygetfunc(tree): 2256 def _trygetfunc(tree):
2257 if tree[0] == 'func' and tree[1][0] == 'symbol': 2257 if tree[0] == 'func' and tree[1][0] == 'symbol':
2258 return tree[1][1], getlist(tree[2]) 2258 return tree[1][1], getlist(tree[2])