Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I wrote a quick parser in pyparsing to do it.</p> <pre><code>from pyparsing import * str = """ ********************************************************************** File "example.py", line 16, in __main__.factorial Failed example: [factorial(n) for n in range(6)] Expected: [0, 1, 2, 6, 24, 120] Got: [1, 1, 2, 6, 24, 120] ********************************************************************** File "example.py", line 20, in __main__.factorial Failed example: factorial(30) Expected: 25252859812191058636308480000000L Got: 265252859812191058636308480000000L ********************************************************************** """ quote = Literal('"').suppress() comma = Literal(',').suppress() in_ = Keyword('in').suppress() block = OneOrMore("**").suppress() + \ Keyword("File").suppress() + \ quote + Word(alphanums + ".") + quote + \ comma + Keyword("line").suppress() + Word(nums) + comma + \ in_ + Word(alphanums + "._") + \ LineStart() + restOfLine.suppress() + \ LineStart() + restOfLine + \ LineStart() + restOfLine.suppress() + \ LineStart() + restOfLine + \ LineStart() + restOfLine.suppress() + \ LineStart() + restOfLine all = OneOrMore(Group(block)) result = all.parseString(str) for section in result: print section </code></pre> <p>gives</p> <pre><code>['example.py', '16', '__main__.factorial', ' [factorial(n) for n in range(6)]', ' [0, 1, 2, 6, 24, 120]', ' [1, 1, 2, 6, 24, 120]'] ['example.py', '20', '__main__.factorial', ' factorial(30)', ' 25252859812191058636308480000000L', ' 265252859812191058636308480000000L'] </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload