Skip to content

Commit

Permalink
another COOL example
Browse files Browse the repository at this point in the history
  • Loading branch information
teverett committed Jun 12, 2018
1 parent 9e19408 commit 6f2ee22
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 27 deletions.
54 changes: 27 additions & 27 deletions cool/COOL.g4
Original file line number Diff line number Diff line change
Expand Up @@ -80,33 +80,6 @@ expression
| OBJECTID ASSIGNMENT expression # assignment
;

// skip spaces, tabs, newlines, note that \v is not suppoted in antlr

WHITESPACE
: [ \t\r\n\f] + -> skip
;

// comments

OPEN_COMMENT
: '(*'
;


CLOSE_COMMENT
: '*)'
;


COMMENT
: OPEN_COMMENT (COMMENT | .)*? CLOSE_COMMENT -> channel (HIDDEN)
;


ONE_LINE_COMMENT
: '--' (~ '\n')* '\n'? -> channel (HIDDEN)
;

// key words

CLASS
Expand Down Expand Up @@ -373,3 +346,30 @@ fragment UNICODE
fragment HEX
: [0-9a-fA-F]
;
// comments
OPEN_COMMENT
: '(*'
;
CLOSE_COMMENT
: '*)'
;
COMMENT
: OPEN_COMMENT (COMMENT | .)*? CLOSE_COMMENT -> skip
;
ONE_LINE_COMMENT
: '--' (~ '\n')* '\n'? -> skip
;
// skip spaces, tabs, newlines, note that \v is not suppoted in antlr
WHITESPACE
: [ \t\r\n\f] + -> skip
;
3 changes: 3 additions & 0 deletions cool/examples/pr1154_2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class A {}; -- this is last comment

(* this is a comment (* this is a comment inside a comment (* abc123 *) *)*)

0 comments on commit 6f2ee22

Please sign in to comment.