some docs

This commit is contained in:
Torsten Ruger 2014-04-27 21:51:06 +03:00
parent 74060d6ab6
commit 18c2abfd2b
2 changed files with 7 additions and 0 deletions

View File

@ -12,6 +12,11 @@ module Parser
include Tokens
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) {
left_parenthesis >>
((expression.as(:argument) >> (comma >> expression.as(:argument)).repeat(0)).maybe).as(:argument_list) >>

View File

@ -9,6 +9,7 @@ module Parser
rule(:argument => simple(:argument)) { argument }
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),
:argument_list => simple(:argument)) do
Vm::FuncallExpression.new(function_call.name, [argument])
@ -25,6 +26,7 @@ module Parser
rule(:parmeter => simple(:parmeter)) { parmeter }
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),
:parmeter_list => simple(:parmeter),
:block => simple(:block)) do