Merge pull request #900 from lydell/js-tokens-1.0

Upgrade to js-tokens@1.0.0
This commit is contained in:
Sebastian McKenzie 2015-02-26 21:13:55 +11:00
commit f753cf4845
2 changed files with 14 additions and 15 deletions

View File

@ -49,7 +49,7 @@
"fs-readdir-recursive": "^0.1.0",
"globals": "^6.2.0",
"is-integer": "^1.0.4",
"js-tokens": "0.4.1",
"js-tokens": "^1.0.0",
"leven": "^1.0.1",
"line-numbers": "0.2.0",
"lodash": "^3.2.0",

View File

@ -6,18 +6,17 @@ import chalk from "chalk";
import ary from "lodash/function/ary";
var defs = {
string: chalk.red,
punctuation: chalk.white.bold,
operator: chalk.white.bold,
curly: chalk.green,
parens: chalk.blue.bold,
square: chalk.yellow,
name: chalk.white,
keyword: chalk.cyan,
number: chalk.magenta,
regex: chalk.magenta,
comment: chalk.grey,
invalid: chalk.inverse
string: chalk.red,
punctuator: chalk.white.bold,
curly: chalk.green,
parens: chalk.blue.bold,
square: chalk.yellow,
name: chalk.white,
keyword: chalk.cyan,
number: chalk.magenta,
regex: chalk.magenta,
comment: chalk.grey,
invalid: chalk.inverse
};
var newline = /\r\n|[\n\r\u2028\u2029]/;
@ -25,11 +24,11 @@ var newline = /\r\n|[\n\r\u2028\u2029]/;
var highlight = function (text) {
var tokenType = function (match) {
var token = jsTokens.matchToToken(match);
if (token.type === "name" && esutils.keyword.isKeywordES6(token.value)) {
if (token.type === "name" && esutils.keyword.isReservedWordES6(token.value)) {
return "keyword";
}
if (token.type === "punctuation") {
if (token.type === "punctuator") {
switch (token.value) {
case "{":
case "}":