- 
                Notifications
    You must be signed in to change notification settings 
- Fork 25
Closed
Description
Describe the bug
Some value declarations are not parsed correctly and lead to an exception.
To Reproduce
(Type)Cobol code that cause the bug : (if any)
       IDENTIFICATION DIVISION.
       PROGRAM-ID. MyPGM.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 item PIC 9(4).
          88 ranges VALUE 0001 THRU
                          0005.
       procedure division.
           goback
           .
       END PROGRAM MyPGM.Expected behavior
No error.
Check this code, the keywords THROUGH and THRU should be added to distinguish between literals and level number in that case.
TypeCobol/TypeCobol/Compiler/Scanner/Scanner.cs
Lines 1563 to 1569 in a7793a0
| //Try to guess if it is a LevelNumber or Literal depending on previous tokens | |
| bool currentTokenIsExpectedToBeALiteral = | |
| lastSignificantToken.TokenType == TokenType.OCCURS || | |
| lastSignificantToken.TokenType == TokenType.VALUE || | |
| lastSignificantToken.TokenType == TokenType.VALUES || | |
| (beforeLastSignificantToken.TokenType == TokenType.VALUE && lastSignificantToken.TokenType == TokenType.IS) || | |
| (beforeLastSignificantToken.TokenType == TokenType.VALUES && lastSignificantToken.TokenType == TokenType.ARE); |