2014-06-04 18:55:04 +02:00
|
|
|
module Parser
|
|
|
|
module Expression
|
2015-08-28 22:37:25 +02:00
|
|
|
include output
|
2014-06-04 18:55:04 +02:00
|
|
|
|
|
|
|
rule(:value_expression) { call_site | basic_type }
|
|
|
|
|
|
|
|
rule(:expression) { (simple_return | while_do | conditional | operator_expression | call_site ) >> newline }
|
|
|
|
|
|
|
|
def delimited_expressions( delimit )
|
|
|
|
( (delimit.absent? >> expression).repeat(1)).as(:expressions) >> delimit
|
|
|
|
end
|
|
|
|
|
|
|
|
rule(:expressions_do) { delimited_expressions(keyword_do) }
|
|
|
|
rule(:expressions_else) { delimited_expressions(keyword_else) }
|
|
|
|
rule(:expressions_end) { delimited_expressions(keyword_end) }
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|