[rspec-users] [Cucumber] call the (Treetop?) parser directly?

Korny Sietsma korny at sietsma.com
Wed Apr 29 07:34:13 EDT 2009


Just one comment - I went down this path a bit, and ended up finding
it drastically easier to write a custom formatter.
Take a look at http://wiki.github.com/aslakhellesoy/cucumber/custom-formatters
- or see my post earlier at
http://groups.google.com/group/rspec/browse_thread/thread/c8fde28e5f757758

I'm sure there are places where you'd want to call the parser
directly; but everything I needed to do was handled more easily by
writing a formatter and catching the events I care about.

- Korny


On Sat, Apr 25, 2009 at 2:07 PM, Phlip <phlip2005 at gmail.com> wrote:
> Cucumberists:
>
> The sample code:
>
> require 'treetop'
> require 'cucumber'
> require 'cucumber/parser'
> require 'cucumber/parser/treetop_ext'
>  # too many requires because fishing around!
>
>  include Cucumber
>  include Parser
>  include Feature
>
>  @parser = FeatureParser.new
>  exp = @parser.parse_or_fail(%{# My comment
> Feature: hi
> })
>
> The error message:
>
> NameError: undefined local variable or method `_nt_scenario_outline_keyword'
> for #<Cucumber::Parser::FeatureParser:0xb6f3f67c>
>    cucumber (0.3.0) lib/cucumber/parser/feature.rb:855:in
> `_nt_scenario_outline'
>    cucumber (0.3.0) lib/cucumber/parser/feature.rb:106:in `_nt_feature'
>    cucumber (0.3.0) lib/cucumber/parser/feature.rb:102:in `loop'
>    ...
>
> Okay, how do I just whip out the parser and have it parse raw Cuke code?
>
> --
>  Phlip
>  http://flea.sourceforge.net/resume.html
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>



-- 
Kornelis Sietsma  korny at my surname dot com
"Every jumbled pile of person has a thinking part
that wonders what the part that isn't thinking
isn't thinking of"


More information about the rspec-users mailing list