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/Comment.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;
/**
* Node representing comments.
* Node type is {@link Token#COMMENT}.
*
* <p>JavaScript effectively has five comment types:
* <ol>
* <li>// line comments</li>
* <li>/* block comments *\/</li>
* <li>/** jsdoc comments *\/</li>
* <li><!-- html-open line comments</li>
* <li>^\\s*--> html-close line comments</li>
* </ol>
*
* <p>The first three should be familiar to Java programmers. JsDoc comments
* are really just block comments with some conventions about the formatting
* within the comment delimiters. Line and block comments are described in the
* Ecma-262 specification.
*
* <p>SpiderMonkey and Rhino also support HTML comment syntax, but somewhat
* counterintuitively, the syntax does not produce a block comment. Instead,
* everything from the string <!-- through the end of the line is considered
* a comment, and if the token --> is the first non-whitespace on the line,
* then the line is considered a line comment. This is to support parsing
* JavaScript in <script> HTML tags that has been "hidden" from very old
* browsers by surrounding it with HTML comment delimiters.
*
* <p>Note the node start position for Comment nodes is still relative to the
* parent, but Comments are always stored directly in the AstRoot node, so
* they are also effectively absolute offsets.
*/
public class Comment extends AstNode {
private String value;
private Token.CommentType commentType;
{
type = Token.COMMENT;
}
/**
* Constructs a new Comment
* @param pos the start position
* @param len the length including delimiter(s)
* @param type the comment type
* @param value the value of the comment, as a string
*/
public Comment(int pos, int len, Token.CommentType type, String value) {
super(pos, len);
commentType = type;
this.value = value;
}
/**
* Returns the comment style
*/
public Token.CommentType getCommentType() {
return commentType;
}
/**
* Sets the comment style
* @param type the comment style, a
* {@link org.mozilla.javascript.Token.CommentType}
*/
public void setCommentType(Token.CommentType type) {
this.commentType = type;
}
/**
* Returns a string of the comment value.
*/
public String getValue() {
return value;
}
/**
* Set the comment Value with the new commentString. and updates the length with new Length.
* @param commentString
*/
public void setValue(String commentString) {
this.value = commentString;
this.setLength(this.value.length());
}
@Override
public String toSource(int depth) {
StringBuilder sb = new StringBuilder(getLength() + 10);
sb.append(makeIndent(depth));
sb.append(value);
if(Token.CommentType.BLOCK_COMMENT == this.getCommentType()) {
sb.append("\n");
}
return sb.toString();
}
/**
* Comment nodes are not visited during normal visitor traversals,
* but comply with the {@link AstNode#visit} interface.
*/
@Override
public void visit(NodeVisitor v) {
v.visit(this);
}
}
⏎ org/mozilla/javascript/ast/Comment.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, ≈208🔥, 1💬
Popular Posts:
JDK 11 jdk.dynalink.jmod is the JMOD file for JDK 11 Dynamic Linking module. JDK 11 Dynamic Linking ...
maven-model-builder-3.5. 4.jaris the JAR file for Apache Maven 3.5.4 Model Builder module. Apache Ma...
Jackson is "the Java JSON library" or "the best JSON parser for Java". Or simply as "JSON for Java"....
JSP(tm) Standard Tag Library 1.0 implementation - Jakarta Taglibs hosts the Standard Taglib 1.0, an ...
JDK 11 jdk.xml.dom.jmod is the JMOD file for JDK 11 XML DOM module. JDK 11 XML DOM module compiled c...