pax_global_header00006660000000000000000000000064135012030550014504gustar00rootroot0000000000000052 comment=8368242deeb6c5b57294769a2e2497b809b58c3a js-tokens-5.0.0/000077500000000000000000000000001350120305500134235ustar00rootroot00000000000000js-tokens-5.0.0/.gitignore000066400000000000000000000000171350120305500154110ustar00rootroot00000000000000/node_modules/ js-tokens-5.0.0/.travis.yml000066400000000000000000000000711350120305500155320ustar00rootroot00000000000000language: node_js node_js: - 6 - 8 - 10 - "node" js-tokens-5.0.0/CHANGELOG.md000066400000000000000000000110451350120305500152350ustar00rootroot00000000000000### Version 5.0.0 (2019-06-15) ### - Added: Support for ES2019. The only change is that `\u2028` and `\u2029` are now allowed unescaped inside string literals. ### Version 4.0.0 (2018-01-28) ### - Added: Support for ES2018. The only change needed was recognizing the `s` regex flag. - Changed: _All_ tokens returned by the `matchToToken` function now have a `closed` property. It is set to `undefined` for the tokens where “closed” doesn’t make sense. This means that all tokens objects have the same shape, which might improve performance. These are the breaking changes: - `'/a/s'.match(jsTokens)` no longer returns `['/', 'a', '/', 's']`, but `['/a/s']`. (There are of course other variations of this.) - Code that rely on some token objects not having the `closed` property could now behave differently. ### Version 3.0.2 (2017-06-28) ### - No code changes. Just updates to the readme. ### Version 3.0.1 (2017-01-30) ### - Fixed: ES2015 unicode escapes with more than 6 hex digits are now matched correctly. ### Version 3.0.0 (2017-01-11) ### This release contains one breaking change, that should [improve performance in V8][v8-perf]: > So how can you, as a JavaScript developer, ensure that your RegExps are fast? > If you are not interested in hooking into RegExp internals, make sure that > neither the RegExp instance, nor its prototype is modified in order to get the > best performance: > > ```js > var re = /./g; > re.exec(''); // Fast path. > re.new_property = 'slow'; > ``` This module used to export a single regex, with `.matchToToken` bolted on, just like in the above example. This release changes the exports of the module to avoid this issue. Before: ```js import jsTokens from "js-tokens" // or: var jsTokens = require("js-tokens") var matchToToken = jsTokens.matchToToken ``` After: ```js import jsTokens, {matchToToken} from "js-tokens" // or: var jsTokens = require("js-tokens").default var matchToToken = require("js-tokens").matchToToken ``` [v8-perf]: http://v8project.blogspot.se/2017/01/speeding-up-v8-regular-expressions.html ### Version 2.0.0 (2016-06-19) ### - Added: Support for ES2016. In other words, support for the `**` exponentiation operator. These are the breaking changes: - `'**'.match(jsTokens)` no longer returns `['*', '*']`, but `['**']`. - `'**='.match(jsTokens)` no longer returns `['*', '*=']`, but `['**=']`. ### Version 1.0.3 (2016-03-27) ### - Improved: Made the regex ever so slightly smaller. - Updated: The readme. ### Version 1.0.2 (2015-10-18) ### - Improved: Limited npm package contents for a smaller download. Thanks to @zertosh! ### Version 1.0.1 (2015-06-20) ### - Fixed: Declared an undeclared variable. ### Version 1.0.0 (2015-02-26) ### - Changed: Merged the 'operator' and 'punctuation' types into 'punctuator'. That type is now equivalent to the Punctuator token in the ECMAScript specification. (Backwards-incompatible change.) - Fixed: A `-` followed by a number is now correctly matched as a punctuator followed by a number. It used to be matched as just a number, but there is no such thing as negative number literals. (Possibly backwards-incompatible change.) ### Version 0.4.1 (2015-02-21) ### - Added: Support for the regex `u` flag. ### Version 0.4.0 (2015-02-21) ### - Improved: `jsTokens.matchToToken` performance. - Added: Support for octal and binary number literals. - Added: Support for template strings. ### Version 0.3.1 (2015-01-06) ### - Fixed: Support for unicode spaces. They used to be allowed in names (which is very confusing), and some unicode newlines were wrongly allowed in strings and regexes. ### Version 0.3.0 (2014-12-19) ### - Changed: The `jsTokens.names` array has been replaced with the `jsTokens.matchToToken` function. The capturing groups of `jsTokens` are no longer part of the public API; instead use said function. See this [gist] for an example. (Backwards-incompatible change.) - Changed: The empty string is now considered an “invalid” token, instead an “empty” token (its own group). (Backwards-incompatible change.) - Removed: component support. (Backwards-incompatible change.) [gist]: https://gist.github.com/lydell/be49dbf80c382c473004 ### Version 0.2.0 (2014-06-19) ### - Changed: Match ES6 function arrows (`=>`) as an operator, instead of its own category (“functionArrow”), for simplicity. (Backwards-incompatible change.) - Added: ES6 splats (`...`) are now matched as an operator (instead of three punctuations). (Backwards-incompatible change.) ### Version 0.1.0 (2014-03-08) ### - Initial release. js-tokens-5.0.0/LICENSE000066400000000000000000000021251350120305500144300ustar00rootroot00000000000000The MIT License (MIT) Copyright (c) 2014, 2015, 2016, 2017, 2018, 2019 Simon Lydell Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. js-tokens-5.0.0/README.md000066400000000000000000000163341350120305500147110ustar00rootroot00000000000000Overview [![Build Status](https://travis-ci.org/lydell/js-tokens.svg?branch=master)](https://travis-ci.org/lydell/js-tokens) ======== A regex that tokenizes JavaScript. ```js var jsTokens = require("js-tokens").default var jsString = "var foo=opts.foo;\n..." jsString.match(jsTokens) // ["var", " ", "foo", "=", "opts", ".", "foo", ";", "\n", ...] ``` Installation ============ `npm install js-tokens` ```js import jsTokens from "js-tokens" // or: var jsTokens = require("js-tokens").default ``` Usage ===== ### `jsTokens` ### A regex with the `g` flag that matches JavaScript tokens. The regex _always_ matches, even invalid JavaScript and the empty string. The next match is always directly after the previous. ### `var token = matchToToken(match)` ### ```js import {matchToToken} from "js-tokens" // or: var matchToToken = require("js-tokens").matchToToken ``` Takes a `match` returned by `jsTokens.exec(string)`, and returns a `{type: String, value: String}` object. The following types are available: - string - comment - regex - number - name - punctuator - whitespace - invalid Multi-line comments and strings also have a `closed` property indicating if the token was closed or not (see below). Comments and strings both come in several flavors. To distinguish them, check if the token starts with `//`, `/*`, `'`, `"` or `` ` ``. Names are ECMAScript IdentifierNames, that is, including both identifiers and keywords. You may use [is-keyword-js] to tell them apart. Whitespace includes both line terminators and other whitespace. [is-keyword-js]: https://github.com/crissdev/is-keyword-js ECMAScript support ================== The intention is to always support the latest ECMAScript version whose feature set has been finalized. If adding support for a newer version requires changes, a new version with a major verion bump will be released. Currently, ECMAScript 2019 is supported. Invalid code handling ===================== Unterminated strings are still matched as strings. JavaScript strings cannot contain (unescaped) newlines, so unterminated strings simply end at the end of the line. Unterminated template strings can contain unescaped newlines, though, so they go on to the end of input. Unterminated multi-line comments are also still matched as comments. They simply go on to the end of the input. Unterminated regex literals are likely matched as division and whatever is inside the regex. Invalid ASCII characters have their own capturing group. Invalid non-ASCII characters are treated as names, to simplify the matching of names (except unicode spaces which are treated as whitespace). Note: See also the [ES2018](#es2018) section. Regex literals may contain invalid regex syntax. They are still matched as regex literals. They may also contain repeated regex flags, to keep the regex simple. Strings may contain invalid escape sequences. Limitations =========== Tokenizing JavaScript using regexes—in fact, _one single regex_—won’t be perfect. But that’s not the point either. You may compare jsTokens with [esprima] by using `esprima-compare.js`. See `npm run esprima-compare`! [esprima]: http://esprima.org/ ### Template string interpolation ### Template strings are matched as single tokens, from the starting `` ` `` to the ending `` ` ``, including interpolations (whose tokens are not matched individually). Matching template string interpolations requires recursive balancing of `{` and `}`—something that JavaScript regexes cannot do. Only one level of nesting is supported. ### Division and regex literals collision ### Consider this example: ```js var g = 9.82 var number = bar / 2/g var regex = / 2/g ``` A human can easily understand that in the `number` line we’re dealing with division, and in the `regex` line we’re dealing with a regex literal. How come? Because humans can look at the whole code to put the `/` characters in context. A JavaScript regex cannot. It only sees forwards. (Well, ES2018 regexes can also look backwards. See the [ES2018](#es2018) section). When the `jsTokens` regex scans throught the above, it will see the following at the end of both the `number` and `regex` rows: ```js / 2/g ``` It is then impossible to know if that is a regex literal, or part of an expression dealing with division. Here is a similar case: ```js foo /= 2/g foo(/= 2/g) ``` The first line divides the `foo` variable with `2/g`. The second line calls the `foo` function with the regex literal `/= 2/g`. Again, since `jsTokens` only sees forwards, it cannot tell the two cases apart. There are some cases where we _can_ tell division and regex literals apart, though. First off, we have the simple cases where there’s only one slash in the line: ```js var foo = 2/g foo /= 2 ``` Regex literals cannot contain newlines, so the above cases are correctly identified as division. Things are only problematic when there are more than one non-comment slash in a single line. Secondly, not every character is a valid regex flag. ```js var number = bar / 2/e ``` The above example is also correctly identified as division, because `e` is not a valid regex flag. I initially wanted to future-proof by allowing `[a-zA-Z]*` (any letter) as flags, but it is not worth it since it increases the amount of ambigous cases. So only the standard `g`, `m`, `i`, `y` and `u` flags are allowed. This means that the above example will be identified as division as long as you don’t rename the `e` variable to some permutation of `gmiyus` 1 to 6 characters long. Lastly, we can look _forward_ for information. - If the token following what looks like a regex literal is not valid after a regex literal, but is valid in a division expression, then the regex literal is treated as division instead. For example, a flagless regex cannot be followed by a string, number or name, but all of those three can be the denominator of a division. - Generally, if what looks like a regex literal is followed by an operator, the regex literal is treated as division instead. This is because regexes are seldomly used with operators (such as `+`, `*`, `&&` and `==`), but division could likely be part of such an expression. Please consult the regex source and the test cases for precise information on when regex or division is matched (should you need to know). In short, you could sum it up as: If the end of a statement looks like a regex literal (even if it isn’t), it will be treated as one. Otherwise it should work as expected (if you write sane code). ### ES2018 ### ES2018 added some nice regex improvements to the language. - [Unicode property escapes] should allow telling names and invalid non-ASCII characters apart without blowing up the regex size. - [Lookbehind assertions] should allow matching telling division and regex literals apart in more cases. - [Named capture groups] might simplify some things. These things would be nice to do, but are not critical. They probably have to wait until the oldest maintained Node.js LTS release supports those features. [Unicode property escapes]: http://2ality.com/2017/07/regexp-unicode-property-escapes.html [Lookbehind assertions]: http://2ality.com/2017/05/regexp-lookbehind-assertions.html [Named capture groups]: http://2ality.com/2017/05/regexp-named-capture-groups.html License ======= [MIT](LICENSE). js-tokens-5.0.0/esprima-compare.js000066400000000000000000000047141350120305500170530ustar00rootroot00000000000000// Copyright 2015, 2017 Simon Lydell // License: MIT. (See LICENSE.) var fs = require("fs") var esprima = require("esprima") var jsTokensTmp = require("./") var jsTokens = jsTokensTmp.default var matchToToken = jsTokensTmp.matchToToken var typeMap = { Boolean: "name", Identifier: "name", Keyword: "name", Null: "name", Numeric: "number", Punctuator: "punctuator", RegularExpression: "regex", String: "string" } function getEsprimaTokens(code) { var tokens = esprima.tokenize(code, {loc: true}) tokens.forEach(function(token) { token.type = typeMap[token.type] }) return tokens } function jsTokensTokenize(string) { jsTokens.lastIndex = 0 if (string === "") return [] var tokens = [] var match while (match = jsTokens.exec(string)) { tokens.push(matchToToken(match)) } return tokens } var exclusionMap = { comment: true, whitespace: true } function getJsTokensTokens(code) { return jsTokensTokenize(code) .filter(function(token) { return !exclusionMap.hasOwnProperty(token.type) }) } function compare(file) { var code = fs.readFileSync(require.resolve(file)).toString() var esprimaTokens = getEsprimaTokens(code) var jsTokensTokens = getJsTokensTokens(code) var length = Math.min(esprimaTokens.length, jsTokensTokens.length) for (var index = 0; index < length; index++) { var esprimaToken = esprimaTokens[index] var jsTokensToken = jsTokensTokens[index] if ( esprimaToken.type !== jsTokensToken.type || esprimaToken.value !== jsTokensToken.value ) { var loc = esprimaToken.loc.start console.error( file + ":" + loc.line + ":" + (loc.column + 1) + ": " + "(token #" + (index + 1) + ")\n" + " esprima: '" + esprimaToken.type + "': " + esprimaToken.value + "\n" + " jsTokens: '" + jsTokensToken.type + "': " + jsTokensToken.value ) return false } } if (esprimaTokens.length !== jsTokensTokens.length) { console.error( file + ': Number of tokens mismatch.\n' + " esprima: " + (esprimaTokens.length + 1) + "\n" + " jsTokens: " + (jsTokensTokens.length + 1) ) return false } return true } var results = process.argv.slice(2).map(compare) if (results.every(Boolean)) { console.log( "Comparison succeeded: esprima and jsTokens produced the same tokens!" ) } else { console.error("Comparison failed.") } js-tokens-5.0.0/generate-index.js000066400000000000000000000004471350120305500166650ustar00rootroot00000000000000// Copyright 2014 Simon Lydell // License: MIT. (See LICENSE.) var fs = require("fs") require("coffeescript/register") var regex = require("./regex.coffee") var code = fs.readFileSync("index.js").toString() code = code.replace(/\/.+\/.+/, regex.toString()) fs.writeFileSync("index.js", code) js-tokens-5.0.0/index.js000066400000000000000000000026551350120305500151000ustar00rootroot00000000000000// Copyright 2014, 2015, 2016, 2017, 2018 Simon Lydell // License: MIT. (See LICENSE.) Object.defineProperty(exports, "__esModule", { value: true }) // This regex comes from regex.coffee, and is inserted here by generate-index.js // (run `npm run build`). exports.default = /((['"])(?:(?!\2)[^\\\n\r]|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyus]{1,6}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g exports.matchToToken = function(match) { var token = {type: "invalid", value: match[0], closed: undefined} if (match[ 1]) token.type = "string" , token.closed = !!(match[3] || match[4]) else if (match[ 5]) token.type = "comment" else if (match[ 6]) token.type = "comment", token.closed = !!match[7] else if (match[ 8]) token.type = "regex" else if (match[ 9]) token.type = "number" else if (match[10]) token.type = "name" else if (match[11]) token.type = "punctuator" else if (match[12]) token.type = "whitespace" return token } js-tokens-5.0.0/package-lock.json000066400000000000000000001064221350120305500166440ustar00rootroot00000000000000{ "name": "js-tokens", "version": "5.0.0", "lockfileVersion": 1, "requires": true, "dependencies": { "ansi-colors": { "version": "3.2.3", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.3.tgz", "integrity": "sha512-LEHHyuhlPY3TmuUYMh2oz89lTShfvgbmzaBcxve9t/9Wuy7Dwf4yoAKcND7KFT1HAQfqZ12qtc+DUrBMeKF9nw==", "dev": true }, "ansi-regex": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "dev": true }, "ansi-styles": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dev": true, "requires": { "color-convert": "^1.9.0" } }, "argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", "dev": true, "requires": { "sprintf-js": "~1.0.2" } }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "browser-stdout": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", "dev": true }, "camelcase": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", "dev": true }, "chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", "dev": true, "requires": { "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", "supports-color": "^5.3.0" }, "dependencies": { "supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", "dev": true, "requires": { "has-flag": "^3.0.0" } } } }, "cliui": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz", "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", "dev": true, "requires": { "string-width": "^2.1.1", "strip-ansi": "^4.0.0", "wrap-ansi": "^2.0.0" } }, "code-point-at": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", "dev": true }, "coffeescript": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/coffeescript/-/coffeescript-2.4.1.tgz", "integrity": "sha512-34GV1aHrsMpTaO3KfMJL40ZNuvKDR/g98THHnE9bQj8HjMaZvSrLik99WWqyMhRtbe8V5hpx5iLgdcSvM/S2wg==", "dev": true }, "color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", "dev": true, "requires": { "color-name": "1.1.3" } }, "color-name": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "dev": true }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, "cross-spawn": { "version": "6.0.5", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", "dev": true, "requires": { "nice-try": "^1.0.4", "path-key": "^2.0.1", "semver": "^5.5.0", "shebang-command": "^1.2.0", "which": "^1.2.9" } }, "debug": { "version": "3.2.6", "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", "dev": true, "requires": { "ms": "^2.1.1" } }, "decamelize": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", "dev": true }, "define-properties": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", "dev": true, "requires": { "object-keys": "^1.0.12" } }, "diff": { "version": "3.5.0", "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", "dev": true }, "emoji-regex": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", "dev": true }, "end-of-stream": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", "dev": true, "requires": { "once": "^1.4.0" } }, "es-abstract": { "version": "1.13.0", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.13.0.tgz", "integrity": "sha512-vDZfg/ykNxQVwup/8E1BZhVzFfBxs9NqMzGcvIJrqg5k2/5Za2bWo40dK2J1pgLngZ7c+Shh8lwYtLGyrwPutg==", "dev": true, "requires": { "es-to-primitive": "^1.2.0", "function-bind": "^1.1.1", "has": "^1.0.3", "is-callable": "^1.1.4", "is-regex": "^1.0.4", "object-keys": "^1.0.12" } }, "es-to-primitive": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz", "integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==", "dev": true, "requires": { "is-callable": "^1.1.4", "is-date-object": "^1.0.1", "is-symbol": "^1.0.2" } }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, "esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", "dev": true }, "everything.js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/everything.js/-/everything.js-1.0.3.tgz", "integrity": "sha1-BgMlqrBMFginyLerWXGx3xCoO8s=", "dev": true }, "execa": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", "dev": true, "requires": { "cross-spawn": "^6.0.0", "get-stream": "^4.0.0", "is-stream": "^1.1.0", "npm-run-path": "^2.0.0", "p-finally": "^1.0.0", "signal-exit": "^3.0.0", "strip-eof": "^1.0.0" } }, "find-up": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", "dev": true, "requires": { "locate-path": "^3.0.0" } }, "flat": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/flat/-/flat-4.1.0.tgz", "integrity": "sha512-Px/TiLIznH7gEDlPXcUD4KnBusa6kR6ayRUVcnEAbreRIuhkqow/mun59BuRXwoYk7ZQOLW1ZM05ilIvK38hFw==", "dev": true, "requires": { "is-buffer": "~2.0.3" } }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "dev": true }, "get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", "dev": true }, "get-stream": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", "dev": true, "requires": { "pump": "^3.0.0" } }, "glob": { "version": "7.1.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", "dev": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.0.4", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } }, "growl": { "version": "1.10.5", "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", "dev": true }, "has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", "dev": true, "requires": { "function-bind": "^1.1.1" } }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", "dev": true }, "has-symbols": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=", "dev": true }, "he": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", "dev": true }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "dev": true, "requires": { "once": "^1.3.0", "wrappy": "1" } }, "inherits": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", "dev": true }, "invert-kv": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz", "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==", "dev": true }, "is-buffer": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.3.tgz", "integrity": "sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw==", "dev": true }, "is-callable": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==", "dev": true }, "is-date-object": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=", "dev": true }, "is-fullwidth-code-point": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", "dev": true }, "is-regex": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", "dev": true, "requires": { "has": "^1.0.1" } }, "is-stream": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", "dev": true }, "is-symbol": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz", "integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==", "dev": true, "requires": { "has-symbols": "^1.0.0" } }, "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", "dev": true }, "js-yaml": { "version": "3.13.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", "dev": true, "requires": { "argparse": "^1.0.7", "esprima": "^4.0.0" } }, "lcid": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz", "integrity": "sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==", "dev": true, "requires": { "invert-kv": "^2.0.0" } }, "locate-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", "dev": true, "requires": { "p-locate": "^3.0.0", "path-exists": "^3.0.0" } }, "lodash": { "version": "4.17.11", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", "dev": true }, "log-symbols": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz", "integrity": "sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg==", "dev": true, "requires": { "chalk": "^2.0.1" } }, "map-age-cleaner": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz", "integrity": "sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==", "dev": true, "requires": { "p-defer": "^1.0.0" } }, "mem": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/mem/-/mem-4.3.0.tgz", "integrity": "sha512-qX2bG48pTqYRVmDB37rn/6PT7LcR8T7oAX3bf99u1Tt1nzxYfxkgqDwUwolPlXweM0XzBOBFzSx4kfp7KP1s/w==", "dev": true, "requires": { "map-age-cleaner": "^0.1.1", "mimic-fn": "^2.0.0", "p-is-promise": "^2.0.0" } }, "mimic-fn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", "dev": true }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "dev": true }, "mkdirp": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, "requires": { "minimist": "0.0.8" } }, "mocha": { "version": "6.1.4", "resolved": "https://registry.npmjs.org/mocha/-/mocha-6.1.4.tgz", "integrity": "sha512-PN8CIy4RXsIoxoFJzS4QNnCH4psUCPWc4/rPrst/ecSJJbLBkubMiyGCP2Kj/9YnWbotFqAoeXyXMucj7gwCFg==", "dev": true, "requires": { "ansi-colors": "3.2.3", "browser-stdout": "1.3.1", "debug": "3.2.6", "diff": "3.5.0", "escape-string-regexp": "1.0.5", "find-up": "3.0.0", "glob": "7.1.3", "growl": "1.10.5", "he": "1.2.0", "js-yaml": "3.13.1", "log-symbols": "2.2.0", "minimatch": "3.0.4", "mkdirp": "0.5.1", "ms": "2.1.1", "node-environment-flags": "1.0.5", "object.assign": "4.1.0", "strip-json-comments": "2.0.1", "supports-color": "6.0.0", "which": "1.3.1", "wide-align": "1.1.3", "yargs": "13.2.2", "yargs-parser": "13.0.0", "yargs-unparser": "1.5.0" } }, "ms": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", "dev": true }, "nice-try": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", "dev": true }, "node-environment-flags": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.5.tgz", "integrity": "sha512-VNYPRfGfmZLx0Ye20jWzHUjyTW/c+6Wq+iLhDzUI4XmhrDd9l/FozXV3F2xOaXjvp0co0+v1YSR3CMP6g+VvLQ==", "dev": true, "requires": { "object.getownpropertydescriptors": "^2.0.3", "semver": "^5.7.0" } }, "npm-run-path": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", "dev": true, "requires": { "path-key": "^2.0.0" } }, "number-is-nan": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", "dev": true }, "object-keys": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", "dev": true }, "object.assign": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", "dev": true, "requires": { "define-properties": "^1.1.2", "function-bind": "^1.1.1", "has-symbols": "^1.0.0", "object-keys": "^1.0.11" } }, "object.getownpropertydescriptors": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz", "integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=", "dev": true, "requires": { "define-properties": "^1.1.2", "es-abstract": "^1.5.1" } }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "requires": { "wrappy": "1" } }, "os-locale": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz", "integrity": "sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q==", "dev": true, "requires": { "execa": "^1.0.0", "lcid": "^2.0.0", "mem": "^4.0.0" } }, "p-defer": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", "integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=", "dev": true }, "p-finally": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", "dev": true }, "p-is-promise": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-2.1.0.tgz", "integrity": "sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg==", "dev": true }, "p-limit": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.0.tgz", "integrity": "sha512-pZbTJpoUsCzV48Mc9Nh51VbwO0X9cuPFE8gYwx9BTCt9SF8/b7Zljd2fVgOxhIF/HDTKgpVzs+GPhyKfjLLFRQ==", "dev": true, "requires": { "p-try": "^2.0.0" } }, "p-locate": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", "dev": true, "requires": { "p-limit": "^2.0.0" } }, "p-try": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", "dev": true }, "path-exists": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", "dev": true }, "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, "path-key": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", "dev": true }, "pump": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", "dev": true, "requires": { "end-of-stream": "^1.1.0", "once": "^1.3.1" } }, "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", "dev": true }, "require-main-filename": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", "dev": true }, "semver": { "version": "5.7.0", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", "dev": true }, "set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", "dev": true }, "shebang-command": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", "dev": true, "requires": { "shebang-regex": "^1.0.0" } }, "shebang-regex": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", "dev": true }, "signal-exit": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", "dev": true }, "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "dev": true }, "string-width": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", "dev": true, "requires": { "is-fullwidth-code-point": "^2.0.0", "strip-ansi": "^4.0.0" } }, "strip-ansi": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", "dev": true, "requires": { "ansi-regex": "^3.0.0" } }, "strip-eof": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", "dev": true }, "strip-json-comments": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", "dev": true }, "supports-color": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.0.0.tgz", "integrity": "sha512-on9Kwidc1IUQo+bQdhi8+Tijpo0e1SS6RoGo2guUwn5vdaxw8RXOF9Vb2ws+ihWOmh4JnCJOvaziZWP1VABaLg==", "dev": true, "requires": { "has-flag": "^3.0.0" } }, "which": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", "dev": true, "requires": { "isexe": "^2.0.0" } }, "which-module": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", "dev": true }, "wide-align": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", "dev": true, "requires": { "string-width": "^1.0.2 || 2" } }, "wrap-ansi": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", "dev": true, "requires": { "string-width": "^1.0.1", "strip-ansi": "^3.0.1" }, "dependencies": { "ansi-regex": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", "dev": true }, "is-fullwidth-code-point": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "dev": true, "requires": { "number-is-nan": "^1.0.0" } }, "string-width": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", "strip-ansi": "^3.0.0" } }, "strip-ansi": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { "ansi-regex": "^2.0.0" } } } }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, "y18n": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", "dev": true }, "yargs": { "version": "13.2.2", "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.2.2.tgz", "integrity": "sha512-WyEoxgyTD3w5XRpAQNYUB9ycVH/PQrToaTXdYXRdOXvEy1l19br+VJsc0vcO8PTGg5ro/l/GY7F/JMEBmI0BxA==", "dev": true, "requires": { "cliui": "^4.0.0", "find-up": "^3.0.0", "get-caller-file": "^2.0.1", "os-locale": "^3.1.0", "require-directory": "^2.1.1", "require-main-filename": "^2.0.0", "set-blocking": "^2.0.0", "string-width": "^3.0.0", "which-module": "^2.0.0", "y18n": "^4.0.0", "yargs-parser": "^13.0.0" }, "dependencies": { "ansi-regex": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", "dev": true }, "string-width": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", "dev": true, "requires": { "emoji-regex": "^7.0.1", "is-fullwidth-code-point": "^2.0.0", "strip-ansi": "^5.1.0" } }, "strip-ansi": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", "dev": true, "requires": { "ansi-regex": "^4.1.0" } } } }, "yargs-parser": { "version": "13.0.0", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.0.0.tgz", "integrity": "sha512-w2LXjoL8oRdRQN+hOyppuXs+V/fVAYtpcrRxZuF7Kt/Oc+Jr2uAcVntaUTNT6w5ihoWfFDpNY8CPx1QskxZ/pw==", "dev": true, "requires": { "camelcase": "^5.0.0", "decamelize": "^1.2.0" } }, "yargs-unparser": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.5.0.tgz", "integrity": "sha512-HK25qidFTCVuj/D1VfNiEndpLIeJN78aqgR23nL3y4N0U/91cOAzqfHlF8n2BvoNDcZmJKin3ddNSvOxSr8flw==", "dev": true, "requires": { "flat": "^4.1.0", "lodash": "^4.17.11", "yargs": "^12.0.5" }, "dependencies": { "get-caller-file": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==", "dev": true }, "require-main-filename": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", "dev": true }, "yargs": { "version": "12.0.5", "resolved": "https://registry.npmjs.org/yargs/-/yargs-12.0.5.tgz", "integrity": "sha512-Lhz8TLaYnxq/2ObqHDql8dX8CJi97oHxrjUcYtzKbbykPtVW9WB+poxI+NM2UIzsMgNCZTIf0AQwsjK5yMAqZw==", "dev": true, "requires": { "cliui": "^4.0.0", "decamelize": "^1.2.0", "find-up": "^3.0.0", "get-caller-file": "^1.0.1", "os-locale": "^3.0.0", "require-directory": "^2.1.1", "require-main-filename": "^1.0.1", "set-blocking": "^2.0.0", "string-width": "^2.0.0", "which-module": "^2.0.0", "y18n": "^3.2.1 || ^4.0.0", "yargs-parser": "^11.1.1" } }, "yargs-parser": { "version": "11.1.1", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-11.1.1.tgz", "integrity": "sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ==", "dev": true, "requires": { "camelcase": "^5.0.0", "decamelize": "^1.2.0" } } } } } } js-tokens-5.0.0/package.json000066400000000000000000000012111350120305500157040ustar00rootroot00000000000000{ "name": "js-tokens", "version": "5.0.0", "author": "Simon Lydell", "license": "MIT", "description": "A regex that tokenizes JavaScript.", "keywords": [ "JavaScript", "js", "token", "tokenize", "regex" ], "files": [ "index.js" ], "repository": "lydell/js-tokens", "scripts": { "test": "mocha --ui tdd", "esprima-compare": "node esprima-compare ./index.js everything.js/es5.js", "build": "node generate-index.js", "dev": "npm run build && npm test" }, "devDependencies": { "coffeescript": "2.4.1", "esprima": "4.0.1", "everything.js": "1.0.3", "mocha": "6.1.4" } } js-tokens-5.0.0/regex.coffee000066400000000000000000000042331350120305500157100ustar00rootroot00000000000000# Copyright 2014, 2015, 2016, 2017, 2018, 2019 Simon Lydell # License: MIT. (See LICENSE.) # # Don’t worry, you don’t need to know CoffeeScript. It is only used for its # readable regex syntax. Everything else is done in JavaScript in index.js. module.exports = /// ( # ([ ' " ]) (?: (?! \2 )[^ \\ \n \r ] | \\(?: \r\n | [\s\S] ) )* (\2)? | ` (?: [^ ` \\ $ ] | \\[\s\S] | \$(?!\{) | \$\{ (?: [^{}] | \{ [^}]* \}? )* \}? )* (`)? ) | ( # //.* ) | ( # /\* (?: [^*] | \*(?!/) )* ( \*/ )? ) | ( # /(?!\*) (?: \[ (?: (?![ \] \\ ]). | \\. )* \] | (?![ / \] \\ ]). | \\. )+ / (?: (?! \s* (?: \b | [ \u0080-\uFFFF $ \\ ' " ~ ( { ] | [ + \- ! ](?!=) | \.?\d ) ) | [ g m i y u s ]{1,6} \b (?! [ \u0080-\uFFFF $ \\ ] | \s* (?: [ + \- * % & | ^ < > ! = ? ( { ] | /(?! [ / * ] ) ) ) ) ) | ( # 0[xX][ \d a-f A-F ]+ | 0[oO][0-7]+ | 0[bB][01]+ | (?: \d*\.\d+ | \d+\.? # Support one trailing dot for integers only. ) (?: [eE][+-]?\d+ )? ) | ( # # See . (?!\d) (?: (?!\s)[ $ \w \u0080-\uFFFF ] | \\u[ \d a-f A-F ]{4} | \\u\{[ \d a-f A-F ]+\} )+ ) | ( # -- | \+\+ | && | \|\| | => | \.{3} | (?: [ + \- / % & | ^ ] | \*{1,2} | <{1,2} | >{1,3} | !=? | ={1,2} )=? | [ ? ~ . , : ; [ \] ( ) { } ] ) | ( # \s+ ) | ( # ^$ # Empty. | [\s\S] # Catch-all rule for anything not matched by the above. ) ///g js-tokens-5.0.0/test/000077500000000000000000000000001350120305500144025ustar00rootroot00000000000000js-tokens-5.0.0/test/fixtures/000077500000000000000000000000001350120305500162535ustar00rootroot00000000000000js-tokens-5.0.0/test/fixtures/base64.js000066400000000000000000000043021350120305500176740ustar00rootroot00000000000000/* * https://github.com/davidchambers/Base64.js */ ;(function () { var object = typeof exports != 'undefined' ? exports : this; // #8: web workers var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; function InvalidCharacterError(message) { this.message = message; } InvalidCharacterError.prototype = new Error; InvalidCharacterError.prototype.name = 'InvalidCharacterError'; // encoder // [https://gist.github.com/999166] by [https://github.com/nignag] object.btoa || ( object.btoa = function (input) { for ( // initialize result and counter var block, charCode, idx = 0, map = chars, output = ''; // if the next input index does not exist: // change the mapping table to "=" // check if d has no fractional digits input.charAt(idx | 0) || (map = '=', idx % 1); // "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8 output += map.charAt(63 & block >> 8 - idx % 1 * 8) ) { charCode = input.charCodeAt(idx += 3/4); if (charCode > 0xFF) { throw new InvalidCharacterError("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range."); } block = block << 8 | charCode; } return output; }); // decoder // [https://gist.github.com/1020396] by [https://github.com/atk] object.atob || ( object.atob = function (input) { input = input.replace(/=+$/, '') if (input.length % 4 == 1) { throw new InvalidCharacterError("'atob' failed: The string to be decoded is not correctly encoded."); } for ( // initialize result and counters var bc = 0, bs, buffer, idx = 0, output = ''; // get next character buffer = input.charAt(idx++); // character found in table? initialize bit storage and add its ascii value; ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer, // and if not first of each 4 characters, // convert the first 8 bits to one ascii character bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0 ) { // try to find character in table (0-63, not found => -1) buffer = chars.indexOf(buffer); } return output; }); }()); js-tokens-5.0.0/test/fixtures/base64.json000066400000000000000000000075631350120305500202450ustar00rootroot00000000000000[ "/*\n * https://github.com/davidchambers/Base64.js\n */","\n", ";","(","function"," ","(",")"," ","{","\n\n ", "var"," ","object"," ","="," ","typeof"," ","exports"," ","!="," ","'undefined'"," ","?"," ","exports"," ",":"," ","this",";"," ","// #8: web workers","\n ", "var"," ","chars"," ","="," ","'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='",";","\n\n ", "function"," ","InvalidCharacterError","(","message",")"," ","{","\n ", "this",".","message"," ","="," ","message",";","\n ", "}","\n ", "InvalidCharacterError",".","prototype"," ","="," ","new"," ","Error",";","\n ", "InvalidCharacterError",".","prototype",".","name"," ","="," ","'InvalidCharacterError'",";","\n\n ", "// encoder","\n ", "// [https://gist.github.com/999166] by [https://github.com/nignag]","\n ", "object",".","btoa"," ","||"," ","(","\n ", "object",".","btoa"," ","="," ","function"," ","(","input",")"," ","{","\n ", "for"," ","(","\n ", "// initialize result and counter","\n ", "var"," ","block",","," ","charCode",","," ","idx"," ","="," ","0",","," ","map"," ","="," ","chars",","," ","output"," ","="," ","''",";","\n ", "// if the next input index does not exist:","\n ", "// change the mapping table to \"=\"","\n ", "// check if d has no fractional digits","\n ", "input",".","charAt","(","idx"," ","|"," ","0",")"," ","||"," ","(","map"," ","="," ","'='",","," ","idx"," ","%"," ","1",")",";","\n ", "// \"8 - idx % 1 * 8\" generates the sequence 2, 4, 6, 8","\n ", "output"," ","+="," ","map",".","charAt","(","63"," ","&"," ","block"," ",">>"," ","8"," ","-"," ","idx"," ","%"," ","1"," ","*"," ","8",")","\n ", ")"," ","{","\n ", "charCode"," ","="," ","input",".","charCodeAt","(","idx"," ","+="," ","3","/","4",")",";","\n ", "if"," ","(","charCode"," ",">"," ","0xFF",")"," ","{","\n ", "throw"," ","new"," ","InvalidCharacterError","(","\"'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.\"",")",";","\n ", "}","\n ", "block"," ","="," ","block"," ","<<"," ","8"," ","|"," ","charCode",";","\n ", "}","\n ", "return"," ","output",";","\n ", "}",")",";","\n\n ", "// decoder","\n ", "// [https://gist.github.com/1020396] by [https://github.com/atk]","\n ", "object",".","atob"," ","||"," ","(","\n ", "object",".","atob"," ","="," ","function"," ","(","input",")"," ","{","\n ", "input"," ","="," ","input",".","replace","(","/=+$/",","," ","''",")","\n ", "if"," ","(","input",".","length"," ","%"," ","4"," ","=="," ","1",")"," ","{","\n ", "throw"," ","new"," ","InvalidCharacterError","(","\"'atob' failed: The string to be decoded is not correctly encoded.\"",")",";","\n ", "}","\n ", "for"," ","(","\n ", "// initialize result and counters","\n ", "var"," ","bc"," ","="," ","0",","," ","bs",","," ","buffer",","," ","idx"," ","="," ","0",","," ","output"," ","="," ","''",";","\n ", "// get next character","\n ", "buffer"," ","="," ","input",".","charAt","(","idx","++",")",";","\n ", "// character found in table? initialize bit storage and add its ascii value;","\n ", "~","buffer"," ","&&"," ","(","bs"," ","="," ","bc"," ","%"," ","4"," ","?"," ","bs"," ","*"," ","64"," ","+"," ","buffer"," ",":"," ","buffer",",","\n ", "// and if not first of each 4 characters,","\n ", "// convert the first 8 bits to one ascii character","\n ", "bc","++"," ","%"," ","4",")"," ","?"," ","output"," ","+="," ","String",".","fromCharCode","(","255"," ","&"," ","bs"," ",">>"," ","(","-","2"," ","*"," ","bc"," ","&"," ","6",")",")"," ",":"," ","0","\n ", ")"," ","{","\n ", "// try to find character in table (0-63, not found => -1)","\n ", "buffer"," ","="," ","chars",".","indexOf","(","buffer",")",";","\n ", "}","\n ", "return"," ","output",";","\n ", "}",")",";","\n\n", "}","(",")",")",";","\n" ] js-tokens-5.0.0/test/fixtures/division.js000066400000000000000000000007331350120305500204400ustar00rootroot00000000000000foo = 1/a/2 foo = 1/a/ 2 foo = 1/a/(b+1) foo = 1/a/~bar.indexOf(baz) foo = 1/a/+str foo = 1/a/-1 foo = 1/a/-bar foo = 1/a/--bar foo = 1/a/ --bar foo = 1/a/ ++bar foo = 1/a/g+1 foo = 1/a/g - 1 foo = 1/a/g*1 foo = 1/a/g/1 foo = 1/a/g /1 if (1/a/g && foo) {} if (1/a/g && foo) {} if (1/a/g || foo) {} if (1/a/g === 3) {} foo = 1/a/g ? true : false nan = 1/a/'' nan = 1/a/ "" foo = 1/a/goo foo = 1/a/iff foo = 1/a/igor foo = 1/a/moo foo = 1/a/yüm foo = 1/a/imgyp js-tokens-5.0.0/test/fixtures/division.json000066400000000000000000000030751350120305500207770ustar00rootroot00000000000000[ "foo"," ","="," ","1","/","a","/","2","\n", "foo"," ","="," ","1","/","a","/","\n ","2","\n", "foo"," ","="," ","1","/","a","/","(","b","+","1",")","\n", "foo"," ","="," ","1","/","a","/","~","bar",".","indexOf","(","baz",")","\n", "foo"," ","="," ","1","/","a","/","+","str","\n", "foo"," ","="," ","1","/","a","/","-","1","\n", "foo"," ","="," ","1","/","a","/","-","bar","\n", "foo"," ","="," ","1","/","a","/","--","bar","\n", "foo"," ","="," ","1","/","a","/","\n ","--","bar","\n", "foo"," ","="," ","1","/","a","/"," ","++","bar","\n\n", "foo"," ","="," ","1","/","a","/","g","+","1","\n", "foo"," ","="," ","1","/","a","/","g"," ","-"," ","1","\n", "foo"," ","="," ","1","/","a","/","g","*","1","\n", "foo"," ","="," ","1","/","a","/","g","/","1","\n", "foo"," ","="," ","1","/","a","/","g","\n ","/","1","\n\n", "if"," ","(","1","/","a","/","g"," ","&&"," ","foo",")"," ","{","}","\n", "if"," ","(","1","/","a","/","g","\n ","&&"," ","foo",")"," ","{","}","\n", "if"," ","(","1","/","a","/","g"," ","||"," ","foo",")"," ","{","}","\n", "if"," ","(","1","/","a","/","g"," ","==="," ","3",")"," ","{","}","\n\n", "foo"," ","="," ","1","/","a","/","g"," ","?"," ","true"," ",":"," ","false","\n\n", "nan"," ","="," ","1","/","a","/","''","\n", "nan"," ","="," ","1","/","a","/"," ","\"\"","\n\n", "foo"," ","="," ","1","/","a","/","goo","\n", "foo"," ","="," ","1","/","a","/","iff","\n", "foo"," ","="," ","1","/","a","/","igor","\n", "foo"," ","="," ","1","/","a","/","moo","\n", "foo"," ","="," ","1","/","a","/","yüm","\n", "foo"," ","="," ","1","/","a","/","imgyp","\n" ] js-tokens-5.0.0/test/fixtures/errors.js000066400000000000000000000004421350120305500201250ustar00rootroot00000000000000var multiLineString = '\ While I was writing along\ I suddenly forgot to add a backslash @ the end of a line' var unterminatedRegex = /3?2:1 # Oops, forgot that this isn’t coffee-script. /* Let’s try a valid JavaScript comment instead var string='Pity I forgot to close it, though' js-tokens-5.0.0/test/fixtures/errors.json000066400000000000000000000007541350120305500204700ustar00rootroot00000000000000[ "var"," ","multiLineString"," ","="," ","'\\\nWhile I was writing along\\\nI suddenly forgot to","\n", "add"," ","a"," ","backslash"," ","@"," ","the"," ","end"," ","of"," ","a"," ","line","'","\n\n", "var"," ","unterminatedRegex"," ","="," ","/","3","?","2",":","1","\n\n", "#"," ","Oops",","," ","forgot"," ","that"," ","this"," ","isn’t"," ","coffee","-","script",".","\n\n", "/* Let’s try a valid JavaScript comment instead\n\nvar string='Pity I forgot to close it, though'\n" ] js-tokens-5.0.0/test/fixtures/regex.js000066400000000000000000000011761350120305500177300ustar00rootroot00000000000000foo(/a/) foo(/a/g) foo( /a/ ) foo( /a/g ) foo(/a/, bar) foo(/a/g, bar) foo(/a/, /a/g, /b/g, /b/) arr = [/a/] arr = [/a/g] arr = [ /a/ ] arr = [ /a/g ] obj = {re: /a/} obj = {re: /a/g} obj = { re: /a/ } obj = { re: /a/g } re = foo ? /a/ : RegExp(bar) re = foo ? /a/g : RegExp(bar) /a/.exec(foo) /a/g.exec(foo) foo = (1/2) + /a/.exec(bar)[0] foo = (1/2) + /a/g.exec(bar)[0] re = /a/// comment re = /a/g// comment re = /a//* comment */ re = /a/g/* comment */ re = /a/ // comment re = /a/g // comment re = /a/ /* comment */ re = /a/g /* comment */ silly = /a/ ? true : false if (/a/ == "/a/") {} if (/a/ && foo) {} if (/a/ || foo) {} js-tokens-5.0.0/test/fixtures/regex.json000066400000000000000000000033321350120305500202610ustar00rootroot00000000000000[ "foo","(","/a/",")","\n", "foo","(","/a/g",")","\n", "foo","("," ","/a/"," ",")","\n", "foo","("," ","/a/g"," ",")","\n", "foo","(","/a/",","," ","bar",")","\n", "foo","(","/a/g",","," ","bar",")","\n", "foo","(","/a/",","," ","/a/g",","," ","/b/g",","," ","/b/",")","\n\n", "arr"," ","="," ","[","/a/","]","\n", "arr"," ","="," ","[","/a/g","]","\n", "arr"," ","="," ","["," ","/a/"," ","]","\n", "arr"," ","="," ","["," ","/a/g"," ","]","\n\n", "obj"," ","="," ","{","re",":"," ","/a/","}","\n", "obj"," ","="," ","{","re",":"," ","/a/g","}","\n", "obj"," ","="," ","{"," ","re",":"," ","/a/"," ","}","\n", "obj"," ","="," ","{"," ","re",":"," ","/a/g"," ","}","\n\n", "re"," ","="," ","foo"," ","?"," ","/a/"," ",":"," ","RegExp","(","bar",")","\n", "re"," ","="," ","foo"," ","?"," ","/a/g"," ",":"," ","RegExp","(","bar",")","\n\n", "/a/",".","exec","(","foo",")","\n", "/a/g",".","exec","(","foo",")","\n\n", "foo"," ","="," ","(","1","/","2",")"," ","+"," ","/a/",".","exec","(","bar",")","[","0","]","\n", "foo"," ","="," ","(","1","/","2",")"," ","+"," ","/a/g",".","exec","(","bar",")","[","0","]","\n\n", "re"," ","="," ","/a/","// comment","\n", "re"," ","="," ","/a/g","// comment","\n", "re"," ","="," ","/a/","/* comment */","\n", "re"," ","="," ","/a/g","/* comment */","\n\n", "re"," ","="," ","/a/"," ","// comment","\n", "re"," ","="," ","/a/g"," ","// comment","\n", "re"," ","="," ","/a/"," ","/* comment */","\n", "re"," ","="," ","/a/g"," ","/* comment */","\n\n", "silly"," ","="," ","/a/"," ","?"," ","true"," ",":"," ","false","\n", "if"," ","(","/a/"," ","=="," ","\"/a/\"",")"," ","{","}","\n", "if"," ","(","/a/"," ","&&"," ","foo",")"," ","{","}","\n", "if"," ","(","/a/"," ","||"," ","foo",")"," ","{","}","\n" ] js-tokens-5.0.0/test/index.js000066400000000000000000000470211350120305500160530ustar00rootroot00000000000000// Copyright 2014, 2015, 2016, 2017, 2018 Simon Lydell // License: MIT. (See LICENSE.) var fs = require("fs") var util = require("util") var assert = require("assert") var jsTokensTmp = require("../") var jsTokens = jsTokensTmp.default var matchToToken = jsTokensTmp.matchToToken suite("jsTokens", function() { test("is a regex", function() { assert(util.isRegExp(jsTokens)) }) }) suite("matchToToken", function() { test("is a function", function() { assert.equal(typeof matchToToken, "function") }) }) suite("tokens", function() { function token(name, fn) { suite(name, fn.bind(null, matchHelper.bind(null, name))) } function matchHelper(type, string, expected, extra) { extra = extra || {} if (typeof expected === "object") { extra = expected expected = undefined } jsTokens.lastIndex = 0 var token = matchToToken(jsTokens.exec(string)) test(String(string), function() { if (expected === false) { assert.notEqual(token.type, type) } else { assert.equal(token.type, type) assert.equal( token.value, (typeof expected === "string" ? expected : string) ) if ("closed" in extra) { assert.equal(token.closed, extra.closed) } else if (type === "string") { assert.equal(token.closed, true) } } }) } token("whitespace", function(match) { match(" ") match(" ") match(" a", " ") match("\t") match("\t\t\t") match("\ta", "\t") match("\n") match("\n\n\n") match("\na", "\n") match("\r") match("\r\r\r") match("\ra", "\r") match(" \t\n\r \r\n") match(" \t\n\r \r\n-1", " \t\n\r \r\n") match("\f") match("\v") match("\u00a0") match("\u1680") match("\u2000") match("\u2001") match("\u2002") match("\u2003") match("\u2004") match("\u2005") match("\u2006") match("\u2007") match("\u2008") match("\u2009") match("\u200a") match("\u2028") match("\u2029") match("\u202f") match("\u205f") match("\u3000") }) token("comment", function(match) { match("//") match("//comment") match("// comment") match("//comment ") match("///") match("//**//") match("//comment\n", "//comment") match("//comment\r", "//comment") match("//comment\u2028", "//comment") match("//comment\u2029", "//comment") match("//comment\r\n", "//comment") match("//comment \n", "//comment ") match("//comment\t\n", "//comment\t") match("/**/", {closed: true}) match("/*comment*/", {closed: true}) match("/* comment */", {closed: true}) match("/***/", {closed: true}) match("/*/*/", {closed: true}) match("/*\n\r\u2028\u2029 \r\n*/", {closed: true}) match("/*", {closed: false}) match("/*/", {closed: false}) match("/*unclosed", {closed: false}) match("/*unclosed\nnew Line(this == code ? true : false)", {closed: false}) }) token("string", function(match) { match("''") match('""') match("``") match("'string'") match('"string"') match("`string`") match("'\\''") match('"\\""') match("`\\``") match("'\\\\''", "'\\\\'") match('"\\\\""', '"\\\\"') match("`\\\\``", "`\\\\`") match("'\\\\\\''") match('"\\\\\\""') match("`\\\\\\``") match("'\\u05aF'") match('"\\u05aF"') match("`\\u05aF`") match("'invalid escape sequence is OK: \\u'") match('"invalid escape sequence is OK: \\u"') match("`invalid escape sequence is OK: \\u`") match("'\\\n'") match('"\\\n"') match("`\\\n`") match("'\\\r'") match('"\\\r"') match("`\\\r`") match("'\u2028'") match('"\u2028"') match("`\u2028`") match("'\u2029'") match('"\u2029"') match("`\u2029`") match("'\\\u2028'") match('"\\\u2028"') match("`\\\u2028`") match("'\\\u2029'") match('"\\\u2029"') match("`\\\u2029`") match("'\\\r\n'") match('"\\\r\n"') match("`\\\r\n`") match("'string'code'another string'", "'string'") match('"string"code"another string"', '"string"') match("`string`code`another string`", "`string`") match("'\"'") match("'`'") match('"\'"') match('"`"') match("`'`") match('`"`') match("'", {closed: false}) match('"', {closed: false}) match("`", {closed: false}) match("'unclosed", {closed: false}) match('"unclosed', {closed: false}) match("`unclosed", {closed: false}) match("'\n", "'", {closed: false}) match('"\n', '"', {closed: false}) match("`\n", {closed: false}) match("'\r", "'", {closed: false}) match('"\r', '"', {closed: false}) match("`\r", {closed: false}) match("'\u2028", {closed: false}) match('"\u2028', {closed: false}) match("`\u2028", {closed: false}) match("'\u2029", {closed: false}) match('"\u2029', {closed: false}) match("`\u2029", {closed: false}) match("'\r\n", "'", {closed: false}) match('"\r\n', '"', {closed: false}) match("`\r\n", {closed: false}) match("'\\\n", {closed: false}) match('"\\\n', {closed: false}) match("`\\\n", {closed: false}) match("'\\\r", {closed: false}) match('"\\\r', {closed: false}) match("`\\\r", {closed: false}) match("'\\\u2028", {closed: false}) match('"\\\u2028', {closed: false}) match("`\\\u2028", {closed: false}) match("'\\\u2029", {closed: false}) match('"\\\u2029', {closed: false}) match("`\\\u2029", {closed: false}) match("'\\\r\n", {closed: false}) match('"\\\r\n', {closed: false}) match("`\\\r\n", {closed: false}) match("'${}'") match('"${}"') match("`${}`") match("'${a}'") match('"${a}"') match("`${a}`") match("'a${b}c'") match('"a${b}c"') match("`a${b}c`") match("'${'a'}'", "'${'") match('"${"a"}"', '"${"') match("`${`a`}`") match("`${`${a}`}`") match("`${fn({a: b})}`") match("`${fn({a: '{'})}`") match("`a${}${a}${ `${b\r}` + `${`c`}` } d $${\n(x=>{return x*2})(4)}$`") match("`\\${{{}}}a`") match("`a ${b c`.length", {closed: false}) match("`a ${`b${c`} d`.length", {closed: false}) match("`a ${ {c:d } e`.length", {closed: false}) }) token("regex", function(match) { match("//", false) match("/a/") match("/\\//") match("/\\\\//", "/\\\\/") match("/\\\\\\//") match("/[/]/") match("/[\\]]/") match("/[\\]/]/") match("/[\\\\]/]/", "/[\\\\]/") match("/[\\\\\\]/]/") match(/\\u05aF/) match("/invalid escape sequence is OK: \\u/") match("/?foo/") match("/*foo/", false) match("/a/g") match("/a/m") match("/a/i") match("/a/y") match("/a/u") match("/a/s") match("/a/gmiyus") match("/a/myg") match("/a/e", false) match("/a/invalidFlags", false) match("/a/f00", false) match("/\n/", false) match("/\r/", false) match("/\u2028/", false) match("/\u2029/", false) match("/\r\n/", false) match("/\\\n/", false) match("/\\\r/", false) match("/\\\u2028/", false) match("/\\\u2029/", false) match("/\\\r\n/", false) match("/[\n]/", false) match("/[\r]/", false) match("/[\u2028]/", false) match("/[\u2029]/", false) match("/[\r\n]/", false) match("/[\\\n]/", false) match("/[\\\r]/", false) match("/[\\\u2028]/", false) match("/[\\\u2029]/", false) match("/[\\\r\n]/", false) match("/a/", "/a/") match("/a/g", "/a/g") match("/a/;", "/a/") match("/a/g;", "/a/g") match("/a/ ;", "/a/") match("/a/g ;", "/a/g") match("/a/, b", "/a/") match("/a/g, b", "/a/g") match("/a/ , b", "/a/") match("/a/g , b", "/a/g") match("/a/.exec(b)", "/a/") match("/a/g.exec(b)", "/a/g") match("/a/ .exec(b)", "/a/") match("/a/g .exec(b)", "/a/g") match("/a/['exec'](b)", "/a/") match("/a/g['exec'](b)", "/a/g") match("/a/ ['exec'](b)", "/a/") match("/a/g ['exec'](b)", "/a/g") match("/a/]", "/a/") match("/a/g]", "/a/g") match("/a/ ]", "/a/") match("/a/g ]", "/a/g") match("/a/)", "/a/") match("/a/g)", "/a/g") match("/a/ )", "/a/") match("/a/g )", "/a/g") match("/a/}", "/a/") match("/a/g}", "/a/g") match("/a/ }", "/a/") match("/a/g }", "/a/g") match("/a/+=b", "/a/") match("/a/ +=b", "/a/") match("/a/-=b", "/a/") match("/a/ -=b", "/a/") match("/a/*b", "/a/") match("/a/ *b", "/a/") match("/a/ *=b", "/a/") match("/a//b", "/a/") match("/a/ /b", "/a/") match("/a/ /=b", "/a/") match("/a/%b", "/a/") match("/a/ %b", "/a/") match("/a/%=b", "/a/") match("/a/ %=b", "/a/") match("/a/&b", "/a/") match("/a/ &b", "/a/") match("/a/&=b", "/a/") match("/a/ &=b", "/a/") match("/a/&&b", "/a/") match("/a/ &&b", "/a/") match("/a/|b", "/a/") match("/a/ |b", "/a/") match("/a/|=b", "/a/") match("/a/ |=b", "/a/") match("/a/||b", "/a/") match("/a/ ||b", "/a/") match("/a/^b", "/a/") match("/a/ ^b", "/a/") match("/a/^=b", "/a/") match("/a/ ^=b", "/a/") match("/a/b", "/a/") match("/a/ >b", "/a/") match("/a/>=b", "/a/") match("/a/ >=b", "/a/") match("/a/>>b", "/a/") match("/a/ >>b", "/a/") match("/a/>>=b", "/a/") match("/a/ >>=b", "/a/") match("/a/>>>b", "/a/") match("/a/ >>>=b", "/a/") match("/a/>>>=b", "/a/") match("/a/ >>>b", "/a/") match("/a/!=b", "/a/") match("/a/ !=b", "/a/") match("/a/!==b", "/a/") match("/a/ !==b", "/a/") match("/a/=b", "/a/") match("/a/ =b", "/a/") match("/a/==b", "/a/") match("/a/ ==b", "/a/") match("/a/===b", "/a/") match("/a/ ===b", "/a/") match("/a/?b:c", "/a/") match("/a/ ? b : c", "/a/") match("/a/:c", "/a/") match("/a/g:c", "/a/g") match("/a/ : c", "/a/") match("/a/g : c", "/a/g") match("/a///", "/a/") match("/a/g//", "/a/g") match("/a/ //", "/a/") match("/a/g //", "/a/g") match("/a//**/", "/a/") match("/a/g/**/", "/a/g") match("/a/ /**/", "/a/") match("/a/g /**/", "/a/g") match("/a/g''", "/a/g") match("/a/g ''", "/a/g") match('/a/g""', "/a/g") match('/a/g ""', "/a/g") match("/a//b/", "/a/") match("/a/ /b/", "/a/") match("/a/g 0", "/a/g") match("/a/g 0.1", "/a/g") match("/a/g .1", "/a/g") match("/a/g 0x1", "/a/g") match("/a/g e", "/a/g") match("/a/g _", "/a/g") match("/a/g $", "/a/g") match("/a/g é", "/a/g") match("/a/g \\u0080", "/a/g") }) token("number", function(match) { match("1") match("1.") match("1..", "1.") match("0.1") match(".1") match("0.1.", "0.1") match("-1", false) match("-1.", false) match("-1..", false) match("-0.1", false) match("-.1", false) match("-0.1.", false) match("-", false) match("1e1") match("1.e1") match("1.e1.", "1.e1") match("0.1e1") match(".1e1") match("0.1e1.", "0.1e1") match("1e+1") match("1e-1") match("1e0123") match("1e0.123", "1e0") match("1e0x123", "1e0") match("1E1") match("1E+1") match("1E-1") match("1E0123") match("1E0.123", "1E0") match("1E0x123", "1E0") match("1E0o123", "1E0") match("1E0b123", "1E0") match("e1", false) match("e+1", false) match("e-1", false) match("E1", false) match("E+1", false) match("E-1", false) match("-e1", false) match("-e+1", false) match("-e-1", false) match("-E1", false) match("-E+1", false) match("-E-1", false) match("0x1") match("0xa") match("0x015cF") match("0x1e1") match("0x1E1") match("0x1g1", "0x1") match("0X1") match("0Xa") match("0X015cF") match("0X1e1") match("0X1E1") match("0X1g1", "0X1") match("-0x1", false) match("-0xa", false) match("-0x015cF", false) match("-0x1e1", false) match("-0x1E1", false) match("-0x1g1", false) match("0x", "0") match("1x1", "1") match("0x1.", "0x1") match("0x1.1", "0x1") match("0.0x1", "0.0") match(".0x1", ".0") match("0o1") match("0oa", "0") match("0o01574") match("0o1e1", "0o1") match("0o1E1", "0o1") match("0o1g1", "0o1") match("0O1") match("0Oa", "0") match("0O01574") match("0O1e1", "0O1") match("0O1E1", "0O1") match("0O1g1", "0O1") match("-0o1", false) match("-0oa", false) match("-0o01574", false) match("-0o1e1", false) match("-0o1E1", false) match("-0o1g1", false) match("0o", "0") match("1o1", "1") match("0o1.", "0o1") match("0o1.1", "0o1") match("0.0o1", "0.0") match(".0o1", ".0") match("0b1") match("0ba", "0") match("0b01011") match("0b1e1", "0b1") match("0b1E1", "0b1") match("0b1g1", "0b1") match("0B1") match("0Ba", "0") match("0B01011") match("0B1e1", "0B1") match("0B1E1", "0B1") match("0B1g1", "0B1") match("-0b1", false) match("-0ba", false) match("-0b01011", false) match("-0b1e1", false) match("-0b1E1", false) match("-0b1g1", false) match("0b", "0") match("1b1", "1") match("0b1.", "0b1") match("0b1.1", "0b1") match("0.0b1", "0.0") match(".0b1", ".0") }) token("name", function(match) { match("$") match("_") match("a") match("z") match("A") match("Z") match("å") match("π") match("0", false) match("0a", false) match("$0") match("_0") match("a0") match("z0") match("A0") match("Z0") match("å0") match("π0") match("a_56åπ") match("Iñtërnâtiônàlizætiøn☃💩") // The last character is Pile of poo. match("a\u00a0", "a") match("a\u1680", "a") match("a\u2000", "a") match("a\u2001", "a") match("a\u2002", "a") match("a\u2003", "a") match("a\u2004", "a") match("a\u2005", "a") match("a\u2006", "a") match("a\u2007", "a") match("a\u2008", "a") match("a\u2009", "a") match("a\u200a", "a") match("a\u2028", "a") match("a\u2029", "a") match("a\u202f", "a") match("a\u205f", "a") match("a\u3000", "a") match("\\u0000") match("\\u15cF") match("\\u15cG", false) match("\\u000", false) match("\\u00000") match("a\\u0000b") match("\\u{0}") match("\\u{01}") match("\\u{012}") match("\\u{0123}") match("\\u{01234}") match("\\u{012345}") match("\\u{0123456}") match("\\u{00000000000000a0}") match("\\u{15cF}") match("\\u{15cG}", false) match("a\\u{0000}b") match("\\x09", false) }) token("punctuator", function(match) { match("+") match("++") match("+=") match("++=", "++") match("-") match("--") match("-=") match("--=", "--") match("*") match("**") match("*=") match("**=") match("/") match("//", false) match("/=") match("//=", false) match("%") match("%%", "%") match("%=") match("%%=", "%") match("&") match("&&") match("&=") match("&&=", "&&") match("|") match("||") match("|=") match("||=", "||") match("^") match("^^", "^") match("^=") match("^^=", "^") match("<") match("<<") match("<<<", "<<") match("<=") match("<<=") match(">") match(">>") match(">>>") match(">=") match(">>=") match(">>>=") match("!") match("!=") match("!==") match("!===", "!==") match("=") match("==") match("===") match("=>") match("==>", "==") match("=>>", "=>") match("...") match("..", ".") match(".") match("....", "...") match("?") match("~") match(".") match(",") match(":") match(";") match("[") match("]") match("(") match(")") match("{") match("}") match("/a/()", "/") match("/a/g()", "/") match("/a/ ()", "/") match("/a/g ()", "/") match("/a/{}", "/") match("/a/g{}", "/") match("/a/ {}", "/") match("/a/g {}", "/") match("/a/+b", "/") match("/a/ +b", "/") match("/a/++b", "/") match("/a/ ++b", "/") match("/a/-b", "/") match("/a/ -b", "/") match("/a/--b", "/") match("/a/ --b", "/") match("/a/!b", "/") match("/a/ !b", "/") match("/a/~b", "/") match("/a/ ~b", "/") match("/a/g+b", "/") match("/a/g +b", "/") match("/a/g+=b", "/") match("/a/g +=b", "/") match("/a/g++", "/") match("/a/g ++", "/") match("/a/g-b", "/") match("/a/g -b", "/") match("/a/g-=b", "/") match("/a/g -=b", "/") match("/a/g--", "/") match("/a/g --", "/") match("/a/g*b", "/") match("/a/g *b", "/") match("/a/g *=b", "/") match("/a/g/b", "/") match("/a/g /b", "/") match("/a/g /=b", "/") match("/a/g%b", "/") match("/a/g %b", "/") match("/a/g%=b", "/") match("/a/g %=b", "/") match("/a/g&b", "/") match("/a/g &b", "/") match("/a/g&=b", "/") match("/a/g &=b", "/") match("/a/g&&b", "/") match("/a/g &&b", "/") match("/a/g|b", "/") match("/a/g |b", "/") match("/a/g|=b", "/") match("/a/g |=b", "/") match("/a/g||b", "/") match("/a/g ||b", "/") match("/a/g^b", "/") match("/a/g ^b", "/") match("/a/g^=b", "/") match("/a/g ^=b", "/") match("/a/gb", "/") match("/a/g >b", "/") match("/a/g>=b", "/") match("/a/g >=b", "/") match("/a/g>>b", "/") match("/a/g >>b", "/") match("/a/g>>=b", "/") match("/a/g >>=b", "/") match("/a/g>>>b", "/") match("/a/g >>>=b", "/") match("/a/g>>>=b", "/") match("/a/g >>>b", "/") match("/a/g!=b", "/") match("/a/g !=b", "/") match("/a/g!==b", "/") match("/a/g !==b", "/") match("/a/g=b", "/") match("/a/g =b", "/") match("/a/g==b", "/") match("/a/g ==b", "/") match("/a/g===b", "/") match("/a/g ===b", "/") match("/a/g?b:c", "/") match("/a/g ? b : c", "/") match("/a/''", "/") match("/a/ ''", "/") match('/a/""', "/") match('/a/ ""', "/") match("/a/g/b/", "/") match("/a/g /b/", "/") match("/a/0", "/") match("/a/ 0", "/") match("/a/0.1", "/") match("/a/ 0.1", "/") match("/a/.1", "/") match("/a/ .1", "/") match("/a/e", "/") match("/a/ e", "/") match("/a/_", "/") match("/a/ _", "/") match("/a/$", "/") match("/a/ $", "/") match("/a/é", "/") match("/a/ é", "/") match("/a/\\u0080", "/") match("/a/ \\u0080", "/") match("/a/ge", "/") match("/a/g_", "/") match("/a/g$", "/") match("/a/gé", "/") match("/a/g0", "/") match("/a/g\\u0080", "/") }) token("invalid", function(match) { match("") match("@") match("#") match("\\") match("\\xa9", "\\") match("\u0000") match("\u007F") }) }) suite("tokenization", function() { function testFile(file) { var contents = fs.readFileSync("test/fixtures/" + file + ".js").toString() var expected = require("./fixtures/" + file + ".json") var actual = contents.match(jsTokens) test(file + ".js", function() { assert.deepEqual(actual, expected) assert.equal(actual.join(""), contents) }) } testFile("base64") testFile("errors") testFile("regex") testFile("division") })