Commit 00bafa70 authored by bguillaum's avatar bguillaum
Browse files

fix bug with relative paths for included files

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/semagramme/libcaml-grew/trunk@6657 7838e531-6607-4d57-9587-6c381814729c
parent f0981b5a
...@@ -403,8 +403,8 @@ module Corpus_stat = struct ...@@ -403,8 +403,8 @@ module Corpus_stat = struct
); );
incr counter; incr counter;
if html if html
then tmp := sprintf "%s&nbsp;&nbsp;<a href=\"%s.html\">%s</a>" !tmp h h then tmp := sprintf "%s\n <a href=\"%s.html\">%s</a> &nbsp; &nbsp;" !tmp h h
else tmp := sprintf "%s&nbsp;&nbsp;%s" !tmp h else tmp := sprintf "%s\n %s &nbsp; &nbsp;" !tmp h
| h::t -> | h::t ->
if (not (List.mem h t)) then ( (*avoid doublons*) if (not (List.mem h t)) then ( (*avoid doublons*)
if (!counter = 10) then ( if (!counter = 10) then (
...@@ -412,8 +412,8 @@ module Corpus_stat = struct ...@@ -412,8 +412,8 @@ module Corpus_stat = struct
); );
incr counter; incr counter;
if html if html
then tmp := sprintf "&nbsp;&nbsp;<a href=\"%s.html\">%s</a>%s" h h !tmp then tmp := sprintf "%s\n <a href=\"%s.html\">%s</a> &nbsp; &nbsp;" !tmp h h
else tmp := sprintf "%s&nbsp;&nbsp;%s" !tmp h else tmp := sprintf "%s\n %s &nbsp; &nbsp;" !tmp h
); );
compute t compute t
in compute (List.rev file_list); in compute (List.rev file_list);
......
...@@ -70,21 +70,25 @@ module Grew_parser = struct ...@@ -70,21 +70,25 @@ module Grew_parser = struct
raise (Parse_error (Printf.sprintf "Syntax error\nFile %s\nLine %d\n%s\n%!" file cp.Lexing.pos_lnum msg)) raise (Parse_error (Printf.sprintf "Syntax error\nFile %s\nLine %d\n%s\n%!" file cp.Lexing.pos_lnum msg))
| err -> raise (Parse_error (Printexc.to_string err)) | err -> raise (Parse_error (Printexc.to_string err))
end end
with Sys_error msg-> raise (Parse_error msg) with Sys_error msg -> raise (Parse_error msg)
(** (**
[parse_string file] where [file] is a file following the grew syntax [parse_string file] where [file] is a file following the grew syntax
@param file the file to parse @param file the file to parse
@return a syntactic tree of the parsed file @return a syntactic tree of the parsed file
*) *)
let parse_file_to_grs file = let parse_file_to_grs main_file =
let grs_with_includes = parse_file_to_grs_with_includes file in let grs_with_includes = parse_file_to_grs_with_includes main_file in
let rec flatten_modules = function let rec flatten_modules = function
| [] -> [] | [] -> []
| Ast.Modul m :: tail -> m :: (flatten_modules tail) | Ast.Modul m :: tail -> m :: (flatten_modules tail)
| Ast.Includ file :: tail -> | Ast.Includ inc_file :: tail ->
(parse_file_to_module_list file) let sub_file =
if Filename.is_relative inc_file
then Filename.concat (Filename.dirname main_file) inc_file
else inc_file in
(parse_file_to_module_list sub_file)
@ (flatten_modules tail) in @ (flatten_modules tail) in
{ {
Ast.domain = grs_with_includes.Ast.domain_wi; Ast.domain = grs_with_includes.Ast.domain_wi;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment