soml-parser/lib/parser/function_definition.rb
Torsten Ruger 486e24514b there goes the module
it was ruby after all
should be reborn as twins: namespace and aspect
2015-10-08 22:57:39 +03:00

17 lines
499 B
Ruby

module Parser
module FunctionDefinition
include Parslet
rule(:function_definition) {
type >> ((class_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