precedent 1.0.7 → 1.0.8

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 (45) hide show
  1. package/.config/code-server/config.yaml +1 -1
  2. package/.config/configstore/update-notifier-npm.json +1 -1
  3. package/Dockerfile_LUXURYCode +69 -0
  4. package/dist/precedent.js +302 -307
  5. package/dist/precedent.min.js +29 -27
  6. package/dist/precedent.min.js.map +1 -1
  7. package/gulpfile.js +36 -15
  8. package/package.json +26 -12
  9. package/source/Precedent-Browser-Shim.js +5 -9
  10. package/source/StringParser.js +1 -1
  11. package/source/WordTree.js +7 -7
  12. package/test/Precedent_tests.js +106 -0
  13. package/test.js +1 -0
  14. package/.config/luxury-extras/.vscode/launch.json +0 -46
  15. package/.config/luxury-extras/Dockerfile +0 -32
  16. package/.config/luxury-extras/Dockerfile_LUXURYCode +0 -45
  17. package/.config/luxury-extras/MySQL/Dockerfile +0 -51
  18. package/.config/luxury-extras/MySQL/Dockerfile_LUXURYCODE +0 -65
  19. package/.config/luxury-extras/MySQL/MySQL-Laden-Entry.sh +0 -17
  20. package/.config/luxury-extras/MySQL/MySQL-Security.sql +0 -5
  21. package/.config/luxury-extras/model/ddl/BookStore.ddl +0 -66
  22. package/.config/luxury-extras/model/documentation/Dictionary.md +0 -18
  23. package/.config/luxury-extras/model/documentation/Model-Author.md +0 -20
  24. package/.config/luxury-extras/model/documentation/Model-Book.md +0 -26
  25. package/.config/luxury-extras/model/documentation/Model-BookAuthorJoin.md +0 -14
  26. package/.config/luxury-extras/model/documentation/Model-BookPrice.md +0 -25
  27. package/.config/luxury-extras/model/documentation/Model-Review.md +0 -22
  28. package/.config/luxury-extras/model/documentation/ModelChangeTracking.md +0 -17
  29. package/.config/luxury-extras/model/documentation/README.md +0 -1
  30. package/.config/luxury-extras/model/documentation/diagram/README.md +0 -1
  31. package/.config/luxury-extras/model/documentation/diagram/Stricture_Output.dot +0 -13
  32. package/.config/luxury-extras/model/documentation/diagram/Stricture_Output.png +0 -0
  33. package/.config/luxury-extras/model/json_schema_entities/BookStore-MeadowSchema-Author.json +0 -220
  34. package/.config/luxury-extras/model/json_schema_entities/BookStore-MeadowSchema-Book.json +0 -268
  35. package/.config/luxury-extras/model/json_schema_entities/BookStore-MeadowSchema-BookAuthorJoin.json +0 -172
  36. package/.config/luxury-extras/model/json_schema_entities/BookStore-MeadowSchema-BookPrice.json +0 -260
  37. package/.config/luxury-extras/model/json_schema_entities/BookStore-MeadowSchema-Review.json +0 -236
  38. package/.config/luxury-extras/model/json_schema_entities/README.md +0 -1
  39. package/.config/luxury-extras/model/json_schema_model/BookStore-Extended.json +0 -915
  40. package/.config/luxury-extras/model/json_schema_model/BookStore-PICT.json +0 -1
  41. package/.config/luxury-extras/model/json_schema_model/BookStore.json +0 -280
  42. package/.config/luxury-extras/model/json_schema_model/README.md +0 -1
  43. package/.config/luxury-extras/model/mysql_create/BookStore-CreateDatabase.mysql.sql +0 -116
  44. package/.config/luxury-extras/model/mysql_create/README.md +0 -1
  45. package/DockerfileLUXURYCode +0 -45
package/dist/precedent.js CHANGED
@@ -1,322 +1,317 @@
1
- (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Precedent = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
2
- /**
3
- * @license MIT
4
- * @author <steven@velozo.com>
5
- */
1
+ (function (f) {
2
+ if (typeof exports === "object" && typeof module !== "undefined") {
3
+ module.exports = f();
4
+ } else if (typeof define === "function" && define.amd) {
5
+ define([], f);
6
+ } else {
7
+ var g;
8
+ if (typeof window !== "undefined") {
9
+ g = window;
10
+ } else if (typeof global !== "undefined") {
11
+ g = global;
12
+ } else if (typeof self !== "undefined") {
13
+ g = self;
14
+ } else {
15
+ g = this;
16
+ }
17
+ g.Precedent = f();
18
+ }
19
+ })(function () {
20
+ var define, module, exports;
21
+ return function () {
22
+ function r(e, n, t) {
23
+ function o(i, f) {
24
+ if (!n[i]) {
25
+ if (!e[i]) {
26
+ var c = "function" == typeof require && require;
27
+ if (!f && c) return c(i, !0);
28
+ if (u) return u(i, !0);
29
+ var a = new Error("Cannot find module '" + i + "'");
30
+ throw a.code = "MODULE_NOT_FOUND", a;
31
+ }
32
+ var p = n[i] = {
33
+ exports: {}
34
+ };
35
+ e[i][0].call(p.exports, function (r) {
36
+ var n = e[i][1][r];
37
+ return o(n || r);
38
+ }, p, p.exports, r, e, n, t);
39
+ }
40
+ return n[i].exports;
41
+ }
42
+ for (var u = "function" == typeof require && require, i = 0; i < t.length; i++) o(t[i]);
43
+ return o;
44
+ }
45
+ return r;
46
+ }()({
47
+ 1: [function (require, module, exports) {
48
+ /**
49
+ * Simple browser shim loader - assign the npm module to a window global automatically
50
+ *
51
+ * @license MIT
52
+ * @author <steven@velozo.com>
53
+ */
54
+ var libNPMModuleWrapper = require('./Precedent.js');
55
+ if (typeof window == 'object' && !window.hasOwnProperty('Precedent')) {
56
+ window.Precedent = libNPMModuleWrapper;
57
+ }
58
+ module.exports = libNPMModuleWrapper;
59
+ }, {
60
+ "./Precedent.js": 2
61
+ }],
62
+ 2: [function (require, module, exports) {
63
+ /**
64
+ * Precedent Meta-Templating
65
+ *
66
+ * @license MIT
67
+ *
68
+ * @author Steven Velozo <steven@velozo.com>
69
+ *
70
+ * @description Process text streams, parsing out meta-template expressions.
71
+ */
72
+ var libWordTree = require(`./WordTree.js`);
73
+ var libStringParser = require(`./StringParser.js`);
74
+ class Precedent {
75
+ /**
76
+ * Precedent Constructor
77
+ */
78
+ constructor() {
79
+ this.WordTree = new libWordTree();
80
+ this.StringParser = new libStringParser();
81
+ this.ParseTree = this.WordTree.ParseTree;
82
+ }
6
83
 
7
- /**
8
- * Precedent browser shim loader
9
- */
84
+ /**
85
+ * Add a Pattern to the Parse Tree
86
+ * @method addPattern
87
+ * @param {Object} pTree - A node on the parse tree to push the characters into
88
+ * @param {string} pPattern - The string to add to the tree
89
+ * @param {number} pIndex - callback function
90
+ * @return {bool} True if adding the pattern was successful
91
+ */
92
+ addPattern(pPatternStart, pPatternEnd, pParser) {
93
+ return this.WordTree.addPattern(pPatternStart, pPatternEnd, pParser);
94
+ }
10
95
 
11
- // Load the precedent module into the browser global automatically.
12
- var libPrecedent = require('./Precedent.js');
96
+ /**
97
+ * Parse a string with the existing parse tree
98
+ * @method parseString
99
+ * @param {string} pString - The string to parse
100
+ * @return {string} The result from the parser
101
+ */
102
+ parseString(pString) {
103
+ return this.StringParser.parseString(pString, this.ParseTree);
104
+ }
105
+ }
106
+ module.exports = Precedent;
107
+ }, {
108
+ "./StringParser.js": 3,
109
+ "./WordTree.js": 4
110
+ }],
111
+ 3: [function (require, module, exports) {
112
+ /**
113
+ * String Parser
114
+ *
115
+ * @license MIT
116
+ *
117
+ * @author Steven Velozo <steven@velozo.com>
118
+ *
119
+ * @description Parse a string, properly processing each matched token in the word tree.
120
+ */
13
121
 
14
- if ((typeof(window) == 'object') && (!window.hasOwnProperty('Precedent')))
15
- {
16
- window.Precedent = libPrecedent;
17
- }
122
+ class StringParser {
123
+ /**
124
+ * StringParser Constructor
125
+ */
126
+ constructor() {}
18
127
 
19
- module.exports = libPrecedent;
20
- },{"./Precedent.js":2}],2:[function(require,module,exports){
21
- /**
22
- * Precedent Meta-Templating
23
- *
24
- * @license MIT
25
- *
26
- * @author Steven Velozo <steven@velozo.com>
27
- *
28
- * @description Process text streams, parsing out meta-template expressions.
29
- */
30
- var libWordTree = require(`./WordTree.js`);
31
- var libStringParser = require(`./StringParser.js`);
128
+ /**
129
+ * Create a fresh parsing state object to work with.
130
+ * @method newParserState
131
+ * @param {Object} pParseTree - A node on the parse tree to begin parsing from (usually root)
132
+ * @return {Object} A new parser state object for running a character parser on
133
+ * @private
134
+ */
135
+ newParserState(pParseTree) {
136
+ return {
137
+ ParseTree: pParseTree,
138
+ Output: '',
139
+ OutputBuffer: '',
140
+ Pattern: false,
141
+ PatternMatch: false,
142
+ PatternMatchOutputBuffer: ''
143
+ };
144
+ }
32
145
 
33
- class Precedent
34
- {
35
- /**
36
- * Precedent Constructor
37
- */
38
- constructor()
39
- {
40
- this.WordTree = new libWordTree();
41
-
42
- this.StringParser = new libStringParser();
146
+ /**
147
+ * Assign a node of the parser tree to be the next potential match.
148
+ * If the node has a PatternEnd property, it is a valid match and supercedes the last valid match (or becomes the initial match).
149
+ * @method assignNode
150
+ * @param {Object} pNode - A node on the parse tree to assign
151
+ * @param {Object} pParserState - The state object for the current parsing task
152
+ * @private
153
+ */
154
+ assignNode(pNode, pParserState) {
155
+ pParserState.PatternMatch = pNode;
43
156
 
44
- this.ParseTree = this.WordTree.ParseTree;
45
- }
46
-
47
- /**
48
- * Add a Pattern to the Parse Tree
49
- * @method addPattern
50
- * @param {Object} pTree - A node on the parse tree to push the characters into
51
- * @param {string} pPattern - The string to add to the tree
52
- * @param {number} pIndex - callback function
53
- * @return {bool} True if adding the pattern was successful
54
- */
55
- addPattern(pPatternStart, pPatternEnd, pParser)
56
- {
57
- return this.WordTree.addPattern(pPatternStart, pPatternEnd, pParser);
58
- }
59
-
60
- /**
61
- * Parse a string with the existing parse tree
62
- * @method parseString
63
- * @param {string} pString - The string to parse
64
- * @return {string} The result from the parser
65
- */
66
- parseString(pString)
67
- {
68
- return this.StringParser.parseString(pString, this.ParseTree);
69
- }
70
- }
157
+ // If the pattern has a END we can assume it has a parse function...
158
+ if (pParserState.PatternMatch.hasOwnProperty('PatternEnd')) {
159
+ // ... this is the legitimate start of a pattern.
160
+ pParserState.Pattern = pParserState.PatternMatch;
161
+ }
162
+ }
71
163
 
72
- module.exports = Precedent;
164
+ /**
165
+ * Append a character to the output buffer in the parser state.
166
+ * This output buffer is used when a potential match is being explored, or a match is being explored.
167
+ * @method appendOutputBuffer
168
+ * @param {string} pCharacter - The character to append
169
+ * @param {Object} pParserState - The state object for the current parsing task
170
+ * @private
171
+ */
172
+ appendOutputBuffer(pCharacter, pParserState) {
173
+ pParserState.OutputBuffer += pCharacter;
174
+ }
73
175
 
74
- },{"./StringParser.js":3,"./WordTree.js":4}],3:[function(require,module,exports){
75
- /**
76
- * String Parser
77
- *
78
- * @license MIT
79
- *
80
- * @author Steven Velozo <steven@velozo.com>
81
- *
82
- * @description Parse a string, properly processing each matched token in the word tree.
83
- */
176
+ /**
177
+ * Flush the output buffer to the output and clear it.
178
+ * @method flushOutputBuffer
179
+ * @param {Object} pParserState - The state object for the current parsing task
180
+ * @private
181
+ */
182
+ flushOutputBuffer(pParserState) {
183
+ pParserState.Output += pParserState.OutputBuffer;
184
+ pParserState.OutputBuffer = '';
185
+ }
84
186
 
85
- class StringParser
86
- {
87
- /**
88
- * StringParser Constructor
89
- */
90
- constructor()
91
- {
92
- }
93
-
94
- /**
95
- * Create a fresh parsing state object to work with.
96
- * @method newParserState
97
- * @param {Object} pParseTree - A node on the parse tree to begin parsing from (usually root)
98
- * @return {Object} A new parser state object for running a character parser on
99
- * @private
100
- */
101
- newParserState (pParseTree)
102
- {
103
- return (
104
- {
105
- ParseTree: pParseTree,
187
+ /**
188
+ * Check if the pattern has ended. If it has, properly flush the buffer and start looking for new patterns.
189
+ * @method checkPatternEnd
190
+ * @param {Object} pParserState - The state object for the current parsing task
191
+ * @private
192
+ */
193
+ checkPatternEnd(pParserState) {
194
+ if (pParserState.OutputBuffer.length >= pParserState.Pattern.PatternEnd.length + pParserState.Pattern.PatternStart.length && pParserState.OutputBuffer.substr(-pParserState.Pattern.PatternEnd.length) === pParserState.Pattern.PatternEnd) {
195
+ // ... this is the end of a pattern, cut off the end tag and parse it.
196
+ // Trim the start and end tags off the output buffer now
197
+ pParserState.OutputBuffer = pParserState.Pattern.Parse(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStart.length, pParserState.OutputBuffer.length - (pParserState.Pattern.PatternStart.length + pParserState.Pattern.PatternEnd.length)));
198
+ // Flush the output buffer.
199
+ this.flushOutputBuffer(pParserState);
200
+ // End pattern mode
201
+ pParserState.Pattern = false;
202
+ pParserState.PatternMatch = false;
203
+ }
204
+ }
106
205
 
107
- Output: '',
108
- OutputBuffer: '',
206
+ /**
207
+ * Parse a character in the buffer.
208
+ * @method parseCharacter
209
+ * @param {string} pCharacter - The character to append
210
+ * @param {Object} pParserState - The state object for the current parsing task
211
+ * @private
212
+ */
213
+ parseCharacter(pCharacter, pParserState) {
214
+ // (1) If we aren't in a pattern match, and we aren't potentially matching, and this may be the start of a new pattern....
215
+ if (!pParserState.PatternMatch && pParserState.ParseTree.hasOwnProperty(pCharacter)) {
216
+ // ... assign the node as the matched node.
217
+ this.assignNode(pParserState.ParseTree[pCharacter], pParserState);
218
+ this.appendOutputBuffer(pCharacter, pParserState);
219
+ }
220
+ // (2) If we are in a pattern match (actively seeing if this is part of a new pattern token)
221
+ else if (pParserState.PatternMatch) {
222
+ // If the pattern has a subpattern with this key
223
+ if (pParserState.PatternMatch.hasOwnProperty(pCharacter)) {
224
+ // Continue matching patterns.
225
+ this.assignNode(pParserState.PatternMatch[pCharacter], pParserState);
226
+ }
227
+ this.appendOutputBuffer(pCharacter, pParserState);
228
+ if (pParserState.Pattern) {
229
+ // ... Check if this is the end of the pattern (if we are matching a valid pattern)...
230
+ this.checkPatternEnd(pParserState);
231
+ }
232
+ }
233
+ // (3) If we aren't in a pattern match or pattern, and this isn't the start of a new pattern (RAW mode)....
234
+ else {
235
+ pParserState.Output += pCharacter;
236
+ }
237
+ }
109
238
 
110
- Pattern: false,
239
+ /**
240
+ * Parse a string for matches, and process any template segments that occur.
241
+ * @method parseString
242
+ * @param {string} pString - The string to parse.
243
+ * @param {Object} pParseTree - The parse tree to begin parsing from (usually root)
244
+ */
245
+ parseString(pString, pParseTree) {
246
+ let tmpParserState = this.newParserState(pParseTree);
247
+ for (var i = 0; i < pString.length; i++) {
248
+ // TODO: This is not fast.
249
+ this.parseCharacter(pString[i], tmpParserState);
250
+ }
251
+ this.flushOutputBuffer(tmpParserState);
252
+ return tmpParserState.Output;
253
+ }
254
+ }
255
+ module.exports = StringParser;
256
+ }, {}],
257
+ 4: [function (require, module, exports) {
258
+ /**
259
+ * Word Tree
260
+ *
261
+ * @license MIT
262
+ *
263
+ * @author Steven Velozo <steven@velozo.com>
264
+ *
265
+ * @description Create a tree (directed graph) of Javascript objects, one character per object.
266
+ */
111
267
 
112
- PatternMatch: false,
113
- PatternMatchOutputBuffer: ''
114
- });
115
- }
116
-
117
- /**
118
- * Assign a node of the parser tree to be the next potential match.
119
- * If the node has a PatternEnd property, it is a valid match and supercedes the last valid match (or becomes the initial match).
120
- * @method assignNode
121
- * @param {Object} pNode - A node on the parse tree to assign
122
- * @param {Object} pParserState - The state object for the current parsing task
123
- * @private
124
- */
125
- assignNode (pNode, pParserState)
126
- {
127
- pParserState.PatternMatch = pNode;
268
+ class WordTree {
269
+ /**
270
+ * WordTree Constructor
271
+ */
272
+ constructor() {
273
+ this.ParseTree = {};
274
+ }
128
275
 
129
- // If the pattern has a END we can assume it has a parse function...
130
- if (pParserState.PatternMatch.hasOwnProperty('PatternEnd'))
131
- {
132
- // ... this is the legitimate start of a pattern.
133
- pParserState.Pattern = pParserState.PatternMatch;
134
- }
135
- }
136
-
137
- /**
138
- * Append a character to the output buffer in the parser state.
139
- * This output buffer is used when a potential match is being explored, or a match is being explored.
140
- * @method appendOutputBuffer
141
- * @param {string} pCharacter - The character to append
142
- * @param {Object} pParserState - The state object for the current parsing task
143
- * @private
144
- */
145
- appendOutputBuffer (pCharacter, pParserState)
146
- {
147
- pParserState.OutputBuffer += pCharacter;
148
- }
149
-
150
- /**
151
- * Flush the output buffer to the output and clear it.
152
- * @method flushOutputBuffer
153
- * @param {Object} pParserState - The state object for the current parsing task
154
- * @private
155
- */
156
- flushOutputBuffer (pParserState)
157
- {
158
- pParserState.Output += pParserState.OutputBuffer;
159
- pParserState.OutputBuffer = '';
160
- }
276
+ /**
277
+ * Add a child character to a Parse Tree node
278
+ * @method addChild
279
+ * @param {Object} pTree - A parse tree to push the characters into
280
+ * @param {string} pPattern - The string to add to the tree
281
+ * @param {number} pIndex - callback function
282
+ * @returns {Object} The resulting leaf node that was added (or found)
283
+ * @private
284
+ */
285
+ addChild(pTree, pPattern, pIndex) {
286
+ if (pIndex > pPattern.length) return pTree;
287
+ if (!pTree.hasOwnProperty(pPattern[pIndex])) pTree[pPattern[pIndex]] = {};
288
+ return pTree[pPattern[pIndex]];
289
+ }
161
290
 
162
-
163
- /**
164
- * Check if the pattern has ended. If it has, properly flush the buffer and start looking for new patterns.
165
- * @method checkPatternEnd
166
- * @param {Object} pParserState - The state object for the current parsing task
167
- * @private
168
- */
169
- checkPatternEnd (pParserState)
170
- {
171
- if ((pParserState.OutputBuffer.length >= pParserState.Pattern.PatternEnd.length+pParserState.Pattern.PatternStart.length) &&
172
- (pParserState.OutputBuffer.substr(-pParserState.Pattern.PatternEnd.length) === pParserState.Pattern.PatternEnd))
173
- {
174
- // ... this is the end of a pattern, cut off the end tag and parse it.
175
- // Trim the start and end tags off the output buffer now
176
- pParserState.OutputBuffer = pParserState.Pattern.Parse(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStart.length, pParserState.OutputBuffer.length - (pParserState.Pattern.PatternStart.length+pParserState.Pattern.PatternEnd.length)));
177
- // Flush the output buffer.
178
- this.flushOutputBuffer(pParserState);
179
- // End pattern mode
180
- pParserState.Pattern = false;
181
- pParserState.PatternMatch = false;
182
- }
183
- }
184
-
185
- /**
186
- * Parse a character in the buffer.
187
- * @method parseCharacter
188
- * @param {string} pCharacter - The character to append
189
- * @param {Object} pParserState - The state object for the current parsing task
190
- * @private
191
- */
192
- parseCharacter (pCharacter, pParserState)
193
- {
194
- // (1) If we aren't in a pattern match, and we aren't potentially matching, and this may be the start of a new pattern....
195
- if (!pParserState.PatternMatch && pParserState.ParseTree.hasOwnProperty(pCharacter))
196
- {
197
- // ... assign the node as the matched node.
198
- this.assignNode(pParserState.ParseTree[pCharacter], pParserState);
199
- this.appendOutputBuffer(pCharacter, pParserState);
200
- }
201
- // (2) If we are in a pattern match (actively seeing if this is part of a new pattern token)
202
- else if (pParserState.PatternMatch)
203
- {
204
- // If the pattern has a subpattern with this key
205
- if (pParserState.PatternMatch.hasOwnProperty(pCharacter))
206
- {
207
- // Continue matching patterns.
208
- this.assignNode(pParserState.PatternMatch[pCharacter], pParserState);
209
- }
210
- this.appendOutputBuffer(pCharacter, pParserState);
211
- if (pParserState.Pattern)
212
- {
213
- // ... Check if this is the end of the pattern (if we are matching a valid pattern)...
214
- this.checkPatternEnd(pParserState);
215
- }
216
- }
217
- // (3) If we aren't in a pattern match or pattern, and this isn't the start of a new pattern (RAW mode)....
218
- else
219
- {
220
- pParserState.Output += pCharacter;
221
- }
222
- }
223
-
224
- /**
225
- * Parse a string for matches, and process any template segments that occur.
226
- * @method parseString
227
- * @param {string} pString - The string to parse.
228
- * @param {Object} pParseTree - The parse tree to begin parsing from (usually root)
229
- */
230
- parseString (pString, pParseTree)
231
- {
232
- let tmpParserState = this.newParserState(pParseTree);
291
+ /** Add a Pattern to the Parse Tree
292
+ * @method addPattern
293
+ * @param {Object} pTree - A node on the parse tree to push the characters into
294
+ * @param {string} pPattern - The string to add to the tree
295
+ * @param {number} pIndex - callback function
296
+ * @return {bool} True if adding the pattern was successful
297
+ */
298
+ addPattern(pPatternStart, pPatternEnd, pParser) {
299
+ if (pPatternStart.length < 1) return false;
300
+ let tmpLeaf = this.ParseTree;
233
301
 
234
- for (var i = 0; i < pString.length; i++)
235
- {
236
- // TODO: This is not fast.
237
- this.parseCharacter(pString[i], tmpParserState);
238
- }
239
-
240
- this.flushOutputBuffer(tmpParserState);
241
-
242
- return tmpParserState.Output;
243
- }
244
- }
245
-
246
- module.exports = StringParser;
247
-
248
- },{}],4:[function(require,module,exports){
249
- /**
250
- * Word Tree
251
- *
252
- * @license MIT
253
- *
254
- * @author Steven Velozo <steven@velozo.com>
255
- *
256
- * @description Create a tree (directed graph) of Javascript objects, one character per object.
257
- */
258
-
259
- class WordTree
260
- {
261
- /**
262
- * WordTree Constructor
263
- */
264
- constructor()
265
- {
266
- this.ParseTree = {};
267
- }
268
-
269
- /**
270
- * Add a child character to a Parse Tree node
271
- * @method addChild
272
- * @param {Object} pTree - A parse tree to push the characters into
273
- * @param {string} pPattern - The string to add to the tree
274
- * @param {number} pIndex - callback function
275
- * @returns {Object} The resulting leaf node that was added (or found)
276
- * @private
277
- */
278
- addChild (pTree, pPattern, pIndex)
279
- {
280
- if (pIndex > pPattern.length)
281
- return pTree;
282
-
283
- if (!pTree.hasOwnProperty(pPattern[pIndex]))
284
- pTree[pPattern[pIndex]] = {};
285
-
286
- return pTree[pPattern[pIndex]];
287
- }
288
-
289
- /** Add a Pattern to the Parse Tree
290
- * @method addPattern
291
- * @param {Object} pTree - A node on the parse tree to push the characters into
292
- * @param {string} pPattern - The string to add to the tree
293
- * @param {number} pIndex - callback function
294
- * @return {bool} True if adding the pattern was successful
295
- */
296
- addPattern (pPatternStart, pPatternEnd, pParser)
297
- {
298
- if (pPatternStart.length < 1)
299
- return false;
300
-
301
- let tmpLeaf = this.ParseTree;
302
-
303
- // Add the tree of leaves iteratively
304
- for (var i = 0; i < pPatternStart.length; i++)
305
- tmpLeaf = this.addChild(tmpLeaf, pPatternStart, i);
306
-
307
- tmpLeaf.PatternStart = pPatternStart;
308
- tmpLeaf.PatternEnd = ((typeof(pPatternEnd) === 'string') && (pPatternEnd.length > 0)) ? pPatternEnd : pPatternStart;
309
- tmpLeaf.Parse = (typeof(pParser) === 'function') ? pParser :
310
- (typeof(pParser) === 'string') ? () => { return pParser; } :
311
- (pData) => { return pData; };
312
-
313
- return true;
314
- }
315
- }
316
-
317
- module.exports = WordTree;
318
-
319
- },{}]},{},[1])(1)
320
- });
321
-
322
- //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJzb3VyY2UvUHJlY2VkZW50LUJyb3dzZXItU2hpbS5qcyIsInNvdXJjZS9QcmVjZWRlbnQuanMiLCJzb3VyY2UvU3RyaW5nUGFyc2VyLmpzIiwic291cmNlL1dvcmRUcmVlLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBO0FDQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQ2pCQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQ3BEQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0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JldHVybiBwUGFyc2VyOyB9IDpcblx0XHRcdFx0XHRcdChwRGF0YSkgPT4geyByZXR1cm4gcERhdGE7IH07XG5cblx0XHRyZXR1cm4gdHJ1ZTtcblx0fVxufVxuXG5tb2R1bGUuZXhwb3J0cyA9IFdvcmRUcmVlO1xuIl19
302
+ // Add the tree of leaves iteratively
303
+ for (var i = 0; i < pPatternStart.length; i++) tmpLeaf = this.addChild(tmpLeaf, pPatternStart, i);
304
+ tmpLeaf.PatternStart = pPatternStart;
305
+ tmpLeaf.PatternEnd = typeof pPatternEnd === 'string' && pPatternEnd.length > 0 ? pPatternEnd : pPatternStart;
306
+ tmpLeaf.Parse = typeof pParser === 'function' ? pParser : typeof pParser === 'string' ? () => {
307
+ return pParser;
308
+ } : pData => {
309
+ return pData;
310
+ };
311
+ return true;
312
+ }
313
+ }
314
+ module.exports = WordTree;
315
+ }, {}]
316
+ }, {}, [1])(1);
317
+ });