abl-tmlanguage 1.3.15 → 1.3.16

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/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ 1.3.16
2
+ ======
3
+
4
+ - 🐛 Addresses syntax highlighting - DO..WHILE loops with long conditions (vscode-abl/vscode-abl#401)
5
+ - ✨ Improve closing scope on DEFINE QUERY statement
6
+ - ✨ Improve termination of UNDO statement
7
+ - ✨ Dataset scoping improvements
8
+
1
9
  1.3.15
2
10
  ======
3
11
 
@@ -518,6 +518,9 @@
518
518
  {
519
519
  "include": "#event-un-subscribe"
520
520
  },
521
+ {
522
+ "include": "#dataset-name"
523
+ },
521
524
  {
522
525
  "include": "#buffer-name"
523
526
  },
@@ -1952,7 +1955,7 @@
1952
1955
  "name": "variable.other.abl"
1953
1956
  }
1954
1957
  },
1955
- "end": "(?i)\\b(?=\\.)\\b",
1958
+ "end": "(?i)(?=\\.\\s*)",
1956
1959
  "patterns": [
1957
1960
  {
1958
1961
  "match": "(?i)\\b(for|scrolling|(rcode-info(?:rmation|rmatio|rmati|rmat|rma|rm|r)?))\\b",
@@ -2132,6 +2135,17 @@
2132
2135
  }
2133
2136
  ]
2134
2137
  },
2138
+ "dataset-name": {
2139
+ "match": "(?i)\\s*(dataset)\\s+([a-zA-Z][a-zA-Z0-9_\\-]*)",
2140
+ "captures": {
2141
+ "1": {
2142
+ "name": "keyword.other.abl"
2143
+ },
2144
+ "2": {
2145
+ "name": "storage.data.dataset.abl"
2146
+ }
2147
+ }
2148
+ },
2135
2149
  "buffer-name": {
2136
2150
  "match": "(?i)\\b(buffer)\\s+([a-zA-Z][a-zA-Z0-9_\\-#$%]*(\\.[a-zA-Z][a-zA-Z0-9_\\-#$%]*)?)",
2137
2151
  "captures": {
@@ -2826,53 +2840,20 @@
2826
2840
  "name": "meta.block.abl",
2827
2841
  "patterns": [
2828
2842
  {
2829
- "include": "#comment"
2830
- },
2831
- {
2832
- "include": "#for-record"
2833
- },
2834
- {
2835
- "include": "#operator"
2836
- },
2837
- {
2838
- "include": "#from-to-by"
2839
- },
2840
- {
2841
- "include": "#while-expression"
2842
- },
2843
- {
2844
- "match": "(?i)\\b((transact(?:ion|io|i)?)|stop-after)\\b",
2843
+ "match": "(?i)\\b((transact(?:ion|io|i)?)|stop-after|and|or)\\b",
2845
2844
  "name": "keyword.other.abl"
2846
2845
  },
2847
2846
  {
2848
- "include": "#numeric"
2849
- },
2850
- {
2851
- "include": "#type-member-call"
2852
- },
2853
- {
2854
- "include": "#language-functions"
2855
- },
2856
- {
2857
- "include": "#abl-functions"
2847
+ "include": "#logical-expression"
2858
2848
  },
2859
2849
  {
2860
- "include": "#punctuation-comma"
2850
+ "include": "#while-expression"
2861
2851
  },
2862
2852
  {
2863
- "include": "#punctuation-colon"
2853
+ "include": "#for-record"
2864
2854
  },
2865
2855
  {
2866
2856
  "include": "#branch-options"
2867
- },
2868
- {
2869
- "include": "#keywords"
2870
- },
2871
- {
2872
- "include": "#expression"
2873
- },
2874
- {
2875
- "include": "#preprocessors"
2876
2857
  }
2877
2858
  ]
2878
2859
  },
@@ -3206,7 +3187,7 @@
3206
3187
  "name": "punctuation.separator.comma.abl"
3207
3188
  }
3208
3189
  },
3209
- "end": "(?=\\.|:)",
3190
+ "end": "(?=[\\.:](?![a-zA-Z0-9_\\-#$%]))",
3210
3191
  "patterns": [
3211
3192
  {
3212
3193
  "include": "#string"
@@ -3237,6 +3218,12 @@
3237
3218
  {
3238
3219
  "include": "#function-arguments"
3239
3220
  },
3221
+ {
3222
+ "include": "#function-arguments-no-parens"
3223
+ },
3224
+ {
3225
+ "include": "#parens"
3226
+ },
3240
3227
  {
3241
3228
  "include": "#expression"
3242
3229
  },
@@ -3280,20 +3267,10 @@
3280
3267
  "end": "(?i)(?=(transact(?:ion|io|i)?)|on|:|with)",
3281
3268
  "patterns": [
3282
3269
  {
3283
- "comment": "The comment scopes are included in the statements pattern, but the operator trumps these",
3284
- "include": "#comment"
3285
- },
3286
- {
3287
- "include": "#operator"
3288
- },
3289
- {
3290
- "include": "#property-call"
3270
+ "include": "#logical-expression"
3291
3271
  },
3292
3272
  {
3293
3273
  "include": "#branch-options"
3294
- },
3295
- {
3296
- "include": "#expression"
3297
3274
  }
3298
3275
  ]
3299
3276
  },
@@ -3320,7 +3297,7 @@
3320
3297
  }
3321
3298
  ]
3322
3299
  },
3323
- "if-then": {
3300
+ "X-if-then": {
3324
3301
  "begin": "(?i)\\b(if)\\b",
3325
3302
  "beginCaptures": {
3326
3303
  "1": {
@@ -3343,10 +3320,7 @@
3343
3320
  "include": "#function-arguments"
3344
3321
  },
3345
3322
  {
3346
- "include": "#property-call"
3347
- },
3348
- {
3349
- "include": "#static-object-property-call"
3323
+ "include": "#type-member-call"
3350
3324
  },
3351
3325
  {
3352
3326
  "include": "#db-dot-table-dot-field"
@@ -3375,6 +3349,71 @@
3375
3349
  ],
3376
3350
  "end": "(?i)\\b(?=then)\\b"
3377
3351
  },
3352
+ "if-then": {
3353
+ "begin": "(?i)\\b(if)\\b",
3354
+ "beginCaptures": {
3355
+ "1": {
3356
+ "name": "keyword.other.abl"
3357
+ }
3358
+ },
3359
+ "patterns": [
3360
+ {
3361
+ "include": "#logical-expression"
3362
+ }
3363
+ ],
3364
+ "end": "(?i)\\b(?=then)\\b"
3365
+ },
3366
+ "logical-expression": {
3367
+ "patterns": [
3368
+ {
3369
+ "match": "\\b([Aa][Nn][Dd]|[Oo][Rr])\\b",
3370
+ "captures": {
3371
+ "1": {
3372
+ "name": "keyword.other.abl"
3373
+ }
3374
+ }
3375
+ },
3376
+ {
3377
+ "include": "#parens"
3378
+ },
3379
+ {
3380
+ "include": "#function-arguments"
3381
+ },
3382
+ {
3383
+ "include": "#type-member-call"
3384
+ },
3385
+ {
3386
+ "include": "#db-dot-table-dot-field"
3387
+ },
3388
+ {
3389
+ "include": "#comment"
3390
+ },
3391
+ {
3392
+ "include": "#operator"
3393
+ },
3394
+ {
3395
+ "include": "#code-block"
3396
+ },
3397
+ {
3398
+ "include": "#handle-attributes"
3399
+ },
3400
+ {
3401
+ "include": "#preprocessors"
3402
+ },
3403
+ {
3404
+ "include": "#language-functions"
3405
+ },
3406
+ {
3407
+ "include": "#abl-functions"
3408
+ },
3409
+ {
3410
+ "include": "#abl-system-handles"
3411
+ },
3412
+ {
3413
+ "include": "#keywords"
3414
+ }
3415
+ ]
3416
+ },
3378
3417
  "function-arguments": {
3379
3418
  "name": "meta.function.arguments.abl",
3380
3419
  "comment": "Captures what's between ( and ) when calling a function, excluding the braces ",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "abl-tmlanguage",
3
- "version": "1.3.15",
3
+ "version": "1.3.16",
4
4
  "description": "TextMate grammar for Progress OpenEdge ABL Language",
5
5
  "main": "",
6
6
  "type": "commonjs",
@@ -16,3 +16,157 @@ describe('', () => {
16
16
  shared.itShouldMatchExpectedScopes(statement, expectedTokens);
17
17
  })
18
18
 
19
+ describe('', () => {
20
+ let statement = `do while
21
+ vFooId eq ?
22
+ or vFooId eq ""
23
+ or can-find(
24
+ first ttFoo
25
+ where ttFoo.FooId eq vFooId):
26
+
27
+ vFooId = guid.
28
+
29
+ end.`;
30
+ let expectedTokens = [
31
+ [
32
+ { "startIndex": 0, "endIndex": 2, "scopes": ["source.abl", "meta.block.abl", "keyword.other.abl"] }, // 'do'
33
+ { "startIndex": 2, "endIndex": 3, "scopes": ["source.abl", "meta.block.abl"] }, // ' '
34
+ { "startIndex": 3, "endIndex": 8, "scopes": ["source.abl", "meta.block.abl", "keyword.other.abl"] } // 'while'
35
+ ],
36
+ [
37
+ { "startIndex": 0, "endIndex": 4, "scopes": ["source.abl", "meta.block.abl"] }, // ' '
38
+ { "startIndex": 4, "endIndex": 10, "scopes": ["source.abl", "meta.block.abl", "variable.other.abl"] }, // 'vFooId'
39
+ { "startIndex": 10, "endIndex": 11, "scopes": ["source.abl", "meta.block.abl"] }, // ' '
40
+ { "startIndex": 11, "endIndex": 13, "scopes": ["source.abl", "meta.block.abl", "keyword.operator.source.abl"] }, // 'eq'
41
+ { "startIndex": 13, "endIndex": 14, "scopes": ["source.abl", "meta.block.abl"] }, // ' '
42
+ { "startIndex": 14, "endIndex": 15, "scopes": ["source.abl", "meta.block.abl", "constant.language.abl"] } // '?'
43
+ ],
44
+ [
45
+ { "startIndex": 0, "endIndex": 4, "scopes": ["source.abl", "meta.block.abl"] }, // ' '
46
+ { "startIndex": 4, "endIndex": 6, "scopes": ["source.abl", "meta.block.abl", "keyword.other.abl"] }, // 'or'
47
+ { "startIndex": 6, "endIndex": 7, "scopes": ["source.abl", "meta.block.abl"] }, // ' '
48
+ { "startIndex": 7, "endIndex": 13, "scopes": ["source.abl", "meta.block.abl", "variable.other.abl"] }, // 'vFooId'
49
+ { "startIndex": 13, "endIndex": 14, "scopes": ["source.abl", "meta.block.abl"] }, // ' '
50
+ { "startIndex": 14, "endIndex": 16, "scopes": ["source.abl", "meta.block.abl", "keyword.operator.source.abl"] }, // 'eq'
51
+ { "startIndex": 16, "endIndex": 17, "scopes": ["source.abl", "meta.block.abl"] }, // ' '
52
+ { "startIndex": 17, "endIndex": 18, "scopes": ["source.abl", "meta.block.abl", "string.double.complex.abl", "punctuation.definition.string.begin.abl"] }, // '"'
53
+ { "startIndex": 18, "endIndex": 19, "scopes": ["source.abl", "meta.block.abl", "string.double.complex.abl", "punctuation.definition.string.end.abl"] } // '"'
54
+ ],
55
+ [
56
+ { "startIndex": 0, "endIndex": 4, "scopes": ["source.abl", "meta.block.abl"] }, // ' '
57
+ { "startIndex": 4, "endIndex": 6, "scopes": ["source.abl", "meta.block.abl", "keyword.other.abl"] }, // 'or'
58
+ { "startIndex": 6, "endIndex": 7, "scopes": ["source.abl", "meta.block.abl"] }, // ' '
59
+ { "startIndex": 7, "endIndex": 15, "scopes": ["source.abl", "meta.block.abl", "support.function.abl"] }, // 'can-find'
60
+ { "startIndex": 15, "endIndex": 16, "scopes": ["source.abl", "meta.block.abl", "meta.brace.round.js"] } // '('
61
+ ],
62
+ [
63
+ { "startIndex": 0, "endIndex": 8, "scopes": ["source.abl", "meta.block.abl"] }, // ' '
64
+ { "startIndex": 8, "endIndex": 13, "scopes": ["source.abl", "meta.block.abl", "keyword.other.abl"] }, // 'first'
65
+ { "startIndex": 13, "endIndex": 14, "scopes": ["source.abl", "meta.block.abl"] }, // ' '
66
+ { "startIndex": 14, "endIndex": 19, "scopes": ["source.abl", "meta.block.abl", "storage.data.table.abl"] } // 'ttFoo'
67
+ ],
68
+ [
69
+ { "startIndex": 0, "endIndex": 12, "scopes": ["source.abl", "meta.block.abl"] }, // ' '
70
+ { "startIndex": 12, "endIndex": 17, "scopes": ["source.abl", "meta.block.abl", "keyword.other.abl"] }, // 'where'
71
+ { "startIndex": 17, "endIndex": 18, "scopes": ["source.abl", "meta.block.abl"] }, // ' '
72
+ { "startIndex": 18, "endIndex": 29, "scopes": ["source.abl", "meta.block.abl", "storage.data.table.abl"] }, // 'ttFoo.FooId'
73
+ { "startIndex": 29, "endIndex": 30, "scopes": ["source.abl", "meta.block.abl"] }, // ' '
74
+ { "startIndex": 30, "endIndex": 32, "scopes": ["source.abl", "meta.block.abl", "keyword.operator.source.abl"] }, // 'eq'
75
+ { "startIndex": 32, "endIndex": 33, "scopes": ["source.abl", "meta.block.abl"] }, // ' '
76
+ { "startIndex": 33, "endIndex": 39, "scopes": ["source.abl", "meta.block.abl", "variable.other.abl"] }, // 'vFooId'
77
+ { "startIndex": 39, "endIndex": 40, "scopes": ["source.abl", "meta.block.abl", "meta.brace.round.js"] }, // ')'
78
+ { "startIndex": 40, "endIndex": 41, "scopes": ["source.abl", "punctuation.terminator.abl"] } // ':'
79
+ ],
80
+ [
81
+ { "startIndex": 0, "endIndex": 1, "scopes": ["source.abl"] } // ''
82
+ ],
83
+ [
84
+ { "startIndex": 0, "endIndex": 4, "scopes": ["source.abl"] }, // ' '
85
+ { "startIndex": 4, "endIndex": 10, "scopes": ["source.abl", "variable.other.abl"] }, // 'vFooId'
86
+ { "startIndex": 10, "endIndex": 11, "scopes": ["source.abl"] }, // ' '
87
+ { "startIndex": 11, "endIndex": 12, "scopes": ["source.abl", "keyword.operator.source.abl"] }, // '='
88
+ { "startIndex": 12, "endIndex": 13, "scopes": ["source.abl"] }, // ' '
89
+ { "startIndex": 13, "endIndex": 17, "scopes": ["source.abl", "support.function.abl"] }, // 'guid'
90
+ { "startIndex": 17, "endIndex": 18, "scopes": ["source.abl", "punctuation.terminator.abl"] } // '.'
91
+ ],
92
+ [
93
+ { "startIndex": 0, "endIndex": 1, "scopes": ["source.abl"] } // ''
94
+ ],
95
+ [
96
+ { "startIndex": 0, "endIndex": 3, "scopes": ["source.abl", "keyword.other.abl"] }, // 'end'
97
+ { "startIndex": 3, "endIndex": 4, "scopes": ["source.abl", "punctuation.terminator.abl"] } // '.'
98
+ ]
99
+ ]
100
+ shared.itShouldMatchExpectedScopes(statement, expectedTokens);
101
+ })
102
+
103
+ describe('', () => {
104
+ let statement = `if oValidationMessages:IsEmpty() = false then
105
+ undo, throw new ImportValidationException("custname",
106
+ pbAccount.CustKey,
107
+ SalesforceObjectTypeEnum:Account:ToString(),
108
+ pbAccount.ObjectId,
109
+ oValidationMessages).`;
110
+ let expectedTokens = [
111
+ [
112
+ { "startIndex": 0, "endIndex": 2, "scopes": ["source.abl", "keyword.other.abl"] }, // 'if'
113
+ { "startIndex": 2, "endIndex": 3, "scopes": ["source.abl"] }, // ' '
114
+ { "startIndex": 3, "endIndex": 22, "scopes": ["source.abl", "variable.other.abl"] }, // 'oValidationMessages'
115
+ { "startIndex": 22, "endIndex": 23, "scopes": ["source.abl", "punctuation.separator.colon.abl"] }, // ':'
116
+ { "startIndex": 23, "endIndex": 30, "scopes": ["source.abl", "entity.name.function.abl"] }, // 'IsEmpty'
117
+ { "startIndex": 30, "endIndex": 31, "scopes": ["source.abl", "meta.brace.round.js"] }, // '('
118
+ { "startIndex": 31, "endIndex": 32, "scopes": ["source.abl", "meta.brace.round.js"] }, // ')'
119
+ { "startIndex": 32, "endIndex": 33, "scopes": ["source.abl"] }, // ' '
120
+ { "startIndex": 33, "endIndex": 34, "scopes": ["source.abl", "keyword.operator.source.abl"] }, // '='
121
+ { "startIndex": 34, "endIndex": 35, "scopes": ["source.abl"] }, // ' '
122
+ { "startIndex": 35, "endIndex": 40, "scopes": ["source.abl", "constant.language.abl"] }, // 'false'
123
+ { "startIndex": 40, "endIndex": 41, "scopes": ["source.abl"] }, // ' '
124
+ { "startIndex": 41, "endIndex": 45, "scopes": ["source.abl", "keyword.other.abl"] } // 'then'
125
+ ],
126
+ [
127
+ { "startIndex": 0, "endIndex": 4, "scopes": ["source.abl"] }, // ' '
128
+ { "startIndex": 4, "endIndex": 8, "scopes": ["source.abl", "keyword.other.abl"] }, // 'undo'
129
+ { "startIndex": 8, "endIndex": 9, "scopes": ["source.abl", "punctuation.separator.comma.abl"] }, // ','
130
+ { "startIndex": 9, "endIndex": 10, "scopes": ["source.abl"] }, // ' '
131
+ { "startIndex": 10, "endIndex": 15, "scopes": ["source.abl", "keyword.other.abl"] }, // 'throw'
132
+ { "startIndex": 15, "endIndex": 16, "scopes": ["source.abl"] }, // ' '
133
+ { "startIndex": 16, "endIndex": 19, "scopes": ["source.abl", "keyword.other.abl"] }, // 'new'
134
+ { "startIndex": 19, "endIndex": 20, "scopes": ["source.abl"] }, // ' '
135
+ { "startIndex": 20, "endIndex": 45, "scopes": ["source.abl", "entity.name.type.abl"] }, // 'ImportValidationException'
136
+ { "startIndex": 45, "endIndex": 46, "scopes": ["source.abl", "meta.function.arguments.abl", "meta.brace.round.js"] }, // '('
137
+ { "startIndex": 46, "endIndex": 47, "scopes": ["source.abl", "meta.function.arguments.abl", "string.double.complex.abl", "punctuation.definition.string.begin.abl"] }, // '"'
138
+ { "startIndex": 47, "endIndex": 55, "scopes": ["source.abl", "meta.function.arguments.abl", "string.double.complex.abl"] }, // 'custname'
139
+ { "startIndex": 55, "endIndex": 56, "scopes": ["source.abl", "meta.function.arguments.abl", "string.double.complex.abl", "punctuation.definition.string.end.abl"] }, // '"'
140
+ { "startIndex": 56, "endIndex": 57, "scopes": ["source.abl", "meta.function.arguments.abl", "punctuation.separator.comma.abl"] } // ','
141
+ ],
142
+ [
143
+ { "startIndex": 0, "endIndex": 48, "scopes": ["source.abl", "meta.function.arguments.abl"] }, // ' '
144
+ { "startIndex": 48, "endIndex": 65, "scopes": ["source.abl", "meta.function.arguments.abl", "storage.data.table.abl"] }, // 'pbAccount.CustKey'
145
+ { "startIndex": 65, "endIndex": 66, "scopes": ["source.abl", "meta.function.arguments.abl", "punctuation.separator.comma.abl"] } // ','
146
+ ],
147
+ [
148
+ { "startIndex": 0, "endIndex": 48, "scopes": ["source.abl", "meta.function.arguments.abl"] }, // ' '
149
+ { "startIndex": 48, "endIndex": 72, "scopes": ["source.abl", "meta.function.arguments.abl", "variable.other.abl"] }, // 'SalesforceObjectTypeEnum'
150
+ { "startIndex": 72, "endIndex": 73, "scopes": ["source.abl", "meta.function.arguments.abl", "punctuation.separator.colon.abl"] }, // ':'
151
+ { "startIndex": 73, "endIndex": 80, "scopes": ["source.abl", "meta.function.arguments.abl", "entity.name.function.abl"] }, // 'Account'
152
+ { "startIndex": 80, "endIndex": 81, "scopes": ["source.abl", "meta.function.arguments.abl", "punctuation.separator.colon.abl"] }, // ':'
153
+ { "startIndex": 81, "endIndex": 89, "scopes": ["source.abl", "meta.function.arguments.abl", "entity.name.function.abl"] }, // 'ToString'
154
+ { "startIndex": 89, "endIndex": 90, "scopes": ["source.abl", "meta.function.arguments.abl", "meta.brace.round.js"] }, // '('
155
+ { "startIndex": 90, "endIndex": 91, "scopes": ["source.abl", "meta.brace.round.js"] }, // ')'
156
+ { "startIndex": 91, "endIndex": 92, "scopes": ["source.abl", "punctuation.separator.comma.abl"] } // ','
157
+ ],
158
+ [
159
+ { "startIndex": 0, "endIndex": 48, "scopes": ["source.abl"] }, // ' '
160
+ { "startIndex": 48, "endIndex": 66, "scopes": ["source.abl", "storage.data.table.abl"] }, // 'pbAccount.ObjectId'
161
+ { "startIndex": 66, "endIndex": 67, "scopes": ["source.abl", "punctuation.separator.comma.abl"] } // ','
162
+ ],
163
+ [
164
+ { "startIndex": 0, "endIndex": 48, "scopes": ["source.abl"] }, // ' '
165
+ { "startIndex": 48, "endIndex": 67, "scopes": ["source.abl", "variable.other.abl"] }, // 'oValidationMessages'
166
+ { "startIndex": 67, "endIndex": 68, "scopes": ["source.abl", "meta.brace.round.js"] }, // ')'
167
+ { "startIndex": 68, "endIndex": 69, "scopes": ["source.abl", "punctuation.terminator.abl"] } // '.'
168
+ ]
169
+ ]
170
+ shared.itShouldMatchExpectedScopes(statement, expectedTokens);
171
+ })
172
+
@@ -99,3 +99,46 @@ describe('', () => {
99
99
  ];
100
100
  shared.itShouldMatchExpectedScopes(statement, expectedTokens);
101
101
  })
102
+
103
+ describe('', () => {
104
+ // Note space before .
105
+ let statement = `DEFINE QUERY qQuery FOR SmartAttributeValue, SmartAttribute .`;
106
+ let expectedTokens = [
107
+ { "startIndex": 0, "endIndex": 6, "scopes": ["source.abl", "meta.define.abl", "keyword.other.abl"] }, // 'DEFINE'
108
+ { "startIndex": 6, "endIndex": 7, "scopes": ["source.abl", "meta.define.abl"] }, // ' '
109
+ { "startIndex": 7, "endIndex": 12, "scopes": ["source.abl", "meta.define.abl", "keyword.other.abl"] }, // 'QUERY'
110
+ { "startIndex": 12, "endIndex": 13, "scopes": ["source.abl", "meta.define.abl"] }, // ' '
111
+ { "startIndex": 13, "endIndex": 19, "scopes": ["source.abl", "meta.define.abl", "variable.other.abl"] }, // 'qQuery'
112
+ { "startIndex": 19, "endIndex": 20, "scopes": ["source.abl", "meta.define.abl"] }, // ' '
113
+ { "startIndex": 20, "endIndex": 23, "scopes": ["source.abl", "meta.define.abl", "keyword.other.abl"] }, // 'FOR'
114
+ { "startIndex": 23, "endIndex": 24, "scopes": ["source.abl", "meta.define.abl"] }, // ' '
115
+ { "startIndex": 24, "endIndex": 43, "scopes": ["source.abl", "meta.define.abl", "storage.data.table.abl"] }, // 'SmartAttributeValue'
116
+ { "startIndex": 43, "endIndex": 44, "scopes": ["source.abl", "meta.define.abl", "punctuation.separator.comma.abl"] }, // ','
117
+ { "startIndex": 44, "endIndex": 45, "scopes": ["source.abl", "meta.define.abl"] }, // ' '
118
+ { "startIndex": 45, "endIndex": 59, "scopes": ["source.abl", "meta.define.abl", "storage.data.table.abl"] }, // 'SmartAttribute'
119
+ { "startIndex": 59, "endIndex": 60, "scopes": ["source.abl", "meta.define.abl"] }, // ' '
120
+ { "startIndex": 60, "endIndex": 61, "scopes": ["source.abl", "meta.define.abl", "punctuation.terminator.abl"] } // '.'
121
+ ];
122
+ shared.itShouldMatchExpectedScopes(statement, expectedTokens);
123
+ })
124
+
125
+ describe('', () => {
126
+ // Note NO space before .
127
+ let statement = `DEFINE QUERY qQuery FOR SmartAttributeValue, SmartAttribute.`;
128
+ let expectedTokens = [
129
+ { "startIndex": 0, "endIndex": 6, "scopes": ["source.abl", "meta.define.abl", "keyword.other.abl"] }, // 'DEFINE'
130
+ { "startIndex": 6, "endIndex": 7, "scopes": ["source.abl", "meta.define.abl"] }, // ' '
131
+ { "startIndex": 7, "endIndex": 12, "scopes": ["source.abl", "meta.define.abl", "keyword.other.abl"] }, // 'QUERY'
132
+ { "startIndex": 12, "endIndex": 13, "scopes": ["source.abl", "meta.define.abl"] }, // ' '
133
+ { "startIndex": 13, "endIndex": 19, "scopes": ["source.abl", "meta.define.abl", "variable.other.abl"] }, // 'qQuery'
134
+ { "startIndex": 19, "endIndex": 20, "scopes": ["source.abl", "meta.define.abl"] }, // ' '
135
+ { "startIndex": 20, "endIndex": 23, "scopes": ["source.abl", "meta.define.abl", "keyword.other.abl"] }, // 'FOR'
136
+ { "startIndex": 23, "endIndex": 24, "scopes": ["source.abl", "meta.define.abl"] }, // ' '
137
+ { "startIndex": 24, "endIndex": 43, "scopes": ["source.abl", "meta.define.abl", "storage.data.table.abl"] }, // 'SmartAttributeValue'
138
+ { "startIndex": 43, "endIndex": 44, "scopes": ["source.abl", "meta.define.abl", "punctuation.separator.comma.abl"] }, // ','
139
+ { "startIndex": 44, "endIndex": 45, "scopes": ["source.abl", "meta.define.abl"] }, // ' '
140
+ { "startIndex": 45, "endIndex": 59, "scopes": ["source.abl", "meta.define.abl", "storage.data.table.abl"] }, // 'SmartAttribute'
141
+ { "startIndex": 59, "endIndex": 60, "scopes": ["source.abl", "meta.define.abl", "punctuation.terminator.abl"] } // '.'
142
+ ];
143
+ shared.itShouldMatchExpectedScopes(statement, expectedTokens);
144
+ })
@@ -197,7 +197,7 @@ end.`;
197
197
  { "startIndex": 8, "endIndex": 9, "scopes": ["source.abl", "meta.block.abl", "constant.numeric.source.abl"] }, // '1'
198
198
  { "startIndex": 9, "endIndex": 10, "scopes": ["source.abl", "meta.block.abl"] }, // ' '
199
199
  { "startIndex": 10, "endIndex": 12, "scopes": ["source.abl", "meta.block.abl", "keyword.other.abl"] }, // 'to'
200
- { "startIndex": 12, "endIndex": 13, "scopes": ["source.abl", "meta.block.abl"] }, // ' '
200
+ { "startIndex": 12, "endIndex": 13, "scopes": ["source.abl", "meta.block.abl", "meta.function-call.abl"] }, // ' '
201
201
  { "startIndex": 13, "endIndex": 24, "scopes": ["source.abl", "meta.block.abl", "meta.function-call.abl", "support.function.abl"] }, // 'num-entries'
202
202
  { "startIndex": 24, "endIndex": 25, "scopes": ["source.abl", "meta.block.abl", "meta.function-call.abl", "meta.function.arguments.abl", "meta.brace.round.js"] }, // '('
203
203
  { "startIndex": 25, "endIndex": 30, "scopes": ["source.abl", "meta.block.abl", "meta.function-call.abl", "meta.function.arguments.abl", "variable.other.abl"] }, // 'vList'
@@ -0,0 +1,53 @@
1
+ const { assert, expect } = require('chai');
2
+ const shared = require('../shared.js');
3
+
4
+ describe('', () => {
5
+ let statement = `dataset dsEmployee:apply-callback("BEFORE-FILL":U).
6
+ buffer eEmployee:apply-callback("BEFORE-FILL":U).
7
+ buffer eEmployee:apply-callback("BEFORE-ROW-FILL":U).`;
8
+ let expectedTokens = [
9
+ [
10
+ { "startIndex": 0, "endIndex": 7, "scopes": ["source.abl", "keyword.other.abl"] }, // 'dataset'
11
+ { "startIndex": 7, "endIndex": 8, "scopes": ["source.abl"] }, // ' '
12
+ { "startIndex": 8, "endIndex": 18, "scopes": ["source.abl", "storage.data.dataset.abl"] }, // 'dsEmployee'
13
+ { "startIndex": 18, "endIndex": 19, "scopes": ["source.abl", "punctuation.separator.colon.abl"] }, // ':'
14
+ { "startIndex": 19, "endIndex": 33, "scopes": ["source.abl", "entity.name.function.abl"] }, // 'apply-callback'
15
+ { "startIndex": 33, "endIndex": 34, "scopes": ["source.abl", "meta.function.arguments.abl", "meta.brace.round.js"] }, // '('
16
+ { "startIndex": 34, "endIndex": 35, "scopes": ["source.abl", "meta.function.arguments.abl", "string.double.complex.abl", "punctuation.definition.string.begin.abl"] }, // '"'
17
+ { "startIndex": 35, "endIndex": 46, "scopes": ["source.abl", "meta.function.arguments.abl", "string.double.complex.abl"] }, // 'BEFORE-FILL'
18
+ { "startIndex": 46, "endIndex": 47, "scopes": ["source.abl", "meta.function.arguments.abl", "string.double.complex.abl", "punctuation.definition.string.end.abl"] }, // '"'
19
+ { "startIndex": 47, "endIndex": 49, "scopes": ["source.abl", "meta.function.arguments.abl", "string.double.complex.abl", "support.other.abl"] }, // ':U'
20
+ { "startIndex": 49, "endIndex": 50, "scopes": ["source.abl", "meta.brace.round.js"] }, // ')'
21
+ { "startIndex": 50, "endIndex": 51, "scopes": ["source.abl", "punctuation.terminator.abl"] } // '.'
22
+ ],
23
+ [
24
+ { "startIndex": 0, "endIndex": 6, "scopes": ["source.abl", "keyword.other.abl"] }, // 'buffer'
25
+ { "startIndex": 6, "endIndex": 7, "scopes": ["source.abl"] }, // ' '
26
+ { "startIndex": 7, "endIndex": 16, "scopes": ["source.abl", "storage.data.table.abl"] }, // 'eEmployee'
27
+ { "startIndex": 16, "endIndex": 17, "scopes": ["source.abl", "punctuation.separator.colon.abl"] }, // ':'
28
+ { "startIndex": 17, "endIndex": 31, "scopes": ["source.abl", "entity.name.function.abl"] }, // 'apply-callback'
29
+ { "startIndex": 31, "endIndex": 32, "scopes": ["source.abl", "meta.function.arguments.abl", "meta.brace.round.js"] }, // '('
30
+ { "startIndex": 32, "endIndex": 33, "scopes": ["source.abl", "meta.function.arguments.abl", "string.double.complex.abl", "punctuation.definition.string.begin.abl"] }, // '"'
31
+ { "startIndex": 33, "endIndex": 44, "scopes": ["source.abl", "meta.function.arguments.abl", "string.double.complex.abl"] }, // 'BEFORE-FILL'
32
+ { "startIndex": 44, "endIndex": 45, "scopes": ["source.abl", "meta.function.arguments.abl", "string.double.complex.abl", "punctuation.definition.string.end.abl"] }, // '"'
33
+ { "startIndex": 45, "endIndex": 47, "scopes": ["source.abl", "meta.function.arguments.abl", "string.double.complex.abl", "support.other.abl"] }, // ':U'
34
+ { "startIndex": 47, "endIndex": 48, "scopes": ["source.abl", "meta.brace.round.js"] }, // ')'
35
+ { "startIndex": 48, "endIndex": 49, "scopes": ["source.abl", "punctuation.terminator.abl"] } // '.'
36
+ ],
37
+ [
38
+ { "startIndex": 0, "endIndex": 6, "scopes": ["source.abl", "keyword.other.abl"] }, // 'buffer'
39
+ { "startIndex": 6, "endIndex": 7, "scopes": ["source.abl"] }, // ' '
40
+ { "startIndex": 7, "endIndex": 16, "scopes": ["source.abl", "storage.data.table.abl"] }, // 'eEmployee'
41
+ { "startIndex": 16, "endIndex": 17, "scopes": ["source.abl", "punctuation.separator.colon.abl"] }, // ':'
42
+ { "startIndex": 17, "endIndex": 31, "scopes": ["source.abl", "entity.name.function.abl"] }, // 'apply-callback'
43
+ { "startIndex": 31, "endIndex": 32, "scopes": ["source.abl", "meta.function.arguments.abl", "meta.brace.round.js"] }, // '('
44
+ { "startIndex": 32, "endIndex": 33, "scopes": ["source.abl", "meta.function.arguments.abl", "string.double.complex.abl", "punctuation.definition.string.begin.abl"] }, // '"'
45
+ { "startIndex": 33, "endIndex": 48, "scopes": ["source.abl", "meta.function.arguments.abl", "string.double.complex.abl"] }, // 'BEFORE-ROW-FILL'
46
+ { "startIndex": 48, "endIndex": 49, "scopes": ["source.abl", "meta.function.arguments.abl", "string.double.complex.abl", "punctuation.definition.string.end.abl"] }, // '"'
47
+ { "startIndex": 49, "endIndex": 51, "scopes": ["source.abl", "meta.function.arguments.abl", "string.double.complex.abl", "support.other.abl"] }, // ':U'
48
+ { "startIndex": 51, "endIndex": 52, "scopes": ["source.abl", "meta.brace.round.js"] }, // ')'
49
+ { "startIndex": 52, "endIndex": 53, "scopes": ["source.abl", "punctuation.terminator.abl"] } // '.'
50
+ ]
51
+ ];
52
+ shared.itShouldMatchExpectedScopes(statement, expectedTokens);
53
+ })
@@ -31,7 +31,7 @@ END.`;
31
31
  { "startIndex": 10, "endIndex": 11, "scopes": ["source.abl", "meta.block.abl", "constant.numeric.source.abl"] }, // '1'
32
32
  { "startIndex": 11, "endIndex": 12, "scopes": ["source.abl", "meta.block.abl"] }, // ' '
33
33
  { "startIndex": 12, "endIndex": 14, "scopes": ["source.abl", "meta.block.abl", "keyword.other.abl"] }, // 'to'
34
- { "startIndex": 14, "endIndex": 15, "scopes": ["source.abl", "meta.block.abl"] }, // ' '
34
+ { "startIndex": 14, "endIndex": 15, "scopes": ["source.abl", "meta.block.abl", "meta.function-call.abl"] }, // ' '
35
35
  { "startIndex": 15, "endIndex": 26, "scopes": ["source.abl", "meta.block.abl", "meta.function-call.abl", "support.function.abl"] }, // 'NUM-ENTRIES'
36
36
  { "startIndex": 26, "endIndex": 27, "scopes": ["source.abl", "meta.block.abl", "meta.function-call.abl", "meta.function.arguments.abl", "meta.brace.round.js"] }, // '('
37
37
  { "startIndex": 27, "endIndex": 42, "scopes": ["source.abl", "meta.block.abl", "meta.function-call.abl", "meta.function.arguments.abl", "variable.other.abl"] }, // 'mc-g-list-class'
package/spec/shared.js CHANGED
@@ -43,7 +43,7 @@ module.exports = {
43
43
  let lines = statement.split(/\n/g);
44
44
  let nbLines = lines.length;
45
45
  if (nbLines === 1) {
46
- //singleline
46
+ //singleline
47
47
  tokenResult = grammar.tokenizeLine(statement);
48
48
 
49
49
  // More human-readable output
@@ -52,15 +52,13 @@ module.exports = {
52
52
  const token = tokenResult.tokens[j];
53
53
 
54
54
  // More human-readable output
55
- // console.log(` - token from ${token.startIndex} to ${token.endIndex} ` +
56
- // `(${statement.substring(token.startIndex, token.endIndex)}) ` +
57
- // `with scopes ${token.scopes.join(', ')}`
58
- // );
59
-
60
55
  // Formatted as input-values
61
56
  var O = token.scopes.map((e) => ('"' + e + '",')).join(' ').replace(/,\s*$/, "");
62
- console.log(`{ "startIndex": ${token.startIndex}, "endIndex": ${token.endIndex}, "scopes": [${O}] }, // '${statement.substring(token.startIndex, token.endIndex)}'`,);
63
-
57
+ if (j < tokenResult.tokens.length - 1 ) {
58
+ console.log(`{ "startIndex": ${token.startIndex}, "endIndex": ${token.endIndex}, "scopes": [${O}] }, // '${statement.substring(token.startIndex, token.endIndex)}'`,);
59
+ } else {
60
+ console.log(`{ "startIndex": ${token.startIndex}, "endIndex": ${token.endIndex}, "scopes": [${O}] } // '${statement.substring(token.startIndex, token.endIndex)}'`,);
61
+ }
64
62
  }
65
63
  } else {
66
64
  //multiline, we stack the tokens in an array
@@ -70,6 +68,7 @@ module.exports = {
70
68
  };
71
69
  lines.forEach(line => {
72
70
  let r = grammar.tokenizeLine(line, ruleStack);
71
+
73
72
  ruleStack = r.ruleStack;
74
73
  tokenResult.tokens.push(r.tokens);
75
74
 
@@ -87,12 +86,14 @@ module.exports = {
87
86
 
88
87
  // Formatted as input-values
89
88
  var O = token.scopes.map((e) => ('"' + e + '",')).join(' ').replace(/,\s*$/, "");
90
- console.log(`{ "startIndex": ${token.startIndex}, "endIndex": ${token.endIndex}, "scopes": [${O}] }, // '${line.substring(token.startIndex, token.endIndex)}'`,);
91
-
89
+ if (j < r.tokens.length - 1 ) {
90
+ console.log(`{ "startIndex": ${token.startIndex}, "endIndex": ${token.endIndex}, "scopes": [${O}] }, // '${line.substring(token.startIndex, token.endIndex)}'`,);
91
+ } else {
92
+ console.log(`{ "startIndex": ${token.startIndex}, "endIndex": ${token.endIndex}, "scopes": [${O}] } // '${line.substring(token.startIndex, token.endIndex)}'`,);
93
+ }
92
94
  }
93
95
  // Formatted as input-values
94
96
  console.log(`],`);
95
-
96
97
  });
97
98
  }
98
99
  assert.deepEqual(tokenResult.tokens, expectedTokens, JSON.stringify(tokenResult.tokens));
@@ -869,7 +869,7 @@ describe('', () => {
869
869
  { "startIndex": 71, "endIndex": 95, "scopes": ["source.abl", "meta.function.arguments.abl", "variable.other.abl"] }, // 'ClassNameNotEntertedEnum'
870
870
  { "startIndex": 95, "endIndex": 96, "scopes": ["source.abl", "meta.function.arguments.abl", "punctuation.separator.colon.abl"] }, // ':'
871
871
  { "startIndex": 96, "endIndex": 110, "scopes": ["source.abl", "meta.function.arguments.abl", "entity.name.function.abl"] }, // 'BusinessEntity'
872
- { "startIndex": 110, "endIndex": 111, "scopes": ["source.abl"] }, // ')'
872
+ { "startIndex": 110, "endIndex": 111, "scopes": ["source.abl", "meta.brace.round.js"] }, // ')'
873
873
  { "startIndex": 111, "endIndex": 112, "scopes": ["source.abl", "punctuation.terminator.abl"] } // '.'
874
874
  ]
875
875
  ];