diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2003-05-26 14:43:48 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2003-05-26 14:43:48 +0000 |
commit | 05eb4216c7614de17622622f4bc9774645acc0f0 (patch) | |
tree | 56813be9d6bb56ed70c2fcc1faf0f9653e00c684 | |
parent | 48294694130bec9ffe0a152e146d9c58b796e588 (diff) | |
download | perl-MDK-Common-05eb4216c7614de17622622f4bc9774645acc0f0.tar perl-MDK-Common-05eb4216c7614de17622622f4bc9774645acc0f0.tar.gz perl-MDK-Common-05eb4216c7614de17622622f4bc9774645acc0f0.tar.bz2 perl-MDK-Common-05eb4216c7614de17622622f4bc9774645acc0f0.tar.xz perl-MDK-Common-05eb4216c7614de17622622f4bc9774645acc0f0.zip |
handle use foo() and use foo ("x", "y")
-rw-r--r-- | perl_checker.src/parser.mly | 2 | ||||
-rw-r--r-- | perl_checker.src/tree.ml | 10 |
2 files changed, 10 insertions, 2 deletions
diff --git a/perl_checker.src/parser.mly b/perl_checker.src/parser.mly index ceb3c41..a2b3bc1 100644 --- a/perl_checker.src/parser.mly +++ b/perl_checker.src/parser.mly @@ -168,7 +168,7 @@ decl: use: | use_word listexpr semi_colon {sp_n($2); new_esp M_none (Use($1.any, $2.any.expr)) $1 $3} -| use_revision RAW_IDENT_PAREN PAREN PAREN_END {new_esp M_none (Use(to_Ident $2, [])) $1 $2} +| use_revision word_paren PAREN listexpr PAREN_END {sp_0($4); sp_0_or_cr($5); new_esp M_none (Use($2.any, $4.any.expr)) $1 $5} use_word: | use_revision word comma {new_esp M_none $2.any $1 $3} diff --git a/perl_checker.src/tree.ml b/perl_checker.src/tree.ml index f866e14..d576e57 100644 --- a/perl_checker.src/tree.ml +++ b/perl_checker.src/tree.ml @@ -77,11 +77,19 @@ let get_current_package t = let from_qw_raw = function | Call_op("qw", [ Raw_string(s, pos)], _) -> List.map (fun symbol -> symbol, pos) (words s) + | String([s, List []], pos) -> [ s, pos ] | String(_, pos) -> warn_with_pos pos "not recognised yet" ; [] | Raw_string(s, pos) -> [ s, pos ] + | List [] -> [] + | List [ List l ] -> + List.map (function + | String([s, List []], pos) + | Raw_string(s, pos) -> s, pos + | Ident(_, _, pos) as ident -> string_of_Ident ident, pos + ) l | _ -> internal_error "from_qw_raw" let from_qw e = @@ -177,7 +185,7 @@ let get_uses t = | Use(Ident _ as pkg, _) when uses_external_package (string_of_Ident pkg) -> uses | Use(Ident(_, _, pos) as ident, l) -> let package = string_of_Ident ident in - let para = if l = [] then None else Some(from_qw (List.hd l)) in + let para = if l = [] then None else Some(collect from_qw l) in (package, (para, pos)) :: uses | _ -> uses ) [] t |