Can I 'unmatch' rule programmatically in treetop?

Posted by dimus on Stack Overflow See other posts from Stack Overflow or by dimus
Published on 2010-04-15T20:30:21Z Indexed on 2010/04/15 20:33 UTC
Read the original article Hit count: 369

Filed under:
|

Is it possibe to skip a rule validating it using ruby code in treetop?

Say there is something like this:

rule short_words
  [a-z]+ {
    def method1
      text_value
    end
    ...
  }

end

And I want the words size to be from 2 to 5 letters. Can I exit rule if I find that the length of text_value is not between 2 and 5?

© Stack Overflow or respective owner

Related posts about ruby

Related posts about treetop