Java Code Examples for jdk.nashorn.internal.parser.Token#descLength()

The following examples show how to use jdk.nashorn.internal.parser.Token#descLength() . 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: RecompilableScriptFunctionData.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static long tokenFor(final FunctionNode fn) {
    final int  position  = Token.descPosition(fn.getFirstToken());
    final long lastToken = Token.withDelimiter(fn.getLastToken());
    // EOL uses length field to store the line number
    final int  length    = Token.descPosition(lastToken) - position + (Token.descType(lastToken) == TokenType.EOL ? 0 : Token.descLength(lastToken));

    return Token.toDesc(TokenType.FUNCTION, position, length);
}
 
Example 2
Source File: RecompilableScriptFunctionData.java    From jdk8u_nashorn with GNU General Public License v2.0 5 votes vote down vote up
private static long tokenFor(final FunctionNode fn) {
    final int  position  = Token.descPosition(fn.getFirstToken());
    final long lastToken = Token.withDelimiter(fn.getLastToken());
    // EOL uses length field to store the line number
    final int  length    = Token.descPosition(lastToken) - position + (Token.descType(lastToken) == TokenType.EOL ? 0 : Token.descLength(lastToken));

    return Token.toDesc(TokenType.FUNCTION, position, length);
}
 
Example 3
Source File: RecompilableScriptFunctionData.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private static long tokenFor(final FunctionNode fn) {
    final int  position  = Token.descPosition(fn.getFirstToken());
    final long lastToken = Token.withDelimiter(fn.getLastToken());
    // EOL uses length field to store the line number
    final int  length    = Token.descPosition(lastToken) - position + (Token.descType(lastToken) == TokenType.EOL ? 0 : Token.descLength(lastToken));

    return Token.toDesc(TokenType.FUNCTION, position, length);
}
 
Example 4
Source File: RecompilableScriptFunctionData.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static long tokenFor(final FunctionNode fn) {
    final int  position  = Token.descPosition(fn.getFirstToken());
    final long lastToken = Token.withDelimiter(fn.getLastToken());
    // EOL uses length field to store the line number
    final int  length    = Token.descPosition(lastToken) - position + (Token.descType(lastToken) == TokenType.EOL ? 0 : Token.descLength(lastToken));

    return Token.toDesc(TokenType.FUNCTION, position, length);
}
 
Example 5
Source File: RecompilableScriptFunctionData.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static long tokenFor(final FunctionNode fn) {
    final int  position  = Token.descPosition(fn.getFirstToken());
    final long lastToken = Token.withDelimiter(fn.getLastToken());
    // EOL uses length field to store the line number
    final int  length    = Token.descPosition(lastToken) - position + (Token.descType(lastToken) == TokenType.EOL ? 0 : Token.descLength(lastToken));

    return Token.toDesc(TokenType.FUNCTION, position, length);
}
 
Example 6
Source File: RecompilableScriptFunctionData.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
private static long tokenFor(final FunctionNode fn) {
    final int  position   = Token.descPosition(fn.getFirstToken());
    final int  length     = Token.descPosition(fn.getLastToken()) - position + Token.descLength(fn.getLastToken());

    return Token.toDesc(TokenType.FUNCTION, position, length);
}
 
Example 7
Source File: Source.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Fetch a portion of source content associated with a token.
 * @param token Token descriptor.
 * @return Source content portion.
 */
public String getString(final long token) {
    final int start = Token.descPosition(token);
    final int len = Token.descLength(token);
    return new String(content, start, len);
}
 
Example 8
Source File: RecompilableScriptFunctionData.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
private static long tokenFor(final FunctionNode fn) {
    final int  position   = Token.descPosition(fn.getFirstToken());
    final int  length     = Token.descPosition(fn.getLastToken()) - position + Token.descLength(fn.getLastToken());

    return Token.toDesc(TokenType.FUNCTION, position, length);
}
 
Example 9
Source File: Source.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Fetch a portion of source content associated with a token.
 * @param token Token descriptor.
 * @return Source content portion.
 */
public String getString(final long token) {
    final int start = Token.descPosition(token);
    final int len = Token.descLength(token);
    return new String(data(), start, len);
}
 
Example 10
Source File: Source.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Fetch a portion of source content associated with a token.
 * @param token Token descriptor.
 * @return Source content portion.
 */
public String getString(final long token) {
    final int start = Token.descPosition(token);
    final int len = Token.descLength(token);
    return new String(data(), start, len);
}
 
Example 11
Source File: Source.java    From jdk8u_nashorn with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Fetch a portion of source content associated with a token.
 * @param token Token descriptor.
 * @return Source content portion.
 */
public String getString(final long token) {
    final int start = Token.descPosition(token);
    final int len = Token.descLength(token);
    return new String(data(), start, len);
}
 
Example 12
Source File: Source.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Fetch a portion of source content associated with a token.
 * @param token Token descriptor.
 * @return Source content portion.
 */
public String getString(final long token) {
    final int start = Token.descPosition(token);
    final int len = Token.descLength(token);
    return new String(data(), start, len);
}
 
Example 13
Source File: Source.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Fetch a portion of source content associated with a token.
 * @param token Token descriptor.
 * @return Source content portion.
 */
public String getString(final long token) {
    final int start = Token.descPosition(token);
    final int len = Token.descLength(token);
    return new String(data(), start, len);
}
 
Example 14
Source File: Node.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Return token length from a token descriptor.
 *
 * @return Length of the token.
 */
public int length() {
    return Token.descLength(token);
}
 
Example 15
Source File: Node.java    From nashorn with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Return token length from a token descriptor.
 *
 * @return Length of the token.
 */
public int length() {
    return Token.descLength(token);
}
 
Example 16
Source File: Node.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Return token length from a token descriptor.
 *
 * @return Length of the token.
 */
public int length() {
    return Token.descLength(token);
}
 
Example 17
Source File: Node.java    From TencentKona-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Return token length from a token descriptor.
 *
 * @return Length of the token.
 */
public int length() {
    return Token.descLength(token);
}
 
Example 18
Source File: Node.java    From jdk8u_nashorn with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Return token length from a token descriptor.
 *
 * @return Length of the token.
 */
public int length() {
    return Token.descLength(token);
}
 
Example 19
Source File: Node.java    From openjdk-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Return token length from a token descriptor.
 *
 * @return Length of the token.
 */
public int length() {
    return Token.descLength(token);
}
 
Example 20
Source File: Node.java    From openjdk-8-source with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Return token length from a token descriptor.
 *
 * @return Length of the token.
 */
public int length() {
    return Token.descLength(token);
}