AST_FORMAT.md in parser-0.9.2 vs AST_FORMAT.md in parser-1.0.0

- old
+ new

@@ -716,11 +716,11 @@ ### Named splat argument Format: ``` -(splatarg :foo) +(restarg :foo) "*foo" ~~~~ expression ~~~ name ``` @@ -728,11 +728,11 @@ ### Unnamed splat argument Format: ``` -(splatarg) +(restarg) "*" ^ expression ``` ### Block argument @@ -745,11 +745,11 @@ ~~~~ expression ``` Begin of the `expression` points to `&`. -### Ruby 1.8 expression arguments +### Expression arguments Ruby 1.8 allows to use arbitrary expressions as block arguments, such as `@var` or `foo.bar`. Such expressions should be treated as if they were on the lhs of a multiple assignment. @@ -759,18 +759,18 @@ "|@bar|" (args (arg_expr (send (send nil :foo) :a=))) "|foo.a|" -(args (splatarg_expr (ivasgn :@bar))) +(args (restarg_expr (ivasgn :@bar))) "|*@bar|" (args (blockarg_expr (ivasgn :@bar))) "|&@bar|" ``` -### Ruby 1.9 and later block shadow arguments +### Block shadow arguments Format: ``` (args (shadowarg :foo) (shadowarg :bar)) "|; foo, bar|" @@ -778,40 +778,50 @@ ### Decomposition Format: ``` -(def :f (args (arg :a) (mlhs (arg :foo) (splatarg :bar)))) +(def :f (args (arg :a) (mlhs (arg :foo) (restarg :bar)))) "def f(a, (foo, *bar)); end" ^ begin ^ end ~~~~~~~~~~~ expression ``` -### Keyword argument +### Required keyword argument Format: ``` +(kwarg :foo (int 1)) +"foo:" + ~~~~ expression + ~~~~ name +``` + +### Optional keyword argument + +Format: +``` (kwoptarg :foo (int 1)) "foo: 1" ~~~~~~ expression ~~~~ name ``` ### Named keyword splat argument Format: ``` -(kwsplat :foo) +(kwrestarg :foo) "**foo" ~~~~~ expression ~~~ name ``` ### Unnamed keyword splat argument Format: ``` -(kwsplat) +(kwrestarg) "**" ~~ expression ``` ## Send