Skip to content

Loading…

Addition example from website doesn't work with 2.2.0 #9

Closed
geeksam opened this Issue · 3 comments

2 participants

@geeksam

Saw talk at RubyConf, decided to play around with Citrus a wee bit on the flight home to PDX.

Tried following along with: http://mjijackson.com/citrus/example.html

Pasted second code sample (the one that adds two semantic blocks) to file, saved it. Launched IRB, required rubygems, required citrus, loaded addition file, parsed expression... then tried m.value and got:

Citrus::NoMatchError: No match named "term" in 1 + 2 + 3 (additive)
    from /Users/sam/rails/pdxrails/deps/lib/ruby/gems/1.8/gems/citrus-2.2.0/lib/citrus.rb:1198:in `method_missing'
    from (eval):3:in `value'
    from (irb):5
@geeksam

This, however, calculates it just fine:

  rule additive
    (number plus term:(additive | number)) {
      def value
        lft, _, rgt = *matches
        lft.value + rgt.value
      end
    }
  end
@mjackson
Owner

Thanks for catching this. This is a regression that was introduced in the 2.2 release. It has been fixed in this commit and pushed in version 2.2.2.

@geeksam

Cool; thanks for the quick fix. Will find some more time to play with this soon.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.