|
1 |
| -var string, TABS, unlines, enlines, enslash, reslash, camelize, character, KEYWORDS_SHARED, KEYWORDS_UNUSED, KEYWORDS, ID, SYMBOL, SPACE, MULTIDENT, SIMPLESTR, JSTOKEN, BSTOKEN, NUMBER, NUMBER_OMIT, REGEX, HEREGEX_OMIT, LASTDENT, INLINEDENT, NONASCII, OPENERS, CLOSERS, INVERSES, CHAIN, ARG, BLOCK_USERS, slice$ = [].slice; |
| 1 | +var string, TABS, unlines, enlines, enslash, reslash, camelize, character, KEYWORDS_SHARED, KEYWORDS_UNUSED, KEYWORDS, ID, SYMBOL, SPACE, MULTIDENT, SIMPLESTR, BSTOKEN, JSTOKEN, NUMBER, NUMBER_OMIT, REGEX, HEREGEX_OMIT, LASTDENT, INLINEDENT, NONASCII, OPENERS, CLOSERS, INVERSES, CHAIN, ARG, BLOCK_USERS, slice$ = [].slice; |
2 | 2 | exports.lex = function(code, options){
|
3 | 3 | return (clone$(exports)).tokenize(code || '', options || {});
|
4 | 4 | };
|
@@ -353,11 +353,12 @@ exports.doComment = function(code, index){
|
353 | 353 | return this.countLines(comment).length;
|
354 | 354 | };
|
355 | 355 | exports.doJS = function(code, lastIndex){
|
356 |
| - var js, ref$; |
| 356 | + var ref$, lit, js; |
357 | 357 | JSTOKEN.lastIndex = lastIndex;
|
358 |
| - js = JSTOKEN.exec(code)[0] || this.carp('unterminated JS literal'); |
359 |
| - this.token('LITERAL', (ref$ = Object(detab(js.slice(1, -1), this.dent)), ref$.js = true, ref$), true); |
360 |
| - return this.countLines(js).length; |
| 358 | + ref$ = JSTOKEN.exec(code), lit = ref$[0], js = ref$[2]; |
| 359 | + lit || this.carp('unterminated JS literal'); |
| 360 | + this.token('LITERAL', (ref$ = Object(detab(js, this.dent)), ref$.js = true, ref$), true); |
| 361 | + return this.countLines(lit).length; |
361 | 362 | };
|
362 | 363 | exports.doRegex = function(code, index){
|
363 | 364 | var divisible, ref$, input, body, flag;
|
@@ -1455,8 +1456,8 @@ SYMBOL = /[-+*\/%&|^:]=|\.{1,3}|([-+&|@:])\1|[-~=|]>|[!=]==?|<(?:<(?:=|<{0,2})|[
|
1455 | 1456 | SPACE = /[^\n\S]*(?:#.*)?/g;
|
1456 | 1457 | MULTIDENT = /(?:\s*#.*)*(?:\n([^\n\S]*))+/g;
|
1457 | 1458 | SIMPLESTR = /'[^\\']*(?:\\[\s\S][^\\']*)*'|/g;
|
1458 |
| -JSTOKEN = /`[^\\`]*(?:\\[\s\S][^\\`]*)*`|/g; |
1459 | 1459 | BSTOKEN = /\\(?:(\S[^\s,;)}\]]*)|\s*)/g;
|
| 1460 | +JSTOKEN = /(`+)([^`][\s\S]*?)\1|/g; |
1460 | 1461 | NUMBER = /0x[\dA-Fa-f][\dA-Fa-f_]*|([2-9]|[12]\d|3[0-6])r([\dA-Za-z]\w*)|((\d[\d_]*)(\.\d[\d_]*)?(?:e[+-]?\d[\d_]*)?)[$\w]*|/g;
|
1461 | 1462 | NUMBER_OMIT = /_+/g;
|
1462 | 1463 | REGEX = /\/([^[\/\n\\]*(?:(?:\\.|\[[^\]\n\\]*(?:\\.[^\]\n\\]*)*\])[^[\/\n\\]*)*)\/([gimy]{1,4}|\$?)|/g;
|
|
0 commit comments