Open gecolbert opened 3 years ago
Hi @gecolbert
You touch on one of the problems I expressed in discussion #184 The language server is not a language compiler.
That said, if the description of your COPYBOOK is perfectly legal in terms of form, I think there is a design problem in substance: the level numbers should not be symbolic parameters, and I doubt that it there really is a need for them to be. You could just as easily put real values on your number levels and do a replacement when calling COPYBOOK (the IBM documentation on the compiler gives examples of this use case). As far as we are concerned, our COPYBOOKs of data descriptions do not contain any symbolic parameters and are "totally COBOL", which does not prevent us from making replacements during COPY. This has another advantage: our COPYBOOKs can be used in our data manipulation tool which can associate a (actually) COBOL COPYBOOK with a file and interpret its content by means of the COPYBOOK.
Example:
Despite this, unless I am mistaken, the language server detects a false error because it misinterprets REPLACING ...
To solve the initial problem, the language server, but also the textmate grammar, would have to accept at the place where a level number is expected, a text answering the following pattern:
/0[1-9]|[1-4][0-9]|66|77|88|(?P<sep>[\:])(?:\w|\-)+(?P=sep)/
1st Alternative 0[1-9]
0
matches the character 0 with index 48d (30h or 60o) literally (case insensitive)1-9
matches a single character in the range between 1 (index 49) and 9 (index 57) (case insensitive)2nd Alternative [1-4][0-9]
1-4
matches a single character in the range between 1 (index 49) and 4 (index 52) (case insensitive)0-9
matches a single character in the range between 0 (index 48) and 9 (index 57) (case insensitive)3rd Alternative 66
66
matches the characters 66 literally (case insensitive)4th Alternative 77
77
matches the characters 77 literally (case insensitive)5th Alternative 88
88
matches the characters 88 literally (case insensitive)6th Alternative (?P<sep>[\:])(?:\w|\-)+(?P=sep)
(?P<sep>[\:])
\:
matches the character : with index 58d (3Ah or 72o) literally (case insensitive)(?:\w|\-)+
+
matches the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy)\w
\w
matches any word character (equivalent to [a-zA-Z0-9_])\-
\-
matches the character - with index 45d (2Dh or 55o) literally (case insensitive)(?P=sep)
matches the same text as most recently matched by the capturing group named sepAbout last (or second problem) concerning "replacing" on "ascending key is", this works: put "PREF-LOCALITY-CDE" as a subordonate entry of the OCCURS.
I think where is a problem un Language Server that don't accept "ASCENDING/DESCENDINK KEY" on the subject of the OCCURS.
Perhaps need to open a new issue for this second problem ?
The structure of this copybook is perfectly legal (for Enterprise Cobol) in terms of form.
While I fully agree that the use of tokens in this structure is the result of an overly exuberant programmer and are completely un-necessary, the obstacles to fixing it in my system make the implementation of z Open Editor nearly impossible.
This copybook was introduced into my production system in 1992. It is a core part of the processing for billions of dollars of transactions every month. Just changing the :LB: tag to an 05 will require a three month long project of obtaining change approval, scheduling of the distribution of the change to multiple external agencies, and complete end-to-end testing of our entire system. All of this not to correct a problem or enhance any system functionality.
The arduous effort of change management to critical systems makes it necessary for any new tools to be capable of properly emulating the Enterprise Cobol compiler's behavior. I need an editor that fully implements the language without having to make system changes to accommodate the editor.
Hi @gecolbert
To avoid problems linked to the language server, you can pause it: "F1" + "pause"
Cf. #154 Cobol Language Server - "Full red program" after LS analysis.
Development environment used
java -version
and paste the details here):Problem Description
Detailed steps for reproducing the problem:
zOpen Editor reports multiple TOKEN ERRORS
Expected behavior
Should be accepted as valid COPYBOOK structure