ometa.runtime.ParseError.formatError can't deal with InputStreams

Bug #1061935 reported by Aaron Gallagher
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Parsley
Fix Committed
Undecided
Unassigned

Bug Description

The line ``lines = str(self.input).split('\n')`` will stringify an InputStream into something like ``<ometa.runtime.InputStream object at 0x10134c850>``.

    >>> g = BootOMetaGrammar("""
    ... foo = 'a':one baz:two 'd'+ 'e' -> (one, two)
    ... baz = 'b' | 'c'
    ... """, {})
    >>> gg = g.parseGrammar('g')
    >>> i = TrampolinedGrammarInterpreter(gg, 'foo', callback=print)
    >>> i.receive('foobar')
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/Users/habnabit/.local/lib/python2.7/site-packages/ometa/interp.py", line 43, in receive
        for x in self.next:
      File "/Users/habnabit/.local/lib/python2.7/site-packages/ometa/interp.py", line 158, in apply
        for x in self._apply(f, ruleName, argvals):
      File "/Users/habnabit/.local/lib/python2.7/site-packages/ometa/interp.py", line 96, in _apply
        for x in rule():
      File "/Users/habnabit/.local/lib/python2.7/site-packages/ometa/interp.py", line 190, in parse_And
        for x in self._eval(subexpr):
      File "/Users/habnabit/.local/lib/python2.7/site-packages/ometa/interp.py", line 215, in parse_Or
        raise ParseError(self.input, *joinErrors(errors))
    ometa.runtime.ParseError:
    <ometa.runtime.InputStream object at 0x10134c850>
    ^
    Parse error at line 2, column 0: expected the object 'a'

Related branches

Revision history for this message
Allen Short (washort) wrote :
Changed in parsley:
status: New → Fix Committed
Allen Short (washort)
Changed in parsley:
milestone: none → 1.1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.