And I just figured out why this wasn't working, and fixed it. Turns out I
need to just match #optional_paramter or #required_parameter in the
#parameters rule. Validating that no optional parameters come before
required parameters will be validated when building the AST proper.


On Fri, Mar 29, 2013 at 9:26 PM, Thomas Ingram <[email protected]>wrote:

> I've managed to get my parser to pass all (previously) existing test!
> However I noticed that one test[4] was sensitive to a change I didn't think
> it should be, so I wrote some more tests.
>
> I have a method in the parser to match comma-separated items (#csv). #csv
> didn't allow whitespace, so I added whitespaces? rules to it. After that I
> was able to get all tests passing except one[4]. I found that if I changed
> the #parameters[1] rule to use #csv_raw (just for #required_parameter),
> test[4] would pass. Then I hacked in a #csv_raw method to do what the old
> #csv method did (match without whitespace).
>
> I added three failing tests[2][3][5] to make sure everything was covered.
> However if I change #parameters to use #csv instead of #csv_raw,
> tests[3][4][5] fail, and test[2] passes.
>
> Clearly I'm missing something. Any ideas?
>
> [1]
> https://github.com/rip-lang/rip/blob/take-two/lib/rip/compiler/parser.rb#L116
> [2]
> https://github.com/rip-lang/rip/blob/take-two/spec/rip/compiler/parser_spec.rb#L211
> [3]
> https://github.com/rip-lang/rip/blob/take-two/spec/rip/compiler/parser_spec.rb#L229
> [4]
> https://github.com/rip-lang/rip/blob/take-two/spec/rip/compiler/parser_spec.rb#L257
> [5]
> https://github.com/rip-lang/rip/blob/take-two/spec/rip/compiler/parser_spec.rb#L280
>
> --
> Thomas Ingram
>



-- 
Thomas Ingram

Reply via email to