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/Name.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;
/**
* AST node for a simple name. A simple name is an identifier that is
* not a keyword. Node type is {@link Token#NAME}.<p>
*
* This node type is also used to represent certain non-identifier names that
* are part of the language syntax. It's used for the "get" and "set"
* pseudo-keywords for object-initializer getter/setter properties, and it's
* also used for the "*" wildcard in E4X XML namespace and name expressions.
*/
public class Name extends AstNode {
private String identifier;
private Scope scope;
{
type = Token.NAME;
}
public Name() {
}
public Name(int pos) {
super(pos);
}
public Name(int pos, int len) {
super(pos, len);
}
/**
* Constructs a new {@link Name}
* @param pos node start position
* @param len node length
* @param name the identifier associated with this {@code Name} node
*/
public Name(int pos, int len, String name) {
super(pos, len);
setIdentifier(name);
}
public Name(int pos, String name) {
super(pos);
setIdentifier(name);
setLength(name.length());
}
/**
* Returns the node's identifier
*/
public String getIdentifier() {
return identifier;
}
/**
* Sets the node's identifier
* @throws IllegalArgumentException if identifier is null
*/
public void setIdentifier(String identifier) {
assertNotNull(identifier);
this.identifier = identifier;
setLength(identifier.length());
}
/**
* Set the {@link Scope} associated with this node. This method does not
* set the scope's ast-node field to this node. The field exists only
* for temporary storage by the code generator. Not every name has an
* associated scope - typically only function and variable names (but not
* property names) are registered in a scope.
*
* @param s the scope. Can be null. Doesn't set any fields in the
* scope.
*/
@Override
public void setScope(Scope s) {
scope = s;
}
/**
* Return the {@link Scope} associated with this node. This is
* <em>only</em> used for (and set by) the code generator, so it will always
* be null in frontend AST-processing code. Use {@link #getDefiningScope}
* to find the lexical {@code Scope} in which this {@code Name} is defined,
* if any.
*/
@Override
public Scope getScope() {
return scope;
}
/**
* Returns the {@link Scope} in which this {@code Name} is defined.
* @return the scope in which this name is defined, or {@code null}
* if it's not defined in the current lexical scope chain
*/
public Scope getDefiningScope() {
Scope enclosing = getEnclosingScope();
String name = getIdentifier();
return enclosing == null ? null : enclosing.getDefiningScope(name);
}
/**
* Return true if this node is known to be defined as a symbol in a
* lexical scope other than the top-level (global) scope.
*
* @return {@code true} if this name appears as local variable, a let-bound
* variable not in the global scope, a function parameter, a loop
* variable, the property named in a {@link PropertyGet}, or in any other
* context where the node is known not to resolve to the global scope.
* Returns {@code false} if the node is defined in the top-level scope
* (i.e., its defining scope is an {@link AstRoot} object), or if its
* name is not defined as a symbol in the symbol table, in which case it
* may be an external or built-in name (or just an error of some sort.)
*/
public boolean isLocalName() {
Scope scope = getDefiningScope();
return scope != null && scope.getParentScope() != null;
}
/**
* Return the length of this node's identifier, to let you pretend
* it's a {@link String}. Don't confuse this method with the
* {@link AstNode#getLength} method, which returns the range of
* characters that this node overlaps in the source input.
*/
public int length() {
return identifier == null ? 0 : identifier.length();
}
@Override
public String toSource(int depth) {
return makeIndent(depth) + (identifier == null ? "<null>" : identifier);
}
/**
* Visits this node. There are no children to visit.
*/
@Override
public void visit(NodeVisitor v) {
v.visit(this);
}
}
⏎ org/mozilla/javascript/ast/Name.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:
How to download and install javamail-1_2.zip? The JavaMail API is a set of abstract APIs that model ...
How to download and install JDK (Java Development Kit) 1.4? If you want to write Java applications, ...
JDK 17 java.sql.rowset.jmod is the JMOD file for JDK 17 SQL Rowset module. JDK 17 SQL Rowset module ...
What Is log4j-1.2.13.jar? I got the JAR file from logging-log4j-1.2.13.zip .log4j-1.2.13.jar is the ...
How to display types defined in an XML Schema file with the xs\QueryXS.java provided in the Apache X...