some docs
This commit is contained in:
parent
74060d6ab6
commit
18c2abfd2b
@ -12,6 +12,11 @@ module Parser
|
|||||||
include Tokens
|
include Tokens
|
||||||
include Keywords
|
include Keywords
|
||||||
|
|
||||||
|
# Note about the lists (argument and parameter)
|
||||||
|
# Beause of the maybe for the comma ... part , the rules may return either
|
||||||
|
# - a single simple version with one element
|
||||||
|
# a sequence with many element.
|
||||||
|
# This leads to the fact that two transform rules are needed for either
|
||||||
rule(:argument_list) {
|
rule(:argument_list) {
|
||||||
left_parenthesis >>
|
left_parenthesis >>
|
||||||
((expression.as(:argument) >> (comma >> expression.as(:argument)).repeat(0)).maybe).as(:argument_list) >>
|
((expression.as(:argument) >> (comma >> expression.as(:argument)).repeat(0)).maybe).as(:argument_list) >>
|
||||||
|
@ -9,6 +9,7 @@ module Parser
|
|||||||
rule(:argument => simple(:argument)) { argument }
|
rule(:argument => simple(:argument)) { argument }
|
||||||
rule(:argument_list => sequence(:argument_list)) { argument_list }
|
rule(:argument_list => sequence(:argument_list)) { argument_list }
|
||||||
|
|
||||||
|
# need TWO transform rules, for one/many arguments (see the[] wrapping in the first)
|
||||||
rule(:function_call => simple(:function_call),
|
rule(:function_call => simple(:function_call),
|
||||||
:argument_list => simple(:argument)) do
|
:argument_list => simple(:argument)) do
|
||||||
Vm::FuncallExpression.new(function_call.name, [argument])
|
Vm::FuncallExpression.new(function_call.name, [argument])
|
||||||
@ -25,6 +26,7 @@ module Parser
|
|||||||
rule(:parmeter => simple(:parmeter)) { parmeter }
|
rule(:parmeter => simple(:parmeter)) { parmeter }
|
||||||
rule(:parmeter_list => sequence(:parmeter_list)) { parmeter_list }
|
rule(:parmeter_list => sequence(:parmeter_list)) { parmeter_list }
|
||||||
|
|
||||||
|
# need TWO transform rules, for one/many arguments (see the[] wrapping in the first)
|
||||||
rule(:function_definition => simple(:function_definition),
|
rule(:function_definition => simple(:function_definition),
|
||||||
:parmeter_list => simple(:parmeter),
|
:parmeter_list => simple(:parmeter),
|
||||||
:block => simple(:block)) do
|
:block => simple(:block)) do
|
||||||
|
Loading…
Reference in New Issue
Block a user