Skip to content

Commit 614d669

Browse files
committed
add a is_NUM_START function
1 parent 60c9d91 commit 614d669

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/lexer/utils.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ const tokens = ";:,.\\[]()|^&+-/*=%!~$<>?@";
1010
module.exports = {
1111
// check if the char can be a numeric
1212
is_NUM: function() {
13+
const ch = this._input.charCodeAt(this.offset - 1);
14+
return (ch > 47 && ch < 58) || ch === 95;
15+
},
16+
17+
// check if the char can be a numeric
18+
is_NUM_START: function() {
1319
const ch = this._input.charCodeAt(this.offset - 1);
1420
return ch > 47 && ch < 58;
1521
},
@@ -76,7 +82,10 @@ module.exports = {
7682
is_HEX: function() {
7783
const ch = this._input.charCodeAt(this.offset - 1);
7884
return (
79-
(ch > 47 && ch < 58) || (ch > 64 && ch < 71) || (ch > 96 && ch < 103)
85+
(ch > 47 && ch < 58) ||
86+
(ch > 64 && ch < 71) ||
87+
(ch > 96 && ch < 103) ||
88+
ch === 95
8089
);
8190
}
8291
};

0 commit comments

Comments
 (0)