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/.git_consistent
CHANGED
|
@@ -50,7 +50,7 @@ subject:
|
|
|
50
50
|
required: true
|
|
51
51
|
description: 'The subject contains succinct description of the change'
|
|
52
52
|
rules:
|
|
53
|
-
|
|
53
|
+
firstLetter: lower
|
|
54
54
|
dotAtEnd: false
|
|
55
55
|
nonAscii: false
|
|
56
56
|
issueKeyword:
|
|
@@ -75,6 +75,6 @@ body:
|
|
|
75
75
|
required: false
|
|
76
76
|
description: 'The body contains details of the change'
|
|
77
77
|
rules:
|
|
78
|
-
|
|
78
|
+
firstLetter: upper
|
|
79
79
|
dotAtEnd: true
|
|
80
80
|
nonAscii: false
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
name: Test and Lint
|
|
2
|
+
|
|
3
|
+
on: [push]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
test:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
|
|
9
|
+
strategy:
|
|
10
|
+
matrix:
|
|
11
|
+
node-version: [14.x, 16.x, 18.x]
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v3
|
|
15
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
16
|
+
uses: actions/setup-node@v3
|
|
17
|
+
with:
|
|
18
|
+
node-version: ${{ matrix.node-version }}
|
|
19
|
+
cache: 'npm'
|
|
20
|
+
- run: npm install
|
|
21
|
+
- run: npm run build
|
|
22
|
+
- run: npm run test
|
|
23
|
+
lint:
|
|
24
|
+
runs-on: ubuntu-latest
|
|
25
|
+
steps:
|
|
26
|
+
- uses: actions/checkout@v3
|
|
27
|
+
- uses: actions/setup-node@v3
|
|
28
|
+
with:
|
|
29
|
+
node-version: 18.x
|
|
30
|
+
cache: 'npm'
|
|
31
|
+
- run: npm install
|
|
32
|
+
- run: npm run lint
|
package/.node-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
16.18.0
|
package/README.md
CHANGED
|
@@ -1,6 +1,83 @@
|
|
|
1
|
-
# Advanced PoE Filter
|
|
1
|
+
# Advanced PoE Filter Parser [](https://github.com/isuke/advanced-poe-filter-parser/actions/workflows/main.yml) [](https://github.com/isuke/git-consistent) [](https://raw.githubusercontent.com/isuke/vscode-advanced-poe-filter/master/LICENSE) [](https://www.npmjs.com/package/advanced-poe-filter-parser)
|
|
2
2
|
|
|
3
|
-
[
|
|
3
|
+
Advanced PoE Filter is used by [Filter of Kalarandra](https://filter-of-kalandra.netlify.com/).
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
import { parse, SyntaxError } from "advanced-poe-filter-parser"
|
|
9
|
+
|
|
10
|
+
const script = [
|
|
11
|
+
'Show "Map Section"'
|
|
12
|
+
' Class "Maps"'
|
|
13
|
+
' MapTier > 3'
|
|
14
|
+
' SetBorderColor 250 251 252'
|
|
15
|
+
' PlayAlertSound 1 300'
|
|
16
|
+
''
|
|
17
|
+
' Fork "Rarity"'
|
|
18
|
+
' Show "Rare"'
|
|
19
|
+
' Rarity Rare'
|
|
20
|
+
' SetBackgroundColor 255 0 0 100'
|
|
21
|
+
''
|
|
22
|
+
' Hide "Magic"'
|
|
23
|
+
' Rarity Magic'
|
|
24
|
+
''
|
|
25
|
+
].join('\n')
|
|
26
|
+
|
|
27
|
+
const object = parse(script)
|
|
28
|
+
// [
|
|
29
|
+
// {
|
|
30
|
+
// id: '0003',
|
|
31
|
+
// name: 'Map Section',
|
|
32
|
+
// activity: 'Show',
|
|
33
|
+
// conditions: {
|
|
34
|
+
// Class: { ope: '=', vals: ['Maps'] },
|
|
35
|
+
// MapTier: '> 3',
|
|
36
|
+
// },
|
|
37
|
+
// actions: {
|
|
38
|
+
// SetBorderColor: { rgb: { r: 250, g: 251, b: 252 }, alpha: 255 },
|
|
39
|
+
// PlayAlertSound: { id: '1', volume: 300 },
|
|
40
|
+
// },
|
|
41
|
+
// branches: [
|
|
42
|
+
// {
|
|
43
|
+
// name: 'Rarity',
|
|
44
|
+
// type: 'Fork',
|
|
45
|
+
// blocks: [
|
|
46
|
+
// {
|
|
47
|
+
// id: '0001',
|
|
48
|
+
// name: 'Rare',
|
|
49
|
+
// activity: 'Show',
|
|
50
|
+
// conditions: { Rarity: 'Rare' },
|
|
51
|
+
// actions: { SetBackgroundColor: { rgb: { r: 255, g: 0, b: 0 }, alpha: 100 } },
|
|
52
|
+
// branches: [],
|
|
53
|
+
// location: {
|
|
54
|
+
// start: { line: 8, column: 9, offset: 135 },
|
|
55
|
+
// end: { line: 12, column: 1, offset: 215 },
|
|
56
|
+
// },
|
|
57
|
+
// },
|
|
58
|
+
// {
|
|
59
|
+
// id: '0002',
|
|
60
|
+
// name: 'Magic',
|
|
61
|
+
// activity: 'Hide',
|
|
62
|
+
// conditions: { Rarity: 'Magic' },
|
|
63
|
+
// actions: {},
|
|
64
|
+
// branches: [],
|
|
65
|
+
// location: {
|
|
66
|
+
// start: { line: 12, column: 9, offset: 223 },
|
|
67
|
+
// end: { line: 14, column: 1, offset: 261 },
|
|
68
|
+
// },
|
|
69
|
+
// },
|
|
70
|
+
// ],
|
|
71
|
+
// location: {
|
|
72
|
+
// start: { line: 7, column: 5, offset: 113 },
|
|
73
|
+
// end: { line: 14, column: 1, offset: 261 },
|
|
74
|
+
// },
|
|
75
|
+
// },
|
|
76
|
+
// ],
|
|
77
|
+
// location: {
|
|
78
|
+
// start: { line: 1, column: 1, offset: 0 },
|
|
79
|
+
// end: { line: 14, column: 1, offset: 261 },
|
|
80
|
+
// },
|
|
81
|
+
// },
|
|
82
|
+
// ]
|
|
83
|
+
```
|