2014-05-10 10:14:34 +02:00
|
|
|
module Parser
|
|
|
|
module FunctionDefinition
|
|
|
|
include Parslet
|
|
|
|
|
|
|
|
rule(:function_definition) {
|
2014-05-12 12:47:47 +02:00
|
|
|
keyword_def >> name.as(:function_name) >> parmeter_list >> newline >> expressions_end >> newline
|
2014-05-10 10:14:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
rule(:parmeter_list) {
|
|
|
|
left_parenthesis >>
|
|
|
|
((name.as(:parmeter) >> (comma >> name.as(:parmeter)).repeat(0)).repeat(0,1)).as(:parmeter_list) >>
|
|
|
|
right_parenthesis
|
|
|
|
}
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|