Skip to content

Releases: ruby-next/paco

v0.2.1

17 May 17:34
v0.2.1
6d94465
Compare
Choose a tag to compare

Added

Full Changelog: v0.2.0...v0.2.1

v0.2.0

28 Dec 13:05
v0.2.0
65f7053
Compare
Choose a tag to compare

Added

  • Callstack collection for debugging. (@skryukov)

Pass with_callstack: true to the Paco::Parser#parse method to collect a callstack while parsing. To examine the callstack catch the ParseError exception:

begin
  string("Paco").parse("Paco!", with_callstack: true)
rescue Paco::ParseError => e
  pp e.callstack.stack # You will probably want to use `binding.irb` or `binding.pry`
end
  • Paco::Combinators.index method. (@skryukov)

Call Paco::Combinators.index to get Paco::Index representing the current offset into the parse without consuming the input.
Paco::Index has a 0-based character offset attribute :pos and 1-based :line and :column attributes.

index.parse("Paco") #=> #<struct Paco::Index pos=0, line=1, column=1> 

Add require "paco/rspec" to spec_helper.rb to enable a special RSpec matcher #parse:

subject { string("Paco") }

it { is_expected.to parse("Paco") } # just checks if parser succeeds
it { is_expected.to parse("Paco").as("Paco") } # checks if parser result is eq to value passed to `#as`
it { is_expected.to parse("Paco").fully } # checks if parser result is the same as value passed to `#parse`

Changed

  • Paco::Combinators.seq_map merged into Paco::Combinators.seq. (@skryukov)
  • Paco::Combinators.sep_by_1 renamed to Paco::Combinators.sep_by!. (@skryukov)

Fixed

  • Paco::Combinators::Char#regexp now uses \A instead of ^. (@skryukov)
  • include Paco now works inside irb. (@skryukov)
  • Paco::Combinators#not_followed_by and Paco::Combinators#seq now don't consume input on error. (@skryukov)

Full Changelog: v0.1.0...v0.2.0

v0.1.0

16 Dec 10:21
448a80f
Compare
Choose a tag to compare

Added

Full Changelog: https://github.com/skryukov/paco/commits/v0.1.0