Commit 9f3e91e3 authored by Bruno Guillaume's avatar Bruno Guillaume

Remove suffix form filename to get the package name in “Import”

parent 645e0bae
S src
B _build/src
PKG yojson log conll dep2pict
PKG yojson log conll dep2pict containers
true: package(unix, conll, dep2pict, camomile, cairo2, log, yojson)
true: package(unix, containers, conll, dep2pict, camomile, cairo2, log, yojson)
true: bin_annot
......@@ -20,4 +20,5 @@ depends: [
"camomile"
"libcaml-dep2pict"
"yojson"
"containers"
]
......@@ -108,9 +108,12 @@ module Loader = struct
and unfold_new_grs top new_ast_grs = List.fold_left
(fun acc decl -> match decl with
| New_ast.Import filename ->
let pack_name = match CCString.chop_suffix ~suf:".grs" filename with
| Some x -> x
| None -> Error.build "Imported file must have the \".grs\" file extension" in
let sub = loc_new_grs filename in
let unfolded_sub = unfold_new_grs false sub in
New_ast.Package (filename, unfolded_sub) :: acc
New_ast.Package (pack_name, unfolded_sub) :: acc
| New_ast.Include filename ->
let sub = loc_new_grs filename in
let unfolded_sub = unfold_new_grs top sub in
......
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