occam-parsers 23.0.53 → 23.0.55
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 +7 -7
- package/example.js +579 -189
- package/lib/bnf/bnf.js +2 -2
- package/lib/bnf/parser.js +4 -4
- package/lib/definition/{lookAheadModifierRule.js → callAheadModifierRule.js} +11 -11
- package/lib/definition/partRule/nonTerminal/ruleName.js +3 -3
- package/lib/example/basic/bnf.js +14 -0
- package/lib/example/basic/entries.js +18 -0
- package/lib/example/basic/lexer.js +136 -0
- package/lib/example/basic/parser.js +134 -0
- package/lib/example/view/basic.js +8 -8
- package/lib/example/view/div/sizeable.js +2 -2
- package/lib/node/bnf/{lookAheadModifier.js → callAheadModifier.js} +12 -12
- package/lib/node/bnf/choiceOfParts.js +4 -4
- package/lib/node/bnf/definition.js +3 -3
- package/lib/node/bnf/endOfLine.js +2 -2
- package/lib/node/bnf/epsilon.js +2 -2
- package/lib/node/bnf/noWhitespacePart.js +2 -2
- package/lib/node/bnf/part/nonTerminal.js +6 -6
- package/lib/node/bnf/part/terminal.js +3 -3
- package/lib/node/bnf/part.js +5 -5
- package/lib/node/bnf/partChoice.js +4 -4
- package/lib/node/bnf/regularExpression.js +2 -2
- package/lib/node/bnf/ruleName.js +3 -3
- package/lib/node/bnf/sequenceOfParts.js +4 -4
- package/lib/node/bnf/significantTokenType.js +2 -2
- package/lib/node/bnf/startOfContentPart.js +2 -2
- package/lib/node/bnf/terminalSymbol.js +2 -2
- package/lib/node/bnf/wildcard.js +2 -2
- package/lib/node/nonTerminal.js +39 -7
- package/lib/node/terminal.js +40 -11
- package/lib/part/nonTerminal/choiceOfParts.js +4 -4
- package/lib/part/nonTerminal/oneOrMoreParts.js +4 -4
- package/lib/part/nonTerminal/optionalPart.js +4 -4
- package/lib/part/nonTerminal/ruleName.js +8 -8
- package/lib/part/nonTerminal/sequenceOfParts.js +4 -4
- package/lib/part/nonTerminal/zeroOrMoreParts.js +4 -4
- package/lib/part/nonTerminal.js +6 -6
- package/lib/part/terminal.js +5 -5
- package/lib/rule/{lookAheadModifier.js → callAheadModifier.js} +15 -15
- package/lib/rule.js +21 -14
- package/lib/ruleNames.js +5 -5
- package/lib/utilities/bnf.js +9 -9
- package/lib/utilities/parse.js +28 -28
- package/package.json +1 -1
- package/src/bnf/bnf.js +2 -2
- package/src/bnf/parser.js +3 -3
- package/src/definition/{lookAheadModifierRule.js → callAheadModifierRule.js} +3 -3
- package/src/definition/partRule/nonTerminal/ruleName.js +4 -4
- package/src/example/basic/bnf.js +27 -0
- package/src/example/basic/entries.js +9 -0
- package/src/example/basic/lexer.js +17 -0
- package/src/example/basic/parser.js +15 -0
- package/src/example/view/basic.js +13 -10
- package/src/example/view/div/sizeable.js +1 -1
- package/src/node/bnf/callAheadModifier.js +7 -0
- package/src/node/bnf/choiceOfParts.js +3 -3
- package/src/node/bnf/definition.js +2 -2
- package/src/node/bnf/endOfLine.js +1 -1
- package/src/node/bnf/epsilon.js +1 -1
- package/src/node/bnf/noWhitespacePart.js +1 -1
- package/src/node/bnf/part/nonTerminal.js +6 -6
- package/src/node/bnf/part/terminal.js +2 -2
- package/src/node/bnf/part.js +4 -4
- package/src/node/bnf/partChoice.js +3 -3
- package/src/node/bnf/regularExpression.js +1 -1
- package/src/node/bnf/ruleName.js +2 -2
- package/src/node/bnf/sequenceOfParts.js +3 -3
- package/src/node/bnf/significantTokenType.js +1 -1
- package/src/node/bnf/startOfContentPart.js +1 -1
- package/src/node/bnf/terminalSymbol.js +1 -1
- package/src/node/bnf/wildcard.js +1 -1
- package/src/node/nonTerminal.js +43 -10
- package/src/node/terminal.js +37 -9
- package/src/part/nonTerminal/choiceOfParts.js +4 -4
- package/src/part/nonTerminal/oneOrMoreParts.js +4 -4
- package/src/part/nonTerminal/optionalPart.js +4 -4
- package/src/part/nonTerminal/ruleName.js +9 -9
- package/src/part/nonTerminal/sequenceOfParts.js +4 -4
- package/src/part/nonTerminal/zeroOrMoreParts.js +4 -4
- package/src/part/nonTerminal.js +4 -4
- package/src/part/terminal.js +3 -3
- package/src/rule/callAheadModifier.js +22 -0
- package/src/rule.js +30 -18
- package/src/ruleNames.js +1 -1
- package/src/utilities/bnf.js +6 -6
- package/src/utilities/parse.js +38 -28
- package/src/node/bnf/lookAheadModifier.js +0 -7
- package/src/rule/lookAheadModifier.js +0 -22
|
@@ -10,8 +10,8 @@ import { OptionalPartPartType } from "../../partTypes";
|
|
|
10
10
|
const { questionMark } = specialSymbols;
|
|
11
11
|
|
|
12
12
|
export default class OptionalPartPart extends NonTerminalPart {
|
|
13
|
-
constructor(type,
|
|
14
|
-
super(type,
|
|
13
|
+
constructor(type, callAhead, part) {
|
|
14
|
+
super(type, callAhead);
|
|
15
15
|
|
|
16
16
|
this.part = part;
|
|
17
17
|
}
|
|
@@ -48,8 +48,8 @@ export default class OptionalPartPart extends NonTerminalPart {
|
|
|
48
48
|
|
|
49
49
|
static fromPart(part) {
|
|
50
50
|
const type = OptionalPartPartType,
|
|
51
|
-
|
|
52
|
-
optionalPartPart = new OptionalPartPart(type,
|
|
51
|
+
callAhead = false,
|
|
52
|
+
optionalPartPart = new OptionalPartPart(type, callAhead, part);
|
|
53
53
|
|
|
54
54
|
return optionalPartPart;
|
|
55
55
|
}
|
|
@@ -10,8 +10,8 @@ import { RuleNamePartType } from "../../partTypes";
|
|
|
10
10
|
const { ellipsis } = specialSymbols;
|
|
11
11
|
|
|
12
12
|
export default class RuleNamePart extends NonTerminalPart {
|
|
13
|
-
constructor(type,
|
|
14
|
-
super(type,
|
|
13
|
+
constructor(type, callAAhead, ruleName) {
|
|
14
|
+
super(type, callAAhead);
|
|
15
15
|
|
|
16
16
|
this.ruleName = ruleName;
|
|
17
17
|
}
|
|
@@ -46,26 +46,26 @@ export default class RuleNamePart extends NonTerminalPart {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
asString() {
|
|
49
|
-
const
|
|
50
|
-
|
|
49
|
+
const callAAhead = this.isCallAhead(),
|
|
50
|
+
callAAheadString = callAAhead ?
|
|
51
51
|
ellipsis :
|
|
52
52
|
EMPTY_STRING,
|
|
53
|
-
string = `${this.ruleName}${
|
|
53
|
+
string = `${this.ruleName}${callAAheadString}`;
|
|
54
54
|
|
|
55
55
|
return string;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
static fromRuleName(ruleName) {
|
|
59
59
|
const type = RuleNamePartType,
|
|
60
|
-
|
|
61
|
-
ruleNamePart = new RuleNamePart(type,
|
|
60
|
+
callAAhead = false,
|
|
61
|
+
ruleNamePart = new RuleNamePart(type, callAAhead, ruleName);
|
|
62
62
|
|
|
63
63
|
return ruleNamePart;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
static
|
|
66
|
+
static fromCallAheadAndRuleName(callAAhead, ruleName) {
|
|
67
67
|
const type = RuleNamePartType,
|
|
68
|
-
ruleNamePart = new RuleNamePart(type,
|
|
68
|
+
ruleNamePart = new RuleNamePart(type, callAAhead, ruleName);
|
|
69
69
|
|
|
70
70
|
return ruleNamePart;
|
|
71
71
|
}
|
|
@@ -6,8 +6,8 @@ import { parseParts } from "../../utilities/parse";
|
|
|
6
6
|
import { SequenceOfPartsPartType } from "../../partTypes";
|
|
7
7
|
|
|
8
8
|
export default class SequenceOfPartsPart extends NonTerminalPart {
|
|
9
|
-
constructor(type,
|
|
10
|
-
super(type,
|
|
9
|
+
constructor(type, callAhead, parts) {
|
|
10
|
+
super(type, callAhead);
|
|
11
11
|
|
|
12
12
|
this.parts = parts;
|
|
13
13
|
}
|
|
@@ -64,8 +64,8 @@ export default class SequenceOfPartsPart extends NonTerminalPart {
|
|
|
64
64
|
|
|
65
65
|
static fromParts(parts) {
|
|
66
66
|
const type = SequenceOfPartsPartType,
|
|
67
|
-
|
|
68
|
-
sequenceOfPartsPart = new SequenceOfPartsPart(type,
|
|
67
|
+
callAhead = false,
|
|
68
|
+
sequenceOfPartsPart = new SequenceOfPartsPart(type, callAhead, parts);
|
|
69
69
|
|
|
70
70
|
return sequenceOfPartsPart;
|
|
71
71
|
}
|
|
@@ -10,8 +10,8 @@ import { ZeroOrMorePartsPartType } from "../../partTypes";
|
|
|
10
10
|
const { asterisk } = specialSymbols;
|
|
11
11
|
|
|
12
12
|
export default class ZeroOrMorePartsPart extends NonTerminalPart {
|
|
13
|
-
constructor(type,
|
|
14
|
-
super(type,
|
|
13
|
+
constructor(type, callAhead, part) {
|
|
14
|
+
super(type, callAhead);
|
|
15
15
|
|
|
16
16
|
this.part = part;
|
|
17
17
|
}
|
|
@@ -48,8 +48,8 @@ export default class ZeroOrMorePartsPart extends NonTerminalPart {
|
|
|
48
48
|
|
|
49
49
|
static fromPart(part) {
|
|
50
50
|
const type = ZeroOrMorePartsPartType,
|
|
51
|
-
|
|
52
|
-
zeroOrMorePartsPart = new ZeroOrMorePartsPart(type,
|
|
51
|
+
callAhead = false,
|
|
52
|
+
zeroOrMorePartsPart = new ZeroOrMorePartsPart(type, callAhead, part);
|
|
53
53
|
|
|
54
54
|
return zeroOrMorePartsPart;
|
|
55
55
|
}
|
package/src/part/nonTerminal.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
export default class NonTerminalPart {
|
|
4
|
-
constructor(type,
|
|
4
|
+
constructor(type, callAhead) {
|
|
5
5
|
this.type = type;
|
|
6
|
-
this.
|
|
6
|
+
this.callAhead = callAhead;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
getType() {
|
|
10
10
|
return this.type;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
return this.
|
|
13
|
+
isCallAhead() {
|
|
14
|
+
return this.callAhead;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
isNonTerminalPart() {
|
package/src/part/terminal.js
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import Rule from "../rule";
|
|
4
|
+
import CallAheadModifierBNFNode from "../node/bnf/callAheadModifier";
|
|
5
|
+
import CallAheadModifierRuleDefinition from "../definition/callAheadModifierRule";
|
|
6
|
+
|
|
7
|
+
import { callAheadModifierRuleName } from "../ruleNames";
|
|
8
|
+
|
|
9
|
+
export default class CallAheadModifierRule extends Rule {
|
|
10
|
+
static fromNothing() {
|
|
11
|
+
const name = callAheadModifierRuleName, ///
|
|
12
|
+
callAheadModifierRuleDefinition = CallAheadModifierRuleDefinition.fromNothing(),
|
|
13
|
+
opacity = null,
|
|
14
|
+
definitions = [
|
|
15
|
+
callAheadModifierRuleDefinition
|
|
16
|
+
],
|
|
17
|
+
NonTerminalNode = CallAheadModifierBNFNode, ///
|
|
18
|
+
callAheadModifierRule = new CallAheadModifierRule(name, opacity, definitions, NonTerminalNode);
|
|
19
|
+
|
|
20
|
+
return callAheadModifierRule;
|
|
21
|
+
}
|
|
22
|
+
}
|
package/src/rule.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { arrayUtilities } from "necessary";
|
|
4
|
+
|
|
3
5
|
import { EMPTY_STRING } from "./constants";
|
|
4
6
|
import { specialSymbols } from "occam-lexers";
|
|
5
7
|
import { paddingFromPaddingLength } from "./utilities/string";
|
|
6
8
|
|
|
7
|
-
const {
|
|
9
|
+
const { clear } = arrayUtilities,
|
|
10
|
+
{ opaque: opaqueSpecialSymbol, semiOpaque: semiOpaqueSpecialSymbol } = specialSymbols;
|
|
8
11
|
|
|
9
12
|
export default class Rule {
|
|
10
13
|
constructor(name, opacity, definitions, NonTerminalNode) {
|
|
@@ -61,27 +64,26 @@ export default class Rule {
|
|
|
61
64
|
parse(nodes, state, callback, callAhead) {
|
|
62
65
|
let parsed;
|
|
63
66
|
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
const opacity = this.opacity,
|
|
68
|
+
ruleName = this.name, ///
|
|
69
|
+
childNodes = [],
|
|
70
|
+
nonTerminalNode = this.NonTerminalNode.fromRuleNameChildNodesAndOpacity(ruleName, childNodes, opacity),
|
|
71
|
+
savedPrecedence = state.getSavedPrecedence();
|
|
69
72
|
|
|
70
|
-
|
|
71
|
-
opacity = this.opacity,
|
|
72
|
-
childNodes = [];
|
|
73
|
+
let node = nonTerminalNode; ///
|
|
73
74
|
|
|
74
|
-
|
|
75
|
+
nodes.push(node);
|
|
75
76
|
|
|
76
|
-
|
|
77
|
+
parsed = this.definitions.some((definition) => {
|
|
78
|
+
let parsed;
|
|
77
79
|
|
|
78
|
-
|
|
80
|
+
clear(childNodes);
|
|
79
81
|
|
|
80
|
-
|
|
82
|
+
const precedence = definition.getPrecedence();
|
|
81
83
|
|
|
82
84
|
state.setPrecedence(precedence);
|
|
83
85
|
|
|
84
|
-
|
|
86
|
+
callback = () => { ///
|
|
85
87
|
let parsed;
|
|
86
88
|
|
|
87
89
|
parsed = true;
|
|
@@ -130,24 +132,34 @@ export default class Rule {
|
|
|
130
132
|
if (!parsed) {
|
|
131
133
|
nodes.pop();
|
|
132
134
|
|
|
133
|
-
|
|
135
|
+
node = nonTerminalNode; ///
|
|
134
136
|
|
|
135
137
|
nodes.push(node);
|
|
136
138
|
}
|
|
137
139
|
}
|
|
138
140
|
|
|
139
141
|
return parsed;
|
|
140
|
-
}
|
|
142
|
+
};
|
|
141
143
|
|
|
142
|
-
|
|
143
|
-
nodes.pop();
|
|
144
|
+
parsed = definition.parse(childNodes, state, callback, callAhead);
|
|
144
145
|
|
|
146
|
+
if (!parsed) {
|
|
145
147
|
state.resetPrecedence(savedPrecedence);
|
|
146
148
|
}
|
|
147
149
|
|
|
148
150
|
return parsed;
|
|
149
151
|
});
|
|
150
152
|
|
|
153
|
+
if (parsed) {
|
|
154
|
+
const parentNode = node; ///
|
|
155
|
+
|
|
156
|
+
childNodes.forEach((childNode) => {
|
|
157
|
+
childNode.setParentNode(parentNode);
|
|
158
|
+
});
|
|
159
|
+
} else {
|
|
160
|
+
nodes.pop();
|
|
161
|
+
}
|
|
162
|
+
|
|
151
163
|
if (callAhead === null) {
|
|
152
164
|
state.resetPrecedence(savedPrecedence);
|
|
153
165
|
}
|
package/src/ruleNames.js
CHANGED
|
@@ -21,7 +21,7 @@ export const nonTerminalPartRuleName = "nonTerminalPart";
|
|
|
21
21
|
export const sequenceOfPartsRuleName = "sequenceOfParts";
|
|
22
22
|
export const opacityModifierRuleName = "opacityModifier";
|
|
23
23
|
export const noWhitespacePartRuleName = "noWhitespace";
|
|
24
|
-
export const
|
|
24
|
+
export const CallAheadModifierRuleName = "callAheadModifier";
|
|
25
25
|
export const regularExpressionRuleName = "regularExpression";
|
|
26
26
|
export const optionalQuantifierRuleName = "optionalQuantifier";
|
|
27
27
|
export const startOfContentPartRuleName = "startOfContent";
|
package/src/utilities/bnf.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { arrayUtilities } from "necessary";
|
|
4
4
|
|
|
5
|
-
import { ruleNameRuleName, quantifierRuleName,
|
|
5
|
+
import { ruleNameRuleName, quantifierRuleName, callAheadModifierRuleName } from "../ruleNames";
|
|
6
6
|
|
|
7
7
|
const { first } = arrayUtilities;
|
|
8
8
|
|
|
@@ -53,20 +53,20 @@ export function isNodeQuantifierNode(node) {
|
|
|
53
53
|
return nodeQuantifierNode;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
export function
|
|
57
|
-
let
|
|
56
|
+
export function isNodeCallAheadModifierNode(node) {
|
|
57
|
+
let nodeCallAheadModifierNode = false;
|
|
58
58
|
|
|
59
59
|
const nodeNonTerminalNode = node.isNonTerminalNode();
|
|
60
60
|
|
|
61
61
|
if (nodeNonTerminalNode) {
|
|
62
62
|
const nonTerminalNode = node, ///
|
|
63
63
|
ruleName = nonTerminalNode.getRuleName(),
|
|
64
|
-
|
|
64
|
+
ruleNameCallAheadModifierRuleName = (ruleName === callAheadModifierRuleName);
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
nodeCallAheadModifierNode = ruleNameCallAheadModifierRuleName; ///
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
return
|
|
69
|
+
return nodeCallAheadModifierNode;
|
|
70
70
|
|
|
71
71
|
}
|
|
72
72
|
|
package/src/utilities/parse.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { arrayUtilities } from "necessary";
|
|
4
4
|
|
|
5
|
-
const { push } = arrayUtilities;
|
|
5
|
+
const { push, clear } = arrayUtilities;
|
|
6
6
|
|
|
7
7
|
export function parsePart(part, nodes, state, callback, callAhead) {
|
|
8
8
|
let parsed;
|
|
@@ -37,44 +37,54 @@ function parsePartOfParts(index, parts, nodes, state, callback, callAhead) {
|
|
|
37
37
|
callback() :
|
|
38
38
|
true;
|
|
39
39
|
} else {
|
|
40
|
-
const part = parts[index]
|
|
40
|
+
const part = parts[index],
|
|
41
|
+
partCallAhead = (callAhead === null) ?
|
|
42
|
+
part.isCallAhead() :
|
|
43
|
+
true;
|
|
41
44
|
|
|
42
45
|
index++;
|
|
43
46
|
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
parsed = partCallAhead ?
|
|
48
|
+
parsePartWithCallAhead(part, index, parts, nodes, state, callback, callAhead) :
|
|
49
|
+
parsePartWithoutCallAhead(part, index, parts, nodes, state, callback, callAhead);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return parsed;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function parsePartWithCallAhead(part, index, parts, nodes, state, callback, callAhead) {
|
|
56
|
+
let parsed;
|
|
57
|
+
|
|
58
|
+
const partNodes = [];
|
|
46
59
|
|
|
47
|
-
|
|
48
|
-
|
|
60
|
+
callAhead = () => { ///
|
|
61
|
+
let parsed;
|
|
49
62
|
|
|
50
|
-
|
|
51
|
-
partNodes = [];
|
|
63
|
+
clear(partNodes);
|
|
52
64
|
|
|
53
|
-
|
|
54
|
-
parsed = parsePartOfParts(index, parts, nodes, state, callback, callAhead);
|
|
65
|
+
const nodes = partNodes; ///
|
|
55
66
|
|
|
56
|
-
|
|
57
|
-
});
|
|
67
|
+
parsed = parsePartOfParts(index, parts, nodes, state, callback, callAhead);
|
|
58
68
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
} else {
|
|
63
|
-
parsed = part.parse(nodes, state, callback, callAhead);
|
|
69
|
+
return parsed;
|
|
70
|
+
};
|
|
64
71
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
+
parsed = part.parse(nodes, state, callback, callAhead);
|
|
73
|
+
|
|
74
|
+
if (parsed) {
|
|
75
|
+
push(nodes, partNodes);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return parsed;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function parsePartWithoutCallAhead(part, index, parts, nodes, state, callback, callAhead) {
|
|
82
|
+
let parsed;
|
|
72
83
|
|
|
73
|
-
|
|
84
|
+
parsed = part.parse(nodes, state, callback, callAhead);
|
|
74
85
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
86
|
+
if (parsed) {
|
|
87
|
+
parsed = parsePartOfParts(index, parts, nodes, state, callback, callAhead);
|
|
78
88
|
}
|
|
79
89
|
|
|
80
90
|
return parsed;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import NonTerminalNode from "../../node/nonTerminal";
|
|
4
|
-
|
|
5
|
-
export default class LookAheadModifierBNFNode extends NonTerminalNode {
|
|
6
|
-
static fromRuleNameChildNodesAndLookAhead(ruleName, childNode, opacity) { return NonTerminalNode.fromRuleNameChildNodesAndLookAhead(LookAheadModifierBNFNode, ruleName, childNode, opacity); }
|
|
7
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import Rule from "../rule";
|
|
4
|
-
import LookAheadModifierBNFNode from "../node/bnf/lookAheadModifier";
|
|
5
|
-
import LookAheadModifierRuleDefinition from "../definition/lookAheadModifierRule";
|
|
6
|
-
|
|
7
|
-
import { lookAheadModifierRuleName } from "../ruleNames";
|
|
8
|
-
|
|
9
|
-
export default class LookAheadModifierRule extends Rule {
|
|
10
|
-
static fromNothing() {
|
|
11
|
-
const name = lookAheadModifierRuleName, ///
|
|
12
|
-
lookAheadModifierRuleDefinition = LookAheadModifierRuleDefinition.fromNothing(),
|
|
13
|
-
opacity = null,
|
|
14
|
-
definitions = [
|
|
15
|
-
lookAheadModifierRuleDefinition
|
|
16
|
-
],
|
|
17
|
-
NonTerminalNode = LookAheadModifierBNFNode, ///
|
|
18
|
-
lookAheadModifierRule = new LookAheadModifierRule(name, opacity, definitions, NonTerminalNode);
|
|
19
|
-
|
|
20
|
-
return lookAheadModifierRule;
|
|
21
|
-
}
|
|
22
|
-
}
|