Add NaN support

This commit is contained in:
syuilo 2017-02-10 01:19:27 +09:00
parent c12253f56b
commit e1eed38857
2 changed files with 15 additions and 0 deletions

View File

@ -271,6 +271,20 @@ const elements = [
} }
}, },
// nan
(code, i, source) => {
const prev = source[i - 1];
if (prev && /[a-zA-Z]/.test(prev)) return null;
if (code.substr(0, 3) == 'NaN') {
return {
html: `<span class="nan">NaN</span>`,
next: 3
};
} else {
return null;
}
},
// keyword // keyword
(code, i, source) => { (code, i, source) => {
const prev = source[i - 1]; const prev = source[i - 1];

View File

@ -137,6 +137,7 @@ pre
color #42b983 color #42b983
.number .number
.nan
color #ae81ff color #ae81ff
.var:not(.keyword) .var:not(.keyword)