mercurial/templater.py
changeset 45886 18489e26d9a0
parent 45776 0fc8b066928a
child 45942 89a2afe31e82
equal deleted inserted replaced
45885:600aec73f309 45886:18489e26d9a0
   374 
   374 
   375     >>> parseexpr(b'"foo"')
   375     >>> parseexpr(b'"foo"')
   376     ('string', 'foo')
   376     ('string', 'foo')
   377     >>> parseexpr(b'foo(bar)')
   377     >>> parseexpr(b'foo(bar)')
   378     ('func', ('symbol', 'foo'), ('symbol', 'bar'))
   378     ('func', ('symbol', 'foo'), ('symbol', 'bar'))
   379     >>> parseexpr(b'foo(')
   379     >>> from . import error
   380     Traceback (most recent call last):
   380     >>> from . import pycompat
   381       ...
   381     >>> try:
   382     ParseError: ('not a prefix: end', 4)
   382     ...   parseexpr(b'foo(')
   383     >>> parseexpr(b'"foo" "bar"')
   383     ... except error.ParseError as e:
   384     Traceback (most recent call last):
   384     ...   pycompat.sysstr(e.message)
   385       ...
   385     ...   e.location
   386     ParseError: ('invalid token', 7)
   386     'not a prefix: end'
       
   387     4
       
   388     >>> try:
       
   389     ...   parseexpr(b'"foo" "bar"')
       
   390     ... except error.ParseError as e:
       
   391     ...   pycompat.sysstr(e.message)
       
   392     ...   e.location
       
   393     'invalid token'
       
   394     7
   387     """
   395     """
   388     try:
   396     try:
   389         return _parseexpr(expr)
   397         return _parseexpr(expr)
   390     except error.ParseError as inst:
   398     except error.ParseError as inst:
   391         _addparseerrorhint(inst, expr)
   399         _addparseerrorhint(inst, expr)