From cb79314a713769a18a76dddeb1eb393452e584ef Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 26 May 2003 13:55:19 +0000 Subject: add a special case to handle "arch => 1" without going through word_alone() --- perl_checker.src/parser.mly | 5 +++-- perl_checker.src/parser_helper.ml | 8 ++++---- perl_checker.src/parser_helper.mli | 3 +-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/perl_checker.src/parser.mly b/perl_checker.src/parser.mly index 2ed8a0b..3f042ae 100644 --- a/perl_checker.src/parser.mly +++ b/perl_checker.src/parser.mly @@ -195,8 +195,9 @@ expr: /* Ordinary expressions; logical combinations */ argexpr: /* Expressions are a list of terms joined by commas */ | argexpr comma { new_pesp M_list P_comma $1.any.expr $1 $2} -| argexpr comma term {if not_simple ($3.any.expr) then sp_p($3); new_pesp M_list P_comma (followed_by_comma $1 $2 @ [$3.any.expr]) $1 $3} -| argexpr comma BRACKET expr BRACKET_END {sp_p($3); sp_p($5); new_pesp M_list P_comma (followed_by_comma $1 $2 @ [ Ref(I_hash, $4.any.expr) ]) $1 $5} +| bareword RIGHT_ARROW term {if not_simple ($3.any.expr) then sp_p($3); new_pesp M_list P_comma (followed_by_comma [$1.any] false @ [$3.any.expr]) $1 $3} +| argexpr comma term {if not_simple ($3.any.expr) then sp_p($3); new_pesp M_list P_comma (followed_by_comma $1.any.expr $2.any @ [$3.any.expr]) $1 $3} +| argexpr comma BRACKET expr BRACKET_END {sp_p($3); sp_p($5); new_pesp M_list P_comma (followed_by_comma $1.any.expr $2.any @ [ Ref(I_hash, $4.any.expr) ]) $1 $5} | term %prec PREC_LOW { new_1pesp $1.any.priority [$1.any.expr] $1 } /********************************************************************************/ diff --git a/perl_checker.src/parser_helper.ml b/perl_checker.src/parser_helper.ml index 654999a..5468c3a 100644 --- a/perl_checker.src/parser_helper.ml +++ b/perl_checker.src/parser_helper.ml @@ -663,11 +663,11 @@ let to_Call_op_ mcontext prio op para esp_start esp_end = let pos = raw_pos_range esp_start esp_end in new_any mcontext { priority = prio ; expr = cook_call_op op para pos } esp_start.spaces pos -let followed_by_comma pesp true_comma = - if true_comma.any then pesp.any.expr else - match split_last pesp.any.expr with +let followed_by_comma expr true_comma = + if true_comma then expr else + match split_last expr with | l, Ident(None, s, pos) -> l @ [Raw_string(s, pos)] - | _ -> pesp.any.expr + | _ -> expr let pot_strings = Hashtbl.create 16 diff --git a/perl_checker.src/parser_helper.mli b/perl_checker.src/parser_helper.mli index f43c6b1..9a5e2fa 100644 --- a/perl_checker.src/parser_helper.mli +++ b/perl_checker.src/parser_helper.mli @@ -175,8 +175,7 @@ val to_Call_op_ : 'b Types.any_spaces_pos -> Types.fromparser Types.prio_anyexpr Types.any_spaces_pos val followed_by_comma : - Types.fromparser list Types.prio_anyexpr Types.any_spaces_pos -> - bool Types.any_spaces_pos -> Types.fromparser list + Types.fromparser list -> bool -> Types.fromparser list val pot_strings : (string, string list) Hashtbl.t val pot_strings_and_file : (string, string) Hashtbl.t val po_comments : string list ref -- cgit v1.2.1