From 5e42328ec1a4ff0c3d2484cab1c04d863e083c7f Mon Sep 17 00:00:00 2001 From: Nicolas Berthier Date: Mon, 25 Sep 2023 13:47:54 +0200 Subject: [PATCH] Fix handling of MF-style compiler directives, and emit related semtoks --- src/lsp/cobol_lsp/lsp_request.ml | 4 +- src/lsp/cobol_lsp/lsp_semtoks.ml | 3 +- src/lsp/cobol_preproc/preproc.ml | 55 +------ src/lsp/cobol_preproc/preproc.mli | 160 ++++++++----------- src/lsp/cobol_preproc/preproc_directives.ml | 67 ++++++++ src/lsp/cobol_preproc/preproc_engine.ml | 15 +- src/lsp/cobol_preproc/preproc_grammar.mly | 14 +- src/lsp/cobol_preproc/preproc_grammar_sig.ml | 12 +- src/lsp/cobol_preproc/preproc_trace.ml | 11 +- src/lsp/cobol_preproc/preproc_trace.mli | 9 ++ src/lsp/cobol_preproc/preproc_utils.mli | 4 +- src/lsp/cobol_preproc/src_lexer.mll | 2 +- test/output-tests/listings.expected | 8 +- test/output-tests/run_extensions.expected | 103 ------------ test/output-tests/run_file.expected | 6 +- test/output-tests/run_ml.expected | 4 +- test/output-tests/run_refmod.expected | 12 +- test/output-tests/run_subscripts.expected | 10 +- test/output-tests/syn_misc.expected | 56 +++---- 19 files changed, 236 insertions(+), 319 deletions(-) create mode 100644 src/lsp/cobol_preproc/preproc_directives.ml diff --git a/src/lsp/cobol_lsp/lsp_request.ml b/src/lsp/cobol_lsp/lsp_request.ml index 39a169cad..a277a5300 100644 --- a/src/lsp/cobol_lsp/lsp_request.ml +++ b/src/lsp/cobol_lsp/lsp_request.ml @@ -236,7 +236,8 @@ let handle_hover registry (params: HoverParams.t) = | Cobol_preproc.FileCopy { copyloc = loc; _ } -> Lsp_position.is_in_lexloc params.position (Cobol_common.Srcloc.lexloc_in ~filename loc) - | Cobol_preproc.Replace _ -> + | Cobol_preproc.Replace _ + | Cobol_preproc.LexDir _ -> false end (Cobol_preproc.Trace.events pplog) in @@ -264,6 +265,7 @@ let handle_hover registry (params: HoverParams.t) = Pretty.string_to (hover_markdown ~loc) "```%s\n%s\n```" mdlang text | Some FileCopy { status = MissingCopy _; _ } | Some Replace _ + | Some LexDir _ | None -> None end diff --git a/src/lsp/cobol_lsp/lsp_semtoks.ml b/src/lsp/cobol_lsp/lsp_semtoks.ml index 4b97b22e8..119e9a963 100644 --- a/src/lsp/cobol_lsp/lsp_semtoks.ml +++ b/src/lsp/cobol_lsp/lsp_semtoks.ml @@ -569,7 +569,8 @@ let semtoks_of_comments ~filename ?range comments = comments |> let semtoks_of_preproc_statements ~filename ?range pplog = List.rev @@ List.fold_left begin fun acc -> function | Cobol_preproc.Trace.FileCopy { copyloc = loc; _ } - | Cobol_preproc.Trace.Replace { replloc = loc } -> + | Cobol_preproc.Trace.Replace { replloc = loc } + | Cobol_preproc.Trace.LexDir { loc; _ } -> acc_semtoks ~filename ?range TOKTYP.macro loc acc | Cobol_preproc.Trace.Replacement _ -> acc diff --git a/src/lsp/cobol_preproc/preproc.ml b/src/lsp/cobol_preproc/preproc.ml index 7c72bbf06..614aa0804 100644 --- a/src/lsp/cobol_preproc/preproc.ml +++ b/src/lsp/cobol_preproc/preproc.ml @@ -16,6 +16,7 @@ open Cobol_common.Srcloc.TYPES open Cobol_common.Srcloc.INFIX open Cobol_common.Diagnostics.TYPES open Text.TYPES +open Preproc_directives (* import types of directives *) module DIAGS = Cobol_common.Diagnostics @@ -126,10 +127,6 @@ let srclex_restart_on_file ?position filename = (* SOURCE FORMAT *) -type lexing_directive = - | LexDirSource - : 'k Src_lexing.source_format with_loc -> lexing_directive [@@unboxed] - let cdir_source_format ~dialect format = match Src_lexing.decypher_source_format ~dialect ~&format with | Ok sf -> @@ -142,50 +139,6 @@ let cdir_source_format ~dialect format = (* COPY/REPLACING *) -type copy_statement = - | CDirCopy of - { - library: library; - suppress_printing: bool; - replacing: replacing with_loc list; - } -and replace_statement = - | CDirReplace of - { - also: bool; - replacing: replacing with_loc list; - } - | CDirReplaceOff of - { - last: bool; - } -and library = - { - libname: fileloc with_loc; - cbkname: fileloc with_loc option; - } -and fileloc = [`Word | `Alphanum] * string -and replacing = - | ReplaceExact of - { - repl_from: pseudotext with_loc; - repl_to: pseudotext with_loc; - } - | ReplacePartial of - { - repl_subst: partial_subst with_loc; - repl_to: string with_loc option; - } -and partial_subst = - { - partial_subst_dir: replacing_direction; - partial_subst_len: int; - partial_subst_regexp: Str.regexp; - } -and replacing_direction = Leading | Trailing - -(* --- Implementation of replacing operations ------------------------------- *) - let concat_strings = Cobol_common.Srcloc.concat_strings_with_loc let lift_textword w = TextWord ~&w &@<- w @@ -219,12 +172,6 @@ let partial_word (type k) (req: k partial_word_request) words : (k, _) result = | _, _ -> Error (DIAGS.One.error ~loc:~@words "Expected@ one@ text-word") -type partial_replacing = - { - repl_dir: replacing_direction; - repl_strict: bool; - } - let partial_subst (k: partial_replacing) ({ payload = pat; _ } as repl_from) = { partial_subst_dir = k.repl_dir; partial_subst_len = String.length pat; diff --git a/src/lsp/cobol_preproc/preproc.mli b/src/lsp/cobol_preproc/preproc.mli index 25b45d6aa..7bd7e82e1 100644 --- a/src/lsp/cobol_preproc/preproc.mli +++ b/src/lsp/cobol_preproc/preproc.mli @@ -15,98 +15,18 @@ open Cobol_common.Srcloc.TYPES open Cobol_common.Diagnostics.TYPES open Text.TYPES +(** {1 Source text lexer} *) + type 'k srclexer = 'k Src_lexing.state * Lexing.lexbuf and any_srclexer = | Plx: 'k srclexer -> any_srclexer [@@unboxed] -(* --- Compiler Directives -------------------------------------------------- *) - -(* SOURCE FORMAT *) - -type lexing_directive = - | LexDirSource: - 'k Src_lexing.source_format with_loc -> lexing_directive [@@unboxed] - -(* COPY/REPLACING *) - -type copy_statement = - | CDirCopy of - { - library: library; - suppress_printing: bool; - replacing: replacing with_loc list; - } -and replace_statement = - | CDirReplace of - { - also: bool; - replacing: replacing with_loc list; - } - | CDirReplaceOff of - { - last: bool; - } -and library = - { - libname: fileloc with_loc; - cbkname: fileloc with_loc option; - } -and fileloc = [`Word | `Alphanum] * string -and replacing - -type (_, _) repl_attempt = - | OnPartText: ([`NoReplacement | `MissingText], - partial_text_repl_result) repl_attempt - | OnFullText: ([`NoReplacement], - text * Preproc_trace.log) repl_attempt -and partial_text_repl_result = - (text * Preproc_trace.log, - [`MissingText of text * Preproc_trace.log * text]) result - -module type ENTRY_POINTS = sig - type 'x entry - val replace_statement: replace_statement with_diags with_loc entry - val lexing_directive: lexing_directive option with_diags with_loc entry - val copy_statement: copy_statement with_diags with_loc entry -end - -module type PPPARSER = sig - exception Error - - (* The incremental API. *) - module MenhirInterpreter: MenhirLib.IncrementalEngine.INCREMENTAL_ENGINE - with type token = Preproc_tokens.token - - (* The entry point(s) to the incremental API. *) - module Incremental: ENTRY_POINTS with type - 'x entry := Lexing.position -> 'x MenhirInterpreter.checkpoint -end - -type partial_replacing = - { - repl_dir: replacing_direction; - repl_strict: bool; - } -and replacing_direction = Leading | Trailing - -val replacing - : ?partial:partial_replacing - -> pseudotext with_loc - -> pseudotext with_loc - -> replacing option with_diags -val apply_replacing - : (_, 'a) repl_attempt - -> replacing with_loc list - -> Preproc_trace.log - -> text - -> 'a - -(** {3 Source format} *) +(** {2 Source format} *) val cdir_source_format : dialect: Cobol_config.dialect -> string with_loc - -> lexing_directive option with_diags + -> Preproc_directives.lexing_directive option with_diags val srclex_source_format : any_srclexer -> Cobol_config.source_format @@ -115,7 +35,7 @@ val with_source_format -> any_srclexer -> any_srclexer -(** {3 Instantiation} *) +(** {2 Instantiation} *) val srclex_from_file : source_format:Cobol_config.source_format @@ -132,7 +52,7 @@ val srclex_from_channel -> in_channel -> any_srclexer -(** {3 Resetting the input} *) +(** {2 Resetting the input} *) (** Note: the functions below assume [position] corresponds to the begining of the input.} *) @@ -153,7 +73,7 @@ val srclex_restart_on_channel -> any_srclexer -> any_srclexer -(** {3 Queries} *) +(** {2 Queries} *) val srclex_diags : any_srclexer @@ -167,12 +87,46 @@ val srclex_comments val srclex_newline_cnums : any_srclexer -> int list +val next_source_line + : any_srclexer + -> any_srclexer * text +val fold_source_lines + : any_srclexer + -> (text -> 'a -> 'a) + -> 'a + -> 'a +val print_source_lines + : Format.formatter + -> any_srclexer + -> unit -val next_source_line: any_srclexer -> any_srclexer * text -val fold_source_lines: any_srclexer -> (text -> 'a -> 'a) -> 'a -> 'a -val print_source_lines: Format.formatter -> any_srclexer -> unit +(** {1 Compiler Directives} *) -(* --- *) +val replacing + : ?partial:Preproc_directives.partial_replacing + -> pseudotext with_loc + -> pseudotext with_loc + -> Preproc_directives.replacing option with_diags + +type (_, _) repl_attempt = + | OnPartText: ([`NoReplacement | `MissingText], + partial_text_repl_result) repl_attempt + | OnFullText: ([`NoReplacement], + text * Preproc_trace.log) repl_attempt +and partial_text_repl_result = + (text * Preproc_trace.log, + [`MissingText of text * Preproc_trace.log * text]) result +val apply_replacing + : (_, 'a) repl_attempt + -> Preproc_directives.replacing with_loc list + -> Preproc_trace.log + -> text + -> 'a + +(** {1 Preprocessor state} + + This state is used to track some preprocessing-related divisions, like the + `CONTROL DIVISION` in the GCOS dialect. *) type state @@ -198,3 +152,27 @@ val find_preproc_phrase -> text -> (preproc_phrase * state, [> `MissingPeriod | `MissingText | `NoneFound ]) result + +(** {1 Parsing statements and directives} *) + +module type ENTRY_POINTS = sig + type 'x entry + val replace_statement + : Preproc_directives.replace_statement with_diags with_loc entry + val lexing_directive + : Preproc_directives.lexing_directive option with_diags with_loc entry + val copy_statement + : Preproc_directives.copy_statement with_diags with_loc entry +end + +module type PPPARSER = sig + exception Error + + (* The incremental API. *) + module MenhirInterpreter: MenhirLib.IncrementalEngine.INCREMENTAL_ENGINE + with type token = Preproc_tokens.token + + (* The entry point(s) to the incremental API. *) + module Incremental: ENTRY_POINTS with type + 'x entry := Lexing.position -> 'x MenhirInterpreter.checkpoint +end diff --git a/src/lsp/cobol_preproc/preproc_directives.ml b/src/lsp/cobol_preproc/preproc_directives.ml new file mode 100644 index 000000000..29faa2a79 --- /dev/null +++ b/src/lsp/cobol_preproc/preproc_directives.ml @@ -0,0 +1,67 @@ +(**************************************************************************) +(* *) +(* 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 Cobol_common.Srcloc.TYPES +open Text.TYPES + +type lexing_directive = + | LexDirSource + : 'k Src_lexing.source_format with_loc -> lexing_directive [@@unboxed] + +type copy_statement = + | CDirCopy of + { + library: library; + suppress_printing: bool; + replacing: replacing with_loc list; + } +and replace_statement = + | CDirReplace of + { + also: bool; + replacing: replacing with_loc list; + } + | CDirReplaceOff of + { + last: bool; + } +and library = + { + libname: fileloc with_loc; + cbkname: fileloc with_loc option; + } +and fileloc = [`Word | `Alphanum] * string +and replacing = + | ReplaceExact of + { + repl_from: pseudotext with_loc; + repl_to: pseudotext with_loc; + } + | ReplacePartial of + { + repl_subst: partial_subst with_loc; + repl_to: string with_loc option; + } +and partial_subst = + { + partial_subst_dir: replacing_direction; + partial_subst_len: int; + partial_subst_regexp: Str.regexp; + } +and replacing_direction = Leading | Trailing + +type partial_replacing = + { + repl_dir: replacing_direction; + repl_strict: bool; + } diff --git a/src/lsp/cobol_preproc/preproc_engine.ml b/src/lsp/cobol_preproc/preproc_engine.ml index 2ed9e00c4..b15d18b51 100644 --- a/src/lsp/cobol_preproc/preproc_engine.ml +++ b/src/lsp/cobol_preproc/preproc_engine.ml @@ -50,7 +50,7 @@ and preprocessor_persist = { pparser: (module Preproc.PPPARSER); overlay_manager: (module Src_overlay.MANAGER); - replacing: Preproc.replacing with_loc list list; + replacing: Preproc_directives.replacing with_loc list list; copybooks: Cobol_common.Srcloc.copylocs; (* opened copybooks *) libpath: string list; verbose: bool; @@ -187,16 +187,23 @@ and try_lexing_directive ({ persist = { pparser = (module Pp); | Error `NotCDir -> Error `NotLexDir | Ok supplier -> + (* Here, [srctext] is never empty as it's known to start with a compiler + directive marker `>>` (or `$` for MF-style directives), so we should + always have a loc: *) + let loc = Option.get @@ Cobol_common.Srcloc.concat_locs srctext in let parser = Pp.Incremental.lexing_directive (position lp) in match ~&(Pp.MenhirInterpreter.loop supplier parser) with - | { result = Some LexDirSource sf; diags } -> + | { result = Some Preproc_directives.LexDirSource sf as lexdir; diags } -> + let pplog = Preproc_trace.new_lexdir ~loc ?lexdir lp.pplog in let lp = add_diags lp diags in + let lp = with_pplog lp pplog in Ok (with_srclex lp (Preproc.with_source_format sf srclex)) | { result = None; diags } -> (* valid lexdir with erroneous semantics *) + let pplog = Preproc_trace.new_lexdir ~loc lp.pplog in + let lp = with_pplog lp pplog in Ok (add_diags lp diags) | exception Pp.Error -> - let loc = Cobol_common.Srcloc.concat_locs srctext in - Ok (DIAGS.Cont.kerror (add_diag lp) ?loc + Ok (DIAGS.Cont.kerror (add_diag lp) ~loc "Malformed@ or@ unknown@ compiler@ directive") and preprocess_line lp srctext = diff --git a/src/lsp/cobol_preproc/preproc_grammar.mly b/src/lsp/cobol_preproc/preproc_grammar.mly index f297825fa..82b0d14b1 100644 --- a/src/lsp/cobol_preproc/preproc_grammar.mly +++ b/src/lsp/cobol_preproc/preproc_grammar.mly @@ -23,13 +23,13 @@ (* Entry points *) -%start lexing_directive -%start copy_statement -%start replace_statement @@ -62,7 +62,7 @@ let lexdir_source_format := | CDIR_SOURCE; FORMAT?; IS?; _free = loc(FREE); { let SF sf = Src_lexing.select_source_format Cobol_config.SFFree in Cobol_common.Diagnostics.some_result @@ - Preproc.LexDirSource (sf &@<- _free) } + Preproc_directives.LexDirSource (sf &@<- _free) } | CDIR_SOURCE; FORMAT?; IS?; i = text_word; { Preproc.cdir_source_format ~dialect i } @@ -134,8 +134,8 @@ let copy_replacing_text_identifier := c @ [lpar] @ cl @ [rpar] } let leading_or_trailing == - | LEADING; { Preproc.Leading } - | TRAILING; { Preproc.Trailing } + | LEADING; { Preproc_directives.Leading } + | TRAILING; { Preproc_directives.Trailing } (* --- REPLACE -------------------------------------------------------------- *) @@ -147,7 +147,7 @@ let replace_statement_ := { result = CDirReplace { also; replacing }; diags } } | REPLACE; last = ibo(LAST); OFF; "."; { Cobol_common.Diagnostics.simple_result @@ - Preproc.CDirReplaceOff { last } } + Preproc_directives.CDirReplaceOff { last } } (* ISO/IEC 1989:2014 only allows the following clauses in "REPLACE"; however we allow the same clauses as GnuCOBOL. *) diff --git a/src/lsp/cobol_preproc/preproc_grammar_sig.ml b/src/lsp/cobol_preproc/preproc_grammar_sig.ml index 29a209516..3fd03b0b2 100644 --- a/src/lsp/cobol_preproc/preproc_grammar_sig.ml +++ b/src/lsp/cobol_preproc/preproc_grammar_sig.ml @@ -31,11 +31,11 @@ module type S = sig (* The monolithic API. *) - val replace_statement: (Lexing.lexbuf -> token) -> Lexing.lexbuf -> (Preproc.replace_statement Cobol_common.Srcloc.with_loc) + val replace_statement: (Lexing.lexbuf -> token) -> Lexing.lexbuf -> (Preproc_directives.replace_statement Cobol_common.Srcloc.with_loc) - val lexing_directive: (Lexing.lexbuf -> token) -> Lexing.lexbuf -> (Preproc.lexing_directive Cobol_common.Srcloc.with_loc) + val lexing_directive: (Lexing.lexbuf -> token) -> Lexing.lexbuf -> (Preproc_directives.lexing_directive Cobol_common.Srcloc.with_loc) - val copy_statement: (Lexing.lexbuf -> token) -> Lexing.lexbuf -> (Preproc.copy_statement Cobol_common.Srcloc.with_loc) + val copy_statement: (Lexing.lexbuf -> token) -> Lexing.lexbuf -> (Preproc_directives.copy_statement Cobol_common.Srcloc.with_loc) val _unused_symbols: (Lexing.lexbuf -> token) -> Lexing.lexbuf -> (unit) @@ -52,11 +52,11 @@ module type S = sig module Incremental : sig - val replace_statement: Lexing.position -> (Preproc.replace_statement Cobol_common.Srcloc.with_loc) MenhirInterpreter.checkpoint + val replace_statement: Lexing.position -> (Preproc_directives.replace_statement Cobol_common.Srcloc.with_loc) MenhirInterpreter.checkpoint - val lexing_directive: Lexing.position -> (Preproc.lexing_directive Cobol_common.Srcloc.with_loc) MenhirInterpreter.checkpoint + val lexing_directive: Lexing.position -> (Preproc_directives.lexing_directive Cobol_common.Srcloc.with_loc) MenhirInterpreter.checkpoint - val copy_statement: Lexing.position -> (Preproc.copy_statement Cobol_common.Srcloc.with_loc) MenhirInterpreter.checkpoint + val copy_statement: Lexing.position -> (Preproc_directives.copy_statement Cobol_common.Srcloc.with_loc) MenhirInterpreter.checkpoint val _unused_symbols: Lexing.position -> (unit) MenhirInterpreter.checkpoint diff --git a/src/lsp/cobol_preproc/preproc_trace.ml b/src/lsp/cobol_preproc/preproc_trace.ml index 6a2bf84e2..f7a106ada 100644 --- a/src/lsp/cobol_preproc/preproc_trace.ml +++ b/src/lsp/cobol_preproc/preproc_trace.ml @@ -8,7 +8,8 @@ (* *) (**************************************************************************) -(** Some utilities to log preprocessing events. *) +(** Some utilities to log preprocessing events. `Preproc_journal` may be a + better name. *) open Cobol_common.Srcloc.TYPES @@ -28,6 +29,12 @@ module TYPES = struct matched_loc: srcloc; replacement_text: Text.text; } + | LexDir of + { + lexdir: Preproc_directives.lexing_directive option; (** invalid if + [None] *) + loc: srcloc; + } and copy_event_status = | CopyDone of string @@ -43,6 +50,8 @@ include TYPES let empty = [] let append = List.cons +let new_lexdir ~loc ?lexdir : log -> log = + List.cons @@ LexDir { lexdir; loc } let copy_done ~loc ~filename : log -> log = List.cons @@ FileCopy { copyloc = loc; status = CopyDone filename } let cyclic_copy ~loc ~filename : log -> log = diff --git a/src/lsp/cobol_preproc/preproc_trace.mli b/src/lsp/cobol_preproc/preproc_trace.mli index b20e7775f..d53dcaa85 100644 --- a/src/lsp/cobol_preproc/preproc_trace.mli +++ b/src/lsp/cobol_preproc/preproc_trace.mli @@ -24,6 +24,11 @@ module TYPES: sig matched_loc: Cobol_common.srcloc; replacement_text: Text.text; } + | LexDir of + { + lexdir: Preproc_directives.lexing_directive option; + loc: Cobol_common.srcloc; + } and copy_event_status = | CopyDone of string @@ -42,6 +47,10 @@ val empty: log val append : log_entry -> log -> log +val new_lexdir + : loc: Cobol_common.srcloc + -> ?lexdir: Preproc_directives.lexing_directive + -> log -> log val copy_done : loc: Cobol_common.srcloc -> filename: string diff --git a/src/lsp/cobol_preproc/preproc_utils.mli b/src/lsp/cobol_preproc/preproc_utils.mli index 53a2e1c08..2ad9f7c30 100644 --- a/src/lsp/cobol_preproc/preproc_utils.mli +++ b/src/lsp/cobol_preproc/preproc_utils.mli @@ -17,11 +17,11 @@ open Cobol_common.Diagnostics.TYPES module Make (Config: Cobol_config.T) : sig val replacing' - : ?repl_dir:Preproc.replacing_direction + : ?repl_dir:Preproc_directives.replacing_direction -> [< `Alphanum of Text.pseudotext | `PseudoText of Text.pseudotext ] Cobol_common.Srcloc.with_loc -> Text.pseudotext Cobol_common.Srcloc.with_loc - -> Preproc.replacing option Cobol_common.Diagnostics.with_diags + -> Preproc_directives.replacing option Cobol_common.Diagnostics.with_diags val filter_map_4_list_with_diags' : 'a option with_diags with_loc list -> 'a with_loc list with_diags diff --git a/src/lsp/cobol_preproc/src_lexer.mll b/src/lsp/cobol_preproc/src_lexer.mll index 16d5578ad..bf90e7e2d 100644 --- a/src/lsp/cobol_preproc/src_lexer.mll +++ b/src/lsp/cobol_preproc/src_lexer.mll @@ -282,7 +282,7 @@ and fixed_nominal state } and fixed_cdir_line state (* microfocus compiler directive *) = parse - | blank text_word (* XXX: '\t'? *) + | blanks? text_word { Src_lexing.cdir_word ~ktkd:gobble_line ~knom:fixed_nominal state lexbuf } diff --git a/test/output-tests/listings.expected b/test/output-tests/listings.expected index 121caef61..c4f018d98 100644 --- a/test/output-tests/listings.expected +++ b/test/output-tests/listings.expected @@ -4039,7 +4039,7 @@ listings.at-2876-prog2.cob:7.7-7.26: ---- ^^^^^^^^^^^^^^^^^^^ 8 DISPLAY "NOTOK" NO ADVANCING 9 END-DISPLAY ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive listings.at-2876-prog2.cob:10.7-10.29: 7 $IF ACTIVATE DEFINED @@ -4049,7 +4049,7 @@ listings.at-2876-prog2.cob:10.7-10.29: ---- ^^^^^^^^^^^^^^^^^^^^^^ 11 DISPLAY "OK" NO ADVANCING 12 END-DISPLAY ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive listings.at-2876-prog2.cob:13.7-13.11: 10 $ELIF ACTIVATE2 DEFINED @@ -4059,7 +4059,7 @@ listings.at-2876-prog2.cob:13.7-13.11: ---- ^^^^ 14 DISPLAY "NOTOK" NO ADVANCING 15 END-DISPLAY ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive listings.at-2876-prog2.cob:16.7-16.10: 13 $ELSE @@ -4068,7 +4068,7 @@ listings.at-2876-prog2.cob:16.7-16.10: 16 > $END ---- ^^^ 17 STOP RUN. ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive Considering: import/gnucobol/tests/testsuite.src/listings.at:3684:0 listings.at-3684-expected.lst:1.6-1.7: diff --git a/test/output-tests/run_extensions.expected b/test/output-tests/run_extensions.expected index 00e3bb2da..8943e76b9 100644 --- a/test/output-tests/run_extensions.expected +++ b/test/output-tests/run_extensions.expected @@ -3882,109 +3882,6 @@ run_extensions.at-5188-prog.cob:2.7-2.8: Considering: import/gnucobol/tests/testsuite.src/run_extensions.at:5266:0 Considering: import/gnucobol/tests/testsuite.src/run_extensions.at:5290:0 -run_extensions.at-5290-prog2.cob:2.7-2.29: - 1 - 2 > $SET SOURCEFORMAT"FREE" ----- ^^^^^^^^^^^^^^^^^^^^^^ - 3 IDENTIFICATION DIVISION. - 4 PROGRAM-ID. prog. ->> Error: Unexpected characters - -run_extensions.at-5290-prog2.cob:3.6-3.7: - 1 - 2 $SET SOURCEFORMAT"FREE" - 3 > IDENTIFICATION DIVISION. ----- ^ - 4 PROGRAM-ID. prog. - 5 DATA DIVISION. ->> Error: Unexpected indicator: `F' - -run_extensions.at-5290-prog2.cob:4.6-4.7: - 1 - 2 $SET SOURCEFORMAT"FREE" - 3 IDENTIFICATION DIVISION. - 4 > PROGRAM-ID. prog. ----- ^ - 5 DATA DIVISION. - 6 WORKING-STORAGE SECTION. ->> Error: Unexpected indicator: `M' - -run_extensions.at-5290-prog2.cob:5.6-5.7: - 2 $SET SOURCEFORMAT"FREE" - 3 IDENTIFICATION DIVISION. - 4 PROGRAM-ID. prog. - 5 > DATA DIVISION. ----- ^ - 6 WORKING-STORAGE SECTION. - 7 1 X PIC 99. ->> Error: Unexpected indicator: `I' - -run_extensions.at-5290-prog2.cob:6.6-6.7: - 3 IDENTIFICATION DIVISION. - 4 PROGRAM-ID. prog. - 5 DATA DIVISION. - 6 > WORKING-STORAGE SECTION. ----- ^ - 7 1 X PIC 99. - 8 PROCEDURE DIVISION. ->> Error: Unexpected indicator: `G' - -run_extensions.at-5290-prog2.cob:7.6-7.7: - 4 PROGRAM-ID. prog. - 5 DATA DIVISION. - 6 WORKING-STORAGE SECTION. - 7 > 1 X PIC 99. ----- ^ - 8 PROCEDURE DIVISION. - 9 MAIN. ->> Error: Unexpected indicator: `C' - -run_extensions.at-5290-prog2.cob:8.6-8.7: - 5 DATA DIVISION. - 6 WORKING-STORAGE SECTION. - 7 1 X PIC 99. - 8 > PROCEDURE DIVISION. ----- ^ - 9 MAIN. - 10 COMPUTE X = 6 ->> Error: Unexpected indicator: `U' - -run_extensions.at-5290-prog2.cob:10.6-10.7: - 7 1 X PIC 99. - 8 PROCEDURE DIVISION. - 9 MAIN. - 10 > COMPUTE X = 6 ----- ^ - 11 * 7 - 12 DISPLAY X NO ADVANCING ->> Error: Unexpected indicator: `E' - -run_extensions.at-5290-prog2.cob:12.6-12.7: - 9 MAIN. - 10 COMPUTE X = 6 - 11 * 7 - 12 > DISPLAY X NO ADVANCING ----- ^ - 13 STOP RUN. ->> Error: Unexpected indicator: `Y' - -run_extensions.at-5290-prog2.cob:13.6-13.7: - 10 COMPUTE X = 6 - 11 * 7 - 12 DISPLAY X NO ADVANCING - 13 > STOP RUN. ----- ^ ->> Error: Unexpected indicator: `U' - -run_extensions.at-5290-prog2.cob:3.7-3.14: - 1 - 2 $SET SOURCEFORMAT"FREE" - 3 > IDENTIFICATION DIVISION. ----- ^^^^^^^ - 4 PROGRAM-ID. prog. - 5 DATA DIVISION. ->> Error: Invalid syntax - Considering: import/gnucobol/tests/testsuite.src/run_extensions.at:5315:0 Considering: import/gnucobol/tests/testsuite.src/run_extensions.at:5351:0 run_extensions.at-5351-prog.cob:2.7-2.36: diff --git a/test/output-tests/run_file.expected b/test/output-tests/run_file.expected index 8d9de3037..344a95514 100644 --- a/test/output-tests/run_file.expected +++ b/test/output-tests/run_file.expected @@ -110,7 +110,7 @@ run_file.at-790-prog.cob:10.7-10.28: ---- ^^^^^^^^^^^^^^^^^^^^^ 11 SELECT g ASSIGN whatever 12 ORGANIZATION LINE SEQUENTIAL. ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive Considering: import/gnucobol/tests/testsuite.src/run_file.at:816:0 Considering: import/gnucobol/tests/testsuite.src/run_file.at:860:0 @@ -3261,7 +3261,7 @@ run_file.at-8591-prog.cob:9.7-9.17: ---- ^^^^^^^^^^ 10 INPUT-OUTPUT SECTION. 11 FILE-CONTROL. ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive run_file.at-8591-prog.cob:88.54: 85 05 FILLER PIC X(8) VALUE "PRE00000". @@ -5714,7 +5714,7 @@ run_file.at-10488-progs.cob:2.7-2.19: ---- ^^^^^^^^^^^^ 3 ** CREATE KEY-DEF-AREA FROM ACB ARRAY 4 IDENTIFICATION DIVISION. ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive Considering: import/gnucobol/tests/testsuite.src/run_file.at:10676:0 run_file.at-10676-prog.cob:86.12-86.24: diff --git a/test/output-tests/run_ml.expected b/test/output-tests/run_ml.expected index bcdc0a491..153522ac5 100644 --- a/test/output-tests/run_ml.expected +++ b/test/output-tests/run_ml.expected @@ -2809,7 +2809,7 @@ run_ml.at-483-prog.cob:2.7-2.29: ---- ^^^^^^^^^^^^^^^^^^^^^^ 3 IDENTIFICATION DIVISION. 4 PROGRAM-ID. prog. ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive run_ml.at-483-prog.cob:17.11-17.14: 14 01 out PIC X(100). @@ -4301,7 +4301,7 @@ run_ml.at-863-prog.cob:2.7-2.29: ---- ^^^^^^^^^^^^^^^^^^^^^^ 3 IDENTIFICATION DIVISION. 4 PROGRAM-ID. prog. ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive run_ml.at-863-prog.cob:17.11-17.15: 14 01 out PIC X(100). diff --git a/test/output-tests/run_refmod.expected b/test/output-tests/run_refmod.expected index fd3dfe209..de27920eb 100644 --- a/test/output-tests/run_refmod.expected +++ b/test/output-tests/run_refmod.expected @@ -38,7 +38,7 @@ run_refmod.at-413-prog.cob:2.7-2.20: ---- ^^^^^^^^^^^^^ 3 IDENTIFICATION DIVISION. 4 PROGRAM-ID. prog. ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive Considering: import/gnucobol/tests/testsuite.src/run_refmod.at:435:0 run_refmod.at-435-prog1.cob:2.7-2.21: @@ -47,7 +47,7 @@ run_refmod.at-435-prog1.cob:2.7-2.21: ---- ^^^^^^^^^^^^^^ 3 IDENTIFICATION DIVISION. 4 PROGRAM-ID. progb. ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive Considering: import/gnucobol/tests/testsuite.src/run_refmod.at:466:0 run_refmod.at-466-prog2.cob:2.7-2.21: @@ -56,7 +56,7 @@ run_refmod.at-466-prog2.cob:2.7-2.21: ---- ^^^^^^^^^^^^^^ 3 IDENTIFICATION DIVISION. 4 PROGRAM-ID. prog2. ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive run_refmod.at-466-prog2.cob:15.7-15.39: 12 01 m PIC 9 VALUE 2. @@ -66,7 +66,7 @@ run_refmod.at-466-prog2.cob:15.7-15.39: ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 16 DISPLAY y (1:n) 17 $END ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive run_refmod.at-466-prog2.cob:17.7-17.10: 14 PROCEDURE DIVISION. @@ -76,7 +76,7 @@ run_refmod.at-466-prog2.cob:17.7-17.10: ---- ^^^ 18 DISPLAY y (1:m) 19 GOBACK. ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive Considering: import/gnucobol/tests/testsuite.src/run_refmod.at:490:0 run_refmod.at-490-prog3.cob:2.7-2.21: @@ -85,5 +85,5 @@ run_refmod.at-490-prog3.cob:2.7-2.21: ---- ^^^^^^^^^^^^^^ 3 IDENTIFICATION DIVISION. 4 PROGRAM-ID. prog3. ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive diff --git a/test/output-tests/run_subscripts.expected b/test/output-tests/run_subscripts.expected index 3febddb36..32f4b43b5 100644 --- a/test/output-tests/run_subscripts.expected +++ b/test/output-tests/run_subscripts.expected @@ -17,7 +17,7 @@ run_subscripts.at-493-prog.cob:2.7-2.16: ---- ^^^^^^^^^ 3 IDENTIFICATION DIVISION. 4 PROGRAM-ID. prog. ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive Considering: import/gnucobol/tests/testsuite.src/run_subscripts.at:494:0 run_subscripts.at-494-progn.cob:2.7-2.18: @@ -26,7 +26,7 @@ run_subscripts.at-494-progn.cob:2.7-2.18: ---- ^^^^^^^^^^^ 3 IDENTIFICATION DIVISION. 4 PROGRAM-ID. progn. ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive Considering: import/gnucobol/tests/testsuite.src/run_subscripts.at:495:0 run_subscripts.at-495-progn2.cob:2.7-2.19: @@ -35,7 +35,7 @@ run_subscripts.at-495-progn2.cob:2.7-2.19: ---- ^^^^^^^^^^^^ 3 IDENTIFICATION DIVISION. 4 PROGRAM-ID. progn2. ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive Considering: import/gnucobol/tests/testsuite.src/run_subscripts.at:532:0 run_subscripts.at-532-prog.cob:13.7-13.20: @@ -46,7 +46,7 @@ run_subscripts.at-532-prog.cob:13.7-13.20: ---- ^^^^^^^^^^^^^ 14 DISPLAY y (idx) 15 *> Note: MF says "sets BOUND" ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive run_subscripts.at-532-prog.cob:16.7-16.18: 13 $SET NOSSRANGE @@ -56,6 +56,6 @@ run_subscripts.at-532-prog.cob:16.7-16.18: ---- ^^^^^^^^^^^ 17 DISPLAY y (idx) 18 . ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive Considering: import/gnucobol/tests/testsuite.src/run_subscripts.at:581:0 diff --git a/test/output-tests/syn_misc.expected b/test/output-tests/syn_misc.expected index 097493198..51b11d42f 100644 --- a/test/output-tests/syn_misc.expected +++ b/test/output-tests/syn_misc.expected @@ -1224,7 +1224,7 @@ syn_misc.at-2045-prog2.cob:11.7-11.46: ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 12 * DISPLAY 'MFCOMMENT' END-DISPLAY 13 * DISPLAY 'NOMFCOMMENT' END-DISPLAY ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive syn_misc.at-2045-prog2.cob:15.8-15.9: 12 * DISPLAY 'MFCOMMENT' END-DISPLAY @@ -3143,7 +3143,7 @@ syn_misc.at-6845-prog.cob:5.7-5.17: 5 > $DISPLAY OK ---- ^^^^^^^^^^ 6 STOP RUN. ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive Considering: import/gnucobol/tests/testsuite.src/syn_misc.at:6924:0 syn_misc.at-6924-prog.cob:2.7-2.11: @@ -3618,7 +3618,7 @@ syn_misc.at-7109-prog.cob:8.7-8.19: ---- ^^^^^^^^^^^^ 9 $DISPLAY X defined 10 $ELIF Y DEFINED ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive syn_misc.at-7109-prog.cob:9.7-9.24: 6 78 Y VALUE 'a'. @@ -3628,7 +3628,7 @@ syn_misc.at-7109-prog.cob:9.7-9.24: ---- ^^^^^^^^^^^^^^^^^ 10 $ELIF Y DEFINED 11 $DISPLAY X not defined, but Y via lvl 78 ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive syn_misc.at-7109-prog.cob:10.7-10.21: 7 PROCEDURE DIVISION. @@ -3638,7 +3638,7 @@ syn_misc.at-7109-prog.cob:10.7-10.21: ---- ^^^^^^^^^^^^^^ 11 $DISPLAY X not defined, but Y via lvl 78 12 $ELSE ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive syn_misc.at-7109-prog.cob:11.7-11.46: 8 $IF X DEFINED @@ -3648,7 +3648,7 @@ syn_misc.at-7109-prog.cob:11.7-11.46: ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 12 $ELSE 13 $DISPLAY X not defined ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive syn_misc.at-7109-prog.cob:12.7-12.11: 9 $DISPLAY X defined @@ -3658,7 +3658,7 @@ syn_misc.at-7109-prog.cob:12.7-12.11: ---- ^^^^ 13 $DISPLAY X not defined 14 $END ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive syn_misc.at-7109-prog.cob:13.7-13.28: 10 $ELIF Y DEFINED @@ -3668,7 +3668,7 @@ syn_misc.at-7109-prog.cob:13.7-13.28: ---- ^^^^^^^^^^^^^^^^^^^^^ 14 $END 15 CONTINUE ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive syn_misc.at-7109-prog.cob:14.7-14.10: 11 $DISPLAY X not defined, but Y via lvl 78 @@ -3678,7 +3678,7 @@ syn_misc.at-7109-prog.cob:14.7-14.10: ---- ^^^ 15 CONTINUE 16 . ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive Considering: import/gnucobol/tests/testsuite.src/syn_misc.at:7160:0 syn_misc.at-7160-prog.cob:11.7-11.17: @@ -3689,7 +3689,7 @@ syn_misc.at-7160-prog.cob:11.7-11.17: ---- ^^^^^^^^^^ 12 $DISPLAY correct Y = Y2 13 $ELSE ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive syn_misc.at-7160-prog.cob:12.7-12.29: 9 78 Z VALUE 354. @@ -3699,7 +3699,7 @@ syn_misc.at-7160-prog.cob:12.7-12.29: ---- ^^^^^^^^^^^^^^^^^^^^^^ 13 $ELSE 14 $DISPLAY bad: Y should be = Y2 ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive syn_misc.at-7160-prog.cob:13.7-13.11: 10 PROCEDURE DIVISION. @@ -3709,7 +3709,7 @@ syn_misc.at-7160-prog.cob:13.7-13.11: ---- ^^^^ 14 $DISPLAY bad: Y should be = Y2 15 $END ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive syn_misc.at-7160-prog.cob:14.7-14.36: 11 $IF Y = Y2X @@ -3719,7 +3719,7 @@ syn_misc.at-7160-prog.cob:14.7-14.36: ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 15 $END 16 $IF Y > X ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive syn_misc.at-7160-prog.cob:15.7-15.10: 12 $DISPLAY correct Y = Y2 @@ -3729,7 +3729,7 @@ syn_misc.at-7160-prog.cob:15.7-15.10: ---- ^^^ 16 $IF Y > X 17 $DISPLAY BAD - Y is not > X ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive syn_misc.at-7160-prog.cob:16.7-16.15: 13 $ELSE @@ -3739,7 +3739,7 @@ syn_misc.at-7160-prog.cob:16.7-16.15: ---- ^^^^^^^^ 17 $DISPLAY BAD - Y is not > X 18 $ELIF Y < X ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive syn_misc.at-7160-prog.cob:17.7-17.33: 14 $DISPLAY bad: Y should be = Y2 @@ -3749,7 +3749,7 @@ syn_misc.at-7160-prog.cob:17.7-17.33: ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^ 18 $ELIF Y < X 19 $DISPLAY correct Y < X ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive syn_misc.at-7160-prog.cob:18.7-18.17: 15 $END @@ -3759,7 +3759,7 @@ syn_misc.at-7160-prog.cob:18.7-18.17: ---- ^^^^^^^^^^ 19 $DISPLAY correct Y < X 20 $ELSE ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive syn_misc.at-7160-prog.cob:19.7-19.28: 16 $IF Y > X @@ -3769,7 +3769,7 @@ syn_misc.at-7160-prog.cob:19.7-19.28: ---- ^^^^^^^^^^^^^^^^^^^^^ 20 $ELSE 21 $DISPLAY BROKEN ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive syn_misc.at-7160-prog.cob:20.7-20.11: 17 $DISPLAY BAD - Y is not > X @@ -3779,7 +3779,7 @@ syn_misc.at-7160-prog.cob:20.7-20.11: ---- ^^^^ 21 $DISPLAY BROKEN 22 $END ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive syn_misc.at-7160-prog.cob:21.7-21.21: 18 $ELIF Y < X @@ -3789,7 +3789,7 @@ syn_misc.at-7160-prog.cob:21.7-21.21: ---- ^^^^^^^^^^^^^^ 22 $END 23 ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive syn_misc.at-7160-prog.cob:22.7-22.10: 19 $DISPLAY correct Y < X @@ -3799,7 +3799,7 @@ syn_misc.at-7160-prog.cob:22.7-22.10: ---- ^^^ 23 24 $IF X > Y ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive syn_misc.at-7160-prog.cob:24.7-24.15: 21 $DISPLAY BROKEN @@ -3809,7 +3809,7 @@ syn_misc.at-7160-prog.cob:24.7-24.15: ---- ^^^^^^^^ 25 $DISPLAY correct X > Y 26 $ELIF X < Y ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive syn_misc.at-7160-prog.cob:25.7-25.28: 22 $END @@ -3819,7 +3819,7 @@ syn_misc.at-7160-prog.cob:25.7-25.28: ---- ^^^^^^^^^^^^^^^^^^^^^ 26 $ELIF X < Y 27 $DISPLAY BAD - X is not < Y ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive syn_misc.at-7160-prog.cob:26.7-26.17: 23 @@ -3829,7 +3829,7 @@ syn_misc.at-7160-prog.cob:26.7-26.17: ---- ^^^^^^^^^^ 27 $DISPLAY BAD - X is not < Y 28 $ELSE ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive syn_misc.at-7160-prog.cob:27.7-27.33: 24 $IF X > Y @@ -3839,7 +3839,7 @@ syn_misc.at-7160-prog.cob:27.7-27.33: ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^ 28 $ELSE 29 $DISPLAY BROKEN ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive syn_misc.at-7160-prog.cob:28.7-28.11: 25 $DISPLAY correct X > Y @@ -3849,7 +3849,7 @@ syn_misc.at-7160-prog.cob:28.7-28.11: ---- ^^^^ 29 $DISPLAY BROKEN 30 $END ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive syn_misc.at-7160-prog.cob:29.7-29.21: 26 $ELIF X < Y @@ -3859,7 +3859,7 @@ syn_misc.at-7160-prog.cob:29.7-29.21: ---- ^^^^^^^^^^^^^^ 30 $END 31 CONTINUE ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive syn_misc.at-7160-prog.cob:30.7-30.10: 27 $DISPLAY BAD - X is not < Y @@ -3869,7 +3869,7 @@ syn_misc.at-7160-prog.cob:30.7-30.10: ---- ^^^ 31 CONTINUE 32 . ->> Error: Unexpected characters +>> Error: Malformed or unknown compiler directive Considering: import/gnucobol/tests/testsuite.src/syn_misc.at:7193:0 Considering: import/gnucobol/tests/testsuite.src/syn_misc.at:7264:0