Ox.tokenize: handle '.1'
This commit is contained in:
parent
625325a6e6
commit
71218cd61f
1 changed files with 7 additions and 3 deletions
|
@ -903,8 +903,8 @@ Ox.tokenize <f> Tokenizes JavaScript
|
||||||
14
|
14
|
||||||
> Ox.tokenize('return /foo/gi;')[2].value.length
|
> Ox.tokenize('return /foo/gi;')[2].value.length
|
||||||
7
|
7
|
||||||
> Ox.tokenize('[0xFF, 1e1, 1e+1, 1e-1, 1e+1+1]').length
|
> Ox.tokenize('[.1, 0xFF, 1e1, 1e+1, 1e-1, 1e+1+1]').length
|
||||||
17
|
20
|
||||||
@*/
|
@*/
|
||||||
Ox.tokenize = (function() {
|
Ox.tokenize = (function() {
|
||||||
|
|
||||||
|
@ -999,7 +999,10 @@ Ox.tokenize = (function() {
|
||||||
} else if (linebreak.indexOf(char) > -1) {
|
} else if (linebreak.indexOf(char) > -1) {
|
||||||
type = 'linebreak';
|
type = 'linebreak';
|
||||||
while (linebreak.indexOf(source[++cursor]) > -1) {}
|
while (linebreak.indexOf(source[++cursor]) > -1) {}
|
||||||
} else if (number.indexOf(char) > -1) {
|
} else if (
|
||||||
|
number.indexOf(char) > -1
|
||||||
|
|| char == '.' && number.indexOf(source[cursor + 1]) > -1
|
||||||
|
) {
|
||||||
type = 'number';
|
type = 'number';
|
||||||
while ((number + '.abcdefxABCDEFX+-').indexOf(source[++cursor]) > -1) {
|
while ((number + '.abcdefxABCDEFX+-').indexOf(source[++cursor]) > -1) {
|
||||||
if (
|
if (
|
||||||
|
@ -1016,6 +1019,7 @@ Ox.tokenize = (function() {
|
||||||
}
|
}
|
||||||
while (regexp.indexOf(source[++cursor]) > -1) {}
|
while (regexp.indexOf(source[++cursor]) > -1) {}
|
||||||
} else if (operator.indexOf(char) > -1) {
|
} else if (operator.indexOf(char) > -1) {
|
||||||
|
// has to be tested after number and regexp
|
||||||
type = 'operator';
|
type = 'operator';
|
||||||
while (operator.indexOf(char += source[++cursor]) > -1 && cursor < length) {}
|
while (operator.indexOf(char += source[++cursor]) > -1 && cursor < length) {}
|
||||||
} else if (string.indexOf(delimiter = char) > -1) {
|
} else if (string.indexOf(delimiter = char) > -1) {
|
||||||
|
|
Loading…
Reference in a new issue