lib/parser/index.js
function parse(code) {
    try {
        var labels = {};
        var root = [];
        var manager = new BlockManager();

        var lines = code.split('\n');
        for (var i = 0; i < lines.length; i++) {
            try {
                var line = parseLine(lines[i].trim(), i, labels, false, manager);
                if (line instanceof SyntaxError) throw createLineError(line, i);
                if (line.error instanceof SyntaxError) throw createLineError(line.error, i);
                root[i] = line;
            } catch (ex) {
                throw createLineError(ex, i);
            }
        }

        return new AbstractSyntaxTree(root, labels, manager);
    } catch (ex) {
        return { "error": ex };
    }
}
function parse(code) {
    try {
        var labels = {};
        var root = [];
        var manager = new BlockManager();

        var lines = code.split('\n');
        for (var i = 0; i < lines.length; i++) {
            try {
                var line = parseLine(lines[i].trim(), i, labels, false, manager);
                if (line instanceof SyntaxError) throw createLineError(line, i);
                if (line.error instanceof SyntaxError) throw createLineError(line.error, i);
                root[i] = line;
            } catch (ex) {
                throw createLineError(ex, i);
            }
        }

        return new AbstractSyntaxTree(root, labels, manager);
    } catch (ex) {
        return { "error": ex };
    }
}
function parse ( code ) { try { var labels = { } ; var root = [ ] ; var manager = new BlockManager ( ) ; var lines = code . split ( '\n' ) ; for ( var i = 0 ; i < lines . length ; i ++ ) { try { var line = parseLine ( lines [ i ] . trim ( ) , i , labels , false , manager ) ; if ( line instanceof SyntaxError ) throw createLineError ( line , i ) ; if ( line . error instanceof SyntaxError ) throw createLineError ( line . error , i ) ; root [ i ] = line ; } catch ( ex ) { throw createLineError ( ex , i ) ; } } return new AbstractSyntaxTree ( root , labels , manager ) ; } catch ( ex ) { return { "error" : ex } ; } }
Parses BASIC code and returns an abstract syntax tree

@param {String} code
@returns {AbstractSyntaxTree|{error: String}} The resulting AST
Parses BASIC code and returns an abstract syntax tree