Skip to content
  • Damien George's avatar
    py/parse: Simplify handling of errors by raising them directly. · f615d82d
    Damien George authored
    The parser was originally written to work without raising any exceptions
    and instead return an error value to the caller.  But it's now required
    that a call to the parser be wrapped in an nlr handler, so we may as well
    make use of that fact and simplify the parser so that it doesn't need to
    keep track of any memory errors that it had.  The parser anyway explicitly
    raises an exception at the end if there was an error.
    
    This patch simplifies the parser by letting the underlying memory
    allocation functions raise an exception if they fail to allocate any
    memory.  And if there is an error parsing the "<id> = const(<val>)" pattern
    then that also raises an exception right away instead of trying to recover
    gracefully and then raise.
    f615d82d