advanced-poe-filter-parser 0.2.7 → 0.3.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/.git_consistent +2 -2
- package/.github/workflows/main.yml +32 -0
- package/.node-version +1 -1
- package/README.md +81 -4
- package/lib/{parser.js → parser.mjs} +740 -654
- package/package.json +18 -17
- package/src/advanced-poe-filter.pegjs +4 -0
- package/test/parser.test.js +51 -29
- package/.travis.yml +0 -11
- package/README.adoc +0 -94
- package/ava.config.js +0 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "advanced-poe-filter-parser",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"path-of-exile",
|
|
6
6
|
"filter-of-kalandra",
|
|
@@ -8,32 +8,33 @@
|
|
|
8
8
|
],
|
|
9
9
|
"homepage": "https://github.com/isuke/advanced-poe-filter-parser",
|
|
10
10
|
"repository": "git@github.com:isuke/advanced-poe-filter-parser.git",
|
|
11
|
-
"main": "lib/parser.
|
|
11
|
+
"main": "lib/parser.mjs",
|
|
12
12
|
"author": "isuke <isuke770@gmail.com>",
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"private": false,
|
|
15
|
+
"type": "module",
|
|
15
16
|
"scripts": {
|
|
16
17
|
"lint": "eslint ./*.js test/**/*.js",
|
|
17
18
|
"fix": "eslint --fix ./*.js test/**/*.js",
|
|
18
19
|
"test": "ava --verbose",
|
|
19
|
-
"build": "pegjs --format=es -o lib/parser.
|
|
20
|
-
"predeploy": "
|
|
21
|
-
"deploy": "
|
|
20
|
+
"build": "pegjs --format=es -o lib/parser.mjs src/advanced-poe-filter.pegjs",
|
|
21
|
+
"predeploy": "npm run build",
|
|
22
|
+
"deploy": "npm publish"
|
|
22
23
|
},
|
|
23
24
|
"dependencies": {},
|
|
24
25
|
"devDependencies": {
|
|
25
|
-
"@babel/cli": "7.
|
|
26
|
-
"@babel/core": "7.
|
|
27
|
-
"@babel/preset-env": "7.
|
|
28
|
-
"ava": "
|
|
29
|
-
"eslint": "
|
|
30
|
-
"eslint-config-prettier": "
|
|
31
|
-
"eslint-plugin-prettier": "
|
|
32
|
-
"outdent": "0.
|
|
26
|
+
"@babel/cli": "7.19.3",
|
|
27
|
+
"@babel/core": "7.19.6",
|
|
28
|
+
"@babel/preset-env": "7.19.4",
|
|
29
|
+
"ava": "5.0.1",
|
|
30
|
+
"eslint": "8.26.0",
|
|
31
|
+
"eslint-config-prettier": "8.5.0",
|
|
32
|
+
"eslint-plugin-prettier": "4.2.1",
|
|
33
|
+
"outdent": "0.8.0",
|
|
33
34
|
"pegjs": "0.11.0-master.b7b87ea",
|
|
34
|
-
"prettier": "2.
|
|
35
|
-
"sinon": "
|
|
36
|
-
"webpack": "
|
|
37
|
-
"webpack-cli": "
|
|
35
|
+
"prettier": "2.7.1",
|
|
36
|
+
"sinon": "14.0.1",
|
|
37
|
+
"webpack": "5.74.0",
|
|
38
|
+
"webpack-cli": "4.10.00"
|
|
38
39
|
}
|
|
39
40
|
}
|
|
@@ -115,6 +115,7 @@ condition =
|
|
|
115
115
|
/ conditionCorruptedMods
|
|
116
116
|
/ conditionEnchantmentPassiveNum
|
|
117
117
|
/ conditionHasExplicitMod
|
|
118
|
+
/ conditionHasImplicitMod
|
|
118
119
|
/ conditionHasEaterOfWorldsImplicit
|
|
119
120
|
/ conditionHasSearingExarchImplicit
|
|
120
121
|
/ conditionAnyEnchantment
|
|
@@ -124,6 +125,7 @@ condition =
|
|
|
124
125
|
/ conditionAlternateQuality
|
|
125
126
|
/ conditionReplica
|
|
126
127
|
/ conditionArchnemesisMod
|
|
128
|
+
/ conditionHasCruciblePassiveTree
|
|
127
129
|
|
|
128
130
|
// Condition Attributes
|
|
129
131
|
conditionClass = attr:'Class' __ val:conditionValueArray { return { lineType: 'condition', attr, val} }
|
|
@@ -160,6 +162,7 @@ conditionWidth = attr:'Width' __ val:condition
|
|
|
160
162
|
conditionCorruptedMods = attr:'CorruptedMods' __ val:conditionValueNumber { return { lineType: 'condition', attr, val} }
|
|
161
163
|
conditionEnchantmentPassiveNum = attr:'EnchantmentPassiveNum' __ val:conditionValueNumber { return { lineType: 'condition', attr, val} }
|
|
162
164
|
conditionHasExplicitMod = attr:'HasExplicitMod' __ val:conditionValueNumericAndArray { return { lineType: 'condition', attr, val} }
|
|
165
|
+
conditionHasImplicitMod = attr:'HasImplicitMod' __ val:conditionValueBoolean { return { lineType: 'condition', attr, val} }
|
|
163
166
|
conditionHasEaterOfWorldsImplicit = attr:'HasEaterOfWorldsImplicit' __ val:conditionValueNumber { return { lineType: 'condition', attr, val} }
|
|
164
167
|
conditionHasSearingExarchImplicit = attr:'HasSearingExarchImplicit' __ val:conditionValueNumber { return { lineType: 'condition', attr, val} }
|
|
165
168
|
conditionAnyEnchantment = attr:'AnyEnchantment' __ val:conditionValueBoolean { return { lineType: 'condition', attr, val} }
|
|
@@ -169,6 +172,7 @@ conditionEnchantmentPassiveNode = attr:'EnchantmentPassiveNode' __ val:condition
|
|
|
169
172
|
conditionAlternateQuality = attr:'AlternateQuality' __ val:conditionValueBoolean { return { lineType: 'condition', attr, val} }
|
|
170
173
|
conditionReplica = attr:'Replica' __ val:conditionValueBoolean { return { lineType: 'condition', attr, val} }
|
|
171
174
|
conditionArchnemesisMod = attr:'ArchnemesisMod' __ val:conditionValueArray { return { lineType: 'condition', attr, val} }
|
|
175
|
+
conditionHasCruciblePassiveTree = attr:'HasCruciblePassiveTree' __ val:conditionValueBoolean { return { lineType: 'condition', attr, val} }
|
|
172
176
|
|
|
173
177
|
|
|
174
178
|
// Condition Values
|
package/test/parser.test.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import test from 'ava'
|
|
2
2
|
import outdent from 'outdent'
|
|
3
3
|
|
|
4
|
-
import { parse } from '../lib/parser'
|
|
4
|
+
import { parse } from '../lib/parser.mjs'
|
|
5
5
|
|
|
6
6
|
test('parse : blank and comment lines', (t) => {
|
|
7
7
|
const script = [
|
|
@@ -135,6 +135,7 @@ Show "Section1"
|
|
|
135
135
|
CorruptedMods >= 1
|
|
136
136
|
EnchantmentPassiveNum > 5
|
|
137
137
|
HasExplicitMod "Foo" "Bar"
|
|
138
|
+
HasImplicitMod True
|
|
138
139
|
HasEaterOfWorldsImplicit >= 4
|
|
139
140
|
HasSearingExarchImplicit >= 4
|
|
140
141
|
AnyEnchantment True
|
|
@@ -153,6 +154,7 @@ Show "Section1"
|
|
|
153
154
|
MinimapIcon 0 Red Circle
|
|
154
155
|
PlayEffect Red
|
|
155
156
|
ArchnemesisMod "Toxic"
|
|
157
|
+
HasCruciblePassiveTree True
|
|
156
158
|
Show "Section2"
|
|
157
159
|
Class "Life Flasks" "Mana Flasks" "Hybrid Flasks"
|
|
158
160
|
BaseType "Two-Toned Boots" "Spiked Gloves" "Gripped Gloves" "Fingerless Silk Gloves" "Bone Helmet"
|
|
@@ -234,15 +236,20 @@ Unset "Section6"
|
|
|
234
236
|
CorruptedMods: '>= 1',
|
|
235
237
|
EnchantmentPassiveNum: '> 5',
|
|
236
238
|
HasExplicitMod: { ope: '=', vals: ['Foo', 'Bar'] },
|
|
239
|
+
HasImplicitMod: true,
|
|
237
240
|
HasEaterOfWorldsImplicit: '>= 4',
|
|
238
241
|
HasSearingExarchImplicit: '>= 4',
|
|
239
242
|
AnyEnchantment: true,
|
|
240
243
|
HasEnchantment: { ope: '=', vals: ['Foo', 'Bar'] },
|
|
241
244
|
HasInfluence: { ope: '=', vals: ['Shaper', 'Elder'] },
|
|
242
|
-
EnchantmentPassiveNode: {
|
|
245
|
+
EnchantmentPassiveNode: {
|
|
246
|
+
ope: '=',
|
|
247
|
+
vals: ['Damage while you have a Herald', 'Projectile Damage'],
|
|
248
|
+
},
|
|
243
249
|
AlternateQuality: true,
|
|
244
250
|
Replica: true,
|
|
245
251
|
ArchnemesisMod: { ope: '=', vals: ['Toxic'] },
|
|
252
|
+
HasCruciblePassiveTree: true,
|
|
246
253
|
},
|
|
247
254
|
actions: {
|
|
248
255
|
SetBorderColor: { rgb: { r: 100, g: 101, b: 102 }, alpha: 255 },
|
|
@@ -263,9 +270,9 @@ Unset "Section6"
|
|
|
263
270
|
offset: 0,
|
|
264
271
|
},
|
|
265
272
|
end: {
|
|
266
|
-
line:
|
|
273
|
+
line: 56,
|
|
267
274
|
column: 1,
|
|
268
|
-
offset:
|
|
275
|
+
offset: 1600,
|
|
269
276
|
},
|
|
270
277
|
},
|
|
271
278
|
},
|
|
@@ -274,8 +281,14 @@ Unset "Section6"
|
|
|
274
281
|
name: 'Section2',
|
|
275
282
|
activity: 'Show',
|
|
276
283
|
conditions: {
|
|
277
|
-
Class: {
|
|
278
|
-
|
|
284
|
+
Class: {
|
|
285
|
+
ope: '=',
|
|
286
|
+
vals: ['Life Flasks', 'Mana Flasks', 'Hybrid Flasks'],
|
|
287
|
+
},
|
|
288
|
+
BaseType: {
|
|
289
|
+
ope: '=',
|
|
290
|
+
vals: ['Two-Toned Boots', 'Spiked Gloves', 'Gripped Gloves', 'Fingerless Silk Gloves', 'Bone Helmet'],
|
|
291
|
+
},
|
|
279
292
|
SocketGroup: 'W',
|
|
280
293
|
Rarity: 'Rare',
|
|
281
294
|
HasExplicitMod: { ope: '==', vals: ['Foo', 'Bar'] },
|
|
@@ -288,21 +301,24 @@ Unset "Section6"
|
|
|
288
301
|
SetBackgroundColor: { rgb: { r: 106, g: 107, b: 108 }, alpha: 202 },
|
|
289
302
|
PlayAlertSound: { id: '2', volume: undefined },
|
|
290
303
|
DisableDropSound: true,
|
|
291
|
-
CustomAlertSound: {
|
|
304
|
+
CustomAlertSound: {
|
|
305
|
+
filePath: 'C\\foobar\\sound.mp3',
|
|
306
|
+
volume: undefined,
|
|
307
|
+
},
|
|
292
308
|
MinimapIcon: { size: 'Medium', color: 'Red', shape: 'Circle' },
|
|
293
309
|
PlayEffect: { color: 'Blue', temp: true },
|
|
294
310
|
},
|
|
295
311
|
branches: [],
|
|
296
312
|
location: {
|
|
297
313
|
start: {
|
|
298
|
-
line:
|
|
314
|
+
line: 56,
|
|
299
315
|
column: 1,
|
|
300
|
-
offset:
|
|
316
|
+
offset: 1600,
|
|
301
317
|
},
|
|
302
318
|
end: {
|
|
303
|
-
line:
|
|
319
|
+
line: 72,
|
|
304
320
|
column: 1,
|
|
305
|
-
offset:
|
|
321
|
+
offset: 2263,
|
|
306
322
|
},
|
|
307
323
|
},
|
|
308
324
|
},
|
|
@@ -311,8 +327,14 @@ Unset "Section6"
|
|
|
311
327
|
name: 'Section3',
|
|
312
328
|
activity: 'Show',
|
|
313
329
|
conditions: {
|
|
314
|
-
HasExplicitMod: {
|
|
315
|
-
|
|
330
|
+
HasExplicitMod: {
|
|
331
|
+
numeric: { ope: '>=', val: 2 },
|
|
332
|
+
vals: ['Foo', 'Bar'],
|
|
333
|
+
},
|
|
334
|
+
HasEnchantment: {
|
|
335
|
+
numeric: { ope: '>=', val: 2 },
|
|
336
|
+
vals: ['Foo', 'Bar'],
|
|
337
|
+
},
|
|
316
338
|
HasInfluence: { ope: undefined, val: 'None' },
|
|
317
339
|
},
|
|
318
340
|
actions: {
|
|
@@ -325,14 +347,14 @@ Unset "Section6"
|
|
|
325
347
|
branches: [],
|
|
326
348
|
location: {
|
|
327
349
|
start: {
|
|
328
|
-
line:
|
|
350
|
+
line: 72,
|
|
329
351
|
column: 1,
|
|
330
|
-
offset:
|
|
352
|
+
offset: 2263,
|
|
331
353
|
},
|
|
332
354
|
end: {
|
|
333
|
-
line:
|
|
355
|
+
line: 81,
|
|
334
356
|
column: 1,
|
|
335
|
-
offset:
|
|
357
|
+
offset: 2574,
|
|
336
358
|
},
|
|
337
359
|
},
|
|
338
360
|
},
|
|
@@ -351,14 +373,14 @@ Unset "Section6"
|
|
|
351
373
|
branches: [],
|
|
352
374
|
location: {
|
|
353
375
|
start: {
|
|
354
|
-
line:
|
|
376
|
+
line: 81,
|
|
355
377
|
column: 1,
|
|
356
|
-
offset:
|
|
378
|
+
offset: 2574,
|
|
357
379
|
},
|
|
358
380
|
end: {
|
|
359
|
-
line:
|
|
381
|
+
line: 87,
|
|
360
382
|
column: 1,
|
|
361
|
-
offset:
|
|
383
|
+
offset: 2794,
|
|
362
384
|
},
|
|
363
385
|
},
|
|
364
386
|
},
|
|
@@ -375,14 +397,14 @@ Unset "Section6"
|
|
|
375
397
|
branches: [],
|
|
376
398
|
location: {
|
|
377
399
|
start: {
|
|
378
|
-
line:
|
|
400
|
+
line: 87,
|
|
379
401
|
column: 1,
|
|
380
|
-
offset:
|
|
402
|
+
offset: 2794,
|
|
381
403
|
},
|
|
382
404
|
end: {
|
|
383
|
-
line:
|
|
405
|
+
line: 91,
|
|
384
406
|
column: 1,
|
|
385
|
-
offset:
|
|
407
|
+
offset: 2936,
|
|
386
408
|
},
|
|
387
409
|
},
|
|
388
410
|
},
|
|
@@ -398,14 +420,14 @@ Unset "Section6"
|
|
|
398
420
|
branches: [],
|
|
399
421
|
location: {
|
|
400
422
|
start: {
|
|
401
|
-
line:
|
|
423
|
+
line: 91,
|
|
402
424
|
column: 1,
|
|
403
|
-
offset:
|
|
425
|
+
offset: 2936,
|
|
404
426
|
},
|
|
405
427
|
end: {
|
|
406
|
-
line:
|
|
428
|
+
line: 94,
|
|
407
429
|
column: 1,
|
|
408
|
-
offset:
|
|
430
|
+
offset: 3042,
|
|
409
431
|
},
|
|
410
432
|
},
|
|
411
433
|
},
|
package/.travis.yml
DELETED
package/README.adoc
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
:chapter-label:
|
|
2
|
-
:icons: font
|
|
3
|
-
:lang: en
|
|
4
|
-
:sectanchors:
|
|
5
|
-
:sectlinks:
|
|
6
|
-
:sectnums:
|
|
7
|
-
:sectnumlevels: 1
|
|
8
|
-
:source-highlighter: highlightjs
|
|
9
|
-
:toc: preamble
|
|
10
|
-
:toclevels: 1
|
|
11
|
-
|
|
12
|
-
= Advanced PoE Filter Parser image:https://img.shields.io/github/license/mashape/apistatus.svg["MIT", link="https://raw.githubusercontent.com/isuke/vscode-advanced-poe-filter/master/LICENSE"] image:https://travis-ci.org/isuke/advanced-poe-filter-parser.svg?branch=master["Build Status", link="https://travis-ci.org/isuke/advanced-poe-filter-parser"] image:https://img.shields.io/npm/v/advanced-poe-filter-parser.svg["npm",link="https://www.npmjs.com/package/advanced-poe-filter-parser"] image:https://img.shields.io/badge/git--consistent-friendly-brightgreen.svg["git-consistent friendly",link="https://github.com/isuke/git-consistent"]
|
|
13
|
-
|
|
14
|
-
Advanced PoE Filter is used by link:https://filter-of-kalandra.netlify.com/[Filter of Kalarandra].
|
|
15
|
-
|
|
16
|
-
== Usage
|
|
17
|
-
|
|
18
|
-
```js
|
|
19
|
-
import { parse, SyntaxError } from "advanced-poe-filter-parser"
|
|
20
|
-
|
|
21
|
-
const script = [
|
|
22
|
-
'Show "Map Section"'
|
|
23
|
-
' Class "Maps"'
|
|
24
|
-
' MapTier > 3'
|
|
25
|
-
' SetBorderColor 250 251 252'
|
|
26
|
-
' PlayAlertSound 1 300'
|
|
27
|
-
''
|
|
28
|
-
' Fork "Rarity"'
|
|
29
|
-
' Show "Rare"'
|
|
30
|
-
' Rarity Rare'
|
|
31
|
-
' SetBackgroundColor 255 0 0 100'
|
|
32
|
-
''
|
|
33
|
-
' Hide "Magic"'
|
|
34
|
-
' Rarity Magic'
|
|
35
|
-
''
|
|
36
|
-
].join('\n')
|
|
37
|
-
|
|
38
|
-
const object = parse(script)
|
|
39
|
-
// [
|
|
40
|
-
// {
|
|
41
|
-
// id: '0003',
|
|
42
|
-
// name: 'Map Section',
|
|
43
|
-
// activity: 'Show',
|
|
44
|
-
// conditions: {
|
|
45
|
-
// Class: { ope: '=', vals: ['Maps'] },
|
|
46
|
-
// MapTier: '> 3',
|
|
47
|
-
// },
|
|
48
|
-
// actions: {
|
|
49
|
-
// SetBorderColor: { rgb: { r: 250, g: 251, b: 252 }, alpha: 255 },
|
|
50
|
-
// PlayAlertSound: { id: '1', volume: 300 },
|
|
51
|
-
// },
|
|
52
|
-
// branches: [
|
|
53
|
-
// {
|
|
54
|
-
// name: 'Rarity',
|
|
55
|
-
// type: 'Fork',
|
|
56
|
-
// blocks: [
|
|
57
|
-
// {
|
|
58
|
-
// id: '0001',
|
|
59
|
-
// name: 'Rare',
|
|
60
|
-
// activity: 'Show',
|
|
61
|
-
// conditions: { Rarity: 'Rare' },
|
|
62
|
-
// actions: { SetBackgroundColor: { rgb: { r: 255, g: 0, b: 0 }, alpha: 100 } },
|
|
63
|
-
// branches: [],
|
|
64
|
-
// location: {
|
|
65
|
-
// start: { line: 8, column: 9, offset: 135 },
|
|
66
|
-
// end: { line: 12, column: 1, offset: 215 },
|
|
67
|
-
// },
|
|
68
|
-
// },
|
|
69
|
-
// {
|
|
70
|
-
// id: '0002',
|
|
71
|
-
// name: 'Magic',
|
|
72
|
-
// activity: 'Hide',
|
|
73
|
-
// conditions: { Rarity: 'Magic' },
|
|
74
|
-
// actions: {},
|
|
75
|
-
// branches: [],
|
|
76
|
-
// location: {
|
|
77
|
-
// start: { line: 12, column: 9, offset: 223 },
|
|
78
|
-
// end: { line: 14, column: 1, offset: 261 },
|
|
79
|
-
// },
|
|
80
|
-
// },
|
|
81
|
-
// ],
|
|
82
|
-
// location: {
|
|
83
|
-
// start: { line: 7, column: 5, offset: 113 },
|
|
84
|
-
// end: { line: 14, column: 1, offset: 261 },
|
|
85
|
-
// },
|
|
86
|
-
// },
|
|
87
|
-
// ],
|
|
88
|
-
// location: {
|
|
89
|
-
// start: { line: 1, column: 1, offset: 0 },
|
|
90
|
-
// end: { line: 14, column: 1, offset: 261 },
|
|
91
|
-
// },
|
|
92
|
-
// },
|
|
93
|
-
// ]
|
|
94
|
-
```
|
package/ava.config.js
DELETED