1 comment

[ 20.1 ms ] story [ 80.4 ms ] thread
I'm here to answer questions if anyone has any.

The biggest difference to Haskell's Parsec is probably the automatic labeling and error messages[1]:

  pry(main)> Parsby::Example::LispParser.sexp.parse "(foo `(foo ,bar) 2.3 . . nil)"    
  Parsby::ExpectationFailed: line 1:
    (foo `(foo ,bar) 2.3 . . nil)
                           |           * failure: char_in("([")
                           |           * failure: list
                           |          *| failure: symbol
                           |         *|| failure: nil
                           |        *||| failure: string
                           |       *|||| failure: number
                                   \\\||
                           |          *| failure: atom
                           |         *|| failure: abbrev
                                     \\|
                           |           * failure: sexp
                         V            *| success: lit(".")
                     \-/             *|| success: sexp
         \---------/                *||| success: sexp
     \-/                           *|||| success: sexp
    V                             *||||| success: char_in("([")
                                  \\\\\|
    |                                  * failure: list
    |                                  * failure: sexp
[1] https://github.com/jolmg/parsby#expectationfailed