Make PyParsing fail loudly

Anonymous
2013-04-16
2013-05-14

  • Anonymous
    2013-04-16

    Hi everyone,

    When using http://pastebin.com/LPA6eEre pyparsing often just ignores stuff instead of complaining when it can't handle something. This is especially true for stuff within "suite". Is there any way to tell pyparsing to fail fast and loud if it can't handle something instead of ignoring it?

     

  • Anonymous
    2013-04-16

    I'm not on a machine with pyparsing, so can't try your pastebin example at the moment.
    But can you be more specific about the "stuff" it ignores? It might be an issue with your
    grammar. If a parser (any parser) can't "handle" something and the grammar has
    alternative rules, the parser has to try to use those alternatives. That's not ignoring
    something. That's parsing according to the grammar.

     

  • Anonymous
    2013-04-16

    Running this http://pastebin.com/ijT3dVmt through it only catches the top 9 lines

     

  • Anonymous
    2013-04-16

    What is BUILTINS on line 167? Mine isn't compiling without that.

     

  • Anonymous
    2013-04-16

    Thanks for trying to help DangGriffith. I think I figured it out. When calling parseFile if I pass parseAll=True it will fail if there's unexpected stuff at the end. Also removing "empty" from "suite" helped a lot.