rubyx/lib/parser/conditional.rb

16 lines
497 B
Ruby
Raw Normal View History

2014-05-10 10:14:34 +02:00
module Parser
module Conditional
include Parslet
rule(:conditional) {
keyword_if >> left_parenthesis >> expression.as(:conditional) >> right_parenthesis >> newline >>
delimited_expressions(keyword_else).as(:if_true) >>
delimited_expressions(keyword_end).as(:if_false)
}
2014-05-10 18:02:51 +02:00
rule(:while) {
keyword_while >> expression.as(:while_cond) >> keyword_do >> newline >>
delimited_expressions(keyword_end).as(:body)
}
2014-05-10 10:14:34 +02:00
end
end