src/parser.js
function parseStatements(lex, endTokens, isRoot) {
    endTokens = Array.isArray(endTokens) ? endTokens : [endTokens];
    var statements = [];
    var temp = lex.peek();
    while (endTokens.indexOf(temp) === -1 &&
           (temp.type && endTokens.indexOf(temp.type) === -1)) {
        var statement = parseStatement(lex, isRoot);
        if (!statement) {
            throw new Error('Invalid statement');
        }
        temp = lex.peek();
        statements.push(statement);
    }
    return statements;
}
function parseStatements(lex, endTokens, isRoot) {
    endTokens = Array.isArray(endTokens) ? endTokens : [endTokens];
    var statements = [];
    var temp = lex.peek();
    while (endTokens.indexOf(temp) === -1 &&
           (temp.type && endTokens.indexOf(temp.type) === -1)) {
        var statement = parseStatement(lex, isRoot);
        if (!statement) {
            throw new Error('Invalid statement');
        }
        temp = lex.peek();
        statements.push(statement);
    }
    return statements;
}
function parseStatements ( lex , endTokens , isRoot ) { endTokens = Array . isArray ( endTokens ) ? endTokens : [ endTokens ] ; var statements = [ ] ; var temp = lex . peek ( ) ; while ( endTokens . indexOf ( temp ) === - 1 && ( temp . type && endTokens . indexOf ( temp . type ) === - 1 ) ) { var statement = parseStatement ( lex , isRoot ) ; if ( ! statement ) { throw new Error ( 'Invalid statement' ) ; } temp = lex . peek ( ) ; statements . push ( statement ) ; } return statements ; }
Parses an array of statements
@param  {Lexer} lex
@param  {string|string[]} endTokens
@param  {bool} isRoot
@return {array}
Parses an array of statements