大文字対応

This commit is contained in:
syuilo 2017-02-10 01:42:22 +09:00
parent 3742f4fe52
commit 4330d41f5d

View file

@ -25,7 +25,7 @@ function escape(text) {
// 文字数が多い順にソートします
// そうしないと、「function」という文字列が与えられたときに「func」が先にマッチしてしまう可能性があるためです
const keywords = [
const _keywords = [
'true',
'false',
'null',
@ -94,7 +94,12 @@ const keywords = [
'extends',
'implements',
'constructor'
].sort((a, b) => b.length - a.length);
];
const keywords = _keywords
.concat(_keywords.map(k => k[0].toUpperCase() + k.substr(1)))
.concat(_keywords.map(k => k.toUpperCase()))
.sort((a, b) => b.length - a.length);
const symbols = [
'=',