/** * Sets the node start and end positions. * Computes the length as ({@code end} - {@code position}). */ public void setBounds(int position, int end) { setPosition(position); setLength(end - position); }
/** * Sets the node start and end positions. * Computes the length as ({@code end} - {@code position}). */ public void setBounds(int position, int end) { setPosition(position); setLength(end - position); }
/** * Sets the node start and end positions. * Computes the length as ({@code end} - {@code position}). */ public void setBounds(int position, int end) { setPosition(position); setLength(end - position); }
/** * Sets the node start and end positions. * Computes the length as ({@code end} - {@code position}). */ public void setBounds(int position, int end) { setPosition(position); setLength(end - position); }
/** * Adds a child or function to the end of the block. * Sets the parent of the child to this node, and fixes up * the start position of the child to be relative to this node. * Sets the length of this node to include the new child. * @param kid the child * @throws IllegalArgumentException if kid is {@code null} */ public void addChild(AstNode kid) { assertNotNull(kid); int end = kid.getPosition() + kid.getLength(); setLength(end - this.getPosition()); addChildToBack(kid); kid.setParent(this); }
/** * Adds a child or function to the end of the block. * Sets the parent of the child to this node, and fixes up * the start position of the child to be relative to this node. * Sets the length of this node to include the new child. * @param kid the child * @throws IllegalArgumentException if kid is {@code null} */ public void addChild(AstNode kid) { assertNotNull(kid); int end = kid.getPosition() + kid.getLength(); setLength(end - this.getPosition()); addChildToBack(kid); kid.setParent(this); }
/** * Adds a child or function to the end of the block. * Sets the parent of the child to this node, and fixes up * the start position of the child to be relative to this node. * Sets the length of this node to include the new child. * @param kid the child * @throws IllegalArgumentException if kid is {@code null} */ public void addChild(AstNode kid) { assertNotNull(kid); int end = kid.getPosition() + kid.getLength(); setLength(end - this.getPosition()); addChildToBack(kid); kid.setParent(this); }
/** * Adds a child or function to the end of the block. * Sets the parent of the child to this node, and fixes up * the start position of the child to be relative to this node. * Sets the length of this node to include the new child. * @param kid the child * @throws IllegalArgumentException if kid is {@code null} */ public void addChild(AstNode kid) { assertNotNull(kid); int end = kid.getPosition() + kid.getLength(); setLength(end - this.getPosition()); addChildToBack(kid); kid.setParent(this); }
private AstNode statements(AstNode parent) throws IOException { if (currentToken != Token.LC // assertion can be invalid in bad code && !compilerEnv.isIdeMode()) codeBug(); int pos = ts.tokenBeg; AstNode block = parent != null ? parent : new Block(pos); block.setLineno(ts.lineno); int tt; while ((tt = peekToken()) > Token.EOF && tt != Token.RC) { block.addChild(statement()); } block.setLength(ts.tokenBeg - pos); return block; }
private AstNode statements(AstNode parent) throws IOException { if (currentToken != Token.LC // assertion can be invalid in bad code && !compilerEnv.isIdeMode()) codeBug(); int pos = ts.tokenBeg; AstNode block = parent != null ? parent : new Block(pos); block.setLineno(ts.lineno); int tt; while ((tt = peekToken()) > Token.EOF && tt != Token.RC) { block.addChild(statement()); } block.setLength(ts.tokenBeg - pos); return block; }
private AstNode statements(AstNode parent) throws IOException { if (currentToken != Token.LC // assertion can be invalid in bad code && !compilerEnv.isIdeMode()) codeBug(); int pos = ts.tokenBeg; AstNode block = parent != null ? parent : new Block(pos); block.setLineno(ts.lineno); int tt; while ((tt = peekToken()) > Token.EOF && tt != Token.RC) { block.addChild(statement()); } block.setLength(ts.tokenBeg - pos); return block; }
private AstNode statements(AstNode parent) throws IOException { if (currentToken != Token.LC // assertion can be invalid in bad code && !compilerEnv.isIdeMode()) codeBug(); int pos = ts.tokenBeg; AstNode block = parent != null ? parent : new Block(pos); block.setLineno(ts.lineno); int tt; while ((tt = peekToken()) > Token.EOF && tt != Token.RC) { block.addChild(statement()); } block.setLength(ts.tokenBeg - pos); return block; }
private void autoInsertSemicolon(AstNode pn) throws IOException { int ttFlagged = peekFlaggedToken(); int pos = pn.getPosition(); switch (ttFlagged & CLEAR_TI_MASK) { case Token.SEMI: // Consume ';' as a part of expression consumeToken(); // extend the node bounds to include the semicolon. pn.setLength(ts.tokenEnd - pos); break; case Token.ERROR: case Token.EOF: case Token.RC: // Autoinsert ; warnMissingSemi(pos, nodeEnd(pn)); break; default: if ((ttFlagged & TI_AFTER_EOL) == 0) { // Report error if no EOL or autoinsert ; otherwise reportError("msg.no.semi.stmt"); } else { warnMissingSemi(pos, nodeEnd(pn)); } break; } }
private void autoInsertSemicolon(AstNode pn) throws IOException { int ttFlagged = peekFlaggedToken(); int pos = pn.getPosition(); switch (ttFlagged & CLEAR_TI_MASK) { case Token.SEMI: // Consume ';' as a part of expression consumeToken(); // extend the node bounds to include the semicolon. pn.setLength(ts.tokenEnd - pos); break; case Token.ERROR: case Token.EOF: case Token.RC: // Autoinsert ; warnMissingSemi(pos, nodeEnd(pn)); break; default: if ((ttFlagged & TI_AFTER_EOL) == 0) { // Report error if no EOL or autoinsert ; otherwise reportError("msg.no.semi.stmt"); } else { warnMissingSemi(pos, nodeEnd(pn)); } break; } }
private void autoInsertSemicolon(AstNode pn) throws IOException { int ttFlagged = peekFlaggedToken(); int pos = pn.getPosition(); switch (ttFlagged & CLEAR_TI_MASK) { case Token.SEMI: // Consume ';' as a part of expression consumeToken(); // extend the node bounds to include the semicolon. pn.setLength(ts.tokenEnd - pos); break; case Token.ERROR: case Token.EOF: case Token.RC: // Autoinsert ; warnMissingSemi(pos, nodeEnd(pn)); break; default: if ((ttFlagged & TI_AFTER_EOL) == 0) { // Report error if no EOL or autoinsert ; otherwise reportError("msg.no.semi.stmt"); } else { warnMissingSemi(pos, nodeEnd(pn)); } break; } }
private void autoInsertSemicolon(AstNode pn) throws IOException { int ttFlagged = peekFlaggedToken(); int pos = pn.getPosition(); switch (ttFlagged & CLEAR_TI_MASK) { case Token.SEMI: // Consume ';' as a part of expression consumeToken(); // extend the node bounds to include the semicolon. pn.setLength(ts.tokenEnd - pos); break; case Token.ERROR: case Token.EOF: case Token.RC: // Autoinsert ; warnMissingSemi(pos, nodeEnd(pn)); break; default: if ((ttFlagged & TI_AFTER_EOL) == 0) { // Report error if no EOL or autoinsert ; otherwise reportError("msg.no.semi.stmt"); } else { warnMissingSemi(pos, nodeEnd(pn)); } break; } }
AstNode stmt = statements(); mustMatchToken(Token.RC, "msg.no.curly.let"); stmt.setLength(ts.tokenEnd - beg); pn.setLength(ts.tokenEnd - pos); pn.setBody(stmt);
AstNode stmt = statements(); mustMatchToken(Token.RC, "msg.no.curly.let"); stmt.setLength(ts.tokenEnd - beg); pn.setLength(ts.tokenEnd - pos); pn.setBody(stmt);
AstNode stmt = statements(); mustMatchToken(Token.RC, "msg.no.curly.let"); stmt.setLength(ts.tokenEnd - beg); pn.setLength(ts.tokenEnd - pos); pn.setBody(stmt);
AstNode stmt = statements(); mustMatchToken(Token.RC, "msg.no.curly.let"); stmt.setLength(ts.tokenEnd - beg); pn.setLength(ts.tokenEnd - pos); pn.setBody(stmt);