js-tokens
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -0,3 +1,11 @@ | ||
### 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. |
@@ -1,2 +0,2 @@ | ||
module.exports = /(\s+)|(\/\/.*|\/\*(?:[^*]|\*(?!\/))*(?:\*\/)?)|('(?:[^'\\\r\n]|\\(?:\r\n|[\s\S]))*'?|"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))*"?)|(\/(?:\[(?:[^\]\\\r\n]|\\.)*\]|[^\/\]\\\r\n]|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiy]{1,4}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(-?(?:0[xX][\da-fA-F]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?))|((?:[$_a-zA-Z\d\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]{1,6}\})+)|([;,.[\](){}])|(=>)|(--|\+\+|&&|\|\||(?:[+\-*\/%&|^]|<{1,2}|>{1,3}|!=?|={1,2})=?|[?:~])|(^$)|([\s\S])/g | ||
module.exports = /(\s+)|(\/\/.*|\/\*(?:[^*]|\*(?!\/))*(?:\*\/)?)|('(?:[^'\\\r\n]|\\(?:\r\n|[\s\S]))*'?|"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))*"?)|(\/(?:\[(?:[^\]\\\r\n]|\\.)*\]|[^\/\]\\\r\n]|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiy]{1,4}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(-?(?:0[xX][\da-fA-F]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?))|((?:[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]{1,6}\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-*\/%&|^]|<{1,2}|>{1,3}|!=?|={1,2})=?|[?:~])|([;,.[\](){}])|(^$)|([\s\S])/g | ||
module.exports.names = [ | ||
@@ -9,7 +9,6 @@ "whitespace", | ||
"name", | ||
"operator", | ||
"punctuation", | ||
"functionArrow", | ||
"operator", | ||
"empty", | ||
"invalid" | ||
] |
{ | ||
"name": "js-tokens", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"author": "Simon Lydell", | ||
@@ -8,3 +8,2 @@ "license": "MIT", | ||
"main": "index.js", | ||
"repository": "lydell/js-tokens", | ||
"keywords": [ | ||
@@ -17,2 +16,3 @@ "JavaScript", | ||
], | ||
"repository": "lydell/js-tokens", | ||
"scripts": { | ||
@@ -25,2 +25,2 @@ "test": "mocha" | ||
} | ||
} | ||
} |
@@ -21,3 +21,3 @@ Overview [![Build Status](https://travis-ci.org/lydell/js-tokens.png?branch=master)](https://travis-ci.org/lydell/js-tokens) | ||
if (lastSignificantToken !== "." && token === "foo") { | ||
return "bar" | ||
token = "bar" | ||
} | ||
@@ -36,3 +36,4 @@ if (name !== "comment" && name !== "whitespace") { | ||
`npm install js-tokens` | ||
- `npm install js-tokens` | ||
- `component install lydell/js-tokens` | ||
@@ -67,4 +68,3 @@ ```js | ||
contain (unescaped) newlines, so unterminated strings simply end at the end of | ||
the line. You may use `/['"]$/.test(matchedStringToken)` to determine if a | ||
string was terminated or not. | ||
the line. | ||
@@ -71,0 +71,0 @@ Unterminated multi-line comments are also still matched as comments. They |
@@ -425,3 +425,2 @@ // Copyright 2014 Simon Lydell | ||
match("\\u0000") | ||
@@ -465,11 +464,2 @@ match("\\u15cF") | ||
token("functionArrow", function(match) { | ||
match("=>") | ||
match("==>", false) | ||
match("=>>", "=>") | ||
}) | ||
token("operator", function(match) { | ||
@@ -528,2 +518,11 @@ | ||
match("=>") | ||
match("==>", "==") | ||
match("=>>", "=>") | ||
match("...") | ||
match("..", false) | ||
match(".", false) | ||
match("....", "...") | ||
match("?") | ||
@@ -530,0 +529,0 @@ match(":") |
Sorry, the diff of this file is not supported yet
37657
19
907