Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
Rhino JavaScript Java Library Source Code
Rhino JavaScript Java Library is an open-source implementation of JavaScript written entirely in Java.
Rhino JavaScript Java Library Source Code files are provided in binary package (rhino-1.7.14.zip).
You can also browse the source code below:
✍: FYIcenter.com
⏎ org/mozilla/javascript/ast/ForInLoop.java
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ package org.mozilla.javascript.ast; import org.mozilla.javascript.Token; /** * For-in or for-each-in or for-of statement. Node type is {@link Token#FOR}. * * <pre><b>for</b> [<b>each</b>] ( LeftHandSideExpression <b>in</b> Expression ) Statement</pre> * <pre><b>for</b> [<b>each</b>] ( <b>var</b> VariableDeclarationNoIn <b>in</b> Expression ) Statement</pre> * <pre><b>for</b> ( LeftHandSideExpression <b>of</b> Expression ) Statement</pre> * <pre><b>for</b> ( ForDeclaration <b>of</b> Expression ) Statement</pre> */ public class ForInLoop extends Loop { protected AstNode iterator; protected AstNode iteratedObject; protected int inPosition = -1; protected int eachPosition = -1; protected boolean isForEach; protected boolean isForOf; { type = Token.FOR; } public ForInLoop() { } public ForInLoop(int pos) { super(pos); } public ForInLoop(int pos, int len) { super(pos, len); } /** * Returns loop iterator expression */ public AstNode getIterator() { return iterator; } /** * Sets loop iterator expression: the part before the "in" or "of" keyword. * Also sets its parent to this node. * @throws IllegalArgumentException if {@code iterator} is {@code null} */ public void setIterator(AstNode iterator) { assertNotNull(iterator); this.iterator = iterator; iterator.setParent(this); } /** * Returns object being iterated over */ public AstNode getIteratedObject() { return iteratedObject; } /** * Sets object being iterated over, and sets its parent to this node. * @throws IllegalArgumentException if {@code object} is {@code null} */ public void setIteratedObject(AstNode object) { assertNotNull(object); this.iteratedObject = object; object.setParent(this); } /** * Returns whether the loop is a for-each loop */ public boolean isForEach() { return isForEach; } /** * Sets whether the loop is a for-each loop */ public void setIsForEach(boolean isForEach) { this.isForEach = isForEach; } /** * Returns whether the loop is a for-of loop */ public boolean isForOf() { return isForOf; } /** * Sets whether the loop is a for-each loop */ public void setIsForOf(boolean isForOf) { this.isForOf = isForOf; } /** * Returns position of "in" or "of" keyword */ public int getInPosition() { return inPosition; } /** * Sets position of "in" or "of" keyword * @param inPosition position of "in" or "of" keyword, * or -1 if not present (e.g. in presence of a syntax error) */ public void setInPosition(int inPosition) { this.inPosition = inPosition; } /** * Returns position of "each" keyword */ public int getEachPosition() { return eachPosition; } /** * Sets position of "each" keyword * @param eachPosition position of "each" keyword, * or -1 if not present. */ public void setEachPosition(int eachPosition) { this.eachPosition = eachPosition; } @Override public String toSource(int depth) { StringBuilder sb = new StringBuilder(); sb.append(makeIndent(depth)); sb.append("for "); if (isForEach()) { sb.append("each "); } sb.append("("); sb.append(iterator.toSource(0)); if (isForOf) { sb.append(" of "); } else { sb.append(" in "); } sb.append(iteratedObject.toSource(0)); sb.append(") "); if (body.getType() == Token.BLOCK) { sb.append(body.toSource(depth).trim()).append("\n"); } else { sb.append("\n").append(body.toSource(depth+1)); } return sb.toString(); } /** * Visits this node, the iterator, the iterated object, and the body. */ @Override public void visit(NodeVisitor v) { if (v.visit(this)) { iterator.visit(v); iteratedObject.visit(v); body.visit(v); } } }
⏎ org/mozilla/javascript/ast/ForInLoop.java
Or download all of them as a single archive file:
File name: rhino-1.7.14-sources.jar File size: 1029165 bytes Release date: 2022-01-06 Download
⇒ Example code to Test rhino-runtime-1.7.14.jar
⇐ Download Rhino JavaScript Binary Package
2022-05-03, 35490👍, 1💬
Popular Posts:
Jackson is "the Java JSON library" or "the best JSON parser for Java". Or simply as "JSON for Java"....
commons-collections4-4.4 -sources.jaris the source JAR file for Apache Commons Collections 4.2, whic...
How to download and install JDK (Java Development Kit) 8? If you want to write Java applications, yo...
What Is commons-io-2.11.jar? commons-io-2.11.jar is the JAR file for Commons IO 2.5, which is a libr...
Jettison is a collection of Java APIs (like STaX and DOM) which read and write JSON. This allows nea...