Merge pull request babel/babel-eslint#93 from hzoo/tokenTypes

add tokenTypes: Null, Boolean, RegularExpression
This commit is contained in:
Sebastian McKenzie
2015-05-13 00:27:19 +01:00
parent 758e8d40e5
commit 527287aa29

View File

@@ -34,6 +34,10 @@ exports.toToken = function (token) {
token.value = ">";
} else if (type === tt.jsxName) {
token.type = "JSXIdentifier";
} else if (type.keyword === "null") {
token.type = "Null";
} else if (type.keyword === "false" || token.keyword === "true") {
token.type = "Boolean";
} else if (type.keyword) {
token.type = "Keyword";
} else if (type === tt.num) {
@@ -42,6 +46,8 @@ exports.toToken = function (token) {
} else if (type === tt.string) {
token.type = "String";
token.value = JSON.stringify(token.value);
} else if (type === tt.regexp) {
token.type = "RegularExpression";
}
return token;