superbol-studio-oss
superbol-studio-oss copied to clipboard
Clarify and handle `CONSTANT`/`78`-level entries
the format for qualified names does not accept any literal in the position of the qualifiers (
XXin the example)
... which is the reason for the error message. A qualification needs an identifier. You may be able to improve that by postponing, in this case you can raise a better error message like
syntax error, unexpected constant name 'XX`, expecting qualification
But let's check what the standard says. We have 8.4.6 "scope of names" that specifies under "8.4.6.2.2 Scope of condition-names, constant-names, ..."
A constant-name [...] described with a
GLOBALclause is a global name. All data-names and screen-names subordinate to a global name are global names. A constant-name, data-name, [...} declared in a source element for an object definition, whether factory or instance, is a global name. [...]When a condition-name, constant-name, data-name, [...] is not a global name, it is a local name.
The requirements governing the uniqueness of the names allocated by a single source element to be condition-names, constant-names, data-names, [...] are explained elsewhere in these specifications. (See 8.3.2.2, User-defined words.)
Which then specifies:
Within a source element, a given user-defined word may be used as only one type of user-defined word with the following [...exception:] the same name may be used as any of the following types of user-defined words:
- constant-name
- data-name
- property-name
- record-key-name
- record-name
... but as 13.10.4.1 specifies
[...] the effect of specifying constant-name-1 in other than this entry is as if literal-1 [... is] written where constant-name-1 is written
I don't think the rules are clear. I'll ask the working group by mail. Side note: Wikipedia says that
Association Française de Normalisation [AFNOR ... is a] member body for France at the International Organization for Standardization (ISO).
It is not clear to me which of those sub-organizations, if any, takes care of programming languages. I suggest you check with them as they don't have someone in the working group and may also not commented on the last versions. You may be able to volunteer for that and by this also get access to both the documents of the working group (which were sadly moved to a non-public area which can only be accessed by ISO accounts (also given out to international member bodies) and to the working group itself.
Originally posted by @GitMensch in https://github.com/OCamlPro/superbol-studio-oss/issues/53#issuecomment-1818840892
It seems that level 78 is not handled correctly in the LSP - it should at least be seen as a variable (so we get the "show definition" and references), ideally also be supported in general.
Sample that shows it does not work:
IDENTIFICATION DIVISION.
PROGRAM-ID. TESTNC02.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 COMPARE VALUE 'COMPARE_DISPLAY_TO_DISPLAY2'.
77 NUM-FLD PIC S9(35)v9.
01 FLD-X7.
* 03 FLD-97 PIC S9(5)v9(32).
03 FLD-97 PIC S9(02)V9(35).
* 03 FLD-97 PIC 9(3) SIGN LEADING SEPARATE.
77 txt2 pic x(55).
78 def value 55.
77 txt pic x(def).
PROCEDURE DIVISION.
MOVE -1234 TO FLD-97.
MOVE -1234 TO NUM-FLD.
PERFORM 100000000 TIMES
CALL COMPARE USING
FLD-97 NUM-FLD txt2 def txt
END-PERFORM
GOBACK.
I'd expect all three lower case variables in the CALL statement to work as variable (shown with hover - def is missing) and ideally have the correct size for txt recognized (this may come later, is currently shown with a size of 6) and ideally give a syntactic type of "constant" to def.