@op-ted/efx-syntax-highlighter 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -10
- package/dist/efx1/efx1Highlighting.js +45 -0
- package/dist/efx1/generated/lexer.js +1772 -0
- package/dist/efx1/lexer.js +26 -0
- package/dist/efx1/parser.js +23 -0
- package/dist/efx1/parser.terms.js +118 -0
- package/dist/{completion → efx2/completion}/CompletionItems.js +1 -1
- package/dist/{completion → efx2/completion}/EfxCompletions.js +2 -2
- package/dist/{completion → efx2/completion}/ExpectedTokens.js +14 -14
- package/dist/{efxHighlighting.js → efx2/efx2Highlighting.js} +5 -5
- package/dist/{generated → efx2/generated}/completions.js +1 -1
- package/dist/efx2/generated/lexer.js +3880 -0
- package/dist/efx2/generated/words.js +213 -0
- package/dist/efx2/lexer.js +49 -0
- package/dist/efx2/parser.js +23 -0
- package/dist/efx2/parser.terms.js +318 -0
- package/dist/efxLanguage.js +66 -17
- package/dist/lexer/AntlrLexer.js +427 -0
- package/dist/lexer/EditorLexer.js +134 -0
- package/dist/lexer/EditorParser.js +69 -0
- package/dist/lexer/Lexing.js +238 -0
- package/dist/lexer/ParseRanges.js +22 -0
- package/package.json +5 -4
- package/dist/efx-parser.js +0 -26
- package/dist/efx-parser.terms.js +0 -319
- package/dist/generated/words.js +0 -215
- package/dist/lexer/ExpressionMode.js +0 -44
- package/dist/lexer/FormatMode.js +0 -31
- package/dist/lexer/IdentifierMode.js +0 -12
- package/dist/lexer/LabelMode.js +0 -27
- package/dist/lexer/LexerContext.js +0 -76
- package/dist/lexer/LexerInput.js +0 -188
- package/dist/lexer/LexerMode.js +0 -24
- package/dist/lexer/LexerModes.js +0 -50
- package/dist/lexer/LineMode.js +0 -85
- package/dist/lexer/ReservedWords.js +0 -75
- package/dist/lexer/StageHeaderMode.js +0 -12
- package/dist/lexer/TemplateMode.js +0 -77
- package/dist/lexer/TemplateStartMode.js +0 -25
- /package/dist/{completion → efx2/completion}/Variables.js +0 -0
package/dist/efx-parser.terms.js
DELETED
|
@@ -1,319 +0,0 @@
|
|
|
1
|
-
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
2
|
-
export const
|
|
3
|
-
space = 394,
|
|
4
|
-
Comment = 1,
|
|
5
|
-
FreeText = 2,
|
|
6
|
-
AssetType = 3,
|
|
7
|
-
LabelType = 4,
|
|
8
|
-
OtherAssetId = 5,
|
|
9
|
-
Semicolon = 6,
|
|
10
|
-
FormatShort = 7,
|
|
11
|
-
FormatMedium = 8,
|
|
12
|
-
FormatLong = 9,
|
|
13
|
-
FormatNoUnit = 10,
|
|
14
|
-
FormatNoFormatting = 11,
|
|
15
|
-
With = 12,
|
|
16
|
-
Compute = 13,
|
|
17
|
-
Select = 14,
|
|
18
|
-
Let = 15,
|
|
19
|
-
When = 16,
|
|
20
|
-
Otherwise = 17,
|
|
21
|
-
Display = 18,
|
|
22
|
-
Invoke = 19,
|
|
23
|
-
Index = 20,
|
|
24
|
-
By = 21,
|
|
25
|
-
Template = 22,
|
|
26
|
-
Dynamic = 23,
|
|
27
|
-
And = 24,
|
|
28
|
-
Or = 25,
|
|
29
|
-
Is = 26,
|
|
30
|
-
In = 27,
|
|
31
|
-
Like = 28,
|
|
32
|
-
Present = 29,
|
|
33
|
-
Empty = 30,
|
|
34
|
-
Unique = 31,
|
|
35
|
-
Has = 32,
|
|
36
|
-
No = 33,
|
|
37
|
-
Duplicates = 34,
|
|
38
|
-
Every = 35,
|
|
39
|
-
Some = 36,
|
|
40
|
-
Satisfies = 37,
|
|
41
|
-
If = 38,
|
|
42
|
-
Then = 39,
|
|
43
|
-
Else = 40,
|
|
44
|
-
For = 41,
|
|
45
|
-
Return = 42,
|
|
46
|
-
Distinct = 43,
|
|
47
|
-
Always = 44,
|
|
48
|
-
Never = 45,
|
|
49
|
-
True = 46,
|
|
50
|
-
False = 47,
|
|
51
|
-
At = 48,
|
|
52
|
-
AT = 49,
|
|
53
|
-
EVERY = 50,
|
|
54
|
-
Not = 51,
|
|
55
|
-
Text = 52,
|
|
56
|
-
Number = 53,
|
|
57
|
-
Indicator = 54,
|
|
58
|
-
Date = 55,
|
|
59
|
-
Time = 56,
|
|
60
|
-
Duration = 57,
|
|
61
|
-
ContextType = 58,
|
|
62
|
-
CountFunction = 59,
|
|
63
|
-
SubstringFunction = 60,
|
|
64
|
-
SubstringBeforeFunction = 61,
|
|
65
|
-
SubstringAfterFunction = 62,
|
|
66
|
-
ContainsFunction = 63,
|
|
67
|
-
StartsWithFunction = 64,
|
|
68
|
-
EndsWithFunction = 65,
|
|
69
|
-
StringLengthFunction = 66,
|
|
70
|
-
IndexOfSubstringFunction = 67,
|
|
71
|
-
SumFunction = 68,
|
|
72
|
-
MinFunction = 69,
|
|
73
|
-
MaxFunction = 70,
|
|
74
|
-
AverageFunction = 71,
|
|
75
|
-
AbsoluteFunction = 72,
|
|
76
|
-
RoundFunction = 73,
|
|
77
|
-
RoundDownFunction = 74,
|
|
78
|
-
RoundUpFunction = 75,
|
|
79
|
-
YearFunction = 76,
|
|
80
|
-
MonthFunction = 77,
|
|
81
|
-
DayFunction = 78,
|
|
82
|
-
HoursFunction = 79,
|
|
83
|
-
MinutesFunction = 80,
|
|
84
|
-
SecondsFunction = 81,
|
|
85
|
-
YearsFunction = 82,
|
|
86
|
-
MonthsFunction = 83,
|
|
87
|
-
DaysFunction = 84,
|
|
88
|
-
FormatNumberFunction = 85,
|
|
89
|
-
FormatShortFunction = 86,
|
|
90
|
-
FormatMediumFunction = 87,
|
|
91
|
-
FormatLongFunction = 88,
|
|
92
|
-
UpperCaseFunction = 89,
|
|
93
|
-
LowerCaseFunction = 90,
|
|
94
|
-
NormalizeSpaceFunction = 91,
|
|
95
|
-
TrimFunction = 92,
|
|
96
|
-
TrimLeftFunction = 93,
|
|
97
|
-
TrimRightFunction = 94,
|
|
98
|
-
PadLeftFunction = 95,
|
|
99
|
-
PadRightFunction = 96,
|
|
100
|
-
RepeatFunction = 97,
|
|
101
|
-
ReplaceFunction = 98,
|
|
102
|
-
ReplaceRegexFunction = 99,
|
|
103
|
-
UrlEncodeFunction = 100,
|
|
104
|
-
CapitalizeFirstFunction = 101,
|
|
105
|
-
ConcatFunction = 102,
|
|
106
|
-
StringJoinFunction = 103,
|
|
107
|
-
CurrentDateFunction = 104,
|
|
108
|
-
CurrentTimeFunction = 105,
|
|
109
|
-
DayTimeDurationFunction = 106,
|
|
110
|
-
YearMonthDurationFunction = 107,
|
|
111
|
-
AddDurationFunction = 108,
|
|
112
|
-
SubtractDurationFunction = 109,
|
|
113
|
-
DistinctValuesFunction = 110,
|
|
114
|
-
CountDuplicatesFunction = 111,
|
|
115
|
-
GetDuplicatesFunction = 112,
|
|
116
|
-
ValueUnionFunction = 113,
|
|
117
|
-
ValueIntersectFunction = 114,
|
|
118
|
-
ValueExceptFunction = 115,
|
|
119
|
-
SequenceEqualFunction = 116,
|
|
120
|
-
SortFunction = 117,
|
|
121
|
-
ReverseFunction = 118,
|
|
122
|
-
SubsequenceFunction = 119,
|
|
123
|
-
IndexOfFunction = 120,
|
|
124
|
-
PreferredLanguageFunction = 121,
|
|
125
|
-
PreferredLanguageTextFunction = 122,
|
|
126
|
-
SplitFunction = 123,
|
|
127
|
-
Endpoint = 124,
|
|
128
|
-
Call = 125,
|
|
129
|
-
Api = 126,
|
|
130
|
-
On = 127,
|
|
131
|
-
Warn = 128,
|
|
132
|
-
Reject = 129,
|
|
133
|
-
Error = 130,
|
|
134
|
-
Warning = 131,
|
|
135
|
-
Info = 132,
|
|
136
|
-
Assert = 133,
|
|
137
|
-
Report = 134,
|
|
138
|
-
OtherwiseAssert = 135,
|
|
139
|
-
OtherwiseReport = 136,
|
|
140
|
-
As = 137,
|
|
141
|
-
FOR = 138,
|
|
142
|
-
IN = 139,
|
|
143
|
-
Any = 140,
|
|
144
|
-
Scope = 141,
|
|
145
|
-
IncludeDirective = 142,
|
|
146
|
-
AttributeSlash = 143,
|
|
147
|
-
PublicationDate = 144,
|
|
148
|
-
JustificationCode = 145,
|
|
149
|
-
JustificationDescription = 146,
|
|
150
|
-
PrivacyCode = 147,
|
|
151
|
-
WasWithheld = 148,
|
|
152
|
-
IsWithheld = 149,
|
|
153
|
-
IsWithholdable = 150,
|
|
154
|
-
IsDisclosed = 151,
|
|
155
|
-
IsMasked = 152,
|
|
156
|
-
RawValue = 153,
|
|
157
|
-
PreferredLanguage = 154,
|
|
158
|
-
PreferredLanguageText = 155,
|
|
159
|
-
TemplateFile = 156,
|
|
160
|
-
IncludePath = 157,
|
|
161
|
-
GlobalDeclaration = 158,
|
|
162
|
-
VariableDeclaration = 159,
|
|
163
|
-
TypeDeclaration = 161,
|
|
164
|
-
PrimitiveType = 162,
|
|
165
|
-
Star = 163,
|
|
166
|
-
Colon = 164,
|
|
167
|
-
VariablePrefix = 165,
|
|
168
|
-
UnquotedIdentifier = 166,
|
|
169
|
-
Assignment = 167,
|
|
170
|
-
CloseParenthesis = 168,
|
|
171
|
-
OpenParenthesis = 169,
|
|
172
|
-
CloseBracket = 171,
|
|
173
|
-
OpenBracket = 173,
|
|
174
|
-
AtPrefix = 176,
|
|
175
|
-
ColonColon = 178,
|
|
176
|
-
LinkedFieldReference = 179,
|
|
177
|
-
SimpleFieldReference = 180,
|
|
178
|
-
FieldId = 181,
|
|
179
|
-
Identifier = 182,
|
|
180
|
-
LinkedFieldProperty = 183,
|
|
181
|
-
SimpleNodeReference = 185,
|
|
182
|
-
NodeId = 186,
|
|
183
|
-
Slash = 191,
|
|
184
|
-
Percent = 192,
|
|
185
|
-
Plus = 194,
|
|
186
|
-
Minus = 195,
|
|
187
|
-
StringLiteral = 201,
|
|
188
|
-
Comparison = 204,
|
|
189
|
-
IteratorList = 209,
|
|
190
|
-
AbsoluteFieldReference = 213,
|
|
191
|
-
ContextBracket = 214,
|
|
192
|
-
Predicate = 215,
|
|
193
|
-
AbsoluteNodeReference = 217,
|
|
194
|
-
Comma = 218,
|
|
195
|
-
Literal = 222,
|
|
196
|
-
UuidV4Literal = 223,
|
|
197
|
-
NumericLiteral = 224,
|
|
198
|
-
IntegerLiteral = 225,
|
|
199
|
-
DecimalLiteral = 226,
|
|
200
|
-
BooleanLiteral = 227,
|
|
201
|
-
TrueBooleanLiteral = 228,
|
|
202
|
-
FalseBooleanLiteral = 229,
|
|
203
|
-
DateLiteral = 230,
|
|
204
|
-
TimeLiteral = 231,
|
|
205
|
-
DurationLiteral = 232,
|
|
206
|
-
DayTimeDurationLiteral = 233,
|
|
207
|
-
YearMonthDurationLiteral = 234,
|
|
208
|
-
Reference = 236,
|
|
209
|
-
FieldReference = 237,
|
|
210
|
-
NodeReference = 238,
|
|
211
|
-
VariableReference = 239,
|
|
212
|
-
FunctionPrefix = 240,
|
|
213
|
-
FunctionInvocation = 241,
|
|
214
|
-
ArgumentList = 242,
|
|
215
|
-
Argument = 243,
|
|
216
|
-
FieldMention = 246,
|
|
217
|
-
CodelistReference = 253,
|
|
218
|
-
Ellipsis = 254,
|
|
219
|
-
HashPrefix = 255,
|
|
220
|
-
BuiltInFunction = 257,
|
|
221
|
-
DynamicFunctionInvocation = 259,
|
|
222
|
-
DictionaryDeclaration = 260,
|
|
223
|
-
DictionaryIndexClause = 261,
|
|
224
|
-
DictionaryKeyClause = 262,
|
|
225
|
-
FunctionDeclaration = 263,
|
|
226
|
-
ParameterList = 264,
|
|
227
|
-
ParameterDeclaration = 265,
|
|
228
|
-
TemplateDeclaration = 266,
|
|
229
|
-
Indentation = 267,
|
|
230
|
-
Tabs = 268,
|
|
231
|
-
Spaces = 269,
|
|
232
|
-
MixedIndent = 270,
|
|
233
|
-
TemplateDefinition = 271,
|
|
234
|
-
ChooseTemplate = 272,
|
|
235
|
-
WhenBlock = 273,
|
|
236
|
-
WhenDisplayTemplate = 274,
|
|
237
|
-
DisplayTemplate = 275,
|
|
238
|
-
LineBreak = 277,
|
|
239
|
-
NewLine = 278,
|
|
240
|
-
TextBlock = 280,
|
|
241
|
-
Whitespace = 281,
|
|
242
|
-
OtherEscapeSequence = 282,
|
|
243
|
-
CharacterReference = 283,
|
|
244
|
-
EndBlock = 284,
|
|
245
|
-
LinkBlock = 285,
|
|
246
|
-
StartHyperlinkBlock = 286,
|
|
247
|
-
StartLabelBlock = 288,
|
|
248
|
-
Pipe = 291,
|
|
249
|
-
ExpressionBlock = 292,
|
|
250
|
-
StandardExpressionBlock = 293,
|
|
251
|
-
StartExpressionBlock = 294,
|
|
252
|
-
ShorthandFieldValueReferenceFromContextField = 295,
|
|
253
|
-
AssetId = 296,
|
|
254
|
-
BtId = 297,
|
|
255
|
-
Pluraliser = 302,
|
|
256
|
-
sharpValue = 304,
|
|
257
|
-
FormatOptions = 307,
|
|
258
|
-
FormatDecimals = 308,
|
|
259
|
-
FormatStyle = 309,
|
|
260
|
-
WhenInvokeTemplate = 312,
|
|
261
|
-
InvokeTemplate = 313,
|
|
262
|
-
OtherwiseBlock = 314,
|
|
263
|
-
OtherwiseDisplayTemplate = 315,
|
|
264
|
-
OtherwiseInvokeTemplate = 316,
|
|
265
|
-
TemplateLine = 317,
|
|
266
|
-
OutlineNumber = 318,
|
|
267
|
-
ContextDeclarationBlock = 319,
|
|
268
|
-
VariableList = 320,
|
|
269
|
-
ContextDeclaration = 321,
|
|
270
|
-
ContextVariableInitializer = 322,
|
|
271
|
-
Dot = 323,
|
|
272
|
-
DotDot = 324,
|
|
273
|
-
StartContextBlock = 325,
|
|
274
|
-
CRLF = 326,
|
|
275
|
-
OtherSections = 327,
|
|
276
|
-
NavigationSection = 328,
|
|
277
|
-
NavigationSectionHeader = 329,
|
|
278
|
-
SummarySection = 330,
|
|
279
|
-
SummarySectionHeader = 331,
|
|
280
|
-
RulesFile = 332,
|
|
281
|
-
ApiEndpointDeclaration = 333,
|
|
282
|
-
DynamicFunctionDeclaration = 334,
|
|
283
|
-
OnErrorClause = 335,
|
|
284
|
-
GlobalVariableDeclaration = 336,
|
|
285
|
-
ValidationStage = 337,
|
|
286
|
-
StageHeaderStart = 338,
|
|
287
|
-
StageIdentifier = 339,
|
|
288
|
-
StageHeaderEnd = 340,
|
|
289
|
-
StageVariableDeclaration = 341,
|
|
290
|
-
RuleSet = 342,
|
|
291
|
-
WithClause = 343,
|
|
292
|
-
Rules = 344,
|
|
293
|
-
ConditionalRule = 345,
|
|
294
|
-
WhenClause = 346,
|
|
295
|
-
AssertClause = 347,
|
|
296
|
-
ReportClause = 348,
|
|
297
|
-
AsClause = 349,
|
|
298
|
-
Severity = 350,
|
|
299
|
-
RuleId = 351,
|
|
300
|
-
RuleIdentifier = 352,
|
|
301
|
-
ForClause = 353,
|
|
302
|
-
InClause = 354,
|
|
303
|
-
NoticeTypeRange = 357,
|
|
304
|
-
NoticeType = 358,
|
|
305
|
-
ScopeClause = 359,
|
|
306
|
-
ScopeAnnotation = 360,
|
|
307
|
-
Pre = 361,
|
|
308
|
-
Post = 362,
|
|
309
|
-
Flag = 363,
|
|
310
|
-
SimpleRule = 364,
|
|
311
|
-
ConditionalRules = 365,
|
|
312
|
-
FallbackRule = 366,
|
|
313
|
-
OtherwiseAssertClause = 367,
|
|
314
|
-
OtherwiseReportClause = 368,
|
|
315
|
-
SingleExpression = 369,
|
|
316
|
-
StartSelectorBlock = 370,
|
|
317
|
-
SelectorBlock = 371,
|
|
318
|
-
Selection = 372,
|
|
319
|
-
AttributeReference = 373
|
package/dist/generated/words.js
DELETED
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
// Generated by `npm run sync` from EfxLexer.g4 at OP-TED/eForms-SDK@b43466c004b0865a979c9ffd2cc84781bf081fe0. Do not edit.
|
|
2
|
-
|
|
3
|
-
// The words the lexer reads as AssetType in a label block.
|
|
4
|
-
export const assetTypes = new Set([
|
|
5
|
-
'auxiliary',
|
|
6
|
-
'business-term',
|
|
7
|
-
'code',
|
|
8
|
-
'codelist',
|
|
9
|
-
'expression',
|
|
10
|
-
'field',
|
|
11
|
-
'group',
|
|
12
|
-
'indicator',
|
|
13
|
-
'interval',
|
|
14
|
-
'node',
|
|
15
|
-
'notice',
|
|
16
|
-
'pattern',
|
|
17
|
-
'rule',
|
|
18
|
-
'view',
|
|
19
|
-
]);
|
|
20
|
-
|
|
21
|
-
// The words the lexer reads as LabelType in a label block.
|
|
22
|
-
export const labelTypes = new Set([
|
|
23
|
-
'description',
|
|
24
|
-
'hint',
|
|
25
|
-
'name',
|
|
26
|
-
'template',
|
|
27
|
-
'text',
|
|
28
|
-
'when-false',
|
|
29
|
-
'when-true',
|
|
30
|
-
]);
|
|
31
|
-
|
|
32
|
-
// The token the lexer makes of each word it reserves at the start of a line or between its parts.
|
|
33
|
-
export const lineTokens = new Map([
|
|
34
|
-
['DISPLAY', 'Display'],
|
|
35
|
-
['ENDPOINT', 'Endpoint'],
|
|
36
|
-
['INVOKE', 'Invoke'],
|
|
37
|
-
['LET', 'Let'],
|
|
38
|
-
['OTHERWISE', 'Otherwise'],
|
|
39
|
-
['WHEN', 'When'],
|
|
40
|
-
['WITH', 'With'],
|
|
41
|
-
['OTHERWISE DISPLAY', 'Otherwise'],
|
|
42
|
-
]);
|
|
43
|
-
|
|
44
|
-
// The token the lexer makes of each word it reads where it skips whitespace and finds none, as directly after a `;`.
|
|
45
|
-
export const skipWhitespaceTokens = new Map([
|
|
46
|
-
['LET', 'Let'],
|
|
47
|
-
['WITH', 'With'],
|
|
48
|
-
]);
|
|
49
|
-
|
|
50
|
-
// The token the lexer makes of each word it reserves in template text.
|
|
51
|
-
export const templateTokens = new Map([
|
|
52
|
-
['INVOKE', 'Invoke'],
|
|
53
|
-
['OTHERWISE', 'Otherwise'],
|
|
54
|
-
['WHEN', 'When'],
|
|
55
|
-
['value', 'ValueKeyword'],
|
|
56
|
-
['OTHERWISE DISPLAY', 'Otherwise'],
|
|
57
|
-
]);
|
|
58
|
-
|
|
59
|
-
// The token the lexer makes of each word of the format options after the pipe of an expression block.
|
|
60
|
-
export const formatTokens = new Map([
|
|
61
|
-
['long', 'FormatLong'],
|
|
62
|
-
['medium', 'FormatMedium'],
|
|
63
|
-
['no-formatting', 'FormatNoFormatting'],
|
|
64
|
-
['no-unit', 'FormatNoUnit'],
|
|
65
|
-
['short', 'FormatShort'],
|
|
66
|
-
]);
|
|
67
|
-
|
|
68
|
-
// The token the lexer makes of each word it reserves in an expression.
|
|
69
|
-
export const expressionTokens = new Map([
|
|
70
|
-
['ALWAYS', 'Always'],
|
|
71
|
-
['ANY', 'Any'],
|
|
72
|
-
['API', 'Api'],
|
|
73
|
-
['AS', 'As'],
|
|
74
|
-
['ASSERT', 'Assert'],
|
|
75
|
-
['AT', 'AT'],
|
|
76
|
-
['BY', 'By'],
|
|
77
|
-
['CALL', 'Call'],
|
|
78
|
-
['COMPUTE', 'Compute'],
|
|
79
|
-
['DISPLAY', 'Display'],
|
|
80
|
-
['ENDPOINT', 'Endpoint'],
|
|
81
|
-
['ERROR', 'Error'],
|
|
82
|
-
['EVERY', 'EVERY'],
|
|
83
|
-
['FALSE', 'False'],
|
|
84
|
-
['FOR', 'FOR'],
|
|
85
|
-
['IN', 'IN'],
|
|
86
|
-
['INDEX', 'Index'],
|
|
87
|
-
['INFO', 'Info'],
|
|
88
|
-
['INVOKE', 'Invoke'],
|
|
89
|
-
['NEVER', 'Never'],
|
|
90
|
-
['ON', 'On'],
|
|
91
|
-
['OTHERWISE', 'Otherwise'],
|
|
92
|
-
['REJECT', 'Reject'],
|
|
93
|
-
['REPORT', 'Report'],
|
|
94
|
-
['SCOPE', 'Scope'],
|
|
95
|
-
['SELECT', 'Select'],
|
|
96
|
-
['TRUE', 'True'],
|
|
97
|
-
['WARN', 'Warn'],
|
|
98
|
-
['WARNING', 'Warning'],
|
|
99
|
-
['WHEN', 'When'],
|
|
100
|
-
['WITH', 'With'],
|
|
101
|
-
['absolute', 'AbsoluteFunction'],
|
|
102
|
-
['add-duration', 'AddDurationFunction'],
|
|
103
|
-
['and', 'And'],
|
|
104
|
-
['at', 'At'],
|
|
105
|
-
['average', 'AverageFunction'],
|
|
106
|
-
['capitalize-first', 'CapitalizeFirstFunction'],
|
|
107
|
-
['code', 'Code'],
|
|
108
|
-
['codelist', 'Codelist'],
|
|
109
|
-
['concat', 'ConcatFunction'],
|
|
110
|
-
['contains', 'ContainsFunction'],
|
|
111
|
-
['context', 'ContextType'],
|
|
112
|
-
['count', 'CountFunction'],
|
|
113
|
-
['count-duplicates', 'CountDuplicatesFunction'],
|
|
114
|
-
['current-date', 'CurrentDateFunction'],
|
|
115
|
-
['current-time', 'CurrentTimeFunction'],
|
|
116
|
-
['date', 'Date'],
|
|
117
|
-
['day', 'DayFunction'],
|
|
118
|
-
['day-time-duration', 'DayTimeDurationFunction'],
|
|
119
|
-
['days', 'DaysFunction'],
|
|
120
|
-
['distinct', 'Distinct'],
|
|
121
|
-
['distinct-values', 'DistinctValuesFunction'],
|
|
122
|
-
['duplicates', 'Duplicates'],
|
|
123
|
-
['duration', 'Duration'],
|
|
124
|
-
['dynamic', 'Dynamic'],
|
|
125
|
-
['else', 'Else'],
|
|
126
|
-
['empty', 'Empty'],
|
|
127
|
-
['ends-with', 'EndsWithFunction'],
|
|
128
|
-
['every', 'Every'],
|
|
129
|
-
['for', 'For'],
|
|
130
|
-
['format-long', 'FormatLongFunction'],
|
|
131
|
-
['format-medium', 'FormatMediumFunction'],
|
|
132
|
-
['format-number', 'FormatNumberFunction'],
|
|
133
|
-
['format-short', 'FormatShortFunction'],
|
|
134
|
-
['get-duplicates', 'GetDuplicatesFunction'],
|
|
135
|
-
['has', 'Has'],
|
|
136
|
-
['hours', 'HoursFunction'],
|
|
137
|
-
['if', 'If'],
|
|
138
|
-
['in', 'In'],
|
|
139
|
-
['index-of', 'IndexOfFunction'],
|
|
140
|
-
['index-of-substring', 'IndexOfSubstringFunction'],
|
|
141
|
-
['indicator', 'Indicator'],
|
|
142
|
-
['is', 'Is'],
|
|
143
|
-
['isDisclosed', 'IsDisclosed'],
|
|
144
|
-
['isMasked', 'IsMasked'],
|
|
145
|
-
['isWithheld', 'IsWithheld'],
|
|
146
|
-
['isWithholdable', 'IsWithholdable'],
|
|
147
|
-
['justificationCode', 'JustificationCode'],
|
|
148
|
-
['justificationDescription', 'JustificationDescription'],
|
|
149
|
-
['like', 'Like'],
|
|
150
|
-
['lower-case', 'LowerCaseFunction'],
|
|
151
|
-
['max', 'MaxFunction'],
|
|
152
|
-
['min', 'MinFunction'],
|
|
153
|
-
['minutes', 'MinutesFunction'],
|
|
154
|
-
['month', 'MonthFunction'],
|
|
155
|
-
['months', 'MonthsFunction'],
|
|
156
|
-
['no', 'No'],
|
|
157
|
-
['normalize-space', 'NormalizeSpaceFunction'],
|
|
158
|
-
['not', 'Not'],
|
|
159
|
-
['number', 'Number'],
|
|
160
|
-
['or', 'Or'],
|
|
161
|
-
['pad-left', 'PadLeftFunction'],
|
|
162
|
-
['pad-right', 'PadRightFunction'],
|
|
163
|
-
['preferred-language', 'PreferredLanguageFunction'],
|
|
164
|
-
['preferred-language-text', 'PreferredLanguageTextFunction'],
|
|
165
|
-
['preferredLanguage', 'PreferredLanguage'],
|
|
166
|
-
['preferredLanguageText', 'PreferredLanguageText'],
|
|
167
|
-
['present', 'Present'],
|
|
168
|
-
['privacyCode', 'PrivacyCode'],
|
|
169
|
-
['publicationDate', 'PublicationDate'],
|
|
170
|
-
['rawValue', 'RawValue'],
|
|
171
|
-
['repeat', 'RepeatFunction'],
|
|
172
|
-
['replace', 'ReplaceFunction'],
|
|
173
|
-
['replace-regex', 'ReplaceRegexFunction'],
|
|
174
|
-
['return', 'Return'],
|
|
175
|
-
['reverse', 'ReverseFunction'],
|
|
176
|
-
['round', 'RoundFunction'],
|
|
177
|
-
['round-down', 'RoundDownFunction'],
|
|
178
|
-
['round-up', 'RoundUpFunction'],
|
|
179
|
-
['satisfies', 'Satisfies'],
|
|
180
|
-
['seconds', 'SecondsFunction'],
|
|
181
|
-
['sequence-equal', 'SequenceEqualFunction'],
|
|
182
|
-
['some', 'Some'],
|
|
183
|
-
['sort', 'SortFunction'],
|
|
184
|
-
['split', 'SplitFunction'],
|
|
185
|
-
['starts-with', 'StartsWithFunction'],
|
|
186
|
-
['string', 'Text'],
|
|
187
|
-
['string-join', 'StringJoinFunction'],
|
|
188
|
-
['string-length', 'StringLengthFunction'],
|
|
189
|
-
['subsequence', 'SubsequenceFunction'],
|
|
190
|
-
['substring', 'SubstringFunction'],
|
|
191
|
-
['substring-after', 'SubstringAfterFunction'],
|
|
192
|
-
['substring-before', 'SubstringBeforeFunction'],
|
|
193
|
-
['subtract-duration', 'SubtractDurationFunction'],
|
|
194
|
-
['sum', 'SumFunction'],
|
|
195
|
-
['template', 'Template'],
|
|
196
|
-
['text', 'Text'],
|
|
197
|
-
['then', 'Then'],
|
|
198
|
-
['time', 'Time'],
|
|
199
|
-
['trim', 'TrimFunction'],
|
|
200
|
-
['trim-left', 'TrimLeftFunction'],
|
|
201
|
-
['trim-right', 'TrimRightFunction'],
|
|
202
|
-
['unique', 'Unique'],
|
|
203
|
-
['upper-case', 'UpperCaseFunction'],
|
|
204
|
-
['url-encode', 'UrlEncodeFunction'],
|
|
205
|
-
['value-except', 'ValueExceptFunction'],
|
|
206
|
-
['value-intersect', 'ValueIntersectFunction'],
|
|
207
|
-
['value-union', 'ValueUnionFunction'],
|
|
208
|
-
['wasWithheld', 'WasWithheld'],
|
|
209
|
-
['year', 'YearFunction'],
|
|
210
|
-
['year-month-duration', 'YearMonthDurationFunction'],
|
|
211
|
-
['years', 'YearsFunction'],
|
|
212
|
-
['OTHERWISE ASSERT', 'OtherwiseAssert'],
|
|
213
|
-
['OTHERWISE DISPLAY', 'Otherwise'],
|
|
214
|
-
['OTHERWISE REPORT', 'OtherwiseReport'],
|
|
215
|
-
]);
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
// EXPRESSION mode, and every place the other modes do not claim. All whitespace, line ends and
|
|
2
|
-
// comments are hidden (WS, ExpressionComment). A reserved word is its token wherever the parser can
|
|
3
|
-
// take that token or a name, as the lexer reads it; any other word is the grammar's own Identifier.
|
|
4
|
-
// A `/` before an `@`, with only hidden text between, is the lexer's AttributeSlash.
|
|
5
|
-
|
|
6
|
-
import * as terms from '../efx-parser.terms.js';
|
|
7
|
-
import { expressionTokens } from '../generated/words.js';
|
|
8
|
-
import { LexerMode } from './LexerMode.js';
|
|
9
|
-
import { ReservedWords } from './ReservedWords.js';
|
|
10
|
-
|
|
11
|
-
export class ExpressionMode extends LexerMode {
|
|
12
|
-
static #words = new ReservedWords(expressionTokens);
|
|
13
|
-
|
|
14
|
-
/** Everywhere: the modes before it in LexerModes claim their places first. */
|
|
15
|
-
isActive() {
|
|
16
|
-
return true;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
hide(input) {
|
|
20
|
-
if (input.isComment(0)) {
|
|
21
|
-
return input.take(terms.Comment, input.commentLength(0));
|
|
22
|
-
}
|
|
23
|
-
return input.take(terms.space, input.whitespace(0));
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
read(input, stack) {
|
|
27
|
-
if (input.isSlash(0) && input.isAt(1 + input.hiddenLength(1))) {
|
|
28
|
-
input.accept(terms.AttributeSlash, 1);
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
if (input.isSemicolon(0)) {
|
|
32
|
-
input.accept(terms.Semicolon, 1);
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
const word = ExpressionMode.#words.wordAt(input, 0);
|
|
36
|
-
if (word !== undefined && (stack.canShift(word.token) || stack.canShift(terms.Identifier))) {
|
|
37
|
-
input.accept(word.token, word.length);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
words() {
|
|
42
|
-
return ExpressionMode.#words.entries();
|
|
43
|
-
}
|
|
44
|
-
}
|
package/dist/lexer/FormatMode.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
// FORMAT mode, the format options after the pipe of an expression block: blanks are hidden
|
|
2
|
-
// (FormatWhitespace), and a word is one of the format words.
|
|
3
|
-
|
|
4
|
-
import * as terms from '../efx-parser.terms.js';
|
|
5
|
-
import { formatTokens } from '../generated/words.js';
|
|
6
|
-
import { LexerMode } from './LexerMode.js';
|
|
7
|
-
import { ReservedWords } from './ReservedWords.js';
|
|
8
|
-
|
|
9
|
-
export class FormatMode extends LexerMode {
|
|
10
|
-
static #words = new ReservedWords(formatTokens);
|
|
11
|
-
|
|
12
|
-
/** Where the parser can take a number of decimals or `no-unit`. */
|
|
13
|
-
isActive(stack) {
|
|
14
|
-
return stack.canShift(terms.FormatDecimals) || stack.canShift(terms.FormatNoUnit);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
hide(input) {
|
|
18
|
-
return input.take(terms.space, input.blanks(0));
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
read(input) {
|
|
22
|
-
const word = FormatMode.#words.wordAt(input, 0);
|
|
23
|
-
if (word !== undefined) {
|
|
24
|
-
input.accept(word.token, word.length);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
words() {
|
|
29
|
-
return FormatMode.#words.entries();
|
|
30
|
-
}
|
|
31
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// IDENTIFIER mode, after `$`, `@`, `#`, `?` or `...`: the name that follows, never a reserved word,
|
|
2
|
-
// is the grammar's own UnquotedIdentifier. Nothing is hidden.
|
|
3
|
-
|
|
4
|
-
import * as terms from '../efx-parser.terms.js';
|
|
5
|
-
import { LexerMode } from './LexerMode.js';
|
|
6
|
-
|
|
7
|
-
export class IdentifierMode extends LexerMode {
|
|
8
|
-
/** Where the parser can take the name after a prefix. */
|
|
9
|
-
isActive(stack) {
|
|
10
|
-
return stack.canShift(terms.UnquotedIdentifier);
|
|
11
|
-
}
|
|
12
|
-
}
|
package/dist/lexer/LabelMode.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// LABEL mode, in a label block: nothing is hidden. A word is an asset type, a label type or another
|
|
2
|
-
// asset id, OtherAssetId: [a-z]+ ([-.] [a-z0-9]+)*, the longest match, which the lexer lists after
|
|
3
|
-
// the two types.
|
|
4
|
-
|
|
5
|
-
import * as terms from '../efx-parser.terms.js';
|
|
6
|
-
import { assetTypes, labelTypes } from '../generated/words.js';
|
|
7
|
-
import { LexerMode } from './LexerMode.js';
|
|
8
|
-
|
|
9
|
-
const LABEL_TOKENS = [terms.AssetType, terms.LabelType, terms.OtherAssetId];
|
|
10
|
-
|
|
11
|
-
export class LabelMode extends LexerMode {
|
|
12
|
-
/** Where the parser can take an asset type, a label type or an asset id. */
|
|
13
|
-
isActive(stack) {
|
|
14
|
-
return LABEL_TOKENS.some((token) => stack.canShift(token));
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
read(input) {
|
|
18
|
-
const length = input.assetIdLength();
|
|
19
|
-
const word = input.text(0, length);
|
|
20
|
-
const token = assetTypes.has(word) ? terms.AssetType : labelTypes.has(word) ? terms.LabelType : terms.OtherAssetId;
|
|
21
|
-
input.take(token, length);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
words() {
|
|
25
|
-
return [...[...assetTypes].map((word) => [word, terms.AssetType]), ...[...labelTypes].map((word) => [word, terms.LabelType])];
|
|
26
|
-
}
|
|
27
|
-
}
|