code: function parser(input) {
      var state = {};
      var root = state.component = [];
  
      state.stack = [root];
  
      parser._eachLine(input, function(err, line) {
        parser._handleContentLine(line, state);
      });
  
  
      // when there are still items on the stack
      // throw a fatal error, a component was not closed
      // correctly in that case.
      if (state.stack.length > 1) {
        throw new ParserError(
          'invalid ical body. component began but did not end'
        );
      }
  
      state = null;
  
      return (root.length == 1 ? root[0] : root);
    }
docs: Parses iCalendar or vCard data into a raw jCal object. Consult
  documentation on the {@tutorial layers|layers of parsing} for more
  details.
  
  @function ICAL.parse
  @variation function
  @todo Fix the API to be more clear on the return type
  @param {String} input      The string data to parse
  @return {Object|Object[]}  A single jCal object, or an array thereof