From 708685a1a7e11cd6607bb99ed831ec96a5039952 Mon Sep 17 00:00:00 2001 From: Artem Butusov Date: Sun, 26 Mar 2017 22:44:56 -0400 Subject: [PATCH 01/12] add info about alternative lexers --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index e46d7ae..bf97524 100644 --- a/README.md +++ b/README.md @@ -621,3 +621,9 @@ parser.parse(); ## Performance considerations TODO: Add some notes about performance. + +## Alternative Lexers + +- https://github.com/tantaman/lexed.js +- https://github.com/aaditmshah/lexer +- https://github.com/YuhangGe/jslex From 3354f700fd642ca0c094e99bc0dbbba1c7b53909 Mon Sep 17 00:00:00 2001 From: Artem Butusov Date: Mon, 27 Mar 2017 22:21:10 -0400 Subject: [PATCH 02/12] update flex manual reference --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bf97524..aa25340 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ FLEX.JS - Fast lexer (tokenizer, scanner) for JavaScript inspired by FLEX lexer This is a library for creating scanners: programs which recognized lexical patterns in text. It analyzes its input for occurrences of the regular expressions. Whenever it finds one, it executes the corresponding JavaScript code. -This lexer is inspired by well-known FLEX lexer generator for C. See more: https://github.com/westes/flex +This lexer is inspired by well-known FLEX lexer generator for C. See more: http://westes.github.io/flex/manual/ and https://github.com/westes/flex ## What is common between FLEX and FLEX.JS From af6ba264899718bdc5a1c5a3650af8e74fd4089c Mon Sep 17 00:00:00 2001 From: Artem Butusov Date: Mon, 27 Mar 2017 22:26:08 -0400 Subject: [PATCH 03/12] todo fixes --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index aa25340..1593c0a 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,9 @@ This lexer is inspired by well-known FLEX lexer generator for C. See more: http: - yywrap() - EOF rule handling is slightly different (TODO: fix?) - custom output buffer +- NO debug mode (TODO: fix) +- NO trace mode (TODO: fix) +- Track line number (TODO: fix) ## Simple example From f88a3d53ca575ea4d66ae1675f1d7fc153bf1279 Mon Sep 17 00:00:00 2001 From: Artem Butusov Date: Thu, 30 Mar 2017 17:50:19 -0400 Subject: [PATCH 04/12] add multiple rules in state at once --- README.md | 25 +++++++++++++++++++++++++ package.json | 2 +- src/Lexer.js | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1593c0a..d1a3714 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,9 @@ The **rules** section of the lexer configuration contains a series of rules of t ```javascript lexer.addRule(pattern, action); +lexer.addRules(rules); lexer.addStateRule(state, pattern, action); +lexer.addStateRules(state, rules); ``` Lexer defaults and definitions should be added before adding new rules. @@ -547,8 +549,31 @@ while ((token = lexer.lex()) !== Lexer.EOF) { console.log(strings); ``` +Often, such as in some of the examples above, you wind up writing a whole bunch of rules all preceded by the same start condition(s). Flex makes this a little easier and cleaner by introducing a notion of start condition scope. A start condition scope could be defined with `addRules(rules)` or `addStateRules(states, rules)`. + +So, for example, + +```javascript +lexer.addStateRules('ESC', { + '\\n': function () { return '\n'; }, + '\\r': function () { return '\r'; }, + '\\f': function () { return '\f'; }, + '\\0': function () { return '\0'; }, +}); +``` + +is equivalent to: + +```javascript +lexer.addStateRule('ESC', '\\n': function () { return '\n'; }); +lexer.addStateRule('ESC', '\\r': function () { return '\r'; }); +lexer.addStateRule('ESC', '\\f': function () { return '\f'; }); +lexer.addStateRule('ESC', '\\0': function () { return '\0'; }); +``` + Three routines are available for manipulating stacks of start conditions: +- `switchState(newState)` switch to new state and loose previous state value (the same as `begin()`). - `pushState(newState)` pushes the current start condition onto the top of the start condition stack and switches to `newState` as though you had used `begin(newState)` (recall that start condition names are also strings). - `popState()` pops the top of the stack and switches to it via BEGIN. - `topState()` returns the top of the stack without altering the stack's contents. diff --git a/package.json b/package.json index 7b03dc1..c596509 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "flex-js", - "version": "1.0.0", + "version": "1.0.1", "description": "FLEX.JS - Fast lexer (tokenizer, scanner) for JavaScript inspired by FLEX lexer generator", "main": "index.js", "repository": "https://github.com/sormy/flex-js.git", diff --git a/src/Lexer.js b/src/Lexer.js index ec3c048..998f520 100644 --- a/src/Lexer.js +++ b/src/Lexer.js @@ -242,6 +242,21 @@ Lexer.prototype.addStateRule = function (states, expression, action) { } }; +/** + * Add multiple rules into one or more states at once. + * + * @param {string[]|string} states Single state or state array, case sensitive. + * @param {Object} rules Key is an expression, value is action. + * + * @public + */ +Lexer.prototype.addStateRules = function (states, rules) { + for (var expression in rules) { + var action = rules[expression]; + this.addStateRule(states, expression, action); + } +}; + /** * Add rule without explicit state. * @@ -257,6 +272,20 @@ Lexer.prototype.addRule = function (expression, action) { this.addStateRule(undefined, expression, action); }; +/** + * Add multiple rules without explicit state. + * + * @param {Object} rules Key is an expression, value is action. + * + * @public + */ +Lexer.prototype.addRules = function (rules) { + for (var expression in rules) { + var action = rules[expression]; + this.addRule(expression, action); + } +}; + /** * Set source text string to lex. * @@ -449,6 +478,17 @@ Lexer.prototype.popState = function () { this.begin(oldState); }; +/** + * Switch state. + * + * @param {string} [newState] Switch to specific state or initial if omitted. + * + * @public + */ +Lexer.prototype.switchState = function (newState) { + this.begin(newState); +}; + /** * Scan for one token. * From d56a172e4436b20a79d6d229d84e6aa13bd42e0a Mon Sep 17 00:00:00 2001 From: Artem Butusov Date: Thu, 30 Mar 2017 19:47:39 -0400 Subject: [PATCH 05/12] addStateRules() fixes --- README.md | 20 ++++++++++---------- package.json | 2 +- src/Lexer.js | 15 ++++++--------- 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index d1a3714..36d234c 100644 --- a/README.md +++ b/README.md @@ -554,21 +554,21 @@ Often, such as in some of the examples above, you wind up writing a whole bunch So, for example, ```javascript -lexer.addStateRules('ESC', { - '\\n': function () { return '\n'; }, - '\\r': function () { return '\r'; }, - '\\f': function () { return '\f'; }, - '\\0': function () { return '\0'; }, -}); +lexer.addStateRules('ESC', [ + { expression: '\\n', action: function () { return '\n'; } }, + { expression: '\\r', action: function () { return '\r'; } }, + { expression: '\\f', action: function () { return '\f'; } }, + { expression: '\\0', action: function () { return '\0'; } } +]); ``` is equivalent to: ```javascript -lexer.addStateRule('ESC', '\\n': function () { return '\n'; }); -lexer.addStateRule('ESC', '\\r': function () { return '\r'; }); -lexer.addStateRule('ESC', '\\f': function () { return '\f'; }); -lexer.addStateRule('ESC', '\\0': function () { return '\0'; }); +lexer.addStateRule('ESC', '\\n', function () { return '\n'; }); +lexer.addStateRule('ESC', '\\r', function () { return '\r'; }); +lexer.addStateRule('ESC', '\\f', function () { return '\f'; }); +lexer.addStateRule('ESC', '\\0', function () { return '\0'; }); ``` Three routines are available for manipulating stacks of start conditions: diff --git a/package.json b/package.json index c596509..744da7f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "flex-js", - "version": "1.0.1", + "version": "1.0.2", "description": "FLEX.JS - Fast lexer (tokenizer, scanner) for JavaScript inspired by FLEX lexer generator", "main": "index.js", "repository": "https://github.com/sormy/flex-js.git", diff --git a/src/Lexer.js b/src/Lexer.js index 998f520..cdfde1b 100644 --- a/src/Lexer.js +++ b/src/Lexer.js @@ -246,14 +246,14 @@ Lexer.prototype.addStateRule = function (states, expression, action) { * Add multiple rules into one or more states at once. * * @param {string[]|string} states Single state or state array, case sensitive. - * @param {Object} rules Key is an expression, value is action. + * @param {Array} rules Each item should have expression and action keys. * * @public */ Lexer.prototype.addStateRules = function (states, rules) { - for (var expression in rules) { - var action = rules[expression]; - this.addStateRule(states, expression, action); + for (var index in rules) { + var rule = rules[index]; + this.addStateRule(states, rule.expression, rule.action); } }; @@ -275,15 +275,12 @@ Lexer.prototype.addRule = function (expression, action) { /** * Add multiple rules without explicit state. * - * @param {Object} rules Key is an expression, value is action. + * @param {Array} rules Each item should have expression and action keys. * * @public */ Lexer.prototype.addRules = function (rules) { - for (var expression in rules) { - var action = rules[expression]; - this.addRule(expression, action); - } + this.addStateRules(undefined, rules); }; /** From bfcd75c83b803d81f7588eefec65d71fa3db6a09 Mon Sep 17 00:00:00 2001 From: Artem Butusov Date: Fri, 31 Mar 2017 00:05:52 -0400 Subject: [PATCH 06/12] fix EOF detection --- package.json | 2 +- src/Lexer.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 744da7f..5ed778e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "flex-js", - "version": "1.0.2", + "version": "1.0.3", "description": "FLEX.JS - Fast lexer (tokenizer, scanner) for JavaScript inspired by FLEX lexer generator", "main": "index.js", "repository": "https://github.com/sormy/flex-js.git", diff --git a/src/Lexer.js b/src/Lexer.js index cdfde1b..af3bc43 100644 --- a/src/Lexer.js +++ b/src/Lexer.js @@ -569,7 +569,10 @@ Lexer.prototype.scan = function () { this.rejectedRules = []; // rule action could change buffer or position, so EOF state could be changed too - isEOF = this.index >= this.source.length; + // we need revalidate EOF only if EOF was identified before action were executed + if (isEOF) { + isEOF = this.index >= this.source.length; + } return isEOF ? this.terminate() : actionResult; }; From 7cd32628015603ccb3f414a87d8d8f5d63e81cec Mon Sep 17 00:00:00 2001 From: Artem Butusov Date: Fri, 31 Mar 2017 00:18:44 -0400 Subject: [PATCH 07/12] optimization for string rules with fixed width --- src/Lexer.js | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/src/Lexer.js b/src/Lexer.js index af3bc43..6b90d7e 100644 --- a/src/Lexer.js +++ b/src/Lexer.js @@ -187,6 +187,7 @@ Lexer.prototype.addStateRule = function (states, expression, action) { var source; var flags; + var fixedWidth; if (expression === Lexer.RULE_EOF) { source = null; @@ -195,6 +196,7 @@ Lexer.prototype.addStateRule = function (states, expression, action) { throw new Error('Empty expression for rule "' + name + '"'); } source = this.escapeRegExp(expression); + fixedWidth = expression.length; flags = ''; } else if (expression instanceof RegExp) { if (expression.source === '(?:)') { @@ -230,7 +232,8 @@ Lexer.prototype.addStateRule = function (states, expression, action) { hasBOL: hasBOL, hasEOL: hasEOL, isEOF: isEOF, - action: action + action: action, + fixedWidth: fixedWidth // used for weighted match optmization }; for (var index in states) { @@ -517,22 +520,26 @@ Lexer.prototype.scan = function () { break; } } else { - var curMatch = this.execRegExp(rule.expression); - if (curMatch !== undefined) { - var curMatchLength = curMatch.length; - - if (rule.hasBOL) { - curMatchLength++; - } - if (rule.hasEOL) { - curMatchLength++; - } - - if (curMatchLength > matchedValueLength) { - matchedRule = rule; - matchedIndex = index; - matchedValue = curMatch; - matchedValueLength = curMatchLength; + if (rule.fixedWidth === undefined + || rule.fixedWidth > matchedValueLength + ) { + var curMatch = this.execRegExp(rule.expression); + if (curMatch !== undefined) { + var curMatchLength = curMatch.length; + + if (rule.hasBOL) { + curMatchLength++; + } + if (rule.hasEOL) { + curMatchLength++; + } + + if (curMatchLength > matchedValueLength) { + matchedRule = rule; + matchedIndex = index; + matchedValue = curMatch; + matchedValueLength = curMatchLength; + } } } } From d8d65d6b8fd0c41175404c78ce5451771268c855 Mon Sep 17 00:00:00 2001 From: Artem Butusov Date: Fri, 31 Mar 2017 00:23:10 -0400 Subject: [PATCH 08/12] lexAll() method --- src/Lexer.js | 16 ++++++++++++++++ src/Lexer.spec.js | 8 +------- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/Lexer.js b/src/Lexer.js index 6b90d7e..aed3aba 100644 --- a/src/Lexer.js +++ b/src/Lexer.js @@ -315,6 +315,22 @@ Lexer.prototype.lex = function () { return result; }; +/** + * Run lexer until end, collect all tokens into array and return it. + * + * @return {Array} Array of tokens. + * + * @public + */ +Lexer.prototype.lexAll = function () { + var result = []; + var token; + while ((token = this.lex()) !== Lexer.EOF) { + result.push(token); + } + return result; +}; + /** * DISCARD action. * diff --git a/src/Lexer.spec.js b/src/Lexer.spec.js index 44a827c..b41fc58 100644 --- a/src/Lexer.spec.js +++ b/src/Lexer.spec.js @@ -482,13 +482,7 @@ describe('Lexer', function() { ); - var strings = []; - - var token; - while ((token = lexer.lex()) !== Lexer.EOF) { - strings.push(token); - } - + var strings = lexer.lexAll(); expect(strings).to.eql([ 'simple text', From 6474eba1b452cedba05d2527fb5eb169c8fad8bc Mon Sep 17 00:00:00 2001 From: Artem Butusov Date: Fri, 31 Mar 2017 00:42:56 -0400 Subject: [PATCH 09/12] added debug mode --- README.md | 7 ++----- src/Lexer.js | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 36d234c..adbbd8f 100644 --- a/README.md +++ b/README.md @@ -27,8 +27,6 @@ This lexer is inspired by well-known FLEX lexer generator for C. See more: http: - yywrap() - EOF rule handling is slightly different (TODO: fix?) - custom output buffer -- NO debug mode (TODO: fix) -- NO trace mode (TODO: fix) - Track line number (TODO: fix) ## Simple example @@ -98,9 +96,8 @@ Lexer defaults and definitions should be added before adding new rules. ## Options -- Ignore Cae - case sensivity could be set via `setIgnoreCase(false)` or `setIgnoreCase(true)`. By defalt lexer is case sensitive. -- debug mode (TODO) -- trace mode (TODO) +- Ignore Case - case sensivity could be set via `setIgnoreCase(false)` or `setIgnoreCase(true)`. By defalt lexer is case sensitive. +- Debug Mode - debug mode could be enabled with `setDebugEnabled(true)`. In debug mode lexer will output on console state, expression and matched value for each accepted value. - track line number (TODO) - read from stdin or custom file handler without boilerplate (TODO) - echo to stdout, stderr or custom file handler (TODO) diff --git a/src/Lexer.js b/src/Lexer.js index aed3aba..44b519c 100644 --- a/src/Lexer.js +++ b/src/Lexer.js @@ -69,6 +69,7 @@ Lexer.prototype.clear = function () { this.definitions = []; this.rules = {}; this.ignoreCase = false; + this.debugEnabled = false; this.addState(Lexer.STATE_INITIAL); @@ -88,6 +89,19 @@ Lexer.prototype.setIgnoreCase = function (ignoreCase) { this.ignoreCase = ignoreCase; }; +/** + * Set debug enabled. + * + * By default it is disabled. + * + * @param {boolean} debugEnabled + * + * @public + */ +Lexer.prototype.setDebugEnabled = function (debugEnabled) { + this.debugEnabled = debugEnabled; +}; + /** * Add additional state * @@ -561,6 +575,10 @@ Lexer.prototype.scan = function () { } } + if (matchedRule && this.debugEnabled) { + this.logAccept(this.state, matchedRule.expression, matchedValue); + } + this.ruleIndex = matchedIndex; this.text = this.readMore ? this.text : ''; this.readMore = false @@ -600,6 +618,28 @@ Lexer.prototype.scan = function () { return isEOF ? this.terminate() : actionResult; }; +/** + * @private + */ +Lexer.prototype.logAccept = function (state, expression, value) { + console.log( + ' - [' + state + '] accepting rule'+ + ' /' + this.encodeString(expression.source) + '/' + + ' ("' + this.encodeString(value) + '")' + ); +} + +/** + * @private + */ +Lexer.prototype.encodeString = function (s) { + return s.replace(/\r/g, '\\r') + .replace(/\n/g, '\\n') + .replace(/\t/g, '\\t') + .replace(/\f/g, '\\f') + .replace(/\0/g, '\\0'); +}; + /** * @private */ From b7eee65980b24e1105de79bcf2a22e489768ad97 Mon Sep 17 00:00:00 2001 From: Artem Butusov Date: Sun, 2 Apr 2017 01:15:13 -0400 Subject: [PATCH 10/12] bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5ed778e..69f68c7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "flex-js", - "version": "1.0.3", + "version": "1.0.4", "description": "FLEX.JS - Fast lexer (tokenizer, scanner) for JavaScript inspired by FLEX lexer generator", "main": "index.js", "repository": "https://github.com/sormy/flex-js.git", From 29a94731fba9ade916736218b53137a05be4c8a9 Mon Sep 17 00:00:00 2001 From: Artem Butusov Date: Tue, 11 Dec 2018 23:31:35 -0500 Subject: [PATCH 11/12] Update dependencies --- .eslintignore | 1 + .eslintrc.json | 16 ++++ .npmrc | 1 + README.md | 4 + package.json | 14 +-- src/Lexer.js | 4 +- src/Lexer.spec.js | 2 +- yarn.lock | 213 ---------------------------------------------- 8 files changed, 34 insertions(+), 221 deletions(-) create mode 100644 .eslintignore create mode 100644 .eslintrc.json create mode 100644 .npmrc delete mode 100644 yarn.lock diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..889f827 --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +*.spec.js diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..d412350 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,16 @@ +{ + "extends": "eslint:recommended", + "parserOptions": { + "ecmaVersion": 5, + "sourceType": "module" + }, + "env": { + "mocha": true, + "node": true + }, + "rules": { + "no-redeclare": 0, + "no-console": 0, + "quotes": ["error", "single"] + } +} diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..43c97e7 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/README.md b/README.md index adbbd8f..8cb938a 100644 --- a/README.md +++ b/README.md @@ -652,3 +652,7 @@ TODO: Add some notes about performance. - https://github.com/tantaman/lexed.js - https://github.com/aaditmshah/lexer - https://github.com/YuhangGe/jslex + +## License + +MIT diff --git a/package.json b/package.json index 69f68c7..5ca5e39 100644 --- a/package.json +++ b/package.json @@ -1,16 +1,20 @@ { "name": "flex-js", - "version": "1.0.4", + "version": "1.0.5", "description": "FLEX.JS - Fast lexer (tokenizer, scanner) for JavaScript inspired by FLEX lexer generator", "main": "index.js", "repository": "https://github.com/sormy/flex-js.git", "author": "Artem Butusov ", "license": "MIT", "scripts": { - "test": "mocha 'src/**.spec.js'" + "eslint": "eslint 'src/**/*.js'", + "mocha": "mocha 'src/**.spec.js'", + "test": "npm run eslint && npm run mocha", + "prepublishOnly": "npm run test" }, - "dependencies": { - "chai": "^3.5.0", - "mocha": "^3.2.0" + "devDependencies": { + "chai": "^4.2.0", + "eslint": "^5.10.0", + "mocha": "^5.2.0" } } diff --git a/src/Lexer.js b/src/Lexer.js index 44b519c..aa0404b 100644 --- a/src/Lexer.js +++ b/src/Lexer.js @@ -207,14 +207,14 @@ Lexer.prototype.addStateRule = function (states, expression, action) { source = null; } else if (typeof expression === 'string') { if (expression.length === 0) { - throw new Error('Empty expression for rule "' + name + '"'); + throw new Error('Empty expression for rule used in states "' + states.join(', ') + '"'); } source = this.escapeRegExp(expression); fixedWidth = expression.length; flags = ''; } else if (expression instanceof RegExp) { if (expression.source === '(?:)') { - throw new Error('Empty expression for rule "' + name + '"'); + throw new Error('Empty expression for rule used in states "' + states.join(', ') + '"'); } if (expression.flags !== '') { var notSupportedFlags = expression.flags diff --git a/src/Lexer.spec.js b/src/Lexer.spec.js index b41fc58..ffa6edb 100644 --- a/src/Lexer.spec.js +++ b/src/Lexer.spec.js @@ -81,7 +81,7 @@ describe('Lexer', function() { var lexer = new Lexer(); lexer.addDefinition('DIGIT', /[0-9]/); lexer.addRule(/{DIGIT}\.{DIGIT}/); - expect(lexer).with.deep.property('rules.INITIAL.0.expression.source').to.equal('(?:[0-9])\\.(?:[0-9])'); + expect(lexer).with.deep.nested.property('rules.INITIAL.0.expression.source').to.equal('(?:[0-9])\\.(?:[0-9])'); }); it('#lex() - echo all', function() { diff --git a/yarn.lock b/yarn.lock deleted file mode 100644 index b3e122e..0000000 --- a/yarn.lock +++ /dev/null @@ -1,213 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -assertion-error@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.0.2.tgz#13ca515d86206da0bac66e834dd397d87581094c" - -balanced-match@^0.4.1: - version "0.4.2" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-0.4.2.tgz#cb3f3e3c732dc0f01ee70b403f302e61d7709838" - -brace-expansion@^1.0.0: - version "1.1.6" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.6.tgz#7197d7eaa9b87e648390ea61fc66c84427420df9" - dependencies: - balanced-match "^0.4.1" - concat-map "0.0.1" - -browser-stdout@1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.0.tgz#f351d32969d32fa5d7a5567154263d928ae3bd1f" - -chai@^3.5.0: - version "3.5.0" - resolved "https://registry.yarnpkg.com/chai/-/chai-3.5.0.tgz#4d02637b067fe958bdbfdd3a40ec56fef7373247" - dependencies: - assertion-error "^1.0.1" - deep-eql "^0.1.3" - type-detect "^1.0.0" - -commander@2.9.0: - version "2.9.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4" - dependencies: - graceful-readlink ">= 1.0.0" - -concat-map@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" - -debug@2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.2.0.tgz#f87057e995b1a1f6ae6a4960664137bc56f039da" - dependencies: - ms "0.7.1" - -deep-eql@^0.1.3: - version "0.1.3" - resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-0.1.3.tgz#ef558acab8de25206cd713906d74e56930eb69f2" - dependencies: - type-detect "0.1.1" - -diff@1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/diff/-/diff-1.4.0.tgz#7f28d2eb9ee7b15a97efd89ce63dcfdaa3ccbabf" - -escape-string-regexp@1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" - -fs.realpath@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" - -glob@7.0.5: - version "7.0.5" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.0.5.tgz#b4202a69099bbb4d292a7c1b95b6682b67ebdc95" - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.2" - once "^1.3.0" - path-is-absolute "^1.0.0" - -"graceful-readlink@>= 1.0.0": - version "1.0.1" - resolved "https://registry.yarnpkg.com/graceful-readlink/-/graceful-readlink-1.0.1.tgz#4cafad76bc62f02fa039b2f94e9a3dd3a391a725" - -growl@1.9.2: - version "1.9.2" - resolved "https://registry.yarnpkg.com/growl/-/growl-1.9.2.tgz#0ea7743715db8d8de2c5ede1775e1b45ac85c02f" - -has-flag@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa" - -inflight@^1.0.4: - version "1.0.6" - resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" - dependencies: - once "^1.3.0" - wrappy "1" - -inherits@2: - version "2.0.3" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" - -json3@3.3.2: - version "3.3.2" - resolved "https://registry.yarnpkg.com/json3/-/json3-3.3.2.tgz#3c0434743df93e2f5c42aee7b19bcb483575f4e1" - -lodash._baseassign@^3.0.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz#8c38a099500f215ad09e59f1722fd0c52bfe0a4e" - dependencies: - lodash._basecopy "^3.0.0" - lodash.keys "^3.0.0" - -lodash._basecopy@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz#8da0e6a876cf344c0ad8a54882111dd3c5c7ca36" - -lodash._basecreate@^3.0.0: - version "3.0.3" - resolved "https://registry.yarnpkg.com/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz#1bc661614daa7fc311b7d03bf16806a0213cf821" - -lodash._getnative@^3.0.0: - version "3.9.1" - resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5" - -lodash._isiterateecall@^3.0.0: - version "3.0.9" - resolved "https://registry.yarnpkg.com/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz#5203ad7ba425fae842460e696db9cf3e6aac057c" - -lodash.create@3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/lodash.create/-/lodash.create-3.1.1.tgz#d7f2849f0dbda7e04682bb8cd72ab022461debe7" - dependencies: - lodash._baseassign "^3.0.0" - lodash._basecreate "^3.0.0" - lodash._isiterateecall "^3.0.0" - -lodash.isarguments@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz#2f573d85c6a24289ff00663b491c1d338ff3458a" - -lodash.isarray@^3.0.0: - version "3.0.4" - resolved "https://registry.yarnpkg.com/lodash.isarray/-/lodash.isarray-3.0.4.tgz#79e4eb88c36a8122af86f844aa9bcd851b5fbb55" - -lodash.keys@^3.0.0: - version "3.1.2" - resolved "https://registry.yarnpkg.com/lodash.keys/-/lodash.keys-3.1.2.tgz#4dbc0472b156be50a0b286855d1bd0b0c656098a" - dependencies: - lodash._getnative "^3.0.0" - lodash.isarguments "^3.0.0" - lodash.isarray "^3.0.0" - -minimatch@^3.0.2: - version "3.0.3" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.3.tgz#2a4e4090b96b2db06a9d7df01055a62a77c9b774" - dependencies: - brace-expansion "^1.0.0" - -minimist@0.0.8: - version "0.0.8" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" - -mkdirp@0.5.1: - version "0.5.1" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" - dependencies: - minimist "0.0.8" - -mocha@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/mocha/-/mocha-3.2.0.tgz#7dc4f45e5088075171a68896814e6ae9eb7a85e3" - dependencies: - browser-stdout "1.3.0" - commander "2.9.0" - debug "2.2.0" - diff "1.4.0" - escape-string-regexp "1.0.5" - glob "7.0.5" - growl "1.9.2" - json3 "3.3.2" - lodash.create "3.1.1" - mkdirp "0.5.1" - supports-color "3.1.2" - -ms@0.7.1: - version "0.7.1" - resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.1.tgz#9cd13c03adbff25b65effde7ce864ee952017098" - -once@^1.3.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" - dependencies: - wrappy "1" - -path-is-absolute@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" - -supports-color@3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.1.2.tgz#72a262894d9d408b956ca05ff37b2ed8a6e2a2d5" - dependencies: - has-flag "^1.0.0" - -type-detect@0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-0.1.1.tgz#0ba5ec2a885640e470ea4e8505971900dac58822" - -type-detect@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-1.0.0.tgz#762217cc06db258ec48908a1298e8b95121e8ea2" - -wrappy@1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" From 06a2c1c90df8e202f6d8638c8913077bf6a0e9d0 Mon Sep 17 00:00:00 2001 From: Philipp_Lypniakov Date: Mon, 30 Mar 2020 19:49:23 +0300 Subject: [PATCH 12/12] Fix typo in text --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8cb938a..2381fd0 100644 --- a/README.md +++ b/README.md @@ -113,7 +113,7 @@ Lexer defaults and definitions should be added before adding new rules. Read more here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions -The patterns are written using an standard syntex for JavaScript regular expressions + string values are also supported. These are: +The patterns are written using an standard syntax for JavaScript regular expressions + string values are also supported. These are: - `"[xyz]\"foo"` - the literal string: `[xyz]"foo` - `/x/` - match the character `x`