function(input) {
    if (typeof input !== 'string') {
      throw new TypeError('expected a string');
    }

    this.init(this.options);
    this.orig = input;
    this.input = input;
    var self = this;

    function parse() {
      // check input before calling `.next()`
      input = self.input;

      // get the next AST ndoe
      var node = self.next();
      if (node) {
        var prev = self.prev();
        if (prev) {
          define(node, 'parent', prev);
          if (prev.nodes) {
            prev.nodes.push(node);
          }
        }

        if (self.sets.hasOwnProperty(prev.type)) {
          self.currentType = prev.type;
        }
      }

      // if we got here but input is not changed, throw an error
      if (self.input && input === self.input) {
        throw new Error('no parsers registered for: "' + self.input.slice(0, 5) + '"');
      }
    }

    while (this.input) parse();
    if (this.stack.length && this.options.strict) {
      var node = this.stack.pop();
      throw this.error('missing opening ' + node.type + ': "' + this.orig + '"');
    }

    var eos = this.eos();
    var tok = this.prev();
    if (tok.type !== 'eos') {
      this.ast.nodes.push(eos);
    }

    return this.ast;
  }
function(input) {
    if (typeof input !== 'string') {
      throw new TypeError('expected a string');
    }

    this.init(this.options);
    this.orig = input;
    this.input = input;
    var self = this;

    function parse() {
      // check input before calling `.next()`
      input = self.input;

      // get the next AST ndoe
      var node = self.next();
      if (node) {
        var prev = self.prev();
        if (prev) {
          define(node, 'parent', prev);
          if (prev.nodes) {
            prev.nodes.push(node);
          }
        }

        if (self.sets.hasOwnProperty(prev.type)) {
          self.currentType = prev.type;
        }
      }

      // if we got here but input is not changed, throw an error
      if (self.input && input === self.input) {
        throw new Error('no parsers registered for: "' + self.input.slice(0, 5) + '"');
      }
    }

    while (this.input) parse();
    if (this.stack.length && this.options.strict) {
      var node = this.stack.pop();
      throw this.error('missing opening ' + node.type + ': "' + this.orig + '"');
    }

    var eos = this.eos();
    var tok = this.prev();
    if (tok.type !== 'eos') {
      this.ast.nodes.push(eos);
    }

    return this.ast;
  }
function ( input ) { if ( typeof input !== 'string' ) { throw new TypeError ( 'expected a string' ) ; } this . init ( this . options ) ; this . orig = input ; this . input = input ; var self = this ; function parse ( ) { // check input before calling `.next()` input = self . input ; // get the next AST ndoe var node = self . next ( ) ; if ( node ) { var prev = self . prev ( ) ; if ( prev ) { define ( node , 'parent' , prev ) ; if ( prev . nodes ) { prev . nodes . push ( node ) ; } } if ( self . sets . hasOwnProperty ( prev . type ) ) { self . currentType = prev . type ; } } // if we got here but input is not changed, throw an error if ( self . input && input === self . input ) { throw new Error ( 'no parsers registered for: "' + self . input . slice ( 0 , 5 ) + '"' ) ; } } while ( this . input ) parse ( ) ; if ( this . stack . length && this . options . strict ) { var node = this . stack . pop ( ) ; throw this . error ( 'missing opening ' + node . type + ': "' + this . orig + '"' ) ; } var eos = this . eos ( ) ; var tok = this . prev ( ) ; if ( tok . type !== 'eos' ) { this . ast . nodes . push ( eos ) ; } return this . ast ; }
Parse the given string.
@return {Array}
Parse the given string .