diff --git a/.drom b/.drom index 757839f7b..54e0b4697 100644 --- a/.drom +++ b/.drom @@ -5,7 +5,7 @@ version:0.9.0 # hash of toml configuration files # used for generation of all files -20136047f51b526eb8e6687fe5da7afe:. +770715578d99cec11afe5b129aa5930f:. # end context for . # begin context for .github/workflows/workflow.yml @@ -76,7 +76,7 @@ c8281f46ba9a11d0b61bc8ef67eaa357:docs/style.css # begin context for dune-project # file dune-project -c375da381bfae0c77c7af1cb51f96580:dune-project +bbe93981f3f89550246d41f768f73a28:dune-project # end context for dune-project # begin context for opam/cobol_common.opam @@ -211,7 +211,7 @@ f1b12aee900ad3ae5cbd7d65319d2e3d:opam/superbol_free_lib.opam # begin context for opam/superbol_project.opam # file opam/superbol_project.opam -efeab59ae138b2898525da11cb7a9222:opam/superbol_project.opam +6c40da0e3e6f1b1579b73409adb9ac2b:opam/superbol_project.opam # end context for opam/superbol_project.opam # begin context for opam/vscode-debugadapter.opam @@ -486,7 +486,7 @@ de6c46a271140f4f52b2580e0d876351:src/lsp/superbol_preprocs/version.mlt # begin context for src/lsp/superbol_project/dune # file src/lsp/superbol_project/dune -4f0eb93049700d37bb60c5fc13d155a3:src/lsp/superbol_project/dune +a7e1e69bff3d4c180af5f42cce7f6764:src/lsp/superbol_project/dune # end context for src/lsp/superbol_project/dune # begin context for src/lsp/superbol_project/version.mlt diff --git a/CHANGELOG.md b/CHANGELOG.md index e88b972f8..7ad0b843f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## [0.1.4] Next release ### Added +- Detection of copybooks based on contents prefix and configured search path [373](https://github.com/OCamlPro/superbol-studio-oss/pull/373) - Support for connecting to the LSP server remotely (TCP only) [#102](https://github.com/OCamlPro/superbol-studio-oss/pull/102) - Support for Symbol Renaming command [#351](https://github.com/OCamlPro/superbol-studio-oss/pull/351) - Show documentation comments on hover information [#350](https://github.com/OCamlPro/superbol-studio-oss/pull/350) diff --git a/dune-project b/dune-project index 3874d2eaf..a869420bc 100644 --- a/dune-project +++ b/dune-project @@ -226,6 +226,7 @@ (ocplib_stuff (and (>= 0.4.0) (< 1.0.0))) (ezr_toml (= version)) (ez_file (and (>= 0.3.0) (< 1.0.0))) + (cobol_preproc (= version)) (cobol_config (= version)) (cobol_common (= version)) odoc diff --git a/opam/osx/superbol_project-osx.opam b/opam/osx/superbol_project-osx.opam index b744306af..baa025df8 100644 --- a/opam/osx/superbol_project-osx.opam +++ b/opam/osx/superbol_project-osx.opam @@ -53,6 +53,7 @@ depends: [ "ocplib_stuff-osx" {>= "0.4.0" & < "1.0.0"} "ezr_toml-osx" {= version} "ez_file-osx" {>= "0.3.0" & < "1.0.0"} + "cobol_preproc-osx" {= version} "cobol_config-osx" {= version} "cobol_common-osx" {= version} "odoc" {with-doc} diff --git a/opam/superbol_project.opam b/opam/superbol_project.opam index 258ff10eb..c65326144 100644 --- a/opam/superbol_project.opam +++ b/opam/superbol_project.opam @@ -51,6 +51,7 @@ depends: [ "ocplib_stuff" {>= "0.4.0" & < "1.0.0"} "ezr_toml" {= version} "ez_file" {>= "0.3.0" & < "1.0.0"} + "cobol_preproc" {= version} "cobol_config" {= version} "cobol_common" {= version} "odoc" {with-doc} diff --git a/opam/windows/superbol_project-windows.opam b/opam/windows/superbol_project-windows.opam index a474b05e7..d51b24ad6 100644 --- a/opam/windows/superbol_project-windows.opam +++ b/opam/windows/superbol_project-windows.opam @@ -53,6 +53,7 @@ depends: [ "ocplib_stuff-windows" {>= "0.4.0" & < "1.0.0"} "ezr_toml-windows" {= version} "ez_file-windows" {>= "0.3.0" & < "1.0.0"} + "cobol_preproc-windows" {= version} "cobol_config-windows" {= version} "cobol_common-windows" {= version} "odoc" {with-doc} diff --git a/package.json b/package.json index c224c09af..1bf34db1d 100644 --- a/package.json +++ b/package.json @@ -125,7 +125,8 @@ "type": "array", "default": [ "cpy", - "cbx" + "cbl", + "cob" ], "items": "string", "order": 4 diff --git a/src/lsp/cobol_common/copybook.ml b/src/lsp/cobol_common/copybook.ml index 9f9d43ce0..7340b75dc 100644 --- a/src/lsp/cobol_common/copybook.ml +++ b/src/lsp/cobol_common/copybook.ml @@ -28,15 +28,16 @@ type lookup_error = lookup_config: lookup_config; } -(** Filename extensions that we should treat as copybooks and not main - programs. *) -let copybook_extensions = (* this must be a subset of {!libfile_extensions}. *) - ["cpy"; "cbx"] +(** Filename extensions that are searched when looking up copybooks. *) +let copybook_extensions = + ["cpy"; "cbl"; "cob"] -let libfile_extensions = - ["cpy"; "cbl"; "cob"; "cbx"] +(** Filename extensions that we should not treat as main programs, but as + copybooks instead. *) +let copybookonly_extensions = + ["cpy"; "copy"; "copybook"] -let lookup_config ?(libexts = libfile_extensions) libpath = +let lookup_config ?(libexts = copybook_extensions) libpath = { lookup_path = libpath; lookup_exts = List.map String.lowercase_ascii libexts; diff --git a/src/lsp/cobol_common/copybook.mli b/src/lsp/cobol_common/copybook.mli index 63e4b4794..14104d37b 100644 --- a/src/lsp/cobol_common/copybook.mli +++ b/src/lsp/cobol_common/copybook.mli @@ -37,6 +37,7 @@ val pp_lookup_error: lookup_error Pretty.printer (* --- *) val copybook_extensions: string list +val copybookonly_extensions: string list (** [find_lib ~lookup_config ?fromfile ?libname txtname] attempts to locate a file containing the copybook [txtname], which is a file named [txtname], diff --git a/src/lsp/cobol_indent_old/indenter.ml b/src/lsp/cobol_indent_old/indenter.ml index bc37c6670..19d170288 100644 --- a/src/lsp/cobol_indent_old/indenter.ml +++ b/src/lsp/cobol_indent_old/indenter.ml @@ -40,5 +40,4 @@ let indent_range ~dialect ~source_format ~indent_config ~range ~filename ~conten ; acc = [] ; range } in - (* NB: note here we ignore diagnostics *) - state.result.acc + state.acc diff --git a/src/lsp/cobol_lsp/lsp_document.ml b/src/lsp/cobol_lsp/lsp_document.ml index 429b1988f..0b51da840 100644 --- a/src/lsp/cobol_lsp/lsp_document.ml +++ b/src/lsp/cobol_lsp/lsp_document.ml @@ -164,12 +164,14 @@ let rec inspect_at ~position ({ copybook; rewinder; textdoc; _ } as doc) = None (** Creates a record for a document that is not yet parsed or analyzed. *) -let blank ~project ?copybook textdoc = - let copybook = match copybook with - | Some p -> p - | None -> Lsp_project.detect_copybook project - ~uri:(Lsp.Text_document.documentUri textdoc) +let blank ~project textdoc = + let uri = Lsp.Text_document.documentUri textdoc in + let copybook = + Lsp_project.detect_copybook project ~uri + ~contents:(Lsp.Text_document.text textdoc) in + if copybook then + Lsp_io.log_debug "%s appears to be a copybook" (Lsp.Uri.to_string uri); { project; textdoc; @@ -183,9 +185,9 @@ let blank ~project ?copybook textdoc = let position_encoding = `UTF8 -let load ~project ?copybook doc = +let load ~project doc = let textdoc = Lsp.Text_document.make ~position_encoding doc in - let doc = blank ~project ?copybook textdoc in + let doc = blank ~project textdoc in try parse_and_analyze doc with e -> raise @@ Internal_error (doc, e, Printexc.get_raw_backtrace ()) diff --git a/src/lsp/cobol_lsp/lsp_project.ml b/src/lsp/cobol_lsp/lsp_project.ml index 10cd93a56..08ce962cb 100644 --- a/src/lsp/cobol_lsp/lsp_project.ml +++ b/src/lsp/cobol_lsp/lsp_project.ml @@ -71,8 +71,9 @@ let copybook_lookup_config_for ~uri project = Superbol_project.copybook_lookup_config_for ~filename:(Lsp.Uri.to_path uri) project -let detect_copybook ~uri project = - Superbol_project.detect_copybook ~filename:(Lsp.Uri.to_path uri) project +let detect_copybook ~uri ?contents project = + Superbol_project.detect_copybook ~filename:(Lsp.Uri.to_path uri) + ?contents project let relative_path_for ~uri project = Superbol_project.relative_path_for ~filename:(Lsp.Uri.to_path uri) project diff --git a/src/lsp/cobol_lsp/lsp_project.mli b/src/lsp/cobol_lsp/lsp_project.mli index e46a5974c..a100c67be 100644 --- a/src/lsp/cobol_lsp/lsp_project.mli +++ b/src/lsp/cobol_lsp/lsp_project.mli @@ -57,9 +57,9 @@ val rootdir_for: uri:Lsp.Uri.t -> layout:layout -> rootdir val copybook_lookup_config_for : uri:Lsp.Uri.t -> t -> Cobol_common.Copybook.lookup_config -(** [detect_copybook ~uri project] indicates whether a document at the given URI - for [project] should be treated as a copybook. *) -val detect_copybook: uri:Lsp.Uri.t -> t -> bool +(** [detect_copybook ~uri ?contents project] indicates whether a document at the + given URI for [project] should be treated as a copybook. *) +val detect_copybook: uri:Lsp.Uri.t -> ?contents:string -> t -> bool (** {1 Cached representation} *) diff --git a/src/lsp/cobol_lsp/lsp_server.ml b/src/lsp/cobol_lsp/lsp_server.ml index c502397e5..ff00cbe06 100644 --- a/src/lsp/cobol_lsp/lsp_server.ml +++ b/src/lsp/cobol_lsp/lsp_server.ml @@ -663,10 +663,10 @@ let on_change_workspace_folders let add ~doc:(DidOpenTextDocumentParams.{ textDocument = { uri; _ }; _ } as doc) - ?copybook registry = + registry = let add_in_project project registry = try - let doc = Lsp_document.load ~project ?copybook doc in + let doc = Lsp_document.load ~project doc in let registry = dispatch_diagnostics doc registry in add_or_replace_doc doc registry with Lsp_document.Internal_error (doc, e, backtrace) -> @@ -677,7 +677,7 @@ let add ~doc:(DidOpenTextDocumentParams.{ textDocument = { uri; _ }; _ } as doc) let did_open (DidOpenTextDocumentParams.{ textDocument = { uri; text; _ }; - _ } as doc) ?copybook registry = + _ } as doc) registry = (* Try first with a lookup for the project in a cache, and then by creating/loading the project. *) let rec aux ~try_cache registry = @@ -690,7 +690,7 @@ let did_open (DidOpenTextDocumentParams.{ textDocument = { uri; text; _ }; retrieve_project_for ~uri registry |> aux ~try_cache:false (* try again without the cache *) | None | Some _ -> - add ~doc ?copybook registry + add ~doc registry in aux ~try_cache:true registry diff --git a/src/lsp/cobol_lsp/lsp_server.mli b/src/lsp/cobol_lsp/lsp_server.mli index 2251c8c37..a67c79fb5 100644 --- a/src/lsp/cobol_lsp/lsp_server.mli +++ b/src/lsp/cobol_lsp/lsp_server.mli @@ -79,12 +79,10 @@ val init val on_change_workspace_folders : Lsp.Types.DidChangeWorkspaceFoldersParams.t -> t -> t -(** When given, [copybook] indicates whether the document is a copybook (in - which case it is not parsed directly as a normal program). When absent, - copybook detection is performed via project configuration (see - {!Project.detect_copybook}). *) +(** Copybook detection is performed via project configuration (see + {!Lsp_project.detect_copybook}). *) val did_open - : Lsp.Types.DidOpenTextDocumentParams.t -> ?copybook: bool -> t -> t + : Lsp.Types.DidOpenTextDocumentParams.t -> t -> t val did_change : Lsp.Types.DidChangeTextDocumentParams.t -> t -> t diff --git a/src/lsp/cobol_preproc/preproc_engine.ml b/src/lsp/cobol_preproc/preproc_engine.ml index 6068e2462..66defa9c1 100644 --- a/src/lsp/cobol_preproc/preproc_engine.ml +++ b/src/lsp/cobol_preproc/preproc_engine.ml @@ -568,10 +568,49 @@ let fold_source_lines ~dialect ~source_format ?on_initial_source_format | Some f -> f (Src_reader.source_format reader) acc | None -> acc in - OUT.result @@ Src_reader.fold_lines ~dialect ~f reader ?skip_compiler_directives_text ?on_compiler_directive acc +let fold_source_words ~dialect ~source_format ~f input acc = + fold_source_lines ~dialect ~source_format input acc + ~skip_compiler_directives_text:true + ~f:begin fun _ line acc -> + ListLabels.fold_left line ~init:acc ~f:(fun acc word -> f word acc) + end + +let scan_prefix_for_copybook ~dialect ~source_format input = + let open struct + exception Res of [`Program | `Copybook] + type copybook_prefix_state = + | Expect_first_digits + | Expect_word + let digit_chars s = + let rec aux i = + i < 0 || match s.[i] with '0'..'9' -> aux (pred i) | _ -> false + in + aux (String.length s - 1) + let is_digits = function + | Text.TextWord s -> digit_chars s + | _ -> false + let is_word = function + | Text.TextWord _ as w -> not (is_digits w) + | _ -> false + end in + match + fold_source_words ~dialect ~source_format input Expect_first_digits + ~f:begin fun word -> function + | Expect_first_digits when is_digits ~&word -> + Expect_word + | Expect_word when is_word ~&word -> + raise @@ Res `Copybook + | _ -> + raise @@ Res `Program + end + with + | exception Res res -> res + | Expect_first_digits -> `Program (* maybe? *) + | Expect_word -> `Copybook (* maybe? *) + let text_of_input ?options input = let text, pp = full_text ~item:"file" @@ preprocessor ?options input in OUT.result text ~diags:(diags pp) diff --git a/src/lsp/cobol_preproc/preproc_engine.mli b/src/lsp/cobol_preproc/preproc_engine.mli index ca9748f92..b00774faa 100644 --- a/src/lsp/cobol_preproc/preproc_engine.mli +++ b/src/lsp/cobol_preproc/preproc_engine.mli @@ -90,7 +90,13 @@ val fold_source_lines -> f:(int -> Text.text -> 'a -> 'a) -> Src_input.t -> 'a - -> 'a Preproc_outputs.with_diags + -> 'a + +val scan_prefix_for_copybook + : dialect: Cobol_config.dialect + -> source_format: Cobol_config.source_format_spec + -> Src_input.t + -> [`Program | `Copybook] val preprocess_input : ?options: Preproc_options.preproc_options diff --git a/src/lsp/superbol_free_lib/vscode_extension.ml b/src/lsp/superbol_free_lib/vscode_extension.ml index 02e758d11..7fc8e6217 100644 --- a/src/lsp/superbol_free_lib/vscode_extension.ml +++ b/src/lsp/superbol_free_lib/vscode_extension.ml @@ -70,7 +70,7 @@ let package = "vscode-languageclient", "8.0.2"; "polka", "^1.0.0-next.22"; "sirv", "^2.0.2"; - + (* for the debug extension: *) "n-readlines", "^1.0.0"; ] diff --git a/src/lsp/superbol_project/dune b/src/lsp/superbol_project/dune index 776b82b78..3e2fb27cb 100644 --- a/src/lsp/superbol_project/dune +++ b/src/lsp/superbol_project/dune @@ -5,7 +5,7 @@ (public_name superbol_project) (wrapped true) ; use field 'dune-libraries' to add libraries without opam deps - (libraries pretty ocplib_stuff ezr_toml ez_file cobol_config cobol_common ) + (libraries pretty ocplib_stuff ezr_toml ez_file cobol_preproc cobol_config cobol_common ) ; use field 'dune-flags' to set this value (flags (:standard)) ; use field 'dune-stanzas' to add more stanzas here diff --git a/src/lsp/superbol_project/package.toml b/src/lsp/superbol_project/package.toml index 06d8a751b..fa67e4604 100644 --- a/src/lsp/superbol_project/package.toml +++ b/src/lsp/superbol_project/package.toml @@ -54,6 +54,7 @@ skip = ["index.mld"] # base-unix = { libname = "unix", version = ">=base" } [dependencies] cobol_common = "version" +cobol_preproc = "version" cobol_config = "version" ocplib_stuff = "0.4.0" ez_file = "0.3.0" diff --git a/src/lsp/superbol_project/project.ml b/src/lsp/superbol_project/project.ml index 70107f6ca..e16f58c01 100644 --- a/src/lsp/superbol_project/project.ml +++ b/src/lsp/superbol_project/project.ml @@ -103,9 +103,6 @@ let for_ ~rootdir ~layout = let copybook_lookup_config_for ~filename { config; _ } = Project_config.copybook_lookup_config_for ~filename config -let detect_copybook ~filename { config; _ } = - Project_config.detect_copybook ~filename config - let relative_path_for ~filename { rootdir; _ } = try Project_utils.relative_path ~filename rootdir with Invalid_argument _ -> filename (* if not in project rootdir *) @@ -115,6 +112,39 @@ let absolute_path_for ~filename { rootdir; _ } = then filename (* in case the file is not within its project directory *) else rootdir // filename +let file_contents_looks_like_a_copybook ~filename ?contents { config; _ } = + let decide input = + Cobol_preproc.scan_prefix_for_copybook input + ~dialect:(Cobol_config.dialect config.cobol_config) + ~source_format:config.source_format = `Copybook + in + match contents with + | None -> + Cobol_preproc.Input.from ~filename ~f:decide + | Some c -> + decide @@ Cobol_preproc.Input.string ~filename c + +let is_a_copybook_extension ext = + List.mem (String.lowercase_ascii (EzString.after ext 1)) (* trim the `.` *) + Cobol_common.Copybook.copybookonly_extensions + +let file_is_in_libpath ~filename ({ config; _ } as project) = + let filename = relative_path_for ~filename project in + List.exists begin function + | Project_config.RelativeToProjectRoot prefix -> + EzString.starts_with ~prefix filename + | RelativeToFileDir suffix -> + EzString.ends_with ~suffix (Filename.dirname filename) + end config.libpath + +let detect_copybook ~filename ?contents project = + let ext = Filename.extension filename in + (if ext = "" (* assume files with no extension that appear in copybook paths + are copybooks *) + then file_is_in_libpath ~filename project + else is_a_copybook_extension ext) || + file_contents_looks_like_a_copybook ~filename ?contents project + let save_config ?verbose { config_filename; config; _ } = Project_config.save ?verbose ~config_filename config diff --git a/src/lsp/superbol_project/project.mli b/src/lsp/superbol_project/project.mli index ad119f772..aff39cac1 100644 --- a/src/lsp/superbol_project/project.mli +++ b/src/lsp/superbol_project/project.mli @@ -95,9 +95,9 @@ val copybook_lookup_config_for -> t -> Cobol_common.Copybook.lookup_config -(** [detect_copybook ~filename project] indicates whether a file name should be - treated as a copybook within [project]. *) -val detect_copybook: filename:string -> t -> bool +(** [detect_copybook ~filename project] indicates whether a document with the + given [filename] should be treated as a copybook in [project]. *) +val detect_copybook: filename:string -> ?contents:string -> t -> bool (** {1 Cached representation} *) diff --git a/src/lsp/superbol_project/project_config.ml b/src/lsp/superbol_project/project_config.ml index dcd540402..8e8f255dd 100644 --- a/src/lsp/superbol_project/project_config.ml +++ b/src/lsp/superbol_project/project_config.ml @@ -28,7 +28,6 @@ module TYPES = struct mutable source_format: Cobol_config.source_format_spec; mutable libpath: path list; mutable libexts: string list; - mutable copybook_if_no_extension: bool; mutable indent_config: (string * int) list; toml_handle: Ezr_toml.toml_handle; } @@ -69,7 +68,6 @@ let cobol_source_format source_format_name = let default_libpath = [RelativeToProjectRoot "."] let default_libexts = Cobol_common.Copybook.copybook_extensions -let default_copybook_if_no_extension = true let default_indent_config = [] let default = { @@ -78,7 +76,6 @@ let default = { libpath = default_libpath; libexts = default_libexts; indent_config = default_indent_config; - copybook_if_no_extension = default_copybook_if_no_extension; toml_handle = Ezr_toml.make_empty (); } @@ -197,8 +194,7 @@ let load_file ?(verbose=false) config_filename = let DIAGS.{ result = cobol_config; diags } = cobol_config_from_dialect_name ~verbose @@ get_dialect section in DIAGS.result ~diags - { default with - cobol_config; + { cobol_config; toml_handle; source_format = get_source_format section; libpath = get_libpath section; @@ -279,14 +275,6 @@ let copybook_lookup_config_for ~filename config = ~libexts: config.libexts - -(* TODO: add config flags to libpath where some directories may only include - copybooks. *) -let detect_copybook ~filename { libexts; copybook_if_no_extension; _ } = - List.exists (Filename.check_suffix filename) libexts || - (copybook_if_no_extension && Filename.extension filename = "") - - (** Persistent representation (for caching) *) diff --git a/src/lsp/superbol_project/project_config.mli b/src/lsp/superbol_project/project_config.mli index 5c61f6104..f9c5c1382 100644 --- a/src/lsp/superbol_project/project_config.mli +++ b/src/lsp/superbol_project/project_config.mli @@ -24,7 +24,6 @@ module TYPES: sig mutable source_format: Cobol_config.source_format_spec; mutable libpath: path list; mutable libexts: string list; - mutable copybook_if_no_extension: bool; mutable indent_config: (string * int) list; toml_handle: Ezr_toml.toml_handle; } @@ -74,11 +73,6 @@ val copybook_lookup_config_for -> t -> Cobol_common.Copybook.lookup_config -(** [detect_copybook ~filename config] indicates whether a document with the - given filename should be treated as a copybook in a project with - configuration [config]. *) -val detect_copybook: filename:string -> t -> bool - (** {1 Intermediate conversion utilities} Those may also raise {!ERROR}*) diff --git a/test/cobol_preprocessing/preproc_testing.ml b/test/cobol_preprocessing/preproc_testing.ml index 74d2bd60a..f48960054 100644 --- a/test/cobol_preprocessing/preproc_testing.ml +++ b/test/cobol_preprocessing/preproc_testing.ml @@ -49,7 +49,6 @@ let show_source_lines ?(source_format = Cobol_config.(SF SFFixed)) contents = - Cobol_preproc.Outputs.show_n_forget ~ppf:Fmt.stdout @@ Cobol_preproc.fold_source_lines ~dialect ~source_format ~f:begin fun lnum line () -> if with_line_numbers then Pretty.out "@\n%u: " lnum else Pretty.out "@\n"; diff --git a/test/lsp/lsp_copybook.ml b/test/lsp/lsp_copybook.ml new file mode 100644 index 000000000..677a6a954 --- /dev/null +++ b/test/lsp/lsp_copybook.ml @@ -0,0 +1,88 @@ +(**************************************************************************) +(* *) +(* SuperBOL OSS Studio *) +(* *) +(* Copyright (c) 2022-2023 OCamlPro SAS *) +(* *) +(* All rights reserved. *) +(* This source code is licensed under the GNU Affero General Public *) +(* License version 3 found in the LICENSE.md file in the root directory *) +(* of this source tree. *) +(* *) +(**************************************************************************) + +open Lsp_testing + +(** Tests for copybook detection; very basic for now *) + +let make_lsp_project_with_global_copybook_dir dir = + make_lsp_project () ~toml:(Pretty.to_string {toml| + cobol.copybooks = [{ dir = %S, file-relative = false }] + |toml} dir) + +let make_lsp_project_with_file_relative_copybook_dir dir = + make_lsp_project () ~toml:(Pretty.to_string {toml| + cobol.copybooks = [{ dir = %S, file-relative = true }] + |toml} dir) + +(* --- *) + +let%expect_test "typical-copybook" = + let { projdir; end_with_postproc }, server = make_lsp_project () in + ignore @@ add_cobol_doc server ~projdir "FIELD" {cobol| + 01 FIELD PIC X. + |cobol}; + end_with_postproc [%expect.output]; + [%expect {| + {"params":{"message":"file://__rootdir__/FIELD appears to be a copybook","type":4},"method":"window/logMessage","jsonrpc":"2.0"} + {"params":{"diagnostics":[],"uri":"file://__rootdir__/FIELD"},"method":"textDocument/publishDiagnostics","jsonrpc":"2.0"} |}];; + + +let%expect_test "typical-program" = + let { projdir; end_with_postproc }, server = make_lsp_project () in + ignore @@ add_cobol_doc server ~projdir "PROGRAM" {cobol| + program-id. prog. + procedure division. + stop run. + |cobol}; + end_with_postproc [%expect.output]; + [%expect {| + {"params":{"diagnostics":[],"uri":"file://__rootdir__/PROGRAM"},"method":"textDocument/publishDiagnostics","jsonrpc":"2.0"} |}];; + +let%expect_test "typical-copybook-in-project-relative-copybook-dir" = + let { projdir; end_with_postproc }, server = + make_lsp_project_with_global_copybook_dir "global/copybooks" + in + ignore @@ add_cobol_doc server ~projdir "global/copybooks/FIELD" {cobol| + 01 FIELD PIC X. + |cobol}; + end_with_postproc [%expect.output]; + [%expect {| + {"params":{"message":"file://__rootdir__/global/copybooks/FIELD appears to be a copybook","type":4},"method":"window/logMessage","jsonrpc":"2.0"} + {"params":{"diagnostics":[],"uri":"file://__rootdir__/global/copybooks/FIELD"},"method":"textDocument/publishDiagnostics","jsonrpc":"2.0"} |}];; + + +let%expect_test "weird-copybook-in-project-relative-copybook-dir" = + let { projdir; end_with_postproc }, server = + make_lsp_project_with_global_copybook_dir "global/copybooks" + in + ignore @@ add_cobol_doc server ~projdir "global/copybooks/INDIRCPY" {cobol| + COPY X. + |cobol}; + end_with_postproc [%expect.output]; + [%expect {| + {"params":{"message":"file://__rootdir__/global/copybooks/INDIRCPY appears to be a copybook","type":4},"method":"window/logMessage","jsonrpc":"2.0"} + {"params":{"diagnostics":[],"uri":"file://__rootdir__/global/copybooks/INDIRCPY"},"method":"textDocument/publishDiagnostics","jsonrpc":"2.0"} |}];; + + +let%expect_test "typical-copybook-in-file-relative-copybook-dir" = + let { projdir; end_with_postproc }, server = + make_lsp_project_with_file_relative_copybook_dir "lib/copybooks" + in + ignore @@ add_cobol_doc server ~projdir "lib/copybooks/FIELD" {cobol| + 01 FIELD PIC X. + |cobol}; + end_with_postproc [%expect.output]; + [%expect {| + {"params":{"message":"file://__rootdir__/lib/copybooks/FIELD appears to be a copybook","type":4},"method":"window/logMessage","jsonrpc":"2.0"} + {"params":{"diagnostics":[],"uri":"file://__rootdir__/lib/copybooks/FIELD"},"method":"textDocument/publishDiagnostics","jsonrpc":"2.0"} |}];; diff --git a/test/lsp/lsp_hover.ml b/test/lsp/lsp_hover.ml index 955e8d468..5f119aec0 100644 --- a/test/lsp/lsp_hover.ml +++ b/test/lsp/lsp_hover.ml @@ -57,6 +57,7 @@ let%expect_test "hover-copy" = |cobol}; end_with_postproc [%expect.output]; [%expect {| + {"params":{"message":"file://__rootdir__/lib.cpy appears to be a copybook","type":4},"method":"window/logMessage","jsonrpc":"2.0"} {"params":{"diagnostics":[],"uri":"file://__rootdir__/lib.cpy"},"method":"textDocument/publishDiagnostics","jsonrpc":"2.0"} {"params":{"diagnostics":[],"uri":"file://__rootdir__/prog.cob"},"method":"textDocument/publishDiagnostics","jsonrpc":"2.0"} (line 5, character 7): @@ -161,6 +162,7 @@ let%expect_test "hover-typedef-from-copy" = |cobol}; end_with_postproc [%expect.output]; [%expect {| + {"params":{"message":"file://__rootdir__/lib.cpy appears to be a copybook","type":4},"method":"window/logMessage","jsonrpc":"2.0"} {"params":{"diagnostics":[],"uri":"file://__rootdir__/lib.cpy"},"method":"textDocument/publishDiagnostics","jsonrpc":"2.0"} {"params":{"diagnostics":[],"uri":"file://__rootdir__/prog.cob"},"method":"textDocument/publishDiagnostics","jsonrpc":"2.0"} (line 7, character 22): @@ -1236,6 +1238,7 @@ let%expect_test "hover-comment-copy" = |cobol}; end_with_postproc [%expect.output]; [%expect {| + {"params":{"message":"file://__rootdir__/lib.cpy appears to be a copybook","type":4},"method":"window/logMessage","jsonrpc":"2.0"} {"params":{"diagnostics":[],"uri":"file://__rootdir__/lib.cpy"},"method":"textDocument/publishDiagnostics","jsonrpc":"2.0"} {"params":{"diagnostics":[],"uri":"file://__rootdir__/prog.cob"},"method":"textDocument/publishDiagnostics","jsonrpc":"2.0"} (line 9, character 19): diff --git a/test/lsp/lsp_rename.ml b/test/lsp/lsp_rename.ml index c7c147c0b..c20f31ca3 100644 --- a/test/lsp/lsp_rename.ml +++ b/test/lsp/lsp_rename.ml @@ -178,6 +178,7 @@ let%expect_test "rename-with-a-ref-in-a-copybook" = in end_with_postproc [%expect.output]; [%expect {| + {"params":{"message":"file://__rootdir__/lib.cpy appears to be a copybook","type":4},"method":"window/logMessage","jsonrpc":"2.0"} {"params":{"diagnostics":[],"uri":"file://__rootdir__/lib.cpy"},"method":"textDocument/publishDiagnostics","jsonrpc":"2.0"} {"params":{"diagnostics":[],"uri":"file://__rootdir__/prog.cob"},"method":"textDocument/publishDiagnostics","jsonrpc":"2.0"} {"params":{"message":"Proceeded to rename of a reference that occurs in a copybook","type":2},"method":"window/showMessage","jsonrpc":"2.0"} @@ -215,6 +216,7 @@ let%expect_test "rename-with-a-ignored-ref-in-a-copybook" = in end_with_postproc [%expect.output]; [%expect {| + {"params":{"message":"file://__rootdir__/lib.cpy appears to be a copybook","type":4},"method":"window/logMessage","jsonrpc":"2.0"} {"params":{"diagnostics":[],"uri":"file://__rootdir__/lib.cpy"},"method":"textDocument/publishDiagnostics","jsonrpc":"2.0"} {"params":{"diagnostics":[],"uri":"file://__rootdir__/prog.cob"},"method":"textDocument/publishDiagnostics","jsonrpc":"2.0"} {"params":{"message":"Ignored renaming of a reference that occurs in a copybook","type":3},"method":"window/showMessage","jsonrpc":"2.0"} diff --git a/test/lsp/lsp_testing.ml b/test/lsp/lsp_testing.ml index 485e99f38..7119ac008 100644 --- a/test/lsp/lsp_testing.ml +++ b/test/lsp/lsp_testing.ml @@ -56,12 +56,13 @@ let make_server ?(with_semantic_tokens = false) () = with_client_file_watcher = false; with_client_config_watcher = false } -let add_cobol_doc server ?copybook ~projdir filename text = +let add_cobol_doc server ~projdir filename text = let path = projdir // filename in let uri = Lsp.Uri.of_path path in + EzFile.(safe_mkdir @@ dirname path); EzFile.write_file path text; let server = - LSP.Server.did_open ?copybook + LSP.Server.did_open DidOpenTextDocumentParams.{ textDocument = TextDocumentItem.{ languageId = "cobol"; version = 0; text; uri; diff --git a/test/lsp/lsp_testing.mli b/test/lsp/lsp_testing.mli index da6d19345..12fece35f 100644 --- a/test/lsp/lsp_testing.mli +++ b/test/lsp/lsp_testing.mli @@ -25,7 +25,7 @@ val make_lsp_project -> unit -> test_project * LSP.Types.registry val add_cobol_doc - : LSP.Types.registry -> ?copybook:bool -> projdir:string -> string -> string + : LSP.Types.registry -> projdir:string -> string -> string -> LSP.Types.registry * Lsp.Types.TextDocumentIdentifier.t type positions = diff --git a/test/output-tests/listings.expected b/test/output-tests/listings.expected index 4b0082dbb..2c238be75 100644 --- a/test/output-tests/listings.expected +++ b/test/output-tests/listings.expected @@ -335,7 +335,7 @@ listings.at-289-prog.cob:7.7-8.70: 10 DISPLAY TEST-AVR. >> Error: Library `copy.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/listings.at:349:0 listings.at-349-prog.cob:7.7-12.48: @@ -358,7 +358,7 @@ listings.at-349-prog.cob:7.7-12.48: 14 DISPLAY TEST-AVR. >> Error: Library `copy.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/listings.at:413:0 listings.at-413-prog2.cob:7.7-12.55: @@ -381,7 +381,7 @@ listings.at-413-prog2.cob:7.7-12.55: 14 DISPLAY TEST-AVR. >> Error: Library `copy2.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/listings.at:477:0 listings.at-477-prog3.cob:7.7-12.55: @@ -404,7 +404,7 @@ listings.at-477-prog3.cob:7.7-12.55: 14 DISPLAY TEST-AVR. >> Error: Library `copy3.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/listings.at:538:0 listings.at-538-prog.cob:6.7-8.53: @@ -421,7 +421,7 @@ listings.at-538-prog.cob:6.7-8.53: 10 DISPLAY FIRST-MATCH NO ADVANCING >> Error: Library `copy.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/listings.at:631:0 listings.at-631-prog.cob:6.7-10.55: @@ -442,7 +442,7 @@ listings.at-631-prog.cob:6.7-10.55: 12 DISPLAY FIRST-MATCH NO ADVANCING PROG011 >> Error: Library `copy.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/listings.at:691:0 listings.at-691-prog.cob:6.7-8.44: @@ -459,7 +459,7 @@ listings.at-691-prog.cob:6.7-8.44: 10 DISPLAY COLON-VAR NO ADVANCING >> Error: Library `copy.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/listings.at:774:0 listings.at-774-prog1.cob:11.10-13.52: @@ -476,7 +476,7 @@ listings.at-774-prog1.cob:11.10-13.52: 15 copy 'copy1.inc' replacing 'YYY-' by a20- >> Error: Library `copy1.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" listings.at-774-prog1.cob:15.10-17.52: 12 'yy1-' by a11- @@ -492,7 +492,7 @@ listings.at-774-prog1.cob:15.10-17.52: 19 copy 'copy1.inc' replacing 'YYY-' by a30- >> Error: Library `copy1.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" listings.at-774-prog1.cob:19.10-21.52: 16 'yy1-' by a21- @@ -508,7 +508,7 @@ listings.at-774-prog1.cob:19.10-21.52: 23 procedure division. >> Error: Library `copy1.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/listings.at:893:0 listings.at-893-prog.cob:6.7-8.53: @@ -525,7 +525,7 @@ listings.at-893-prog.cob:6.7-8.53: 10 DISPLAY FIRST-VAR NO ADVANCING >> Error: Library `copy.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/listings.at:957:0 listings.at-957-prog.cob:6.7-8.54: @@ -542,7 +542,7 @@ listings.at-957-prog.cob:6.7-8.54: 10 DISPLAY TEST-VAR1 NO ADVANCING >> Error: Library `copy.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/listings.at:1020:0 listings.at-1020-prog.cob:6.7-7.50: @@ -557,7 +557,7 @@ listings.at-1020-prog.cob:6.7-7.50: 9 DISPLAY COPY-VAR NO ADVANCING >> Error: Library `copy-1.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/listings.at:1146:0 listings.at-1146-tstcpybk.cob:13.11-13.32: @@ -570,7 +570,7 @@ listings.at-1146-tstcpybk.cob:13.11-13.32: 15 >> Error: Library `copy-sl-1.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" listings.at-1146-tstcpybk.cob:14.11-14.32: 11 INPUT-OUTPUT SECTION. @@ -582,7 +582,7 @@ listings.at-1146-tstcpybk.cob:14.11-14.32: 16 DATA DIVISION. >> Error: Library `copy-sl-2.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" listings.at-1146-tstcpybk.cob:18.11-18.32: 15 @@ -594,7 +594,7 @@ listings.at-1146-tstcpybk.cob:18.11-18.32: 20 >> Error: Library `copy-fd-1.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" listings.at-1146-tstcpybk.cob:19.11-19.32: 16 DATA DIVISION. @@ -606,7 +606,7 @@ listings.at-1146-tstcpybk.cob:19.11-19.32: 21 WORKING-STORAGE SECTION. >> Error: Library `copy-fd-2.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" listings.at-1146-tstcpybk.cob:30.11-30.32: 27 * @@ -618,7 +618,7 @@ listings.at-1146-tstcpybk.cob:30.11-30.32: 32 >> Error: Library `copy-ws-1.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" listings.at-1146-tstcpybk.cob:31.11-31.32: 28 77 GLOB PIC 99 GLOBAL. @@ -630,7 +630,7 @@ listings.at-1146-tstcpybk.cob:31.11-31.32: 33 PROCEDURE DIVISION. >> Error: Library `copy-ws-2.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/listings.at:1394:0 listings.at-1394-prog.cob:4.7-4.23: @@ -643,7 +643,7 @@ listings.at-1394-prog.cob:4.7-4.23: 6 WORKING-STORAGE SECTION. >> Error: Library `copy.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/listings.at:1613:0 Considering: import/gnucobol/tests/testsuite.src/listings.at:1613:0 @@ -5266,7 +5266,7 @@ listings.at-3810-prog.cob:6.7-6.23: 8 PROCEDURE DIVISION. >> Error: Library `copy.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" listings.at-3810-prog.cob:7.7-7.24: 4 DATA DIVISION. @@ -5278,7 +5278,7 @@ listings.at-3810-prog.cob:7.7-7.24: 9 >>LISTING OFF >> Error: Library `copy2.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" listings.at-3810-prog.cob:9.7-9.20: 6 COPY "copy.inc". @@ -5310,7 +5310,7 @@ listings.at-3906-prog.cob:6.7-6.23: 8 PROCEDURE DIVISION. >> Error: Library `copy.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" listings.at-3906-prog.cob:7.7-7.24: 4 DATA DIVISION. @@ -5322,7 +5322,7 @@ listings.at-3906-prog.cob:7.7-7.24: 9 >>LISTING OFF >> Error: Library `copy2.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" listings.at-3906-prog.cob:9.0-9.13: 6 COPY "copy.inc". diff --git a/test/output-tests/run_extensions.expected b/test/output-tests/run_extensions.expected index b562ddb67..b718ca03f 100644 --- a/test/output-tests/run_extensions.expected +++ b/test/output-tests/run_extensions.expected @@ -1946,7 +1946,7 @@ run_extensions.at-4864-progc.cob:12.7-12.25: 13 GOBACK. >> Error: Library `cllprg.cpy' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/run_extensions.at:4903:0 run_extensions.at-4903-prog.cob:7.7-7.8: diff --git a/test/output-tests/run_file.expected b/test/output-tests/run_file.expected index 8d2f2a79d..a0782cc08 100644 --- a/test/output-tests/run_file.expected +++ b/test/output-tests/run_file.expected @@ -3328,7 +3328,7 @@ run_file.at-8744-prog.cob:270.11-270.29: 272 01 key-def. >> Error: Library `xfhfcd.cpy' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" run_file.at-8744-prog.cob:304.16-304.22: 301 DISPLAY "File assigned is '" @@ -5105,7 +5105,7 @@ run_file.at-9400-prog.cob:49.11-49.30: 51 *================================================================* >> Error: Library `xfhfcd3.cpy' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" run_file.at-9400-prog.cob:74.15-74.21: 71 @@ -5129,7 +5129,7 @@ run_file.at-9589-prog.cob:17.11-17.24: 19 VALUE 'FCDLS'. >> Error: Library `xfhfcd3' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" run_file.at-9589-prog.cob:46.16-46.22: 43 DISPLAY PROGRAM-NAME ': STARTING.' @@ -5214,7 +5214,7 @@ run_file.at-9798-prog.cob:19.11-19.24: 21 VALUE 'FCDFB'. >> Error: Library `xfhfcd3' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" run_file.at-9798-prog.cob:48.16-48.22: 45 DISPLAY PROGRAM-NAME ': STARTING.' @@ -5307,7 +5307,7 @@ run_file.at-9979-prog.cob:66.11-66.30: 68 01 KEY-DEF. >> Error: Library `xfhfcd3.cpy' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" run_file.at-9979-prog.cob:93.17-93.21: 90 *----------------------------------------------------------------* @@ -5340,7 +5340,7 @@ run_file.at-10308-prog.cob:86.11-86.23: 88 01 FILE-NAME PIC X(64). >> Error: Library `xfhfcd' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" run_file.at-10308-prog.cob:155.16-155.22: 152 SET FCD-FILENAME-ADDRESS TO ADDRESS OF FILE-NAME @@ -5374,7 +5374,7 @@ run_file.at-10643-prog.cob:97.11-97.23: 99 01 RECORD-AREA. >> Error: Library `xfhfcd' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/run_file.at:10643:0 run_file.at-10643-progs.cob:2.6-2.19: @@ -5396,7 +5396,7 @@ run_file.at-10831-prog.cob:86.12-86.24: 88 01 RECORD-AREA. >> Error: Library `xfhfcd' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" run_file.at-10831-prog.cob:134.16-134.22: 131 ** FIXED(0) OR VARIABLE(1) @@ -5439,7 +5439,7 @@ run_file.at-10990-prog.cob:45.11-45.30: 47 01 EX-RECORD-BUFFER PIC X(32767). >> Error: Library `xfhfcd3.cpy' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/run_file.at:11348:0 run_file.at-11348-prog.cob:15.50: @@ -7167,7 +7167,7 @@ run_file.at-12694-prog1.cob:2.7-4.32: ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >> Error: Library `prog.cpy' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/run_file.at:12704:0 run_file.at-12704-prog2.cob:2.7-4.32: @@ -7180,7 +7180,7 @@ run_file.at-12704-prog2.cob:2.7-4.32: ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >> Error: Library `prog.cpy' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/run_file.at:12715:0 run_file.at-12715-prog3.cob:2.7-4.72: @@ -7193,7 +7193,7 @@ run_file.at-12715-prog3.cob:2.7-4.72: ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >> Error: Library `prog.cpy' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/run_file.at:12725:0 run_file.at-12725-prog4.cob:2.7-4.72: @@ -7206,7 +7206,7 @@ run_file.at-12725-prog4.cob:2.7-4.72: ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >> Error: Library `prog.cpy' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/run_file.at:12735:0 run_file.at-12735-prog5.cob:2.7-4.72: @@ -7219,7 +7219,7 @@ run_file.at-12735-prog5.cob:2.7-4.72: ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >> Error: Library `prog.cpy' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/run_file.at:12745:0 run_file.at-12745-prog6.cob:2.7-4.32: @@ -7232,7 +7232,7 @@ run_file.at-12745-prog6.cob:2.7-4.32: ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >> Error: Library `prog.cpy' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/run_file.at:12755:0 run_file.at-12755-prog7.cob:2.7-4.71: @@ -7245,7 +7245,7 @@ run_file.at-12755-prog7.cob:2.7-4.71: ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >> Error: Library `prog.cpy' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/run_file.at:12765:0 run_file.at-12765-prog8.cob:2.7-4.71: @@ -7258,7 +7258,7 @@ run_file.at-12765-prog8.cob:2.7-4.71: ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >> Error: Library `prog.cpy' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/run_file.at:12696:0 run_file.at-12696-reference_ascii:1.6-1.7: diff --git a/test/output-tests/run_misc.expected b/test/output-tests/run_misc.expected index fafb41b27..192406f48 100644 --- a/test/output-tests/run_misc.expected +++ b/test/output-tests/run_misc.expected @@ -3564,7 +3564,7 @@ run_misc.at-10517-prog.cob:198.12-198.25: 200 DISPLAY TEST-BASED-SUB >> Error: Library `cpyabrt' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/run_misc.at:10935:0 run_misc.at-10935-reference_fdls_tmpl:2.7-2.11: @@ -4152,7 +4152,7 @@ run_misc.at-10517-sub2.cob:84.11-84.24: 85 END PROGRAM sub2. >> Error: Library `cpyabrt' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/run_misc.at:11143:0 run_misc.at-11143-prog.cob:69.35: @@ -6608,7 +6608,7 @@ run_misc.at-14647-prog.cob:22.7-23.58: 25 ==:PROG-KIND:== BY ====. >> Error: Library `prog' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" run_misc.at-14647-prog.cob:24.7-25.51: 21 STOP RUN. @@ -6622,7 +6622,7 @@ run_misc.at-14647-prog.cob:24.7-25.51: 27 COPY prog REPLACING ==:PROG-NAME:== BY ==nonnested_init== >> Error: Library `prog' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" run_misc.at-14647-prog.cob:27.7-28.58: 24 COPY prog REPLACING ==:PROG-NAME:== BY ==nested_noninit== @@ -6636,7 +6636,7 @@ run_misc.at-14647-prog.cob:27.7-28.58: 30 ==:PROG-KIND:== BY ====. >> Error: Library `prog' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" run_misc.at-14647-prog.cob:29.7-30.51: 26 END PROGRAM prog. @@ -6648,7 +6648,7 @@ run_misc.at-14647-prog.cob:29.7-30.51: ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >> Error: Library `prog' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/run_misc.at:14677:0 Considering: import/gnucobol/tests/testsuite.src/run_misc.at:14735:0 diff --git a/test/output-tests/syn_copy.expected b/test/output-tests/syn_copy.expected index 04f17e342..fab6b0ac4 100644 --- a/test/output-tests/syn_copy.expected +++ b/test/output-tests/syn_copy.expected @@ -9,7 +9,7 @@ syn_copy.at-112-prog.cob:6.7-6.30: 8 DISPLAY TEST-VAR. >> Error: Library `copy.inc' not found - search path: ./SUB - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/syn_copy.at:113:0 syn_copy.at-113-prog2.cob:6.7-6.30: @@ -22,7 +22,7 @@ syn_copy.at-113-prog2.cob:6.7-6.30: 8 DISPLAY TEST-VAR. >> Error: Library `copy.inc' not found - search path: ./SUB - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/syn_copy.at:114:0 syn_copy.at-114-prog3.cob:6.7-6.31: @@ -35,7 +35,7 @@ syn_copy.at-114-prog3.cob:6.7-6.31: 8 DISPLAY TEST-VAR. >> Error: Library `copy.inc' not found - search path: ./sub2 - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/syn_copy.at:115:0 syn_copy.at-115-prog4.cob:6.7-6.23: @@ -48,7 +48,7 @@ syn_copy.at-115-prog4.cob:6.7-6.23: 8 DISPLAY TEST-VAR. >> Error: Library `copy.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/syn_copy.at:116:0 syn_copy.at-116-prog5.cob:6.7-6.30: @@ -61,7 +61,7 @@ syn_copy.at-116-prog5.cob:6.7-6.30: 8 DISPLAY TEST-VAR. >> Error: Library `copy.inc' not found - search path: ./CBD - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/syn_copy.at:163:0 Fatal: syn_copy.at-163-SUB/prog.cob: No such file or directory @@ -76,7 +76,7 @@ syn_copy.at-247-prog.cob:6.7-6.23: 8 DISPLAY TEST-VAR. >> Error: Library `copy.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/syn_copy.at:248:0 syn_copy.at-248-prog2.cob:6.7-6.19: @@ -89,7 +89,7 @@ syn_copy.at-248-prog2.cob:6.7-6.19: 8 DISPLAY TEST-VAR. >> Error: Library `copy' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/syn_copy.at:249:0 syn_copy.at-249-prog3.cob:6.7-6.29: @@ -102,7 +102,7 @@ syn_copy.at-249-prog3.cob:6.7-6.29: 8 DISPLAY TEST-VAR. >> Error: Library `sub.inc' not found - search path: ./SUB - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/syn_copy.at:250:0 syn_copy.at-250-prog4.cob:6.7-6.25: @@ -115,7 +115,7 @@ syn_copy.at-250-prog4.cob:6.7-6.25: 8 DISPLAY TEST-VAR. >> Error: Library `sub' not found - search path: ./SUB - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/syn_copy.at:251:0 syn_copy.at-251-prog5.cob:6.7-6.26: @@ -128,7 +128,7 @@ syn_copy.at-251-prog5.cob:6.7-6.26: 8 DISPLAY TEST-VAR. >> Error: Library `sub' not found - search path: ./.. - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/syn_copy.at:252:0 syn_copy.at-252-prog6.cob:6.7-6.18: @@ -141,7 +141,7 @@ syn_copy.at-252-prog6.cob:6.7-6.18: 8 DISPLAY TEST-VAR. >> Error: Library `sub' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/syn_copy.at:280:0 Considering: import/gnucobol/tests/testsuite.src/syn_copy.at:281:0 @@ -160,7 +160,7 @@ syn_copy.at-403-prog.cob:6.7-8.53: 10 DISPLAY FIRST-MATCH NO ADVANCING >> Error: Library `copy.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/syn_copy.at:432:0 syn_copy.at-432-prog.cob:6.7-10.55: @@ -181,7 +181,7 @@ syn_copy.at-432-prog.cob:6.7-10.55: 12 DISPLAY FIRST-MATCH NO ADVANCING >> Error: Library `copy.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/syn_copy.at:462:0 syn_copy.at-462-prog.cob:6.7-8.44: @@ -198,7 +198,7 @@ syn_copy.at-462-prog.cob:6.7-8.44: 10 DISPLAY COLON-VAR NO ADVANCING >> Error: Library `copy.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/syn_copy.at:492:0 syn_copy.at-492-prog.cob:6.7-8.53: @@ -215,7 +215,7 @@ syn_copy.at-492-prog.cob:6.7-8.53: 10 DISPLAY FIRST-VAR NO ADVANCING >> Error: Library `copy.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/syn_copy.at:522:0 syn_copy.at-522-prog.cob:6.7-8.54: @@ -232,7 +232,7 @@ syn_copy.at-522-prog.cob:6.7-8.54: 10 DISPLAY TEST-VAR1 NO ADVANCING >> Error: Library `copy.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/syn_copy.at:569:0 syn_copy.at-569-prog.cob:9.37-9.39: @@ -261,7 +261,7 @@ syn_copy.at-569-prog.cob:6.7-9.40: 11 REPLACING TRAILING "FIRST" BY "VAR1" >> Error: Library `copy.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" syn_copy.at-569-prog.cob:13.38-13.40: 10 COPY "copy2.inc" @@ -289,7 +289,7 @@ syn_copy.at-569-prog.cob:10.7-13.41: 15 DISPLAY FIRST-VAR NO ADVANCING END-DISPLAY. >> Error: Library `copy2.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/syn_copy.at:654:0 syn_copy.at-654-prog.cob:6.7-7.50: @@ -304,7 +304,7 @@ syn_copy.at-654-prog.cob:6.7-7.50: 9 DISPLAY COPY-VAR NO ADVANCING >> Error: Library `copy-1.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/syn_copy.at:680:0 syn_copy.at-680-prog.cob:6.2-6.18: @@ -317,7 +317,7 @@ syn_copy.at-680-prog.cob:6.2-6.18: 8 DISPLAY TEST-VAR NO ADVANCING >> Error: Library `copy.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/syn_copy.at:703:0 syn_copy.at-703-prog.cob:4.36-4.42: @@ -350,7 +350,7 @@ syn_copy.at-761-prog.cob:7.7-8.46: 10 main. >> Error: Library `copy.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/syn_copy.at:799:0 syn_copy.at-799-prog.cob:7.7-12.57: @@ -373,7 +373,7 @@ syn_copy.at-799-prog.cob:7.7-12.57: 14 main. >> Error: Library `copy.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/syn_copy.at:879:0 syn_copy.at-879-prog.cob:7.7-13.62: @@ -398,7 +398,7 @@ syn_copy.at-879-prog.cob:7.7-13.62: 15 main. >> Error: Library `copy.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/syn_copy.at:918:0 syn_copy.at-918-prog.cob:7.7-12.55: @@ -421,7 +421,7 @@ syn_copy.at-918-prog.cob:7.7-12.55: 14 main. >> Error: Library `copy.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/syn_copy.at:949:0 syn_copy.at-949-prog.cob:7.7-8.44: @@ -436,7 +436,7 @@ syn_copy.at-949-prog.cob:7.7-8.44: 10 DISPLAY VAR-COLON NO ADVANCING >> Error: Library `copy.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/syn_copy.at:1072:0 syn_copy.at-1072-prog.cob:8.30-8.32: @@ -463,7 +463,7 @@ syn_copy.at-1072-prog.cob:12.7-14.49: 16 STOP RUN. >> Error: Library `proc.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" syn_copy.at-1072-prog.cob:15.11-15.17: 12 COPY "proc.inc" @@ -498,7 +498,7 @@ syn_copy.at-1155-prog.cob:6.7-8.54: 10 01 TEST-VAR1 PIC X(2) VALUE "OK". >> Error: Library `copy.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" syn_copy.at-1155-prog.cob:20.7-22.54: 17 END-DISPLAY. @@ -512,5 +512,5 @@ syn_copy.at-1155-prog.cob:20.7-22.54: ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >> Error: Library `copy.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" diff --git a/test/output-tests/syn_misc.expected b/test/output-tests/syn_misc.expected index 620a9bad4..a42201c55 100644 --- a/test/output-tests/syn_misc.expected +++ b/test/output-tests/syn_misc.expected @@ -1528,7 +1528,7 @@ syn_misc.at-3261-prog.cob:10.7-10.15: 12 78 var VALUE "hello". >> Error: Library `a.' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" syn_misc.at-3261-prog.cob:14.10-14.11: 11 @@ -1570,7 +1570,7 @@ syn_misc.at-3355-prog.cob:7.7-7.21: 9 PROCEDURE DIVISION. >> Error: Library `ok.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" syn_misc.at-3355-prog.cob:16.11-16.28: 13 * Directive purposefully in Area A @@ -1582,7 +1582,7 @@ syn_misc.at-3355-prog.cob:16.11-16.28: 18 COPY "sec-2.inc". >> Error: Library `sec-1.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" syn_misc.at-3355-prog.cob:18.8-18.25: 15 STOP RUNNN @@ -1592,7 +1592,7 @@ syn_misc.at-3355-prog.cob:18.8-18.25: ---- ^^^^^^^^^^^^^^^^^ >> Error: Library `sec-2.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" syn_misc.at-3355-prog.cob:19.0: 16 COPY "sec-1.inc". @@ -1622,7 +1622,7 @@ syn_misc.at-3470-prog.cob:7.11-9.12: 11 PERFORM SEC-2 >> Error: Library `ok.inc' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" syn_misc.at-3470-prog.cob:11.11-11.18: 8 01 OK PIC XX VALUE "OK". == diff --git a/test/output-tests/used_binaries.expected b/test/output-tests/used_binaries.expected index e1e59e9e1..b54c70b31 100644 --- a/test/output-tests/used_binaries.expected +++ b/test/output-tests/used_binaries.expected @@ -11,7 +11,7 @@ used_binaries.at-259-prog.cob:10.8-10.18: 12 COPY PROCE in "sub". >> Error: Library `PROC' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" used_binaries.at-259-prog.cob:12.8-12.28: 9 00. @@ -23,7 +23,7 @@ used_binaries.at-259-prog.cob:12.8-12.28: 14 STOP RUN. >> Error: Library `PROCE' not found - search path: ./sub - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/used_binaries.at:286:0 Fatal: used_binaries.at-286-sub/copy/PROC.cpy: No such file or directory @@ -70,7 +70,7 @@ used_binaries.at-1024-progprep.cob:7.7-7.23: 9 DISPLAY TEST-VAR NO ADVANCING >> Error: Library `CRUD.CPY' not found - search path: - - filename extensions: "cpy" "cbl" "cob" "cbx" + - filename extensions: "cpy" "cbl" "cob" Considering: import/gnucobol/tests/testsuite.src/used_binaries.at:1167:0 used_binaries.at-1167-f.copy:8.54: