Java Code Examples for jdk.nashorn.internal.ir.LabelNode#getLabel()
The following examples show how to use
jdk.nashorn.internal.ir.LabelNode#getLabel() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Parser.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * ContinueStatement : * continue Identifier? ; // [no LineTerminator here] * * See 12.7 * * Parse CONTINUE statement. */ private void continueStatement() { // Capture CONTINUE token. final int continueLine = line; final long continueToken = token; // CONTINUE tested in caller. nextOrEOL(); LabelNode labelNode = null; // SEMICOLON or label. switch (type) { case RBRACE: case SEMICOLON: case EOL: case EOF: break; default: final IdentNode ident = getIdent(); labelNode = lc.findLabel(ident.getName()); if (labelNode == null) { throw error(AbstractParser.message("undefined.label", ident.getName()), ident.getToken()); } break; } final IdentNode label = labelNode == null ? null : labelNode.getLabel(); final LoopNode targetNode = lc.getContinueTo(label); if (targetNode == null) { throw error(AbstractParser.message("illegal.continue.stmt"), continueToken); } endOfLine(); // Construct and add CONTINUE node. appendStatement(new ContinueNode(continueLine, continueToken, finish, label == null ? null : new IdentNode(label))); }
Example 2
Source File: Parser.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * BreakStatement : * break Identifier? ; // [no LineTerminator here] * * See 12.8 * */ private void breakStatement() { // Capture BREAK token. final int breakLine = line; final long breakToken = token; // BREAK tested in caller. nextOrEOL(); LabelNode labelNode = null; // SEMICOLON or label. switch (type) { case RBRACE: case SEMICOLON: case EOL: case EOF: break; default: final IdentNode ident = getIdent(); labelNode = lc.findLabel(ident.getName()); if (labelNode == null) { throw error(AbstractParser.message("undefined.label", ident.getName()), ident.getToken()); } break; } //either an explicit label - then get its node or just a "break" - get first breakable //targetNode is what we are breaking out from. final IdentNode label = labelNode == null ? null : labelNode.getLabel(); final BreakableNode targetNode = lc.getBreakable(label); if (targetNode == null) { throw error(AbstractParser.message("illegal.break.stmt"), breakToken); } endOfLine(); // Construct and add BREAK node. appendStatement(new BreakNode(breakLine, breakToken, finish, label == null ? null : new IdentNode(label))); }
Example 3
Source File: Parser.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
/** * ContinueStatement : * continue Identifier? ; // [no LineTerminator here] * * See 12.7 * * Parse CONTINUE statement. */ private void continueStatement() { // Capture CONTINUE token. final int continueLine = line; final long continueToken = token; // CONTINUE tested in caller. nextOrEOL(); LabelNode labelNode = null; // SEMICOLON or label. switch (type) { case RBRACE: case SEMICOLON: case EOL: case EOF: break; default: final IdentNode ident = getIdent(); labelNode = lc.findLabel(ident.getName()); if (labelNode == null) { throw error(AbstractParser.message("undefined.label", ident.getName()), ident.getToken()); } break; } final IdentNode label = labelNode == null ? null : labelNode.getLabel(); final LoopNode targetNode = lc.getContinueTo(label); if (targetNode == null) { throw error(AbstractParser.message("illegal.continue.stmt"), continueToken); } endOfLine(); // Construct and add CONTINUE node. appendStatement(new ContinueNode(continueLine, continueToken, finish, label == null ? null : new IdentNode(label))); }
Example 4
Source File: Parser.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
/** * BreakStatement : * break Identifier? ; // [no LineTerminator here] * * See 12.8 * */ private void breakStatement() { // Capture BREAK token. final int breakLine = line; final long breakToken = token; // BREAK tested in caller. nextOrEOL(); LabelNode labelNode = null; // SEMICOLON or label. switch (type) { case RBRACE: case SEMICOLON: case EOL: case EOF: break; default: final IdentNode ident = getIdent(); labelNode = lc.findLabel(ident.getName()); if (labelNode == null) { throw error(AbstractParser.message("undefined.label", ident.getName()), ident.getToken()); } break; } //either an explicit label - then get its node or just a "break" - get first breakable //targetNode is what we are breaking out from. final IdentNode label = labelNode == null ? null : labelNode.getLabel(); final BreakableNode targetNode = lc.getBreakable(label); if (targetNode == null) { throw error(AbstractParser.message("illegal.break.stmt"), breakToken); } endOfLine(); // Construct and add BREAK node. appendStatement(new BreakNode(breakLine, breakToken, finish, label == null ? null : new IdentNode(label))); }
Example 5
Source File: Parser.java From nashorn with GNU General Public License v2.0 | 4 votes |
/** * ContinueStatement : * continue Identifier? ; // [no LineTerminator here] * * See 12.7 * * Parse CONTINUE statement. */ private void continueStatement() { // Capture CONTINUE token. final int continueLine = line; final long continueToken = token; // CONTINUE tested in caller. nextOrEOL(); LabelNode labelNode = null; // SEMICOLON or label. switch (type) { case RBRACE: case SEMICOLON: case EOL: case EOF: break; default: final IdentNode ident = getIdent(); labelNode = lc.findLabel(ident.getName()); if (labelNode == null) { throw error(AbstractParser.message("undefined.label", ident.getName()), ident.getToken()); } break; } final IdentNode label = labelNode == null ? null : labelNode.getLabel(); final LoopNode targetNode = lc.getContinueTo(label); if (targetNode == null) { throw error(AbstractParser.message("illegal.continue.stmt"), continueToken); } endOfLine(); // Construct and add CONTINUE node. appendStatement(new ContinueNode(continueLine, continueToken, finish, label == null ? null : new IdentNode(label))); }
Example 6
Source File: Parser.java From nashorn with GNU General Public License v2.0 | 4 votes |
/** * BreakStatement : * break Identifier? ; // [no LineTerminator here] * * See 12.8 * */ private void breakStatement() { // Capture BREAK token. final int breakLine = line; final long breakToken = token; // BREAK tested in caller. nextOrEOL(); LabelNode labelNode = null; // SEMICOLON or label. switch (type) { case RBRACE: case SEMICOLON: case EOL: case EOF: break; default: final IdentNode ident = getIdent(); labelNode = lc.findLabel(ident.getName()); if (labelNode == null) { throw error(AbstractParser.message("undefined.label", ident.getName()), ident.getToken()); } break; } //either an explicit label - then get its node or just a "break" - get first breakable //targetNode is what we are breaking out from. final IdentNode label = labelNode == null ? null : labelNode.getLabel(); final BreakableNode targetNode = lc.getBreakable(label); if (targetNode == null) { throw error(AbstractParser.message("illegal.break.stmt"), breakToken); } endOfLine(); // Construct and add BREAK node. appendStatement(new BreakNode(breakLine, breakToken, finish, label == null ? null : new IdentNode(label))); }