soml-parser/lib/parser/function_definition.rb
2015-09-18 00:02:52 +03:00

17 lines
500 B
Ruby

module Parser
module FunctionDefinition
include Parslet
rule(:function_definition) {
type >> ((module_name|name).as(:receiver) >> str(".")).maybe >> #possibly qualified
name.as(:function_name) >> left_parenthesis >>
parameter_list.maybe >> right_parenthesis >> expressions_end >> space?
}
rule(:parameter_list) {
((field.as(:parameter) >> (comma >> field.as(:parameter)).repeat(0)).repeat(0,1)).as(:parameter_list)
}
end
end