/** * Parse a stream lexed by the lexer with the same IEnumToken * * @param stream The stream of tokens lexed * @return The head node of the parse tree * @throws CompileException If parse failed */ public Node parse(CodeFile file, PackedToken[] stream) { this.stream_idx = 0; this.stream = stream; this.furthest_idx = 0; this.node = Node.newTopNode(file); if (stream.length == 0 || (Search.doExpressionSearch(this, EnumExpression.START, false) && this.atEnd())) { return this.node; } else { PackedToken last = stream[furthest_idx]; throw new ParseExpressionException(file, last.row, last.col); } }