From f3585eb768249886c5e0447ab507d9b880879254 Mon Sep 17 00:00:00 2001 From: Nicolas Berthier Date: Thu, 5 Oct 2023 14:43:11 +0200 Subject: [PATCH] Avoid folding over source lines that only denote the end-of-input/file --- src/lsp/cobol_preproc/preproc.ml | 4 +- src/lsp/cobol_preproc/src_lexing.ml | 16 +- test/output-tests/listings.expected | 552 ++++++++++++++-------------- test/output-tests/run_misc.expected | 100 ++--- test/output-tests/syn_misc.expected | 40 +- 5 files changed, 357 insertions(+), 355 deletions(-) diff --git a/src/lsp/cobol_preproc/preproc.ml b/src/lsp/cobol_preproc/preproc.ml index 788de9633..68d6c3851 100644 --- a/src/lsp/cobol_preproc/preproc.ml +++ b/src/lsp/cobol_preproc/preproc.ml @@ -113,7 +113,9 @@ let fold_source_lines pl ~f acc = spit_chunk suffix (acc, new_lnum, []) in let acc, last_lnum, tail = fold_source_chunks pl spit_chunk (acc, 1, []) in - f last_lnum tail acc (* fold on the last line upon exit *) + match tail with (* fold on the last line upon exit... *) + | [] | { payload = Eof; _ } :: _ -> acc (* ... if non-empty *) + | _ -> f last_lnum tail acc (* --- *) diff --git a/src/lsp/cobol_preproc/src_lexing.ml b/src/lsp/cobol_preproc/src_lexing.ml index d55d16d29..e22640223 100644 --- a/src/lsp/cobol_preproc/src_lexing.ml +++ b/src/lsp/cobol_preproc/src_lexing.ml @@ -82,20 +82,15 @@ let newline_cnums { newline_cnums; _ } = List.rev newline_cnums let source_format { config = { source_format; _ }; _ } = source_format let allow_debug { config = { debug; _ }; _ } = debug -(* Just check there is no text that requires continuation. *) -let flushed = function - | { continued = CNone; pseudotext = None; _ } -> true - | _ -> false - (** Flush buffered lexing productions, possibly holding onto one that may be subject to continuation on the following line. Always flushes completely whenever a compiler-directive word has been seen, - or upon end-of-input/file. -*) + or the last token is a lonesome period. *) let flush ({ lex_prods; _ } as state) : _ state * text = match lex_prods with - | h :: prods when not state.cdir_seen && ~&h <> Eof -> + | { payload = TextWord w; _ } as h :: prods + when not state.cdir_seen && w <> "." -> { state with lex_prods = [h] }, List.rev prods | prods -> { state with lex_prods = []; cdir_seen = false }, List.rev prods @@ -110,6 +105,11 @@ let lex_diag ~severity state = let lex_error state = lex_diag ~severity:DIAGS.Error state let change_source_format ({ config; _ } as state) { payload = sf; loc } = + (* Just check there is no text that requires continuation. *) + let flushed = function + | { continued = CNone; pseudotext = None; _ } -> true + | _ -> false + in if flushed state then Ok { state with config = { config with source_format = sf } } else Error (lex_error state ~loc "Forbidden@ change@ of@ source@ format") diff --git a/test/output-tests/listings.expected b/test/output-tests/listings.expected index fb31f9b32..4c615c140 100644 --- a/test/output-tests/listings.expected +++ b/test/output-tests/listings.expected @@ -23,6 +23,23 @@ listings.at-80-expected.lst:22.6-22.7: 24 0 warnings in compilation group >> Error: Unexpected indicator: `B' +listings.at-80-expected.lst:24.6-24.7: + 21 + 22 GnuCOBOL V.R.P prog.cob DDD MMM dd HH:MM:SS YYYY Page 0002 + 23 + 24 > 0 warnings in compilation group +---- ^ + 25 0 errors in compilation group +>> Error: Unexpected indicator: `i' + +listings.at-80-expected.lst:25.6-25.7: + 22 GnuCOBOL V.R.P prog.cob DDD MMM dd HH:MM:SS YYYY Page 0002 + 23 + 24 0 warnings in compilation group + 25 > 0 errors in compilation group +---- ^ +>> Error: Unexpected indicator: `r' + listings.at-80-expected.lst:22.9: 19 000015 END-DISPLAY. 20 000016 STOP RUN. @@ -183,23 +200,6 @@ listings.at-80-expected.lst:22.62-22.65: 24 0 warnings in compilation group >> Warning: Invalid syntax -listings.at-80-expected.lst:24.6-24.7: - 21 - 22 GnuCOBOL V.R.P prog.cob DDD MMM dd HH:MM:SS YYYY Page 0002 - 23 - 24 > 0 warnings in compilation group ----- ^ - 25 0 errors in compilation group ->> Error: Unexpected indicator: `i' - -listings.at-80-expected.lst:25.6-25.7: - 22 GnuCOBOL V.R.P prog.cob DDD MMM dd HH:MM:SS YYYY Page 0002 - 23 - 24 0 warnings in compilation group - 25 > 0 errors in compilation group ----- ^ ->> Error: Unexpected indicator: `r' - listings.at-80-expected.lst:22.65: 19 000015 END-DISPLAY. 20 000016 STOP RUN. @@ -1150,146 +1150,6 @@ listings.at-2030-expected.lst:24.6-24.7: 26 WORKING-STORAGE SECTION >> Error: Unexpected indicator: `T' -listings.at-2030-expected.lst:26.6-26.7: - 23 - 24 SIZE TYPE LVL NAME PICTURE - 25 - 26 > WORKING-STORAGE SECTION ----- ^ - 27 - 28 00001 ALPHANUMERIC 01 blah X ->> Error: Unexpected indicator: `W' - -listings.at-2030-expected.lst:28.6-28.7: - 25 - 26 WORKING-STORAGE SECTION - 27 - 28 > 00001 ALPHANUMERIC 01 blah X ----- ^ - 29 - 30 GnuCOBOL V.R.P prog-1.cob Page 0003 ->> Error: Unexpected indicator: `A' - -listings.at-2030-expected.lst:30.6-30.7: - 27 - 28 00001 ALPHANUMERIC 01 blah X - 29 - 30 > GnuCOBOL V.R.P prog-1.cob Page 0003 ----- ^ - 31 - 32 NAME DEFINED REFERENCES ->> Error: Unexpected indicator: `B' - -listings.at-2030-expected.lst:36.6-36.7: - 33 - 34 blah 7 *10 11 14 x3 - 35 - 36 > GnuCOBOL V.R.P prog-1.cob Page 0004 ----- ^ - 37 - 38 LABEL DEFINED REFERENCES ->> Error: Unexpected indicator: `B' - -listings.at-2030-expected.lst:40.6-40.7: - 37 - 38 LABEL DEFINED REFERENCES - 39 - 40 > E prog__1 10 ----- ^ - 41 P EX 16 12 x1 - 42 GnuCOBOL V.R.P prog-1.cob Page 0005 ->> Error: Unexpected indicator: `_' - -listings.at-2030-expected.lst:42.6-42.7: - 39 - 40 E prog__1 10 - 41 P EX 16 12 x1 - 42 > GnuCOBOL V.R.P prog-1.cob Page 0005 ----- ^ - 43 - 44 FUNCTION TYPE REFERENCES ->> Error: Unexpected indicator: `B' - -listings.at-2030-expected.lst:44.6-44.7: - 41 P EX 16 12 x1 - 42 GnuCOBOL V.R.P prog-1.cob Page 0005 - 43 - 44 > FUNCTION TYPE REFERENCES ----- ^ - 45 - 46 L prog-2 EXTERN 11 x1 ->> Error: Unexpected indicator: `O' - -listings.at-2030-expected.lst:46.7-46.11: - 43 - 44 FUNCTION TYPE REFERENCES - 45 - 46 > L prog-2 EXTERN 11 x1 ----- ^^^^ - 47 - 48 GnuCOBOL V.R.P prog-1.cob Page 0006 ->> Warning: Unexpected non-blank area A on continuation line - -listings.at-2030-expected.lst:48.6-48.7: - 45 - 46 L prog-2 EXTERN 11 x1 - 47 - 48 > GnuCOBOL V.R.P prog-1.cob Page 0006 ----- ^ - 49 - 50 Error/Warning summary: ->> Error: Unexpected indicator: `B' - -listings.at-2030-expected.lst:50.6-50.7: - 47 - 48 GnuCOBOL V.R.P prog-1.cob Page 0006 - 49 - 50 > Error/Warning summary: ----- ^ - 51 - 52 prog-1.cob:14: warning: unreachable statement 'DISPLAY' ->> Error: Unexpected indicator: `W' - -listings.at-2030-expected.lst:52.6-52.7: - 49 - 50 Error/Warning summary: - 51 - 52 > prog-1.cob:14: warning: unreachable statement 'DISPLAY' ----- ^ - 53 - 54 1 warning in compilation group ->> Error: Unexpected indicator: `.' - -listings.at-2030-expected.lst:54.6-54.7: - 51 - 52 prog-1.cob:14: warning: unreachable statement 'DISPLAY' - 53 - 54 > 1 warning in compilation group ----- ^ - 55 0 errors in compilation group - 56 GnuCOBOL V.R.P prog-2.cob Page 0001 ->> Error: Unexpected indicator: `i' - -listings.at-2030-expected.lst:55.6-55.7: - 52 prog-1.cob:14: warning: unreachable statement 'DISPLAY' - 53 - 54 1 warning in compilation group - 55 > 0 errors in compilation group ----- ^ - 56 GnuCOBOL V.R.P prog-2.cob Page 0001 - 57 ->> Error: Unexpected indicator: `r' - -listings.at-2030-expected.lst:56.6-56.7: - 53 - 54 1 warning in compilation group - 55 0 errors in compilation group - 56 > GnuCOBOL V.R.P prog-2.cob Page 0001 ----- ^ - 57 - 58 LINE PG/LN A...B............................................................ ->> Error: Unexpected indicator: `B' - listings.at-2030-expected.lst:22.15: 19 warning: unreachable statement 'DISPLAY' 20 000015 @@ -1370,6 +1230,26 @@ listings.at-2030-expected.lst:24.26-24.30: 26 WORKING-STORAGE SECTION >> Warning: Invalid syntax +listings.at-2030-expected.lst:26.6-26.7: + 23 + 24 SIZE TYPE LVL NAME PICTURE + 25 + 26 > WORKING-STORAGE SECTION +---- ^ + 27 + 28 00001 ALPHANUMERIC 01 blah X +>> Error: Unexpected indicator: `W' + +listings.at-2030-expected.lst:28.6-28.7: + 25 + 26 WORKING-STORAGE SECTION + 27 + 28 > 00001 ALPHANUMERIC 01 blah X +---- ^ + 29 + 30 GnuCOBOL V.R.P prog-1.cob Page 0003 +>> Error: Unexpected indicator: `A' + listings.at-2030-expected.lst:24.57-24.64: 21 000016 EX. STOP RUN. 22 GnuCOBOL V.R.P prog-1.cob Page 0002 @@ -1440,6 +1320,16 @@ listings.at-2030-expected.lst:28.26-28.30: 30 GnuCOBOL V.R.P prog-1.cob Page 0003 >> Warning: Invalid syntax +listings.at-2030-expected.lst:30.6-30.7: + 27 + 28 00001 ALPHANUMERIC 01 blah X + 29 + 30 > GnuCOBOL V.R.P prog-1.cob Page 0003 +---- ^ + 31 + 32 NAME DEFINED REFERENCES +>> Error: Unexpected indicator: `B' + listings.at-2030-expected.lst:28.30: 25 26 WORKING-STORAGE SECTION @@ -1620,6 +1510,16 @@ listings.at-2030-expected.lst:34.56-34.58: 36 GnuCOBOL V.R.P prog-1.cob Page 0004 >> Warning: Invalid syntax +listings.at-2030-expected.lst:36.6-36.7: + 33 + 34 blah 7 *10 11 14 x3 + 35 + 36 > GnuCOBOL V.R.P prog-1.cob Page 0004 +---- ^ + 37 + 38 LABEL DEFINED REFERENCES +>> Error: Unexpected indicator: `B' + listings.at-2030-expected.lst:34.58: 31 32 NAME DEFINED REFERENCES @@ -1720,6 +1620,16 @@ listings.at-2030-expected.lst:38.31-38.38: 40 E prog__1 10 >> Warning: Invalid syntax +listings.at-2030-expected.lst:40.6-40.7: + 37 + 38 LABEL DEFINED REFERENCES + 39 + 40 > E prog__1 10 +---- ^ + 41 P EX 16 12 x1 + 42 GnuCOBOL V.R.P prog-1.cob Page 0005 +>> Error: Unexpected indicator: `_' + listings.at-2030-expected.lst:38.38: 35 36 GnuCOBOL V.R.P prog-1.cob Page 0004 @@ -1800,6 +1710,16 @@ listings.at-2030-expected.lst:41.40-41.42: 43 >> Warning: Invalid syntax +listings.at-2030-expected.lst:42.6-42.7: + 39 + 40 E prog__1 10 + 41 P EX 16 12 x1 + 42 > GnuCOBOL V.R.P prog-1.cob Page 0005 +---- ^ + 43 + 44 FUNCTION TYPE REFERENCES +>> Error: Unexpected indicator: `B' + listings.at-2030-expected.lst:41.42: 38 LABEL DEFINED REFERENCES 39 @@ -1860,6 +1780,16 @@ listings.at-2030-expected.lst:42.10-42.15: 44 FUNCTION TYPE REFERENCES >> Warning: Invalid syntax +listings.at-2030-expected.lst:44.6-44.7: + 41 P EX 16 12 x1 + 42 GnuCOBOL V.R.P prog-1.cob Page 0005 + 43 + 44 > FUNCTION TYPE REFERENCES +---- ^ + 45 + 46 L prog-2 EXTERN 11 x1 +>> Error: Unexpected indicator: `O' + listings.at-2030-expected.lst:42.15: 39 40 E prog__1 10 @@ -1900,6 +1830,16 @@ listings.at-2030-expected.lst:44.7-44.8: 46 L prog-2 EXTERN 11 x1 >> Warning: Invalid syntax +listings.at-2030-expected.lst:46.7-46.11: + 43 + 44 FUNCTION TYPE REFERENCES + 45 + 46 > L prog-2 EXTERN 11 x1 +---- ^^^^ + 47 + 48 GnuCOBOL V.R.P prog-1.cob Page 0006 +>> Warning: Unexpected non-blank area A on continuation line + listings.at-2030-expected.lst:44.8: 41 P EX 16 12 x1 42 GnuCOBOL V.R.P prog-1.cob Page 0005 @@ -1940,8 +1880,18 @@ listings.at-2030-expected.lst:46.40-46.42: 48 GnuCOBOL V.R.P prog-1.cob Page 0006 >> Warning: Invalid syntax -listings.at-2030-expected.lst:46.42: - 43 +listings.at-2030-expected.lst:48.6-48.7: + 45 + 46 L prog-2 EXTERN 11 x1 + 47 + 48 > GnuCOBOL V.R.P prog-1.cob Page 0006 +---- ^ + 49 + 50 Error/Warning summary: +>> Error: Unexpected indicator: `B' + +listings.at-2030-expected.lst:46.42: + 43 44 FUNCTION TYPE REFERENCES 45 46 > L prog-2 EXTERN 11 x1 @@ -2000,6 +1950,16 @@ listings.at-2030-expected.lst:48.10-48.15: 50 Error/Warning summary: >> Warning: Invalid syntax +listings.at-2030-expected.lst:50.6-50.7: + 47 + 48 GnuCOBOL V.R.P prog-1.cob Page 0006 + 49 + 50 > Error/Warning summary: +---- ^ + 51 + 52 prog-1.cob:14: warning: unreachable statement 'DISPLAY' +>> Error: Unexpected indicator: `W' + listings.at-2030-expected.lst:48.15: 45 46 L prog-2 EXTERN 11 x1 @@ -2040,6 +2000,16 @@ listings.at-2030-expected.lst:50.7-50.13: 52 prog-1.cob:14: warning: unreachable statement 'DISPLAY' >> Warning: Invalid syntax +listings.at-2030-expected.lst:52.6-52.7: + 49 + 50 Error/Warning summary: + 51 + 52 > prog-1.cob:14: warning: unreachable statement 'DISPLAY' +---- ^ + 53 + 54 1 warning in compilation group +>> Error: Unexpected indicator: `.' + listings.at-2030-expected.lst:50.13: 47 48 GnuCOBOL V.R.P prog-1.cob Page 0006 @@ -2160,6 +2130,16 @@ listings.at-2030-expected.lst:52.36-52.45: 54 1 warning in compilation group >> Warning: Invalid syntax +listings.at-2030-expected.lst:54.6-54.7: + 51 + 52 prog-1.cob:14: warning: unreachable statement 'DISPLAY' + 53 + 54 > 1 warning in compilation group +---- ^ + 55 0 errors in compilation group + 56 GnuCOBOL V.R.P prog-2.cob Page 0001 +>> Error: Unexpected indicator: `i' + listings.at-2030-expected.lst:52.45: 49 50 Error/Warning summary: @@ -2200,6 +2180,16 @@ listings.at-2030-expected.lst:54.10-54.12: 56 GnuCOBOL V.R.P prog-2.cob Page 0001 >> Warning: Invalid syntax +listings.at-2030-expected.lst:55.6-55.7: + 52 prog-1.cob:14: warning: unreachable statement 'DISPLAY' + 53 + 54 1 warning in compilation group + 55 > 0 errors in compilation group +---- ^ + 56 GnuCOBOL V.R.P prog-2.cob Page 0001 + 57 +>> Error: Unexpected indicator: `r' + listings.at-2030-expected.lst:54.24: 51 52 prog-1.cob:14: warning: unreachable statement 'DISPLAY' @@ -2240,6 +2230,16 @@ listings.at-2030-expected.lst:55.9-55.11: 57 >> Warning: Invalid syntax +listings.at-2030-expected.lst:56.6-56.7: + 53 + 54 1 warning in compilation group + 55 0 errors in compilation group + 56 > GnuCOBOL V.R.P prog-2.cob Page 0001 +---- ^ + 57 + 58 LINE PG/LN A...B............................................................ +>> Error: Unexpected indicator: `B' + listings.at-2030-expected.lst:55.23: 52 prog-1.cob:14: warning: unreachable statement 'DISPLAY' 53 @@ -2460,123 +2460,6 @@ listings.at-2030-expected.lst:82.6-82.7: 84 WORKING-STORAGE SECTION >> Error: Unexpected indicator: `T' -listings.at-2030-expected.lst:84.6-84.7: - 81 - 82 SIZE TYPE LVL NAME PICTURE - 83 - 84 > WORKING-STORAGE SECTION ----- ^ - 85 - 86 00001 NUMERIC 01 data-b 9 ->> Error: Unexpected indicator: `W' - -listings.at-2030-expected.lst:86.6-86.7: - 83 - 84 WORKING-STORAGE SECTION - 85 - 86 > 00001 NUMERIC 01 data-b 9 ----- ^ - 87 - 88 LINKAGE SECTION ->> Error: Unexpected indicator: `N' - -listings.at-2030-expected.lst:88.6-88.7: - 85 - 86 00001 NUMERIC 01 data-b 9 - 87 - 88 > LINKAGE SECTION ----- ^ - 89 - 90 00001 ALPHANUMERIC 01 stuff X ->> Error: Unexpected indicator: `L' - -listings.at-2030-expected.lst:90.6-90.7: - 87 - 88 LINKAGE SECTION - 89 - 90 > 00001 ALPHANUMERIC 01 stuff X ----- ^ - 91 - 92 GnuCOBOL V.R.P prog-2.cob Page 0003 ->> Error: Unexpected indicator: `A' - -listings.at-2030-expected.lst:92.6-92.7: - 89 - 90 00001 ALPHANUMERIC 01 stuff X - 91 - 92 > GnuCOBOL V.R.P prog-2.cob Page 0003 ----- ^ - 93 - 94 NAME DEFINED REFERENCES ->> Error: Unexpected indicator: `B' - -listings.at-2030-expected.lst:100.6-100.7: - 97 - 98 stuff 9 *10 12 *16 x3 - 99 - 100 > GnuCOBOL V.R.P prog-2.cob Page 0004 ----- ^ - 101 - 102 LABEL DEFINED REFERENCES ->> Error: Unexpected indicator: `B' - -listings.at-2030-expected.lst:104.6-104.7: - 101 - 102 LABEL DEFINED REFERENCES - 103 - 104 > E prog__2 11 ----- ^ - 105 P MAIN 11 not referenced - 106 P EX 18 14 x1 ->> Error: Unexpected indicator: `_' - -listings.at-2030-expected.lst:108.6-108.7: - 105 P MAIN 11 not referenced - 106 P EX 18 14 x1 - 107 - 108 > GnuCOBOL V.R.P prog-2.cob Page 0005 ----- ^ - 109 - 110 Error/Warning summary: ->> Error: Unexpected indicator: `B' - -listings.at-2030-expected.lst:110.6-110.7: - 107 - 108 GnuCOBOL V.R.P prog-2.cob Page 0005 - 109 - 110 > Error/Warning summary: ----- ^ - 111 - 112 prog-2.cob:16: warning: unreachable statement 'ACCEPT' ->> Error: Unexpected indicator: `W' - -listings.at-2030-expected.lst:112.6-112.7: - 109 - 110 Error/Warning summary: - 111 - 112 > prog-2.cob:16: warning: unreachable statement 'ACCEPT' ----- ^ - 113 - 114 2 warnings in compilation group ->> Error: Unexpected indicator: `.' - -listings.at-2030-expected.lst:114.6-114.7: - 111 - 112 prog-2.cob:16: warning: unreachable statement 'ACCEPT' - 113 - 114 > 2 warnings in compilation group ----- ^ - 115 0 errors in compilation group ->> Error: Unexpected indicator: `i' - -listings.at-2030-expected.lst:115.6-115.7: - 112 prog-2.cob:16: warning: unreachable statement 'ACCEPT' - 113 - 114 2 warnings in compilation group - 115 > 0 errors in compilation group ----- ^ ->> Error: Unexpected indicator: `r' - listings.at-2030-expected.lst:80.15: 77 000017 78 000018 EX. STOP RUN. @@ -2657,6 +2540,26 @@ listings.at-2030-expected.lst:82.26-82.30: 84 WORKING-STORAGE SECTION >> Warning: Invalid syntax +listings.at-2030-expected.lst:84.6-84.7: + 81 + 82 SIZE TYPE LVL NAME PICTURE + 83 + 84 > WORKING-STORAGE SECTION +---- ^ + 85 + 86 00001 NUMERIC 01 data-b 9 +>> Error: Unexpected indicator: `W' + +listings.at-2030-expected.lst:86.6-86.7: + 83 + 84 WORKING-STORAGE SECTION + 85 + 86 > 00001 NUMERIC 01 data-b 9 +---- ^ + 87 + 88 LINKAGE SECTION +>> Error: Unexpected indicator: `N' + listings.at-2030-expected.lst:82.57-82.64: 79 000019 80 GnuCOBOL V.R.P prog-2.cob Page 0002 @@ -2727,6 +2630,16 @@ listings.at-2030-expected.lst:86.26-86.32: 88 LINKAGE SECTION >> Warning: Invalid syntax +listings.at-2030-expected.lst:88.6-88.7: + 85 + 86 00001 NUMERIC 01 data-b 9 + 87 + 88 > LINKAGE SECTION +---- ^ + 89 + 90 00001 ALPHANUMERIC 01 stuff X +>> Error: Unexpected indicator: `L' + listings.at-2030-expected.lst:86.32: 83 84 WORKING-STORAGE SECTION @@ -2767,6 +2680,16 @@ listings.at-2030-expected.lst:88.7-88.13: 90 00001 ALPHANUMERIC 01 stuff X >> Warning: Invalid syntax +listings.at-2030-expected.lst:90.6-90.7: + 87 + 88 LINKAGE SECTION + 89 + 90 > 00001 ALPHANUMERIC 01 stuff X +---- ^ + 91 + 92 GnuCOBOL V.R.P prog-2.cob Page 0003 +>> Error: Unexpected indicator: `A' + listings.at-2030-expected.lst:88.21: 85 86 00001 NUMERIC 01 data-b 9 @@ -2827,6 +2750,16 @@ listings.at-2030-expected.lst:90.26-90.31: 92 GnuCOBOL V.R.P prog-2.cob Page 0003 >> Warning: Invalid syntax +listings.at-2030-expected.lst:92.6-92.7: + 89 + 90 00001 ALPHANUMERIC 01 stuff X + 91 + 92 > GnuCOBOL V.R.P prog-2.cob Page 0003 +---- ^ + 93 + 94 NAME DEFINED REFERENCES +>> Error: Unexpected indicator: `B' + listings.at-2030-expected.lst:90.31: 87 88 LINKAGE SECTION @@ -3087,6 +3020,16 @@ listings.at-2030-expected.lst:98.55-98.58: 100 GnuCOBOL V.R.P prog-2.cob Page 0004 >> Warning: Invalid syntax +listings.at-2030-expected.lst:100.6-100.7: + 97 + 98 stuff 9 *10 12 *16 x3 + 99 + 100 > GnuCOBOL V.R.P prog-2.cob Page 0004 +---- ^ + 101 + 102 LABEL DEFINED REFERENCES +>> Error: Unexpected indicator: `B' + listings.at-2030-expected.lst:98.58: 95 96 data-b 7 *12 13 x2 @@ -3187,6 +3130,16 @@ listings.at-2030-expected.lst:102.31-102.38: 104 E prog__2 11 >> Warning: Invalid syntax +listings.at-2030-expected.lst:104.6-104.7: + 101 + 102 LABEL DEFINED REFERENCES + 103 + 104 > E prog__2 11 +---- ^ + 105 P MAIN 11 not referenced + 106 P EX 18 14 x1 +>> Error: Unexpected indicator: `_' + listings.at-2030-expected.lst:102.38: 99 100 GnuCOBOL V.R.P prog-2.cob Page 0004 @@ -3307,6 +3260,16 @@ listings.at-2030-expected.lst:106.40-106.42: 108 GnuCOBOL V.R.P prog-2.cob Page 0005 >> Warning: Invalid syntax +listings.at-2030-expected.lst:108.6-108.7: + 105 P MAIN 11 not referenced + 106 P EX 18 14 x1 + 107 + 108 > GnuCOBOL V.R.P prog-2.cob Page 0005 +---- ^ + 109 + 110 Error/Warning summary: +>> Error: Unexpected indicator: `B' + listings.at-2030-expected.lst:106.42: 103 104 E prog__2 11 @@ -3367,6 +3330,16 @@ listings.at-2030-expected.lst:108.10-108.15: 110 Error/Warning summary: >> Warning: Invalid syntax +listings.at-2030-expected.lst:110.6-110.7: + 107 + 108 GnuCOBOL V.R.P prog-2.cob Page 0005 + 109 + 110 > Error/Warning summary: +---- ^ + 111 + 112 prog-2.cob:16: warning: unreachable statement 'ACCEPT' +>> Error: Unexpected indicator: `W' + listings.at-2030-expected.lst:108.15: 105 P MAIN 11 not referenced 106 P EX 18 14 x1 @@ -3407,6 +3380,16 @@ listings.at-2030-expected.lst:110.7-110.13: 112 prog-2.cob:16: warning: unreachable statement 'ACCEPT' >> Warning: Invalid syntax +listings.at-2030-expected.lst:112.6-112.7: + 109 + 110 Error/Warning summary: + 111 + 112 > prog-2.cob:16: warning: unreachable statement 'ACCEPT' +---- ^ + 113 + 114 2 warnings in compilation group +>> Error: Unexpected indicator: `.' + listings.at-2030-expected.lst:110.13: 107 108 GnuCOBOL V.R.P prog-2.cob Page 0005 @@ -3527,6 +3510,15 @@ listings.at-2030-expected.lst:112.36-112.45: 114 2 warnings in compilation group >> Warning: Invalid syntax +listings.at-2030-expected.lst:114.6-114.7: + 111 + 112 prog-2.cob:16: warning: unreachable statement 'ACCEPT' + 113 + 114 > 2 warnings in compilation group +---- ^ + 115 0 errors in compilation group +>> Error: Unexpected indicator: `i' + listings.at-2030-expected.lst:112.45: 109 110 Error/Warning summary: @@ -3565,6 +3557,14 @@ listings.at-2030-expected.lst:114.11-114.13: 115 0 errors in compilation group >> Warning: Invalid syntax +listings.at-2030-expected.lst:115.6-115.7: + 112 prog-2.cob:16: warning: unreachable statement 'ACCEPT' + 113 + 114 2 warnings in compilation group + 115 > 0 errors in compilation group +---- ^ +>> Error: Unexpected indicator: `r' + listings.at-2030-expected.lst:114.25: 111 112 prog-2.cob:16: warning: unreachable statement 'ACCEPT' diff --git a/test/output-tests/run_misc.expected b/test/output-tests/run_misc.expected index 1ae61e6c9..a82ab1455 100644 --- a/test/output-tests/run_misc.expected +++ b/test/output-tests/run_misc.expected @@ -5187,16 +5187,6 @@ run_misc.at-10739-reference_tmpl:83.6-83.7: 85 77 RETURN-CODE +000000000 >> Error: Unexpected indicator: `G' -run_misc.at-10739-reference_tmpl:133.6-133.7: - 130 05 TSTTAILX Quick brown fox jumped over the dog \0ALPHA ELECTRICA - 131 57 : L CO.\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 - 132 01 BASED-RECORD. - 133 > 10 B-NUM 0124 ----- ^ - 134 10 B-DISK 'marvdisc' - 135 10 B-NO-TERMINALS 0000 ->> Error: Unexpected indicator: `0' - run_misc.at-10739-reference_tmpl:116.41-116.72: 113 05 TSTTAIL1 X _ 114 1 x 5811 @@ -5207,6 +5197,16 @@ run_misc.at-10739-reference_tmpl:116.41-116.72: 118 05 TSTHEX Q u i c k e r g r e y f o x j u m p e d _ >> Error: Missing continuation of `Quick brown fox jumped over th' +run_misc.at-10739-reference_tmpl:133.6-133.7: + 130 05 TSTTAILX Quick brown fox jumped over the dog \0ALPHA ELECTRICA + 131 57 : L CO.\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 + 132 01 BASED-RECORD. + 133 > 10 B-NUM 0124 +---- ^ + 134 10 B-DISK 'marvdisc' + 135 10 B-NO-TERMINALS 0000 +>> Error: Unexpected indicator: `0' + run_misc.at-10739-reference_tmpl:134.6-134.7: 131 57 : L CO.\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 132 01 BASED-RECORD. @@ -7196,16 +7196,6 @@ run_misc.at-12843-prog2.cob:8.36-8.41: 10 >>SET CONSTANT PONY "White" >> Error: Invalid syntax -run_misc.at-12843-prog2.cob:10.7-10.34: - 7 WORKING-STORAGE SECTION. - 8 01 THEDOG PIC X(6) VALUE DOGGY. - 9 77 MYHORSE PIC X(7) VALUE PONY. - 10 > >>SET CONSTANT PONY "White" ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - 11 * - 12 PROCEDURE DIVISION. ->> Error: Malformed or unknown compiler directive - run_misc.at-12843-prog2.cob:9.35: 6 DATA DIVISION. 7 WORKING-STORAGE SECTION. @@ -7226,6 +7216,16 @@ run_misc.at-12843-prog2.cob:9.36-9.40: 11 * >> Error: Invalid syntax +run_misc.at-12843-prog2.cob:10.7-10.34: + 7 WORKING-STORAGE SECTION. + 8 01 THEDOG PIC X(6) VALUE DOGGY. + 9 77 MYHORSE PIC X(7) VALUE PONY. + 10 > >>SET CONSTANT PONY "White" +---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 11 * + 12 PROCEDURE DIVISION. +>> Error: Malformed or unknown compiler directive + Considering: import/gnucobol/tests/testsuite.src/run_misc.at:12854:0 run_misc.at-12854-prog3.cob:2.7-2.38: 1 @@ -7264,16 +7264,6 @@ run_misc.at-12854-prog3.cob:8.36-8.41: 10 >>DEFINE CONSTANT PONY "White" OVERRIDE >> Error: Invalid syntax -run_misc.at-12854-prog3.cob:10.7-10.46: - 7 WORKING-STORAGE SECTION. - 8 01 THEDOG PIC X(6) VALUE DOGGY. - 9 77 MYHORSE PIC X(7) VALUE PONY. - 10 > >>DEFINE CONSTANT PONY "White" OVERRIDE ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - 11 * - 12 PROCEDURE DIVISION. ->> Error: Malformed or unknown compiler directive - run_misc.at-12854-prog3.cob:9.35: 6 DATA DIVISION. 7 WORKING-STORAGE SECTION. @@ -7294,6 +7284,16 @@ run_misc.at-12854-prog3.cob:9.36-9.40: 11 * >> Error: Invalid syntax +run_misc.at-12854-prog3.cob:10.7-10.46: + 7 WORKING-STORAGE SECTION. + 8 01 THEDOG PIC X(6) VALUE DOGGY. + 9 77 MYHORSE PIC X(7) VALUE PONY. + 10 > >>DEFINE CONSTANT PONY "White" OVERRIDE +---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 11 * + 12 PROCEDURE DIVISION. +>> Error: Malformed or unknown compiler directive + Considering: import/gnucobol/tests/testsuite.src/run_misc.at:12917:0 run_misc.at-12917-prog.cob:5.7-5.35: 2 IDENTIFICATION DIVISION. @@ -7315,16 +7315,6 @@ run_misc.at-12917-prog.cob:6.7-6.34: 8 01 THEDOG PIC X(6) VALUE DOGGY. >> Error: Malformed or unknown compiler directive -run_misc.at-12917-prog.cob:10.7-10.44: - 7 WORKING-STORAGE SECTION. - 8 01 THEDOG PIC X(6) VALUE DOGGY. - 9 - 10 > >>DEFINE DPONY AS PARAMETER OVERRIDE ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - 11 >>IF DPONY IS NOT DEFINED - 12 >>DEFINE DPONY AS "No Dpony" ->> Error: Malformed or unknown compiler directive - run_misc.at-12917-prog.cob:8.35: 5 >>SET CONSTANT DOGGY "Pluto" 6 >>SET CONSTANT PONY "Piper" @@ -7345,6 +7335,16 @@ run_misc.at-12917-prog.cob:8.36-8.41: 10 >>DEFINE DPONY AS PARAMETER OVERRIDE >> Error: Invalid syntax +run_misc.at-12917-prog.cob:10.7-10.44: + 7 WORKING-STORAGE SECTION. + 8 01 THEDOG PIC X(6) VALUE DOGGY. + 9 + 10 > >>DEFINE DPONY AS PARAMETER OVERRIDE +---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 11 >>IF DPONY IS NOT DEFINED + 12 >>DEFINE DPONY AS "No Dpony" +>> Error: Malformed or unknown compiler directive + run_misc.at-12917-prog.cob:11.7-11.32: 8 01 THEDOG PIC X(6) VALUE DOGGY. 9 @@ -7575,16 +7575,6 @@ run_misc.at-12983-prog.cob:6.7-6.34: 8 01 THEDOG PIC X(6) VALUE DOGGY. >> Error: Malformed or unknown compiler directive -run_misc.at-12983-prog.cob:10.7-10.44: - 7 WORKING-STORAGE SECTION. - 8 01 THEDOG PIC X(6) VALUE DOGGY. - 9 - 10 > >>DEFINE DPONY AS PARAMETER OVERRIDE ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - 11 >>IF DPONY IS NOT DEFINED - 12 >>DEFINE DPONY AS "No Dpony" ->> Error: Malformed or unknown compiler directive - run_misc.at-12983-prog.cob:8.35: 5 >>SET CONSTANT DOGGY "Pluto" 6 >>SET CONSTANT PONY "Piper" @@ -7605,6 +7595,16 @@ run_misc.at-12983-prog.cob:8.36-8.41: 10 >>DEFINE DPONY AS PARAMETER OVERRIDE >> Error: Invalid syntax +run_misc.at-12983-prog.cob:10.7-10.44: + 7 WORKING-STORAGE SECTION. + 8 01 THEDOG PIC X(6) VALUE DOGGY. + 9 + 10 > >>DEFINE DPONY AS PARAMETER OVERRIDE +---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 11 >>IF DPONY IS NOT DEFINED + 12 >>DEFINE DPONY AS "No Dpony" +>> Error: Malformed or unknown compiler directive + run_misc.at-12983-prog.cob:11.7-11.32: 8 01 THEDOG PIC X(6) VALUE DOGGY. 9 diff --git a/test/output-tests/syn_misc.expected b/test/output-tests/syn_misc.expected index cd6d515b1..b4b266011 100644 --- a/test/output-tests/syn_misc.expected +++ b/test/output-tests/syn_misc.expected @@ -3254,16 +3254,6 @@ syn_misc.at-6930-prog2.cob:8.36-8.41: 10 >>SET CONSTANT PONY "White" >> Error: Invalid syntax -syn_misc.at-6930-prog2.cob:10.7-10.34: - 7 WORKING-STORAGE SECTION. - 8 01 THEDOG PIC X(6) VALUE DOGGY. - 9 77 MYHORSE PIC X(7) VALUE PONY. - 10 > >>SET CONSTANT PONY "White" ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - 11 * - 12 PROCEDURE DIVISION. ->> Error: Malformed or unknown compiler directive - syn_misc.at-6930-prog2.cob:9.35: 6 DATA DIVISION. 7 WORKING-STORAGE SECTION. @@ -3284,6 +3274,16 @@ syn_misc.at-6930-prog2.cob:9.36-9.40: 11 * >> Error: Invalid syntax +syn_misc.at-6930-prog2.cob:10.7-10.34: + 7 WORKING-STORAGE SECTION. + 8 01 THEDOG PIC X(6) VALUE DOGGY. + 9 77 MYHORSE PIC X(7) VALUE PONY. + 10 > >>SET CONSTANT PONY "White" +---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 11 * + 12 PROCEDURE DIVISION. +>> Error: Malformed or unknown compiler directive + Considering: import/gnucobol/tests/testsuite.src/syn_misc.at:6934:0 syn_misc.at-6934-prog3.cob:2.7-2.38: 1 @@ -3322,16 +3322,6 @@ syn_misc.at-6934-prog3.cob:8.36-8.41: 10 >>DEFINE CONSTANT PONY "White" OVERRIDE >> Error: Invalid syntax -syn_misc.at-6934-prog3.cob:10.7-10.46: - 7 WORKING-STORAGE SECTION. - 8 01 THEDOG PIC X(6) VALUE DOGGY. - 9 77 MYHORSE PIC X(7) VALUE PONY. - 10 > >>DEFINE CONSTANT PONY "White" OVERRIDE ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - 11 * - 12 PROCEDURE DIVISION. ->> Error: Malformed or unknown compiler directive - syn_misc.at-6934-prog3.cob:9.35: 6 DATA DIVISION. 7 WORKING-STORAGE SECTION. @@ -3352,6 +3342,16 @@ syn_misc.at-6934-prog3.cob:9.36-9.40: 11 * >> Error: Invalid syntax +syn_misc.at-6934-prog3.cob:10.7-10.46: + 7 WORKING-STORAGE SECTION. + 8 01 THEDOG PIC X(6) VALUE DOGGY. + 9 77 MYHORSE PIC X(7) VALUE PONY. + 10 > >>DEFINE CONSTANT PONY "White" OVERRIDE +---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 11 * + 12 PROCEDURE DIVISION. +>> Error: Malformed or unknown compiler directive + Considering: import/gnucobol/tests/testsuite.src/syn_misc.at:6969:0 syn_misc.at-6969-prog.cob:7.7-7.28: 4 DATA DIVISION.