occam-parsers 17.0.13 → 18.0.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/README.md +7 -5
- package/example.js +3482 -1257
- package/lib/basic/bnf.js +2 -2
- package/lib/bnf/bnf.js +2 -2
- package/lib/bnf/parser.js +7 -3
- package/lib/common/parser.js +2 -2
- package/lib/definition/ambiguousModifierRule.js +28 -6
- package/lib/definition/choiceOfParts.js +40 -12
- package/lib/definition/definition.js +29 -5
- package/lib/definition/definitions.js +36 -9
- package/lib/definition/document.js +31 -8
- package/lib/definition/error.js +27 -5
- package/lib/definition/lookAheadModifierRule.js +28 -6
- package/lib/definition/name.js +27 -5
- package/lib/definition/noWhitespacePart.js +27 -5
- package/lib/definition/partChoice.js +127 -0
- package/lib/definition/partRule/nonTerminal/ruleName.js +28 -6
- package/lib/definition/partRule/nonTerminal.js +28 -6
- package/lib/definition/partRule/terminal.js +28 -6
- package/lib/definition/precedence.js +132 -0
- package/lib/definition/quantifierRule.js +29 -7
- package/lib/definition/rule.js +31 -9
- package/lib/definition/ruleName.js +28 -6
- package/lib/definition/sequenceOfParts.js +30 -8
- package/lib/definition/significantTokenType.js +28 -6
- package/lib/definition/terminalSymbol.js +28 -6
- package/lib/definition.js +48 -4
- package/lib/example/view/basic.js +44 -21
- package/lib/example/view/bnf.js +5 -11
- package/lib/example/view/div/sizeable.js +2 -2
- package/lib/example/view/textarea/bnf.js +23 -2
- package/lib/example/view/textarea/content.js +23 -2
- package/lib/example/view/textarea/lexicalEntries.js +23 -2
- package/lib/example/view/textarea/parseTree.js +23 -2
- package/lib/example/view/textarea/tokens.js +23 -2
- package/lib/example/view/textarea.js +2 -2
- package/lib/example/view.js +13 -12
- package/lib/node/bnf/choiceOfParts.js +9 -2
- package/lib/node/bnf/definition.js +6 -4
- package/lib/node/bnf/definitions.js +4 -3
- package/lib/node/bnf/document.js +4 -13
- package/lib/node/bnf/endOfLine.js +2 -2
- package/lib/node/bnf/epsilon.js +2 -2
- package/lib/node/bnf/name.js +4 -3
- package/lib/node/bnf/noWhitespacePart.js +2 -2
- package/lib/node/bnf/part/terminal.js +4 -3
- package/lib/node/bnf/part.js +7 -6
- package/lib/node/bnf/partChoice.js +133 -0
- package/lib/node/bnf/precedence.js +130 -0
- package/lib/node/bnf/regularExpression.js +5 -4
- package/lib/node/bnf/rule.js +7 -6
- package/lib/node/bnf/ruleName.js +4 -3
- package/lib/node/bnf/sequenceOfParts.js +9 -2
- package/lib/node/bnf/significantTokenType.js +5 -4
- package/lib/node/bnf/terminalSymbol.js +5 -4
- package/lib/node/bnf/wildcard.js +2 -2
- package/lib/node/nonTerminal.js +17 -16
- package/lib/node/terminal/epsilon.js +2 -3
- package/lib/node/terminal/noWhitespace.js +2 -3
- package/lib/node/terminal.js +11 -1
- package/lib/parseTree/childNodes.js +4 -3
- package/lib/parseTree/horizontalBranch.js +1 -1
- package/lib/parseTree/verticalBranch.js +3 -11
- package/lib/parseTree.js +3 -4
- package/lib/part/nonTerminal/choiceOfParts.js +19 -28
- package/lib/part/nonTerminal/oneOrMoreParts.js +22 -15
- package/lib/part/nonTerminal/optionalPart.js +19 -12
- package/lib/part/nonTerminal/ruleName.js +19 -6
- package/lib/part/nonTerminal/sequenceOfParts.js +10 -15
- package/lib/part/nonTerminal/zeroOrMoreParts.js +23 -15
- package/lib/part/terminal/endOfLine.js +11 -3
- package/lib/part/terminal/epsilon.js +11 -3
- package/lib/part/terminal/noWhitespace.js +11 -3
- package/lib/part/terminal/regularExpression.js +14 -5
- package/lib/part/terminal/significantTokenType.js +11 -3
- package/lib/part/terminal/terminalSymbol.js +11 -3
- package/lib/part/terminal/wildcard.js +11 -3
- package/lib/partChoice.js +89 -0
- package/lib/rule/ambiguousModifier.js +27 -5
- package/lib/rule/choiceOfParts.js +27 -5
- package/lib/rule/definition.js +27 -5
- package/lib/rule/definitions.js +27 -5
- package/lib/rule/document.js +27 -5
- package/lib/rule/endOfLine.js +27 -5
- package/lib/rule/epsilon.js +27 -5
- package/lib/rule/error.js +27 -5
- package/lib/rule/lookAheadModifier.js +27 -5
- package/lib/rule/name.js +27 -5
- package/lib/rule/noWhitespacePart.js +27 -5
- package/lib/rule/nonTerminalPart.js +29 -7
- package/lib/rule/oneOrMoreQuantifier.js +27 -5
- package/lib/rule/optionalQuantifier.js +27 -5
- package/lib/rule/part.js +29 -7
- package/lib/rule/partChoice.js +126 -0
- package/lib/rule/precedence.js +126 -0
- package/lib/rule/quantifier.js +29 -7
- package/lib/rule/regularExpression.js +27 -5
- package/lib/rule/rule.js +27 -5
- package/lib/rule/ruleName.js +27 -5
- package/lib/rule/sequenceOfParts.js +27 -5
- package/lib/rule/significantTokenType.js +27 -5
- package/lib/rule/terminalPart.js +33 -11
- package/lib/rule/terminalSymbol.js +27 -5
- package/lib/rule/wildcard.js +27 -5
- package/lib/rule/zeroOrMoreQuantifier.js +27 -5
- package/lib/rule.js +37 -110
- package/lib/ruleNames.js +9 -1
- package/lib/utilities/bnf.js +4 -3
- package/lib/utilities/lookAhead.js +30 -19
- package/lib/utilities/node.js +46 -0
- package/package.json +2 -2
- package/src/basic/bnf.js +17 -21
- package/src/bnf/bnf.js +8 -4
- package/src/bnf/parser.js +34 -26
- package/src/common/parser.js +3 -1
- package/src/definition/ambiguousModifierRule.js +7 -5
- package/src/definition/choiceOfParts.js +30 -21
- package/src/definition/definition.js +13 -7
- package/src/definition/definitions.js +24 -16
- package/src/definition/document.js +16 -11
- package/src/definition/error.js +6 -4
- package/src/definition/lookAheadModifierRule.js +7 -5
- package/src/definition/name.js +7 -5
- package/src/definition/noWhitespacePart.js +7 -5
- package/src/definition/partChoice.js +23 -0
- package/src/definition/partRule/nonTerminal/ruleName.js +9 -7
- package/src/definition/partRule/nonTerminal.js +8 -6
- package/src/definition/partRule/terminal.js +9 -7
- package/src/definition/precedence.js +34 -0
- package/src/definition/quantifierRule.js +8 -6
- package/src/definition/rule.js +12 -10
- package/src/definition/ruleName.js +7 -5
- package/src/definition/sequenceOfParts.js +9 -7
- package/src/definition/significantTokenType.js +7 -5
- package/src/definition/terminalSymbol.js +7 -5
- package/src/definition.js +58 -12
- package/src/example/view/basic.js +30 -7
- package/src/example/view/bnf.js +5 -18
- package/src/example/view/div/sizeable.js +1 -1
- package/src/example/view/textarea/bnf.js +10 -1
- package/src/example/view/textarea/content.js +9 -1
- package/src/example/view/textarea/lexicalEntries.js +9 -1
- package/src/example/view/textarea/parseTree.js +10 -1
- package/src/example/view/textarea/tokens.js +9 -1
- package/src/example/view/textarea.js +0 -1
- package/src/example/view.js +15 -13
- package/src/node/bnf/choiceOfParts.js +14 -2
- package/src/node/bnf/definition.js +11 -4
- package/src/node/bnf/definitions.js +3 -3
- package/src/node/bnf/document.js +4 -20
- package/src/node/bnf/endOfLine.js +1 -1
- package/src/node/bnf/epsilon.js +1 -1
- package/src/node/bnf/name.js +3 -1
- package/src/node/bnf/noWhitespacePart.js +1 -1
- package/src/node/bnf/part/terminal.js +3 -1
- package/src/node/bnf/part.js +7 -4
- package/src/node/bnf/partChoice.js +27 -0
- package/src/node/bnf/precedence.js +21 -0
- package/src/node/bnf/regularExpression.js +4 -2
- package/src/node/bnf/rule.js +4 -3
- package/src/node/bnf/ruleName.js +4 -2
- package/src/node/bnf/sequenceOfParts.js +14 -2
- package/src/node/bnf/significantTokenType.js +4 -2
- package/src/node/bnf/terminalSymbol.js +4 -2
- package/src/node/bnf/wildcard.js +1 -1
- package/src/node/nonTerminal.js +11 -9
- package/src/node/terminal/epsilon.js +1 -6
- package/src/node/terminal/noWhitespace.js +1 -6
- package/src/node/terminal.js +11 -0
- package/src/parseTree/childNodes.js +3 -1
- package/src/parseTree/horizontalBranch.js +3 -1
- package/src/parseTree/verticalBranch.js +7 -5
- package/src/parseTree.js +3 -4
- package/src/part/nonTerminal/choiceOfParts.js +17 -33
- package/src/part/nonTerminal/oneOrMoreParts.js +20 -14
- package/src/part/nonTerminal/optionalPart.js +17 -11
- package/src/part/nonTerminal/ruleName.js +18 -6
- package/src/part/nonTerminal/sequenceOfParts.js +10 -19
- package/src/part/nonTerminal/zeroOrMoreParts.js +22 -12
- package/src/part/terminal/endOfLine.js +8 -2
- package/src/part/terminal/epsilon.js +8 -2
- package/src/part/terminal/noWhitespace.js +8 -2
- package/src/part/terminal/regularExpression.js +11 -3
- package/src/part/terminal/significantTokenType.js +8 -2
- package/src/part/terminal/terminalSymbol.js +8 -2
- package/src/part/terminal/wildcard.js +8 -2
- package/src/partChoice.js +57 -0
- package/src/rule/ambiguousModifier.js +6 -5
- package/src/rule/choiceOfParts.js +6 -5
- package/src/rule/definition.js +6 -5
- package/src/rule/definitions.js +6 -5
- package/src/rule/document.js +6 -5
- package/src/rule/endOfLine.js +6 -5
- package/src/rule/epsilon.js +6 -5
- package/src/rule/error.js +6 -5
- package/src/rule/lookAheadModifier.js +6 -5
- package/src/rule/name.js +6 -5
- package/src/rule/noWhitespacePart.js +5 -4
- package/src/rule/nonTerminalPart.js +8 -7
- package/src/rule/oneOrMoreQuantifier.js +7 -6
- package/src/rule/optionalQuantifier.js +7 -6
- package/src/rule/part.js +8 -7
- package/src/rule/partChoice.js +22 -0
- package/src/rule/precedence.js +22 -0
- package/src/rule/quantifier.js +8 -7
- package/src/rule/regularExpression.js +7 -6
- package/src/rule/rule.js +6 -5
- package/src/rule/ruleName.js +6 -5
- package/src/rule/sequenceOfParts.js +5 -4
- package/src/rule/significantTokenType.js +7 -6
- package/src/rule/terminalPart.js +12 -11
- package/src/rule/terminalSymbol.js +6 -5
- package/src/rule/wildcard.js +6 -5
- package/src/rule/zeroOrMoreQuantifier.js +7 -6
- package/src/rule.js +40 -69
- package/src/ruleNames.js +2 -0
- package/src/utilities/bnf.js +4 -1
- package/src/utilities/lookAhead.js +20 -9
- package/src/utilities/node.js +41 -0
- package/lib/utilities/array.js +0 -64
- package/src/utilities/array.js +0 -23
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ All parsers share common functionality. The last two parse content according to
|
|
|
30
30
|
|
|
31
31
|
definitions ::= definition ( "|" definition )* ;
|
|
32
32
|
|
|
33
|
-
definition ::= part+ ;
|
|
33
|
+
definition ::= part+ precedence? ;
|
|
34
34
|
|
|
35
35
|
part ::= nonTerminalPart quantifier*
|
|
36
36
|
|
|
@@ -59,15 +59,15 @@ All parsers share common functionality. The last two parse content according to
|
|
|
59
59
|
| wildcard
|
|
60
60
|
|
|
61
61
|
| epsilon
|
|
62
|
-
|
|
62
|
+
|
|
63
63
|
;
|
|
64
64
|
|
|
65
65
|
noWhitespacePart ::= "<NO_WHITESPACE>" ;
|
|
66
66
|
|
|
67
|
-
choiceOfParts ::= "(" part ( "|" part )+ ")" ;
|
|
68
|
-
|
|
69
67
|
sequenceOfParts ::= "(" part part+ ")" ;
|
|
70
68
|
|
|
69
|
+
choiceOfParts ::= "(" part precedence? ( "|" part precedence? )+ ")" ;
|
|
70
|
+
|
|
71
71
|
ruleName ::= [name] ;
|
|
72
72
|
|
|
73
73
|
significantTokenType ::= [type] ;
|
|
@@ -76,8 +76,10 @@ All parsers share common functionality. The last two parse content according to
|
|
|
76
76
|
|
|
77
77
|
terminalSymbol ::= [string-literal] ;
|
|
78
78
|
|
|
79
|
+
precedence ::= "("<NO_WHITESPACE>[number]<NO_WHITESPACE>")" ;
|
|
80
|
+
|
|
79
81
|
endOfLine ::= "<END_OF_LINE>" ;
|
|
80
|
-
|
|
82
|
+
|
|
81
83
|
wildcard ::= "." ;
|
|
82
84
|
|
|
83
85
|
epsilon ::= "ε" ;
|