Closed mpheath closed 2 months ago
Fix with #229 string style fix included. Please commit after #229.
I think this is about supporting (a subset of) picture clauses which use 'V' to indicate an assumed decimal position like PI PICTURE 9V99999 VALUE 3.14159.
.
I think this is about supporting (a subset of) picture clauses which use 'V' to indicate an assumed decimal position like
PI PICTURE 9V99999 VALUE 3.14159.
.
So true, though it does not allow keywords starting with v
. The code sees v
and considers it a numeric literal for testing. Even if it fails testing as numeric literal and sets it to style identifier, it still misses the inlist test to test for keyword. This fix gives it a second chance to be recognized as a keyword if it failed to be numeric literal.
Found an example with a numeric literal with V
in it :
>>SOURCE FORMAT FREE
IDENTIFICATION DIVISION.
PROGRAM-ID. tutorial21.
DATA DIVISION.
WORKING-STORAGE SECTION.
*> Most programming languages use floating point
*> calculations which can introduce errors.
*> COBOL uses fixed point decimal arithmetic
*> and allows you to define how you will round.
01 Price PIC 9(4)V99.
01 TaxRate PIC V999 VALUE .075.
01 FullPrice PIC 9(4)V99.
PROCEDURE DIVISION.
DISPLAY "Enter the Price : " WITH NO ADVANCING
ACCEPT Price
COMPUTE FullPrice ROUNDED = Price + (Price * TaxRate)
DISPLAY "Price + Tax : " FullPrice.
VARYING *> keyword?
STOP RUN.
I inserted VARYING *> keyword?
before STOP RUN.
. Before fix, VARYING
not seen as keyword. After fix, see as keyword.
Keywords like
VARIANCE
andVARYING
are not identified as keywords.The issue appears to be code testing for a numeric literal that can contain the letter
v
https://github.com/ScintillaOrg/lexilla/blob/a86f23628da5f7b6dcaf190ae8a73efb331fa828/lexers/LexCOBOL.cxx#L99
which causes keyword identication in the
else
code to not occur for keywords starting with the letterv
.