2014-05-10 10:14:34 +02:00
|
|
|
module Parser
|
2014-05-12 11:20:31 +02:00
|
|
|
module Control
|
2014-05-10 10:14:34 +02:00
|
|
|
include Parslet
|
2014-05-12 11:14:04 +02:00
|
|
|
rule(:conditional) do
|
2014-05-10 10:14:34 +02:00
|
|
|
keyword_if >> left_parenthesis >> expression.as(:conditional) >> right_parenthesis >> newline >>
|
2014-05-12 11:14:04 +02:00
|
|
|
expressions_else.as(:if_true) >> expressions_end.as(:if_false)
|
|
|
|
end
|
2014-05-10 18:02:51 +02:00
|
|
|
|
2014-05-12 11:14:04 +02:00
|
|
|
rule(:while_do) do
|
|
|
|
keyword_while >> expressions_do.as(:while_cond) >> expressions_end.as(:body)
|
|
|
|
end
|
2014-05-10 10:14:34 +02:00
|
|
|
end
|
|
|
|
end
|