I'm referring to
http://code.google.com/p/cookcc/wiki/JavaParserInput#Case_2:_Function_returns_vo
id
I suggest to add an extra section to explain args:
`args` is a list of indexes (separated by space) of the elements of `rhs`
which the method expects as arguments. For example:
@Rule (lhs = "stmt", rhs = "VARIABLE ASSIGN expr SEMICOLON", args =
"1 3")
protected Node parseAssign (String var, Node expr)
{
return new AssignNode (var, expr);
}
This will assign the result of tokenizing `VARIABLE` to `String var` and
the result of parsing `expr` to the method parameter `Node expr`.
Note that the indexes need not be in any specific order. This would be
equivalent (indexes and method parameters swapped):
@Rule (lhs = "stmt", rhs = "VARIABLE ASSIGN expr SEMICOLON", args =
"3 1")
protected Node parseAssign (Node expr, String var)
{
return new AssignNode (var, expr);
}
Original issue reported on code.google.com by adigu...@gmail.com on 1 Dec 2008 at 9:54
Original issue reported on code.google.com by
adigu...@gmail.com
on 1 Dec 2008 at 9:54