-
-
Notifications
You must be signed in to change notification settings - Fork 33
/
source.genero-4gl.js
207 lines (205 loc) · 8.17 KB
/
source.genero-4gl.js
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
// This is a TextMate grammar distributed by `starry-night`.
// This grammar is developed at
// <https://github.com/FourjsGenero/GeneroFgl.tmbundle>
// and licensed `unlicense`.
// See <https://github.com/wooorm/starry-night> for more info.
/**
* @import {Grammar} from '@wooorm/starry-night'
*/
/** @type {Grammar} */
const grammar = {
extensions: ['.4gl'],
names: ['genero-4gl'],
patterns: [
{include: '#comments'},
{include: '#keywords'},
{include: '#strings'},
{include: '#numerics'},
{
match: '^\\s*&\\s*(elif|else|endif|ifdef|ifndef|include|undef)\\b',
name: 'meta.preprocessor'
},
{
begin: '^\\s*&\\s*define\\b',
beginCaptures: {0: {name: 'meta.preprocessor'}},
end: '[^\\\\\\{]$',
patterns: [
{include: '#keywords'},
{include: '#strings'},
{include: '#numerics'},
{match: '#', name: 'meta.preprocessor'},
{include: '#comments'},
{captures: {1: {name: 'meta.preprocessor'}}, match: '(\\\\)[ \\t]*\\n'}
]
}
],
repository: {
comments: {
patterns: [
{match: '#.*$', name: 'comment.line.number-sign.4gl'},
{match: '--.*$', name: 'comment.line.double-dash.4gl'},
{begin: '{', end: '}', name: 'comment.block.4gl'}
]
},
keywords: {
patterns: [
{match: '\\b(?i)(AND|OR|MOD|NOT)\\b', name: 'keyword.operator.4gl'},
{
match:
'\\b(?i)(BOOLEAN|BYTE|CHAR|VARCHAR|NVARCHAR|LVARCHAR|FLOAT|INTEGER|INT|INT8|SMALLINT|BIGINT|TINYINT|SMALLFLOAT|DECIMAL|MONEY|DATE|DATETIME|INTERVAL|SERIAL8|SERIAL|STRING|TEXT)\\b',
name: 'storage.type.4gl'
},
{
match:
'\\b(?i)(ABSOLUTE|ACCELERATOR|ACCEPT|ACCESSORYTYPE|ACTION|ADD|AFTER|ALL|ALTER|AND|ANSI|ANY|APPEND|APPLICATION|ARRAY|AS|ASC|ASCENDING|ASCII|AT|ATTRIBUTE|ATTRIBUTES|AUDIT|AUTHORIZATION|AUTO|AVG)\\b',
name: 'keyword.control.4gl'
},
{
match:
'\\b(?i)(BEFORE|BEGIN|BETWEEN|BIGINT|BIGSERIAL|BLACK|BLINK|BLUE|BOLD|BOOLEAN|BORDER|BOTTOM|BREAKPOINT|BUFFER|BUFFERED|BY|BYTE)\\b',
name: 'keyword.control.4gl'
},
{
match:
'\\b(?i)(CACHE|CALL|CANCEL|CASCADE|CASE|CAST|CATCH|CENTURY|CHANGE|CHAR|CHARACTER|CHECK|CHECKMARK|CIRCUIT|CLEAR|CLIPPED|CLOSE|CLUSTER|COLLAPSE|COLUMN|COLUMNS|COMMAND|COMMENT|COMMIT|COMMITTED|CONCURRENT|CONNECT|CONNECTION|CONSTANT|CONSTRAINED|CONSTRAINT|CONSTRUCT|CONTEXTMENU|CONTINUE|CONTROL|COUNT|CREATE|CROSS|CURRENT|CURSOR|CYAN|CYCLE)\\b',
name: 'keyword.control.4gl'
},
{
match:
'\\b(?i)(DATABASE|DATE|DATETIME|DAY|DBA|DBSERVERNAME|DEC|DECIMAL|DECLARE|DEFAULT|DEFAULTS|DEFAULTVIEW|DEFER|DEFINE|DELETE|DELIMITER|DESC|DESCENDING|DESCRIBE|DESTINATION|DETAILACTION|DETAILBUTTON|DIALOG|DICTIONARY|DIM|DIMENSION|DIRTY|DISCLOSUREINDICATOR|DISCONNECT|DISPLAY|DISTINCT|DORMANT|DOUBLE|DOUBLECLICK|DOWN|DRAG_ENTER|DRAG_FINISHED|DRAG_OVER|DRAG_START|DROP|DYNAMIC)\\b',
name: 'keyword.control.4gl'
},
{
match:
'\\b(?i)(ELSE|END|ERROR|ESCAPE|EVERY|EXCLUSIVE|EXECUTE|EXISTS|EXIT|EXPAND|EXPLAIN|EXTEND|EXTENT|EXTERNAL)\\b',
name: 'keyword.control.4gl'
},
{
match:
'\\b(?i)(FALSE|FETCH|FGL|FGL_DRAWBOX|FIELD|FIELD_TOUCHED|FILE|FILL|FINISH|FIRST|FLOAT|FLUSH|FOCUSONFIELD|FOR|FOREACH|FOREIGN|FORM|FORMAT|FOUND|FRACTION|FREE|FROM|FULL|FUNCTION)\\b',
name: 'keyword.control.4gl'
},
{
match: '\\b(?i)(GET_FLDBUF|GLOBALS|GO|GOTO|GRANT|GREEN|GROUP)\\b',
name: 'keyword.control.4gl'
},
{
match: '\\b(?i)(HANDLER|HAVING|HEADER|HELP|HIDE|HOLD|HOUR)\\b',
name: 'keyword.control.4gl'
},
{
match:
'\\b(?i)(IDLE|IF|IIF|IMAGE|IMMEDIATE|IMPORT|IN|INCREMENT|INDEX|INFIELD|INITIALIZE|INNER|INOUT|INPUT|INSERT|INSTANCEOF|INT|INT8|INTEGER|INTERFACE|INTERRUPT|INTERVAL|INTO|INVISIBLE|IS|ISOLATION)\\b',
name: 'keyword.control.4gl'
},
{match: '\\b(?i)(JAVA|JOIN)\\b', name: 'keyword.control.4gl'},
{match: '\\b(?i)(KEEP|KEY)\\b', name: 'keyword.control.4gl'},
{
match:
'\\b(?i)(LABEL|LAST|LEFT|LENGTH|LET|LIKE|LIMIT|LINE|LINENO|LINES|LOAD|LOCATE|LOCK|LOCKS|LOG|LSTR|LVARCHAR)\\b',
name: 'keyword.control.4gl'
},
{
match:
'\\b(?i)(MAGENTA|MAIN|MARGIN|MATCHES|MAX|MAXCOUNT|MAXVALUE|MDY|MEMORY|MENU|MESSAGE|MIDDLE|MIN|MINUTE|MINVALUE|MOD|MODE|MODIFY|MONEY|MONTH)\\b',
name: 'keyword.control.4gl'
},
{
match:
'\\b(?i)(NAME|NATURAL|NAVIGATOR|NCHAR|NEED|NEXT|NO|NOCACHE|NOCYCLE|NOMAXVALUE|NOMINVALUE|NOORDER|NORMAL|NOT|NOTFOUND|NULL|NUMERIC|NVARCHAR|NVL)\\b',
name: 'keyword.control.4gl'
},
{
match:
'\\b(?i)(OF|OFF|ON|OPEN|OPTION|OPTIONS|OR|ORD|ORDER|OTHERWISE|OUT|OUTER|OUTPUT)\\b',
name: 'keyword.control.4gl'
},
{
match:
'\\b(?i)(PACKAGE|PAGE|PAGENO|PAUSE|PERCENT|PICTURE|PIPE|POPUP|PRECISION|PREPARE|PREVIOUS|PRIMARY|PRINT|PRINTER|PRINTX|PRIOR|PRIVATE|PRIVILEGES|PROCEDURE|PROGRAM|PROMPT|PUBLIC|PUT)\\b',
name: 'keyword.control.4gl'
},
{match: '\\b(?i)(QUIT)\\b', name: 'keyword.control.4gl'},
{
match:
'\\b(?i)(RAISE|READ|REAL|RECORD|RECOVER|RED|REFERENCES|RELATIVE|RELEASE|RENAME|REOPTIMIZATION|REPEATABLE|REPORT|RESOURCE|RESTART|RETAIN|RETURN|RETURNING|RETURNS|REVERSE|REVOKE|RIGHT|ROLLBACK|ROLLFORWARD|ROW|ROWBOUND|ROWS|RUN)\\b',
name: 'keyword.control.4gl'
},
{
match:
'\\b(?i)(SAVEPOINT|SCHEMA|SCREEN|SCROLL|SECOND|SELECT|SELECTION|SEQUENCE|SERIAL|SERIAL8|SESSION|SET|SFMT|SHARE|SHIFT|SHORT|SHOW|SIGNAL|SITENAME|SIZE|SKIP|SLEEP|SMALLFLOAT|SMALLINT|SOME|SORT|SPACE|SPACES|SQL|SQLERRMESSAGE|SQLERROR|SQLSTATE|STABILITY|START|STATISTICS|STEP|STOP|STRING|STYLE|SUBDIALOG|SUM|SYNONYM)\\b',
name: 'keyword.control.4gl'
},
{
match:
'\\b(?i)(TABLE|TEMP|TERMINATE|TEXT|THEN|THROUGH|THRU|TIME|TIMER|TINYINT|TO|TODAY|TOP|TRAILER|TRANSACTION|TRUE|TRUNCATE|TRUSTED|TRY|TYPE)\\b',
name: 'keyword.control.4gl'
},
{
match:
'\\b(?i)(UNBUFFERED|UNCONSTRAINED|UNDERLINE|UNION|UNIQUE|UNITS|UNLOAD|UNLOCK|UP|UPDATE|USER|USING)\\b',
name: 'keyword.control.4gl'
},
{
match: '\\b(?i)(VALIDATE|VALUES|VAR|VARCHAR|VIEW)\\b',
name: 'keyword.control.4gl'
},
{
match:
'\\b(?i)(WAIT|WAITING|WARNING|WEEKDAY|WHEN|WHENEVER|WHERE|WHILE|WHITE|WINDOW|WITH|WITHOUT|WORDWRAP|WORK|WRAP)\\b',
name: 'keyword.control.4gl'
},
{match: '\\b(?i)(XML)\\b', name: 'keyword.control.4gl'},
{match: '\\b(?i)(YEAR|YELLOW|YES)\\b', name: 'keyword.control.4gl'}
]
},
numerics: {
patterns: [
{
match:
'(\\+|\\-)?((\\b\\d+(\\.\\d+)?)|(\\.\\d+))([e|E](\\+|\\-)?\\d+)?',
name: 'constant.numeric.4gl'
}
]
},
strings: {
patterns: [
{
begin: "'",
end: "'(?!')",
name: 'string.quoted.single.4gl',
patterns: [
{
match: "\\\\[\\\\btnfr'\"]|\\\\$|''",
name: 'constant.character.escape.untitled'
},
{
match: '\\\\x[0-9a-fA-F]{1,2}',
name: 'constant.character.escape.untitled'
},
{match: '\\\\.', name: 'invalid.illegal'}
]
},
{
begin: '"',
end: '"(?!")',
name: 'string.quoted.double.4gl',
patterns: [
{
match: '\\\\[\\\\btnfr\'"]|\\\\$|""',
name: 'constant.character.escape.untitled'
},
{
match: '\\\\x[0-9a-fA-F]{1,2}',
name: 'constant.character.escape.untitled'
},
{match: '\\\\.', name: 'invalid.illegal'}
]
},
{begin: '`', end: '`', name: 'string.quoted.raw.4gl'}
]
}
},
scopeName: 'source.genero-4gl'
}
export default grammar