uwol / proleap-cobol-parser

ProLeap ANTLR4-based parser for COBOL
MIT License
136 stars 74 forks source link

Inline comments not recognized ( *> comments) #13

Closed Reinhard-Prehofer closed 6 years ago

Reinhard-Prehofer commented 7 years ago

Inline-comments in Cobol can be used since Cobol-2002 (extending the ANSI-85 norm) *> starts a cobol-comment till end-of-line, the same like // for Java.

Parsing leads to error: line 21:30 mismatched input '' expecting and line 21 is the one withe the > ANSI End-of-Line Comment .

Note: I am aware of the Parser being named 85 ;)

 01  Student.
   03  nachname    pic x(20).
   03  vorname     pic x(20).
   03  geschlecht  pic x(1).  *> ANSI End-of-Line Comment 
     88  mann      values 'M' 'm'. 
     88  frau      value 'F', 'f', 'W', 'w'.
     88  egal      values 'a' thru 'z',
          'A' thru 'Z'.
uwol commented 6 years ago

Already fixed in 4c80d4e540f6277822600c43846ba827c5e047b7. Added unit test in 888899fdb9410631386314cb11017c72446ae738.

albertolovato commented 6 years ago

Inline comment at start of line without space still gives error, as in

line 4:11 mismatched input '*>' expecting <EOF>

   PROCEDURE DIVISION.
       *>DISPLAY "Hello World".
       DISPLAY "Hello World".
uwol commented 6 years ago

Ah, you are right. Thanks for issuing! Fixed in e25c264f911e2ee659ad010fa312a90d8807cbe7 and added unit tests.

The fix was a little bit tricky, so if I missed something, please let me know.