File tree Expand file tree Collapse file tree 3 files changed +79
-56
lines changed Expand file tree Collapse file tree 3 files changed +79
-56
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 33
33
"repository" : " jslicense/spdx-expression-parse.js" ,
34
34
"scripts" : {
35
35
"lint" : " standard" ,
36
- "prepublish" : " node generate- parser.js > parser.js " ,
36
+ "prepublish" : " jison -p slr -m commonjs -o parser.js parser.json " ,
37
37
"pretest" : " npm run prepublish" ,
38
38
"test" : " defence -i javascript README.md | replace-require-self | node"
39
39
}
Original file line number Diff line number Diff line change
1
+ {
2
+ "operators" : [
3
+ [
4
+ " left" ,
5
+ " OR"
6
+ ],
7
+ [
8
+ " left" ,
9
+ " AND"
10
+ ],
11
+ [
12
+ " right" ,
13
+ " PLUS" ,
14
+ " WITH"
15
+ ]
16
+ ],
17
+ "tokens" : [
18
+ " CLOSE" ,
19
+ " COLON" ,
20
+ " EXCEPTION" ,
21
+ " LICENSE" ,
22
+ " LICENSEREF" ,
23
+ " OPEN" ,
24
+ " PLUS" ,
25
+ " AND" ,
26
+ " OR" ,
27
+ " WITH"
28
+ ],
29
+ "start" : " start" ,
30
+ "bnf" : {
31
+ "start" : [
32
+ [
33
+ " expression EOS" ,
34
+ " return $$ = $1"
35
+ ]
36
+ ],
37
+ "simpleExpression" : [
38
+ [
39
+ " LICENSE" ,
40
+ " $$ = {license: yytext}"
41
+ ],
42
+ [
43
+ " LICENSE PLUS" ,
44
+ " $$ = {license: $1, plus: true}"
45
+ ],
46
+ [
47
+ " LICENSEREF" ,
48
+ " $$ = {license: yytext}"
49
+ ],
50
+ [
51
+ " DOCUMENTREF COLON LICENSEREF" ,
52
+ " $$ = {license: yytext}"
53
+ ]
54
+ ],
55
+ "expression" : [
56
+ [
57
+ " simpleExpression" ,
58
+ " $$ = $1"
59
+ ],
60
+ [
61
+ " simpleExpression WITH EXCEPTION" ,
62
+ " $$ = {exception: $3}\n $$.license = $1.license\n if ($1.hasOwnProperty('plus')) {\n $$.plus = $1.plus\n }"
63
+ ],
64
+ [
65
+ " expression AND expression" ,
66
+ " $$ = {conjunction: 'and', left: $1, right: $3}"
67
+ ],
68
+ [
69
+ " expression OR expression" ,
70
+ " $$ = {conjunction: 'or', left: $1, right: $3}"
71
+ ],
72
+ [
73
+ " OPEN expression CLOSE" ,
74
+ " $$ = $2"
75
+ ]
76
+ ]
77
+ }
78
+ }
You can’t perform that action at this time.
0 commit comments