Comparing version 0.4.1 to 1.0.0
@@ -0,1 +1,12 @@ | ||
### 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) ### | ||
@@ -2,0 +13,0 @@ |
@@ -6,3 +6,3 @@ // Copyright 2014, 2015 Simon Lydell | ||
// (run `npm run build`). | ||
module.exports = /((['"])(?:(?!\2)[^\\\r\n\u2028\u2029]|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:[^\]\\\r\n\u2028\u2029]|\\.)*\]|[^\/\]\\\r\n\u2028\u2029]|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyu]{1,5}\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]{1,6}\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-*\/%&|^]|<{1,2}|>{1,3}|!=?|={1,2})=?|[?:~])|([;,.[\](){}])|(\s+)|(^$|[\s\S])/g | ||
module.exports = /((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyu]{1,5}\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]{1,6}\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-*\/%&|^]|<{1,2}|>{1,3}|!=?|={1,2})=?|[?:~]|[;,.[\](){}])|(\s+)|(^$|[\s\S])/g | ||
@@ -17,6 +17,5 @@ module.exports.matchToToken = function(match) { | ||
else if (match[10]) token.type = "name" | ||
else if (match[11]) token.type = "operator" | ||
else if (match[12]) token.type = "punctuation" | ||
else if (match[13]) token.type = "whitespace" | ||
else if (match[11]) token.type = "punctuator" | ||
else if (match[12]) token.type = "whitespace" | ||
return token | ||
} |
{ | ||
"name": "js-tokens", | ||
"version": "0.4.1", | ||
"version": "1.0.0", | ||
"author": "Simon Lydell", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -47,4 +47,3 @@ Overview [![Build Status](https://travis-ci.org/lydell/js-tokens.png?branch=master)](https://travis-ci.org/lydell/js-tokens) | ||
- name | ||
- operator | ||
- punctuation | ||
- punctuator | ||
- whitespace | ||
@@ -59,4 +58,10 @@ - invalid | ||
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. | ||
For example usage, please see this [gist]. | ||
[is-keyword-js]: https://github.com/crissdev/is-keyword-js | ||
[gist]: https://gist.github.com/lydell/be49dbf80c382c473004 | ||
@@ -99,3 +104,3 @@ | ||
Template strings are matched as single tokens, from the starting `` ` `` to then | ||
Template strings are matched as single tokens, from the starting `` ` `` to the | ||
ending `` ` ``, including interpolations (whose tokens are not matched | ||
@@ -102,0 +107,0 @@ individually). |
@@ -54,3 +54,3 @@ [ | ||
"// convert the first 8 bits to one ascii character","\n ", | ||
"bc","++"," ","%"," ","4",")"," ","?"," ","output"," ","+="," ","String",".","fromCharCode","(","255"," ","&"," ","bs"," ",">>"," ","(","-2"," ","*"," ","bc"," ","&"," ","6",")",")"," ",":"," ","0","\n ", | ||
"bc","++"," ","%"," ","4",")"," ","?"," ","output"," ","+="," ","String",".","fromCharCode","(","255"," ","&"," ","bs"," ",">>"," ","(","-","2"," ","*"," ","bc"," ","&"," ","6",")",")"," ",":"," ","0","\n ", | ||
")"," ","{","\n ", | ||
@@ -57,0 +57,0 @@ "// try to find character in table (0-63, not found => -1)","\n ", |
@@ -7,3 +7,3 @@ [ | ||
"foo"," ","="," ","1","/","a","/","+","str","\n", | ||
"foo"," ","="," ","1","/","a","/","-1","\n", | ||
"foo"," ","="," ","1","/","a","/","-","1","\n", | ||
"foo"," ","="," ","1","/","a","/","-","bar","\n", | ||
@@ -10,0 +10,0 @@ "foo"," ","="," ","1","/","a","/","--","bar","\n", |
@@ -434,8 +434,8 @@ // Copyright 2014, 2015 Simon Lydell | ||
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) | ||
@@ -492,8 +492,8 @@ | ||
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) | ||
@@ -521,8 +521,8 @@ match("0x", "0") | ||
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) | ||
@@ -550,8 +550,8 @@ match("0o", "0") | ||
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) | ||
@@ -634,19 +634,4 @@ match("0b", "0") | ||
token("punctuation", function(match) { | ||
token("punctuator", function(match) { | ||
match(";") | ||
match(".") | ||
match(",") | ||
match("[") | ||
match("]") | ||
match("(") | ||
match(")") | ||
match("{") | ||
match("}") | ||
}) | ||
token("operator", function(match) { | ||
match("+") | ||
@@ -708,4 +693,4 @@ match("++") | ||
match("...") | ||
match("..", false) | ||
match(".", false) | ||
match("..", ".") | ||
match(".") | ||
match("....", "...") | ||
@@ -717,2 +702,12 @@ | ||
match(";") | ||
match(".") | ||
match(",") | ||
match("[") | ||
match("]") | ||
match("(") | ||
match(")") | ||
match("{") | ||
match("}") | ||
match("/a/()", "/") | ||
@@ -719,0 +714,0 @@ match("/a/g()", "/") |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
44769
1
200
1053