lib/parse.js
/**
   * Parses the next token and sets `tkType` and `tkString`
   * @throws {@see SyntaxError} on invalid token
   */
Parses the next token and sets `tkType` and `tkString`
@throws  SyntaxError on invalid token
Parses the next token and sets ` tkType ` and ` tkString ` @throws SyntaxError on invalid token
function tkNext() {
    var result, type, string, length;
    while (
      (result = tkRegex.exec(text)) &&
      (length = len(result[0]), string = result[1])
    ) {
      column += length;
    }
    if (result) {
      if (result[8]) {
        throw error('unexpected character');
      }
      for (
        string = result[0], type = 1;
        type < 8 && result[type + 1] == null;
        type++
      ) {}
      if (type < 2 ) {
        line++;
        column = 1;
      } else {
        column += length;
      }
      if (type === 5) {
        string = string.slice(1, length - 1);
      }
      if (type > 3 && type < 6 ) {
        string = string.replace(unescapeRegex, unescapeReplacer);
      }
      if (type > 5 ) {
        var lines = [];
        while (result = multilineRegex.exec(string)) {
          lines.push(result[1]);
          if (result[2]) {
            line++;
          }
        }
        string = lines.join('\n');
        column = 0;
      }
      tkType = type;
      tkString = string;
    } else {
      tkType = 0;
      tkString = '';
    }
  }
function tkNext ( ) { var result , type , string , length ; while ( ( result = tkRegex . exec ( text ) ) && ( length = len ( result [ 0 ] ) , string = result [ 1 ] ) ) { column += length ; } if ( result ) { if ( result [ 8 ] ) { throw error ( 'unexpected character' ) ; } for ( string = result [ 0 ] , type = 1 ; type < 8 && result [ type + 1 ] == null ; type ++ ) { } if ( type < 2 ) { line ++ ; column = 1 ; } else { column += length ; } if ( type === 5 ) { string = string . slice ( 1 , length - 1 ) ; } if ( type > 3 && type < 6 ) { string = string . replace ( unescapeRegex , unescapeReplacer ) ; } if ( type > 5 ) { var lines = [ ] ; while ( result = multilineRegex . exec ( string ) ) { lines . push ( result [ 1 ] ) ; if ( result [ 2 ] ) { line ++ ; } } string = lines . join ( '\n' ) ; column = 0 ; } tkType = type ; tkString = string ; } else { tkType = 0 ; tkString = '' ; } }
Parses the next token and sets `tkType` and `tkString`
 @throws {@see SyntaxError} on invalid token
Parses the next token and sets ` tkType ` and ` tkString ` @throws { @see SyntaxError } on invalid token
// Slurp whitespace // Detect the type of the match // Increment line and column numbers /*SEPARATOR*/ /* type === NEWLINE */ // Remove quotes from strings /*STRING*/ // Unescape escape sequences in literals and strings /*OPERATOR*/ /*MULTILINE*/ /* type === LITERAL || type === STRING */ // Extract line bodies from multiline strings /*STRING*/ /* type === MULTILINE */ /*EOF*/