MCPcopy Create free account
hub / github.com/aurelia/binding / scanTemplate

Method scanTemplate

src/parser.js:497–525  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

495 }
496
497 scanTemplate() {
498 let tail = true;
499 let result = '';
500
501 while (this.next() !== /*`*/0x60) {
502 if (this.ch === /*$*/0x24) {
503 if ((this.idx + 1) < this.len && this.src.charCodeAt(this.idx + 1) === /*{*/0x7B) {
504 this.idx++;
505 tail = false;
506 break;
507 } else {
508 result += '$';
509 }
510 } else if (this.ch === /*\*/0x5C) {
511 result += fromCharCode(unescape(this.next()));
512 } else if (this.ch === /*EOF*/0 || this.idx >= this.len) {
513 this.err('Unterminated template literal');
514 } else {
515 result += fromCharCode(this.ch);
516 }
517 }
518
519 this.next();
520 this.val = result;
521 if (tail) {
522 return T$TemplateTail;
523 }
524 return T$TemplateContinuation;
525 }
526
527 scanTemplateTail() {
528 if (this.idx >= this.len) {

Callers 2

scanTemplateTailMethod · 0.95
parser.jsFile · 0.80

Calls 3

nextMethod · 0.95
errMethod · 0.95
unescapeFunction · 0.70

Tested by

no test coverage detected