-
Notifications
You must be signed in to change notification settings - Fork 1
/
SASLog.g4
105 lines (80 loc) · 1.98 KB
/
SASLog.g4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
grammar SASLog;
saslog: stmt+ ;
stmt: pageBreak
| emptyLine
| note
| info
| warning
| error
| source
| source2
| mprint
| garbage
;
note : NOTE
| NOTENUMBERED
;
info : INFO ;
warning : WARNING
| WARNINGNUMBERED
;
error : ERROR
| ERRORNUMBERED
;
source: { _input.LT(1).getCharPositionInLine() == 0 }? SOURCE ;
source2: { _input.LT(1).getCharPositionInLine() == 0 }? SOURCE2 ;
mprint: { _input.LT(1).getCharPositionInLine() == 0 }? MPRINT ;
garbage : { _input.LT(1).getCharPositionInLine() == 0 }? TEXT EOL ;
pageBreak: (PageBreakNumbered | PageBreak) emptyLine? ;
emptyLine: { _input.LT(1).getCharPositionInLine() == 0 }? EOL ;
PageBreakNumbered : '\f'? DIGIT+ WS 'The SAS System' WS DATE EOL ;
PageBreak : '\f'? 'The SAS System' EOL ;
// 117 !+<code>
// 12345678901
SOURCE2: DIGIT+ WS? '!'? '+' TEXT? EOL ;
SOURCE: DIGIT+ WS? '! '? TEXT? EOL ;
MPRINT: 'MPRINT(' ID ('.' ID)* '): ' TEXT (' ' EOL TEXT )* EOL ;
NOTE: 'NOTE: ' TEXT EOL
(' ' TEXT EOL)* ;
NOTENUMBERED: 'NOTE' [0-9\- ]+ ': ' TEXT EOL
(' ' WS ' ' TEXT EOL)* ;
INFO: 'INFO: ' TEXT EOL
(' ' TEXT EOL)* ;
WARNING: 'WARNING: ' TEXT EOL
(' ' TEXT EOL)* ;
WARNINGNUMBERED: 'WARNING' [0-9\- ]+ ': ' TEXT EOL
(' ' WS ' ' TEXT EOL)* ;
ERROR: 'ERROR: ' TEXT EOL
(' ' TEXT EOL)* ;
ERRORNUMBERED: 'ERROR' [0-9\- ]+ ': ' TEXT EOL
(' ' WS ' ' TEXT EOL)* ;
DATE: TIME WS WEEKDAY ',' WS MONTH WS DIGIT+ ',' WS DIGIT+ ;
TIME: DIGIT DIGIT ':' DIGIT DIGIT ;
WEEKDAY
: 'Sunday'
| 'Monday'
| 'Tuesday'
| 'Wednesday'
| 'Thursday'
| 'Friday'
| 'Saturday'
;
MONTH
: 'January'
| 'February'
| 'March'
| 'April'
| 'May'
| 'June'
| 'July'
| 'August'
| 'September'
| 'October'
| 'November'
| 'December'
;
ID : [A-Za-z_][A-Za-z_0-9]* ;
DIGIT : [0-9] ;
WS : [ \t]+ ;
TEXT : ~[\n]+ ;
EOL : '\r'? '\n' ;