rubyx/lib/parser/expression.rb

19 lines
576 B
Ruby
Raw Normal View History

2014-05-10 10:14:34 +02:00
module Parser
module Expression
include Parslet
rule(:value_expression) { call_site | basic_type }
2014-05-27 15:51:37 +02:00
rule(:expression) { (simple_return | while_do | conditional | operator_expression | call_site ) >> newline }
2014-05-10 10:14:34 +02:00
def delimited_expressions( delimit )
( (delimit.absent? >> expression).repeat(1)).as(:expressions) >> delimit
2014-05-10 10:14:34 +02:00
end
rule(:expressions_do) { delimited_expressions(keyword_do) }
2014-05-10 10:14:34 +02:00
rule(:expressions_else) { delimited_expressions(keyword_else) }
rule(:expressions_end) { delimited_expressions(keyword_end) }
end
end