occam-grammars 1.0.677 → 1.0.683

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/src/teX/lexer.js CHANGED
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
 
3
- import { WhitespaceToken, EndOfLineNonSignificantToken } from "occam-lexers";
3
+ import { CommonLexer, WhitespaceToken, EndOfLineNonSignificantToken } from "occam-lexers";
4
4
 
5
5
  import entries from "./entries";
6
- import CommonLexer from "../common/lexer";
7
6
 
8
7
  export default class TeXLexer extends CommonLexer {
9
8
  static entries = entries;
package/src/teX/parser.js CHANGED
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
 
3
+ import { CommonParser } from "occam-parsers";
4
+
3
5
  import bnf from "./bnf";
4
- import CommonParser from "../common/parser";
5
6
 
6
7
  export default class TeXParser extends CommonParser {
7
8
  static bnf = bnf;
@@ -1,93 +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 CommonLexer;
9
- }
10
- });
11
- var _occamlexers = require("occam-lexers");
12
- function _assert_this_initialized(self) {
13
- if (self === void 0) {
14
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
15
- }
16
- return self;
17
- }
18
- function _class_call_check(instance, Constructor) {
19
- if (!(instance instanceof Constructor)) {
20
- throw new TypeError("Cannot call a class as a function");
21
- }
22
- }
23
- function _get_prototype_of(o) {
24
- _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
25
- return o.__proto__ || Object.getPrototypeOf(o);
26
- };
27
- return _get_prototype_of(o);
28
- }
29
- function _inherits(subClass, superClass) {
30
- if (typeof superClass !== "function" && superClass !== null) {
31
- throw new TypeError("Super expression must either be null or a function");
32
- }
33
- subClass.prototype = Object.create(superClass && superClass.prototype, {
34
- constructor: {
35
- value: subClass,
36
- writable: true,
37
- configurable: true
38
- }
39
- });
40
- if (superClass) _set_prototype_of(subClass, superClass);
41
- }
42
- function _possible_constructor_return(self, call) {
43
- if (call && (_type_of(call) === "object" || typeof call === "function")) {
44
- return call;
45
- }
46
- return _assert_this_initialized(self);
47
- }
48
- function _set_prototype_of(o, p) {
49
- _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
50
- o.__proto__ = p;
51
- return o;
52
- };
53
- return _set_prototype_of(o, p);
54
- }
55
- function _type_of(obj) {
56
- "@swc/helpers - typeof";
57
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
58
- }
59
- function _is_native_reflect_construct() {
60
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
61
- if (Reflect.construct.sham) return false;
62
- if (typeof Proxy === "function") return true;
63
- try {
64
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
65
- return true;
66
- } catch (e) {
67
- return false;
68
- }
69
- }
70
- function _create_super(Derived) {
71
- var hasNativeReflectConstruct = _is_native_reflect_construct();
72
- return function _createSuperInternal() {
73
- var Super = _get_prototype_of(Derived), result;
74
- if (hasNativeReflectConstruct) {
75
- var NewTarget = _get_prototype_of(this).constructor;
76
- result = Reflect.construct(Super, arguments, NewTarget);
77
- } else {
78
- result = Super.apply(this, arguments);
79
- }
80
- return _possible_constructor_return(this, result);
81
- };
82
- }
83
- var CommonLexer = /*#__PURE__*/ function(CommonLexerBase) {
84
- _inherits(CommonLexer, CommonLexerBase);
85
- var _super = _create_super(CommonLexer);
86
- function CommonLexer() {
87
- _class_call_check(this, CommonLexer);
88
- return _super.apply(this, arguments);
89
- }
90
- return CommonLexer;
91
- }(_occamlexers.CommonLexer);
92
-
93
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb21tb24vbGV4ZXIuanMiXSwic291cmNlc0NvbnRlbnQiOlsiXCJ1c2Ugc3RyaWN0XCI7XG5cbmltcG9ydCB7IENvbW1vbkxleGVyIGFzIENvbW1vbkxleGVyQmFzZSB9IGZyb20gXCJvY2NhbS1sZXhlcnNcIjtcblxuZXhwb3J0IGRlZmF1bHQgY2xhc3MgQ29tbW9uTGV4ZXIgZXh0ZW5kcyBDb21tb25MZXhlckJhc2Uge31cbiJdLCJuYW1lcyI6WyJDb21tb25MZXhlciIsIkNvbW1vbkxleGVyQmFzZSJdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7Ozs7ZUFJcUJBOzs7MkJBRjBCOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFFaEMsSUFBQSxBQUFNQSw0QkFBRCxBQUFMO2NBQU1BOytCQUFBQTthQUFBQTtnQ0FBQUE7OztXQUFBQTtFQUFvQkMsd0JBQWUifQ==
@@ -1,113 +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 CommonParser;
9
- }
10
- });
11
- var _occamparsers = require("occam-parsers");
12
- var _state = /*#__PURE__*/ _interop_require_default(require("../state"));
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 _class_call_check(instance, Constructor) {
20
- if (!(instance instanceof Constructor)) {
21
- throw new TypeError("Cannot call a class as a function");
22
- }
23
- }
24
- function _define_property(obj, key, value) {
25
- if (key in obj) {
26
- Object.defineProperty(obj, key, {
27
- value: value,
28
- enumerable: true,
29
- configurable: true,
30
- writable: true
31
- });
32
- } else {
33
- obj[key] = value;
34
- }
35
- return obj;
36
- }
37
- function _get_prototype_of(o) {
38
- _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
39
- return o.__proto__ || Object.getPrototypeOf(o);
40
- };
41
- return _get_prototype_of(o);
42
- }
43
- function _inherits(subClass, superClass) {
44
- if (typeof superClass !== "function" && superClass !== null) {
45
- throw new TypeError("Super expression must either be null or a function");
46
- }
47
- subClass.prototype = Object.create(superClass && superClass.prototype, {
48
- constructor: {
49
- value: subClass,
50
- writable: true,
51
- configurable: true
52
- }
53
- });
54
- if (superClass) _set_prototype_of(subClass, superClass);
55
- }
56
- function _interop_require_default(obj) {
57
- return obj && obj.__esModule ? obj : {
58
- default: obj
59
- };
60
- }
61
- function _possible_constructor_return(self, call) {
62
- if (call && (_type_of(call) === "object" || typeof call === "function")) {
63
- return call;
64
- }
65
- return _assert_this_initialized(self);
66
- }
67
- function _set_prototype_of(o, p) {
68
- _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
69
- o.__proto__ = p;
70
- return o;
71
- };
72
- return _set_prototype_of(o, p);
73
- }
74
- function _type_of(obj) {
75
- "@swc/helpers - typeof";
76
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
77
- }
78
- function _is_native_reflect_construct() {
79
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
80
- if (Reflect.construct.sham) return false;
81
- if (typeof Proxy === "function") return true;
82
- try {
83
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
84
- return true;
85
- } catch (e) {
86
- return false;
87
- }
88
- }
89
- function _create_super(Derived) {
90
- var hasNativeReflectConstruct = _is_native_reflect_construct();
91
- return function _createSuperInternal() {
92
- var Super = _get_prototype_of(Derived), result;
93
- if (hasNativeReflectConstruct) {
94
- var NewTarget = _get_prototype_of(this).constructor;
95
- result = Reflect.construct(Super, arguments, NewTarget);
96
- } else {
97
- result = Super.apply(this, arguments);
98
- }
99
- return _possible_constructor_return(this, result);
100
- };
101
- }
102
- var CommonParser = /*#__PURE__*/ function(CommonParserBase) {
103
- _inherits(CommonParser, CommonParserBase);
104
- var _super = _create_super(CommonParser);
105
- function CommonParser() {
106
- _class_call_check(this, CommonParser);
107
- return _super.apply(this, arguments);
108
- }
109
- return CommonParser;
110
- }(_occamparsers.CommonParser);
111
- _define_property(CommonParser, "State", _state.default);
112
-
113
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb21tb24vcGFyc2VyLmpzIl0sInNvdXJjZXNDb250ZW50IjpbIlwidXNlIHN0cmljdFwiO1xuXG5pbXBvcnQgeyBDb21tb25QYXJzZXIgYXMgQ29tbW9uUGFyc2VyQmFzZSB9IGZyb20gXCJvY2NhbS1wYXJzZXJzXCI7XG5cbmltcG9ydCBTdGF0ZSBmcm9tIFwiLi4vc3RhdGVcIjtcblxuZXhwb3J0IGRlZmF1bHQgY2xhc3MgQ29tbW9uUGFyc2VyIGV4dGVuZHMgQ29tbW9uUGFyc2VyQmFzZSB7XG4gIHN0YXRpYyBTdGF0ZSA9IFN0YXRlO1xufVxuIl0sIm5hbWVzIjpbIkNvbW1vblBhcnNlciIsIkNvbW1vblBhcnNlckJhc2UiLCJTdGF0ZSJdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7Ozs7ZUFNcUJBOzs7NEJBSjRCOzREQUUvQjs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBRUgsSUFBQSxBQUFNQSw2QkFBRCxBQUFMO2NBQU1BOytCQUFBQTthQUFBQTtnQ0FBQUE7OztXQUFBQTtFQUFxQkMsMEJBQWdCO0FBQ3hELGlCQURtQkQsY0FDWkUsU0FBUUEsY0FBSyJ9
package/lib/state.js DELETED
@@ -1,152 +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 State;
9
- }
10
- });
11
- var _occamparsers = require("occam-parsers");
12
- function _assert_this_initialized(self) {
13
- if (self === void 0) {
14
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
15
- }
16
- return self;
17
- }
18
- function _class_call_check(instance, Constructor) {
19
- if (!(instance instanceof Constructor)) {
20
- throw new TypeError("Cannot call a class as a function");
21
- }
22
- }
23
- function _defineProperties(target, props) {
24
- for(var i = 0; i < props.length; i++){
25
- var descriptor = props[i];
26
- descriptor.enumerable = descriptor.enumerable || false;
27
- descriptor.configurable = true;
28
- if ("value" in descriptor) descriptor.writable = true;
29
- Object.defineProperty(target, descriptor.key, descriptor);
30
- }
31
- }
32
- function _create_class(Constructor, protoProps, staticProps) {
33
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
34
- if (staticProps) _defineProperties(Constructor, staticProps);
35
- return Constructor;
36
- }
37
- function _get(target, property, receiver) {
38
- if (typeof Reflect !== "undefined" && Reflect.get) {
39
- _get = Reflect.get;
40
- } else {
41
- _get = function get(target, property, receiver) {
42
- var base = _super_prop_base(target, property);
43
- if (!base) return;
44
- var desc = Object.getOwnPropertyDescriptor(base, property);
45
- if (desc.get) {
46
- return desc.get.call(receiver || target);
47
- }
48
- return desc.value;
49
- };
50
- }
51
- return _get(target, property, receiver || target);
52
- }
53
- function _get_prototype_of(o) {
54
- _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
55
- return o.__proto__ || Object.getPrototypeOf(o);
56
- };
57
- return _get_prototype_of(o);
58
- }
59
- function _inherits(subClass, superClass) {
60
- if (typeof superClass !== "function" && superClass !== null) {
61
- throw new TypeError("Super expression must either be null or a function");
62
- }
63
- subClass.prototype = Object.create(superClass && superClass.prototype, {
64
- constructor: {
65
- value: subClass,
66
- writable: true,
67
- configurable: true
68
- }
69
- });
70
- if (superClass) _set_prototype_of(subClass, superClass);
71
- }
72
- function _possible_constructor_return(self, call) {
73
- if (call && (_type_of(call) === "object" || typeof call === "function")) {
74
- return call;
75
- }
76
- return _assert_this_initialized(self);
77
- }
78
- function _set_prototype_of(o, p) {
79
- _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
80
- o.__proto__ = p;
81
- return o;
82
- };
83
- return _set_prototype_of(o, p);
84
- }
85
- function _super_prop_base(object, property) {
86
- while(!Object.prototype.hasOwnProperty.call(object, property)){
87
- object = _get_prototype_of(object);
88
- if (object === null) break;
89
- }
90
- return object;
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
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
98
- if (Reflect.construct.sham) return false;
99
- if (typeof Proxy === "function") return true;
100
- try {
101
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
102
- return true;
103
- } catch (e) {
104
- return false;
105
- }
106
- }
107
- function _create_super(Derived) {
108
- var hasNativeReflectConstruct = _is_native_reflect_construct();
109
- return function _createSuperInternal() {
110
- var Super = _get_prototype_of(Derived), result;
111
- if (hasNativeReflectConstruct) {
112
- var NewTarget = _get_prototype_of(this).constructor;
113
- result = Reflect.construct(Super, arguments, NewTarget);
114
- } else {
115
- result = Super.apply(this, arguments);
116
- }
117
- return _possible_constructor_return(this, result);
118
- };
119
- }
120
- var State = /*#__PURE__*/ function(StateBase) {
121
- _inherits(State, StateBase);
122
- var _super = _create_super(State);
123
- function State(index, tokens, ruleMap, precedence, startOfContent) {
124
- _class_call_check(this, State);
125
- var _this;
126
- _this = _super.call(this, index, tokens, ruleMap, precedence, startOfContent);
127
- _this.startOfContent = startOfContent;
128
- return _this;
129
- }
130
- _create_class(State, [
131
- {
132
- key: "isAtStartOfContent",
133
- value: function isAtStartOfContent() {
134
- var atStartOfContent = false;
135
- if (this.startOfContent) {
136
- atStartOfContent = _get(_get_prototype_of(State.prototype), "isAtStartOfContent", this).call(this);
137
- }
138
- return atStartOfContent;
139
- }
140
- }
141
- ], [
142
- {
143
- key: "fromTokensAndRuleMap",
144
- value: function fromTokensAndRuleMap(tokens, ruleMap, startOfContent) {
145
- return _occamparsers.State.fromTokensAndRuleMap(State, tokens, ruleMap, startOfContent);
146
- }
147
- }
148
- ]);
149
- return State;
150
- }(_occamparsers.State);
151
-
152
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9zdGF0ZS5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJcInVzZSBzdHJpY3RcIjtcblxuaW1wb3J0IHsgU3RhdGUgYXMgU3RhdGVCYXNlIH0gZnJvbSBcIm9jY2FtLXBhcnNlcnNcIjtcblxuZXhwb3J0IGRlZmF1bHQgY2xhc3MgU3RhdGUgZXh0ZW5kcyBTdGF0ZUJhc2Uge1xuICBjb25zdHJ1Y3RvcihpbmRleCwgdG9rZW5zLCBydWxlTWFwLCBwcmVjZWRlbmNlLCBzdGFydE9mQ29udGVudCkge1xuICAgIHN1cGVyKGluZGV4LCB0b2tlbnMsIHJ1bGVNYXAsIHByZWNlZGVuY2UsIHN0YXJ0T2ZDb250ZW50KTtcblxuICAgIHRoaXMuc3RhcnRPZkNvbnRlbnQgPSBzdGFydE9mQ29udGVudDtcbiAgfVxuXG4gIGlzQXRTdGFydE9mQ29udGVudCgpIHtcbiAgICBsZXQgYXRTdGFydE9mQ29udGVudCA9IGZhbHNlO1xuXG4gICAgaWYgKHRoaXMuc3RhcnRPZkNvbnRlbnQpIHtcbiAgICAgIGF0U3RhcnRPZkNvbnRlbnQgPSBzdXBlci5pc0F0U3RhcnRPZkNvbnRlbnQoKTtcbiAgICB9XG5cbiAgICByZXR1cm4gYXRTdGFydE9mQ29udGVudDtcbiAgfVxuXG4gIHN0YXRpYyBmcm9tVG9rZW5zQW5kUnVsZU1hcCh0b2tlbnMsIHJ1bGVNYXAsIHN0YXJ0T2ZDb250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UVDLE9BQU8sRUFBRUUsY0FBYztnQkFBSSxPQUFPSSxtQkFBUyxDQUFDRCxvQkFBb0IsQ0FqQmpGUixPQWlCeUZFLFFBQVFDLFNBQVNFO1lBQWlCOzs7V0FqQjNITDtFQUFjUyxtQkFBUyJ9
@@ -1,5 +0,0 @@
1
- "use strict";
2
-
3
- import { CommonLexer as CommonLexerBase } from "occam-lexers";
4
-
5
- export default class CommonLexer extends CommonLexerBase {}
@@ -1,9 +0,0 @@
1
- "use strict";
2
-
3
- import { CommonParser as CommonParserBase } from "occam-parsers";
4
-
5
- import State from "../state";
6
-
7
- export default class CommonParser extends CommonParserBase {
8
- static State = State;
9
- }
package/src/state.js DELETED
@@ -1,23 +0,0 @@
1
- "use strict";
2
-
3
- import { State as StateBase } from "occam-parsers";
4
-
5
- export default class State extends StateBase {
6
- constructor(index, tokens, ruleMap, precedence, startOfContent) {
7
- super(index, tokens, ruleMap, precedence, startOfContent);
8
-
9
- this.startOfContent = startOfContent;
10
- }
11
-
12
- isAtStartOfContent() {
13
- let atStartOfContent = false;
14
-
15
- if (this.startOfContent) {
16
- atStartOfContent = super.isAtStartOfContent();
17
- }
18
-
19
- return atStartOfContent;
20
- }
21
-
22
- static fromTokensAndRuleMap(tokens, ruleMap, startOfContent) { return StateBase.fromTokensAndRuleMap(State, tokens, ruleMap, startOfContent); }
23
- }