Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
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 (322)
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/ArrayComprehension.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 java.util.ArrayList;
import java.util.List;
import org.mozilla.javascript.Token;
/**
* AST node for a JavaScript 1.7 Array comprehension.
* Node type is {@link Token#ARRAYCOMP}.
*/
public class ArrayComprehension extends Scope {
private AstNode result;
private List<ArrayComprehensionLoop> loops =
new ArrayList<ArrayComprehensionLoop>();
private AstNode filter;
private int ifPosition = -1;
private int lp = -1;
private int rp = -1;
{
type = Token.ARRAYCOMP;
}
public ArrayComprehension() {
}
public ArrayComprehension(int pos) {
super(pos);
}
public ArrayComprehension(int pos, int len) {
super(pos, len);
}
/**
* Returns result expression node (just after opening bracket)
*/
public AstNode getResult() {
return result;
}
/**
* Sets result expression, and sets its parent to this node.
* @throws IllegalArgumentException if result is {@code null}
*/
public void setResult(AstNode result) {
assertNotNull(result);
this.result = result;
result.setParent(this);
}
/**
* Returns loop list
*/
public List<ArrayComprehensionLoop> getLoops() {
return loops;
}
/**
* Sets loop list
* @throws IllegalArgumentException if loops is {@code null}
*/
public void setLoops(List<ArrayComprehensionLoop> loops) {
assertNotNull(loops);
this.loops.clear();
for (ArrayComprehensionLoop acl : loops) {
addLoop(acl);
}
}
/**
* Adds a child loop node, and sets its parent to this node.
* @throws IllegalArgumentException if acl is {@code null}
*/
public void addLoop(ArrayComprehensionLoop acl) {
assertNotNull(acl);
loops.add(acl);
acl.setParent(this);
}
/**
* Returns filter expression, or {@code null} if not present
*/
public AstNode getFilter() {
return filter;
}
/**
* Sets filter expression, and sets its parent to this node.
* Can be {@code null}.
*/
public void setFilter(AstNode filter) {
this.filter = filter;
if (filter != null)
filter.setParent(this);
}
/**
* Returns position of 'if' keyword, -1 if not present
*/
public int getIfPosition() {
return ifPosition;
}
/**
* Sets position of 'if' keyword
*/
public void setIfPosition(int ifPosition) {
this.ifPosition = ifPosition;
}
/**
* Returns filter left paren position, or -1 if no filter
*/
public int getFilterLp() {
return lp;
}
/**
* Sets filter left paren position, or -1 if no filter
*/
public void setFilterLp(int lp) {
this.lp = lp;
}
/**
* Returns filter right paren position, or -1 if no filter
*/
public int getFilterRp() {
return rp;
}
/**
* Sets filter right paren position, or -1 if no filter
*/
public void setFilterRp(int rp) {
this.rp = rp;
}
@Override
public String toSource(int depth) {
StringBuilder sb = new StringBuilder(250);
sb.append("[");
sb.append(result.toSource(0));
for (ArrayComprehensionLoop loop : loops) {
sb.append(loop.toSource(0));
}
if (filter != null) {
sb.append(" if (");
sb.append(filter.toSource(0));
sb.append(")");
}
sb.append("]");
return sb.toString();
}
/**
* Visits this node, the result expression, the loops, and the optional
* filter.
*/
@Override
public void visit(NodeVisitor v) {
if (!v.visit(this)) {
return;
}
result.visit(v);
for (ArrayComprehensionLoop loop : loops) {
loop.visit(v);
}
if (filter != null) {
filter.visit(v);
}
}
}
⏎ org/mozilla/javascript/ast/ArrayComprehension.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, ≈99🔥, 1💬
Popular Posts:
JDK 17 jdk.compiler.jmod is the JMOD file for JDK 17 Compiler tool, which can be invoked by the "jav...
What Is mail.jar of JavaMail 1.4? I got the JAR file from javamail-1_4.zip. mail.jar in javamail-1_4...
JDK 17 java.xml.jmod is the JMOD file for JDK 17 XML (eXtensible Markup Language) module. JDK 17 XML...
JDK 1.1 source code directory contains Java source code for JDK 1.1 core classes: "C:\fyicenter\jdk-...
Jetty provides an HTTP server, HTTP client, and javax.servlet container. These components are open s...