block arguments
We're starting to become more useful, with the addition of block arguments. Here's a sample bit of code that parses nicely:
Just to analyse the parse a little:fictional do |exp, evaller|
exp.split(" ").map {|p| evaller.call(p)}
end
Program: 1 expression(s).
FuncCallExpr: fictional(arguments) { BlockExpr }
BlockExpr: |DefListExpr| 1 expression(s).
DefListExpr: 2 identifier(s).
IdentifierExpr: exp
IdentifierExpr: evaller
FuncCallExpr: Expr.split(arguments)
IdentifierExpr: exp
FuncCallExpr: Expr.map(arguments) { BlockExpr }
LiteralTypedExpr<Ss>:
BlockExpr: |DefListExpr| 1 expression(s).
DefListExpr: 1 identifier(s).
IdentifierExpr: p
FuncCallExpr: Expr.call(arguments)
IdentifierExpr: evaller
IdentifierExpr: p
- We have one FuncCallExpr, calling "fictional" (no arguments are specified in the tree, if you look carefully) with a block. I should probably make it not show '(arguments)' if there are none. :)
- Follows the BlockExpr, with a DefListExpr of block arguments, and an expression.
- The DefListExpr has two identifiers: exp, evaller. These are the block arguments, hello!
- Following the DefListExpr in the output of the BlockExpr is that 1 expression(s), a FuncCallExpr.
- This FuncCallExpr is a call to the `split' method of some Expr.
- That Expr is an identifier, exp.
- Under construction.
