QuBiT / cucumber-netbeans-plugin

Plugin / Module which allow Syntax Highlighting and many more in NetBeans with .feature Files
MIT License
50 stars 19 forks source link

Specifying multiple "Scenarios:" results in unexpected token #8

Closed tmilker closed 15 years ago

tmilker commented 15 years ago

Cucumber Features 1.2.4 NetBeans Ruby 6.7 RC3

Cucumber Features incorrectly identifies multiple "Scenarios" for a Scenario Outline as syntax errors. If you have a feature file like:

Feature: user submits a guess

    The user submits a guess

    Scenario Outline: submit guess
        Given the secret word is <word>
        When I guess <guess>
        Then the answer should be <answer>

    Scenarios: user guesses 'strong'
        | word   | guess    | answer |
        | happy  | strong   | no     |
        | strong | strong   | no     |
        | happy  | strong   | no     |

    Scenarios: user guesses 'happy'
        | word   | guess    | answer |
        | happy  | happy    | yes    |
        | what   | happy    | no     |

The second "Secenarios" section and any additional "Scenarios" sections are identified as unexpected tokens.

QuBiT commented 15 years ago

i'll check it and solve it, stay tuned.

QuBiT commented 15 years ago

thanks for this information, my grammar was specified only to have exactly 1 examples block.

I changed it and now you can have as many as you want.

check new version 1.2.5 in the download section.

tmilker commented 15 years ago

I fixed it by editing the language.nbs file and changing:

TableScenario = <scenario_outline> <colon> [ScenarioDescription] ScenarioBlock ExamplesBlock;

to:

TableScenario = <scenario_outline> <colon> [ScenarioDescription] ScenarioBlock (ExamplesBlock)*;

However, I was not familiar with the exact syntax of the file(What lexer is it?) and did not know how to require at least 1 ExampleBlock and allow *.

edit: Fixed code for what I actually did, for posterity.

QuBiT commented 15 years ago

Thats a similar solution to what I did.

[] = for 0..1

()* = for 0..*

just the token = 1

About the lexer, and more ... just read my "NetBeans" wiki page.

QuBiT commented 15 years ago

the solution for:

at least 1 = Token (Token)*

so I changed it again and the current version in the download is the version with "at least 1"