occam-grammars 1.3.306 → 1.3.310

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.
Files changed (34) hide show
  1. package/example.js +153 -88
  2. package/index.html +1 -1
  3. package/lib/customGrammarBNF/bnf.js +14 -0
  4. package/lib/customGrammarBNF/entries.js +30 -0
  5. package/lib/customGrammarBNF/lexer.js +9 -4
  6. package/lib/customGrammarBNF/parser.js +8 -3
  7. package/lib/customGrammarVocabulary/bnf.js +14 -0
  8. package/lib/customGrammarVocabulary/entries.js +18 -0
  9. package/lib/customGrammarVocabulary/lexer.js +144 -0
  10. package/lib/{customGrammarPattern → customGrammarVocabulary}/parser.js +13 -13
  11. package/lib/example/view/{customGrammarPattern.js → customGrammarVocabulary.js} +14 -14
  12. package/lib/example.js +4 -4
  13. package/lib/index.js +5 -5
  14. package/lib/nominal/bnf.js +2 -2
  15. package/lib/nominal/entries.js +11 -8
  16. package/package.json +1 -1
  17. package/src/customGrammarBNF/bnf.js +75 -0
  18. package/src/customGrammarBNF/entries.js +21 -0
  19. package/src/customGrammarBNF/lexer.js +3 -3
  20. package/src/customGrammarBNF/parser.js +2 -2
  21. package/src/customGrammarVocabulary/bnf.js +19 -0
  22. package/src/{customGrammarPattern → customGrammarVocabulary}/lexer.js +4 -4
  23. package/src/{customGrammarPattern → customGrammarVocabulary}/parser.js +4 -4
  24. package/src/example/view/customGrammarVocabulary.js +22 -0
  25. package/src/example.js +2 -2
  26. package/src/index.js +2 -2
  27. package/src/nominal/bnf.js +3 -3
  28. package/src/nominal/entries.js +11 -7
  29. package/lib/customGrammarPattern/bnf.js +0 -14
  30. package/lib/customGrammarPattern/entries.js +0 -18
  31. package/lib/customGrammarPattern/lexer.js +0 -144
  32. package/src/customGrammarPattern/bnf.js +0 -16
  33. package/src/example/view/customGrammarPattern.js +0 -22
  34. /package/src/{customGrammarPattern → customGrammarVocabulary}/entries.js +0 -0
@@ -1,144 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "default", {
6
- enumerable: true,
7
- get: function() {
8
- return CustomGrammarPatternLexer;
9
- }
10
- });
11
- var _occamlexers = require("occam-lexers");
12
- var _entries = /*#__PURE__*/ _interop_require_default(require("./entries"));
13
- function _assert_this_initialized(self) {
14
- if (self === void 0) {
15
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
16
- }
17
- return self;
18
- }
19
- function _call_super(_this, derived, args) {
20
- derived = _get_prototype_of(derived);
21
- return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
22
- }
23
- function _class_call_check(instance, Constructor) {
24
- if (!(instance instanceof Constructor)) {
25
- throw new TypeError("Cannot call a class as a function");
26
- }
27
- }
28
- function _defineProperties(target, props) {
29
- for(var i = 0; i < props.length; i++){
30
- var descriptor = props[i];
31
- descriptor.enumerable = descriptor.enumerable || false;
32
- descriptor.configurable = true;
33
- if ("value" in descriptor) descriptor.writable = true;
34
- Object.defineProperty(target, descriptor.key, descriptor);
35
- }
36
- }
37
- function _create_class(Constructor, protoProps, staticProps) {
38
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
39
- if (staticProps) _defineProperties(Constructor, staticProps);
40
- return Constructor;
41
- }
42
- function _define_property(obj, key, value) {
43
- if (key in obj) {
44
- Object.defineProperty(obj, key, {
45
- value: value,
46
- enumerable: true,
47
- configurable: true,
48
- writable: true
49
- });
50
- } else {
51
- obj[key] = value;
52
- }
53
- return obj;
54
- }
55
- function _get_prototype_of(o) {
56
- _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
57
- return o.__proto__ || Object.getPrototypeOf(o);
58
- };
59
- return _get_prototype_of(o);
60
- }
61
- function _inherits(subClass, superClass) {
62
- if (typeof superClass !== "function" && superClass !== null) {
63
- throw new TypeError("Super expression must either be null or a function");
64
- }
65
- subClass.prototype = Object.create(superClass && superClass.prototype, {
66
- constructor: {
67
- value: subClass,
68
- writable: true,
69
- configurable: true
70
- }
71
- });
72
- if (superClass) _set_prototype_of(subClass, superClass);
73
- }
74
- function _interop_require_default(obj) {
75
- return obj && obj.__esModule ? obj : {
76
- default: obj
77
- };
78
- }
79
- function _possible_constructor_return(self, call) {
80
- if (call && (_type_of(call) === "object" || typeof call === "function")) {
81
- return call;
82
- }
83
- return _assert_this_initialized(self);
84
- }
85
- function _set_prototype_of(o, p) {
86
- _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
87
- o.__proto__ = p;
88
- return o;
89
- };
90
- return _set_prototype_of(o, p);
91
- }
92
- function _type_of(obj) {
93
- "@swc/helpers - typeof";
94
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
95
- }
96
- function _is_native_reflect_construct() {
97
- try {
98
- var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
99
- } catch (_) {}
100
- return (_is_native_reflect_construct = function() {
101
- return !!result;
102
- })();
103
- }
104
- var CustomGrammarPatternLexer = /*#__PURE__*/ function(CommonLexer) {
105
- _inherits(CustomGrammarPatternLexer, CommonLexer);
106
- function CustomGrammarPatternLexer() {
107
- _class_call_check(this, CustomGrammarPatternLexer);
108
- return _call_super(this, CustomGrammarPatternLexer, arguments);
109
- }
110
- _create_class(CustomGrammarPatternLexer, null, [
111
- {
112
- key: "fromNothing",
113
- value: function fromNothing() {
114
- return _occamlexers.CommonLexer.fromNothing(CustomGrammarPatternLexer);
115
- }
116
- },
117
- {
118
- key: "fromRules",
119
- value: function fromRules(rules) {
120
- return _occamlexers.CommonLexer.fromRules(CustomGrammarPatternLexer, rules);
121
- }
122
- },
123
- {
124
- key: "fromEntries",
125
- value: function fromEntries(entries) {
126
- return _occamlexers.CommonLexer.fromEntries(CustomGrammarPatternLexer, entries);
127
- }
128
- }
129
- ]);
130
- return CustomGrammarPatternLexer;
131
- }(_occamlexers.CommonLexer);
132
- _define_property(CustomGrammarPatternLexer, "entries", _entries.default);
133
- _define_property(CustomGrammarPatternLexer, "EndOfLineToken", _occamlexers.EndOfLineSignificantToken);
134
- _define_property(CustomGrammarPatternLexer, "WhitespaceToken", _occamlexers.WhitespaceToken);
135
- _define_property(CustomGrammarPatternLexer, "EndOfLineCommentToken", null);
136
- _define_property(CustomGrammarPatternLexer, "SingleLineCommentToken", null);
137
- _define_property(CustomGrammarPatternLexer, "RegularExpressionToken", null);
138
- _define_property(CustomGrammarPatternLexer, "EndOfMultiLineCommentToken", null);
139
- _define_property(CustomGrammarPatternLexer, "StartOfMultiLineCommentToken", null);
140
- _define_property(CustomGrammarPatternLexer, "MiddleOfMultiLineCommentToken", null);
141
- _define_property(CustomGrammarPatternLexer, "SinglyQuotedStringLiteralToken", null);
142
- _define_property(CustomGrammarPatternLexer, "DoublyQuotedStringLiteralToken", null);
143
-
144
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jdXN0b21HcmFtbWFyUGF0dGVybi9sZXhlci5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJcInVzZSBzdHJpY3RcIjtcblxuaW1wb3J0IHsgQ29tbW9uTGV4ZXIsIFdoaXRlc3BhY2VUb2tlbiwgRW5kT2ZMaW5lU2lnbmlmaWNhbnRUb2tlbiB9IGZyb20gXCJvY2NhbS1sZXhlcnNcIjtcblxuaW1wb3J0IGVudHJpZXMgZnJvbSBcIi4vZW50cmllc1wiO1xuXG5leHBvcnQgZGVmYXVsdCBjbGFzcyBDdXN0b21HcmFtbWFyUGF0dGVybkxleGVyIGV4dGVuZHMgQ29tbW9uTGV4ZXIge1xuICBzdGF0aWMgZW50cmllcyA9IGVudHJpZXM7XG5cbiAgc3RhdGljIEVuZE9mTGluZVRva2VuID0gRW5kT2ZMaW5lU2lnbmlmaWNhbnRUb2tlbjtcblxuICBzdGF0aWMgV2hpdGVzcGFjZVRva2VuID0g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kFEbUJGLDJCQUNaTSxXQUFVQSxnQkFBTztBQUV4QixpQkFIbUJOLDJCQUdaTyxrQkFBaUJDLHNDQUF5QjtBQUVqRCxpQkFMbUJSLDJCQUtaUyxtQkFBa0JBLDRCQUFlO0FBRXhDLGlCQVBtQlQsMkJBT1pVLHlCQUF3QjtBQUUvQixpQkFUbUJWLDJCQVNaVywwQkFBeUI7QUFFaEMsaUJBWG1CWCwyQkFXWlksMEJBQXlCO0FBRWhDLGlCQWJtQlosMkJBYVphLDhCQUE2QjtBQUVwQyxpQkFmbUJiLDJCQWVaYyxnQ0FBK0I7QUFFdEMsaUJBakJtQmQsMkJBaUJaZSxpQ0FBZ0M7QUFFdkMsaUJBbkJtQmYsMkJBbUJaZ0Isa0NBQWlDO0FBRXhDLGlCQXJCbUJoQiwyQkFxQlppQixrQ0FBaUMifQ==
@@ -1,16 +0,0 @@
1
- "use strict";
2
-
3
- const bnf = `
4
-
5
-
6
- document ::= ( expression | error )+ ;
7
-
8
-
9
- expression ::= <NO_WHITESPACE>[unassigned]<NO_WHITESPACE><END_OF_LINE> ;
10
-
11
-
12
- error. ::= . ;
13
-
14
- `;
15
-
16
- export default bnf;
@@ -1,22 +0,0 @@
1
- "use strict";
2
-
3
- import { CustomGrammarPatternLexer, CustomGrammarPatternParser } from "../../index"; ///
4
-
5
- import View from "../view";
6
-
7
- export default class CustomGrammarPatternView extends View {
8
- static Lexer = CustomGrammarPatternLexer;
9
-
10
- static Parser = CustomGrammarPatternParser;
11
-
12
- static readOnly = false;
13
-
14
- static initialContent = `adsf
15
-
16
- aadf
17
- `;
18
-
19
- static defaultProperties = {
20
- className: "custom-grammar-pattern"
21
- };
22
- }