facebook/pfff — pull request #32 by alokmenghrajani (2012-07-06 20:52:52+00:00)
Title: as per our discussion...

Note: this diff also include some white space changes.

Here is the output of git show -w:

commit a8742239e7b128ee3614fb061f238de02ac1f1c3
Author: Alok Menghrajani
Date: Fri Jul 6 13:49:51 2012 -0700

Fix cmf to handle ...

diff --git a/lang_php/parsing/ast_php.ml b/lang_php/parsing/ast_php.ml
index 0dae467..7b01bf3 100644
--- a/lang_php/parsing/ast_php.ml
+++ b/lang_php/parsing/ast_php.ml
@@ -603,7 +603,7 @@ and func_def = {
f_ref: is_ref;
(* can be a Name("__lambda", fakeInfo()) when used for lambdas *)
f_name: name;
- f_params: parameter comma_list_dots paren;
+ f_params: parameter comma_list_dots paren; (* TODO: handle ... *)
(* static-php-ext: *)
f_return_type: hint_type option;
(* the opening/closing brace can be (fakeInfo(), ';') for abstract methods *)
diff --git a/lang_php/parsing/lexer_php.mll b/lang_php/parsing/lexer_php.mll
index e8c3491..0814e6a 100644
--- a/lang_php/parsing/lexer_php.mll
+++ b/lang_php/parsing/lexer_php.mll
@@ -558,7 +558,7 @@ rule st_in_scripting = parse

| ":" { TCOLON(tokinfo lexbuf) }
| "?" { TQUESTION(tokinfo lexbuf) }
- (* semantic grep *)
+ (* semantic grep or vargs extension *)
| "..." { TDOTS(tokinfo lexbuf) }

(*x: symbol rules *)
diff --git a/lang_php/parsing/parser_php.mly b/lang_php/parsing/parser_php.mly
index 2d639d2..604ced0 100644
--- a/lang_php/parsing/parser_php.mly
+++ b/lang_php/parsing/parser_php.mly
@@ -556,11 +556,11 @@ non_empty_parameter_list:
{ let p = mk_param $1 $3 in
[Left3 {p with p_ref = Some $2; p_default = Some ($4, $5)}]
}
- /*(* sgrep_ext: *)*/
+ /*(* varargs extension *)*/
| TDOTS
- { sgrep_guard ([Middle3 $1]) }
+ { [Middle3 $1] }
| non_empty_parameter_list TCOMMA TDOTS
- { sgrep_guard ($1 ++ [Right3 $2; Middle3 $3]) }
+ { $1 ++ [Right3 $2; Middle3 $3] }

/*(*s: repetitive non_empty_parameter_list *)*/
| non_empty_parameter_list TCOMMA type_hint_opt T_VARIABLE