@@ -326,7 +326,7 @@ class TokenParser {
326326 node . type = 'ATOM'
327327 }
328328
329- // If the node was never closed, throw it
329+ // If the node was never closed, throw it
330330 if ( ! node . closed ) {
331331 throw new Error ( 'Unexpected end of input at position ' + ( this . pos + this . uint8Array . length - 1 ) )
332332 }
@@ -391,7 +391,7 @@ class TokenParser {
391391 let i
392392 let len
393393 const checkSP = ( pos ) => {
394- // jump to the next non whitespace pos
394+ // jump to the next non whitespace pos
395395 while ( this . uint8Array [ i + 1 ] === ' ' ) {
396396 i ++
397397 }
@@ -404,22 +404,22 @@ class TokenParser {
404404 case 'NORMAL' :
405405
406406 switch ( chr ) {
407- // DQUOTE starts a new string
407+ // DQUOTE starts a new string
408408 case '"' :
409409 this . currentNode = this . createNode ( this . currentNode , i )
410410 this . currentNode . type = 'string'
411411 this . state = 'STRING'
412412 this . currentNode . closed = false
413413 break
414414
415- // ( starts a new list
415+ // ( starts a new list
416416 case '(' :
417417 this . currentNode = this . createNode ( this . currentNode , i )
418418 this . currentNode . type = 'LIST'
419419 this . currentNode . closed = false
420420 break
421421
422- // ) closes a list
422+ // ) closes a list
423423 case ')' :
424424 if ( this . currentNode . type !== 'LIST' ) {
425425 throw new Error ( 'Unexpected list terminator ) at position ' + ( this . pos + i ) )
@@ -432,7 +432,7 @@ class TokenParser {
432432 checkSP ( )
433433 break
434434
435- // ] closes section group
435+ // ] closes section group
436436 case ']' :
437437 if ( this . currentNode . type !== 'SECTION' ) {
438438 throw new Error ( 'Unexpected section terminator ] at position ' + ( this . pos + i ) )
@@ -443,7 +443,7 @@ class TokenParser {
443443 checkSP ( )
444444 break
445445
446- // < starts a new partial
446+ // < starts a new partial
447447 case '<' :
448448 if ( String . fromCharCode ( this . uint8Array [ i - 1 ] ) !== ']' ) {
449449 this . currentNode = this . createNode ( this . currentNode , i )
@@ -459,15 +459,15 @@ class TokenParser {
459459 }
460460 break
461461
462- // { starts a new literal
462+ // { starts a new literal
463463 case '{' :
464464 this . currentNode = this . createNode ( this . currentNode , i )
465465 this . currentNode . type = 'LITERAL'
466466 this . state = 'LITERAL'
467467 this . currentNode . closed = false
468468 break
469469
470- // ( starts a new sequence
470+ // ( starts a new sequence
471471 case '*' :
472472 this . currentNode = this . createNode ( this . currentNode , i )
473473 this . currentNode . type = 'SEQUENCE'
@@ -477,14 +477,14 @@ class TokenParser {
477477 this . state = 'SEQUENCE'
478478 break
479479
480- // normally a space should never occur
480+ // normally a space should never occur
481481 case ' ' :
482- // just ignore
482+ // just ignore
483483 break
484484
485- // [ starts section
485+ // [ starts section
486486 case '[' :
487- // If it is the *first* element after response command, then process as a response argument list
487+ // If it is the *first* element after response command, then process as a response argument list
488488 if ( [ 'OK' , 'NO' , 'BAD' , 'BYE' , 'PREAUTH' ] . indexOf ( this . parent . command . toUpperCase ( ) ) >= 0 && this . currentNode === this . tree ) {
489489 this . currentNode . endPos = this . pos + i
490490
@@ -496,12 +496,12 @@ class TokenParser {
496496 this . currentNode . closed = false
497497 this . state = 'NORMAL'
498498
499- // RFC2221 defines a response code REFERRAL whose payload is an
500- // RFC2192/RFC5092 imapurl that we will try to parse as an ATOM but
501- // fail quite badly at parsing. Since the imapurl is such a unique
502- // (and crazy) term, we just specialize that case here.
499+ // RFC2221 defines a response code REFERRAL whose payload is an
500+ // RFC2192/RFC5092 imapurl that we will try to parse as an ATOM but
501+ // fail quite badly at parsing. Since the imapurl is such a unique
502+ // (and crazy) term, we just specialize that case here.
503503 if ( fromCharCode ( this . uint8Array . subarray ( i + 1 , i + 10 ) ) . toUpperCase ( ) === 'REFERRAL ' ) {
504- // create the REFERRAL atom
504+ // create the REFERRAL atom
505505 this . currentNode = this . createNode ( this . currentNode , this . pos + i + 1 )
506506 this . currentNode . type = 'ATOM'
507507 this . currentNode . endPos = this . pos + i + 8
@@ -510,30 +510,30 @@ class TokenParser {
510510 this . currentNode . valueToUpperCase = true
511511 this . currentNode = this . currentNode . parentNode
512512
513- // eat all the way through the ] to be the IMAPURL token.
513+ // eat all the way through the ] to be the IMAPURL token.
514514 this . currentNode = this . createNode ( this . currentNode , this . pos + i + 10 )
515- // just call this an ATOM, even though IMAPURL might be more correct
515+ // just call this an ATOM, even though IMAPURL might be more correct
516516 this . currentNode . type = 'ATOM'
517- // jump i to the ']'
517+ // jump i to the ']'
518518 i = this . uint8Array . indexOf ( ASCII_RIGHT_BRACKET , i + 10 )
519519 this . currentNode . endPos = this . pos + i - 1
520520 this . currentNode . valueStart = this . currentNode . startPos - this . pos
521521 this . currentNode . valueEnd = this . currentNode . endPos - this . pos + 1
522522 this . currentNode = this . currentNode . parentNode
523523
524- // close out the SECTION
524+ // close out the SECTION
525525 this . currentNode . closed = true
526526 this . currentNode = this . currentNode . parentNode
527527 checkSP ( )
528528 }
529529
530530 break
531531 }
532- /* falls through */
532+ /* falls through */
533533 default :
534- // Any ATOM supported char starts a new Atom sequence, otherwise throw an error
535- // Allow \ as the first char for atom to support system flags
536- // Allow % to support LIST '' %
534+ // Any ATOM supported char starts a new Atom sequence, otherwise throw an error
535+ // Allow \ as the first char for atom to support system flags
536+ // Allow % to support LIST '' %
537537 if ( ATOM_CHAR ( ) . indexOf ( chr ) < 0 && chr !== '\\' && chr !== '%' ) {
538538 throw new Error ( 'Unexpected char at position ' + ( this . pos + i ) )
539539 }
@@ -549,22 +549,22 @@ class TokenParser {
549549
550550 case 'ATOM' :
551551
552- // space finishes an atom
552+ // space finishes an atom
553553 if ( chr === ' ' ) {
554554 this . currentNode . endPos = this . pos + i - 1
555555 this . currentNode = this . currentNode . parentNode
556556 this . state = 'NORMAL'
557557 break
558558 }
559559
560- //
560+ //
561561 if (
562- this . currentNode . parentNode &&
563- (
564- ( chr === ')' && this . currentNode . parentNode . type === 'LIST' ) ||
565- ( chr === ']' && this . currentNode . parentNode . type === 'SECTION' )
566- )
567- ) {
562+ this . currentNode . parentNode &&
563+ (
564+ ( chr === ')' && this . currentNode . parentNode . type === 'LIST' ) ||
565+ ( chr === ']' && this . currentNode . parentNode . type === 'SECTION' )
566+ )
567+ ) {
568568 this . currentNode . endPos = this . pos + i - 1
569569 this . currentNode = this . currentNode . parentNode
570570
@@ -583,7 +583,7 @@ class TokenParser {
583583 this . state = 'SEQUENCE'
584584 }
585585
586- // [ starts a section group for this element
586+ // [ starts a section group for this element
587587 if ( chr === '[' && ( this . currentNode . equals ( 'BODY' , false ) || this . currentNode . equals ( 'BODY.PEEK' , false ) ) ) {
588588 this . currentNode . endPos = this . pos + i
589589 this . currentNode = this . createNode ( this . currentNode . parentNode , this . pos + i )
@@ -597,7 +597,7 @@ class TokenParser {
597597 throw new Error ( 'Unexpected start of partial at position ' + this . pos )
598598 }
599599
600- // if the char is not ATOM compatible, throw. Allow \* as an exception
600+ // if the char is not ATOM compatible, throw. Allow \* as an exception
601601 if ( ATOM_CHAR ( ) . indexOf ( chr ) < 0 && chr !== ']' && ! ( chr === '*' && this . currentNode . equals ( '\\' ) ) ) {
602602 throw new Error ( 'Unexpected char at position ' + ( this . pos + i ) )
603603 } else if ( this . currentNode . equals ( '\\*' ) ) {
@@ -609,7 +609,7 @@ class TokenParser {
609609
610610 case 'STRING' :
611611
612- // DQUOTE ends the string sequence
612+ // DQUOTE ends the string sequence
613613 if ( chr === '"' ) {
614614 this . currentNode . endPos = this . pos + i
615615 this . currentNode . closed = true
@@ -620,7 +620,7 @@ class TokenParser {
620620 break
621621 }
622622
623- // \ Escapes the following char
623+ // \ Escapes the following char
624624 if ( chr === '\\' ) {
625625 this . currentNode . valueSkip . push ( i - this . currentNode . valueStart )
626626 i ++
@@ -630,11 +630,11 @@ class TokenParser {
630630 chr = String . fromCharCode ( this . uint8Array [ i ] )
631631 }
632632
633- /* // skip this check, otherwise the parser might explode on binary input
634- if (TEXT_CHAR().indexOf(chr) < 0) {
635- throw new Error('Unexpected char at position ' + (this.pos + i));
636- }
637- */
633+ /* // skip this check, otherwise the parser might explode on binary input
634+ if (TEXT_CHAR().indexOf(chr) < 0) {
635+ throw new Error('Unexpected char at position ' + (this.pos + i));
636+ }
637+ */
638638
639639 this . currentNode . valueEnd = i + 1
640640 break
@@ -705,8 +705,8 @@ class TokenParser {
705705 this . currentNode . started = true
706706
707707 if ( ! this . currentNode . literalLength ) {
708- // special case where literal content length is 0
709- // close the node right away, do not wait for additional input
708+ // special case where literal content length is 0
709+ // close the node right away, do not wait for additional input
710710 this . currentNode . endPos = this . pos + i
711711 this . currentNode . closed = true
712712 this . currentNode = this . currentNode . parentNode
@@ -725,7 +725,7 @@ class TokenParser {
725725 break
726726
727727 case 'SEQUENCE' :
728- // space finishes the sequence set
728+ // space finishes the sequence set
729729 if ( chr === ' ' ) {
730730 if ( ! this . currentNode . isDigit ( - 1 ) && ! this . currentNode . equalsAt ( '*' , - 1 ) ) {
731731 throw new Error ( 'Unexpected whitespace at position ' + ( this . pos + i ) )
@@ -741,8 +741,8 @@ class TokenParser {
741741 this . state = 'NORMAL'
742742 break
743743 } else if ( this . currentNode . parentNode &&
744- chr === ']' &&
745- this . currentNode . parentNode . type === 'SECTION' ) {
744+ chr === ']' &&
745+ this . currentNode . parentNode . type === 'SECTION' ) {
746746 this . currentNode . endPos = this . pos + i - 1
747747 this . currentNode = this . currentNode . parentNode
748748
0 commit comments