equal
deleted
inserted
replaced
640 |
640 |
641 def parse(spec, lookup=None): |
641 def parse(spec, lookup=None): |
642 try: |
642 try: |
643 return _parsewith(spec, lookup=lookup) |
643 return _parsewith(spec, lookup=lookup) |
644 except error.ParseError as inst: |
644 except error.ParseError as inst: |
645 if len(inst.args) > 1: # has location |
645 if inst.location is not None: |
646 loc = inst.args[1] |
646 loc = inst.location |
647 # Remove newlines -- spaces are equivalent whitespace. |
647 # Remove newlines -- spaces are equivalent whitespace. |
648 spec = spec.replace(b'\n', b' ') |
648 spec = spec.replace(b'\n', b' ') |
649 # We want the caret to point to the place in the template that |
649 # We want the caret to point to the place in the template that |
650 # failed to parse, but in a hint we get a open paren at the |
650 # failed to parse, but in a hint we get a open paren at the |
651 # start. Therefore, we print "loc + 1" spaces (instead of "loc") |
651 # start. Therefore, we print "loc + 1" spaces (instead of "loc") |