2014-06-04 18:55:04 +02:00
|
|
|
module Parser
|
|
|
|
module FunctionDefinition
|
|
|
|
include Parslet
|
2015-09-15 17:57:31 +02:00
|
|
|
|
2014-06-04 18:55:04 +02:00
|
|
|
rule(:function_definition) {
|
2015-10-08 21:57:39 +02:00
|
|
|
type >> ((class_name|name).as(:receiver) >> str(".")).maybe >> #possibly qualified
|
2015-09-17 23:02:52 +02:00
|
|
|
name.as(:function_name) >> left_parenthesis >>
|
2015-10-09 16:28:47 +02:00
|
|
|
parameter_list.maybe >> right_parenthesis >> statements_end >> space?
|
2014-06-04 18:55:04 +02:00
|
|
|
}
|
|
|
|
|
2014-06-19 18:33:08 +02:00
|
|
|
rule(:parameter_list) {
|
2015-10-09 16:28:47 +02:00
|
|
|
((field_def.as(:parameter) >> (comma >> field_def.as(:parameter)).repeat(0)).repeat(0,1)).as(:parameter_list)
|
2014-06-04 18:55:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|