Skip to content

Commit

Permalink
Merge pull request #335 from nberth/copyexts-command-line-option
Browse files Browse the repository at this point in the history
Add CLI option `--ext` for copybook filename extensions
  • Loading branch information
nberth authored Jul 31, 2024
2 parents d155fae + 94f0500 commit 7141942
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/lsp/superbol_free_lib/common_args.ml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ let get () =
"cobolx"; "Cobolx"; "CobolX"; "COBOLX";
"auto"; "AUTO"] in
let libpath = ref ["."] in
let libexts = ref Cobol_common.Copybook.copybook_extensions in
let definitions = ref [] in
let recovery = ref true in
let show = ref [`Pending] in (* default *)
Expand Down Expand Up @@ -104,15 +105,22 @@ let get () =
EZCMD.info "Shorthand for `--source-format FREE`";

["recovery"], Arg.Set_bool recovery,
EZCMD.info @@
EZCMD.info ~docv:"BOOL" @@
Pretty.to_string "Enable/disable parser recovery after syntax errors \
(default: %b)" !recovery;

["silence"], Arg.String silence,
EZCMD.info "Silence specific messages";

["I"], Arg.String (fun s -> libpath := !libpath @ [s]),
EZCMD.info ~docv:"DIRECTORY" "Add DIRECTORY to library search path";
EZCMD.info ~docv:"DIR" "Add DIR to library search path";

["ext"], Arg.String (fun s -> libexts := !libexts @ [s]),
EZCMD.info ~docv:"EXT" @@
Pretty.to_string
"Add EXT as a filename extension for copybook resolution (default: %a)"
Fmt.(list ~sep:sp @@ fmt "`%s`")
Cobol_common.Copybook.copybook_extensions;
] in

let get () =
Expand Down Expand Up @@ -163,7 +171,8 @@ let get () =
{ preproc_options = { config; verbose; source_format;
exec_preprocs = EXEC_MAP.empty;
copybook_lookup_config =
Cobol_common.Copybook.lookup_config !libpath;
Cobol_common.Copybook.lookup_config !libpath
~libexts:!libexts;
env };
parser_options = { config; recovery; verbose; show = !show;
exec_scanners = Superbol_preprocs.exec_scanners } }
Expand Down

0 comments on commit 7141942

Please sign in to comment.