Java Code Examples for jdk.nashorn.internal.parser.Token#descType()
The following examples show how to use
jdk.nashorn.internal.parser.Token#descType() .
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: Debug.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Dump a token stream to stdout * * TODO: most other bugging goes to stderr, change? * * @param source the source * @param lexer the lexer * @param stream the stream to dump */ public static void dumpTokens(final Source source, final Lexer lexer, final TokenStream stream) { TokenType type; int k = 0; do { while (k > stream.last()) { // Get more tokens. lexer.lexify(); } final long token = stream.get(k); type = Token.descType(token); System.out.println("" + k + ": " + Token.toString(source, token, true)); k++; } while(type != EOF); }
Example 2
Source File: Debug.java From jdk8u_nashorn with GNU General Public License v2.0 | 6 votes |
/** * Dump a token stream to stdout * * TODO: most other bugging goes to stderr, change? * * @param source the source * @param lexer the lexer * @param stream the stream to dump */ public static void dumpTokens(final Source source, final Lexer lexer, final TokenStream stream) { TokenType type; int k = 0; do { while (k > stream.last()) { // Get more tokens. lexer.lexify(); } final long token = stream.get(k); type = Token.descType(token); System.out.println("" + k + ": " + Token.toString(source, token, true)); k++; } while(type != EOF); }
Example 3
Source File: Debug.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * Dump a token stream to stdout * * TODO: most other bugging goes to stderr, change? * * @param source the source * @param lexer the lexer * @param stream the stream to dump */ public static void dumpTokens(final Source source, final Lexer lexer, final TokenStream stream) { TokenType type; int k = 0; do { while (k > stream.last()) { // Get more tokens. lexer.lexify(); } final long token = stream.get(k); type = Token.descType(token); System.out.println("" + k + ": " + Token.toString(source, token, true)); k++; } while(type != EOF); }
Example 4
Source File: Debug.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Dump a token stream to stdout * * TODO: most other bugging goes to stderr, change? * * @param source the source * @param lexer the lexer * @param stream the stream to dump */ public static void dumpTokens(final Source source, final Lexer lexer, final TokenStream stream) { TokenType type; int k = 0; do { while (k > stream.last()) { // Get more tokens. lexer.lexify(); } final long token = stream.get(k); type = Token.descType(token); System.out.println("" + k + ": " + Token.toString(source, token, true)); k++; } while(type != EOF); }
Example 5
Source File: Debug.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Dump a token stream to stdout * * TODO: most other bugging goes to stderr, change? * * @param source the source * @param lexer the lexer * @param stream the stream to dump */ public static void dumpTokens(final Source source, final Lexer lexer, final TokenStream stream) { TokenType type; int k = 0; do { while (k > stream.last()) { // Get more tokens. lexer.lexify(); } final long token = stream.get(k); type = Token.descType(token); System.out.println("" + k + ": " + Token.toString(source, token, true)); k++; } while(type != EOF); }
Example 6
Source File: Debug.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Dump a token stream to stdout * * TODO: most other bugging goes to stderr, change? * * @param source the source * @param lexer the lexer * @param stream the stream to dump */ public static void dumpTokens(final Source source, final Lexer lexer, final TokenStream stream) { TokenType type; int k = 0; do { while (k > stream.last()) { // Get more tokens. lexer.lexify(); } final long token = stream.get(k); type = Token.descType(token); System.out.println("" + k + ": " + Token.toString(source, token, true)); k++; } while(type != EOF); }
Example 7
Source File: RecompilableScriptFunctionData.java From jdk8u_nashorn with GNU General Public License v2.0 | 5 votes |
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 8
Source File: RecompilableScriptFunctionData.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
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 9
Source File: RecompilableScriptFunctionData.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
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 10
Source File: RecompilableScriptFunctionData.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
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 11
Source File: Node.java From openjdk-8-source with GNU General Public License v2.0 | 2 votes |
/** * Return token tokenType from a token descriptor. * * @return Type of token. */ public TokenType tokenType() { return Token.descType(token); }
Example 12
Source File: Node.java From hottub with GNU General Public License v2.0 | 2 votes |
/** * Returns this node's token's type. If you want to check for the node having a specific token type, * consider using {@link #isTokenType(TokenType)} instead. * * @return type of token. */ public TokenType tokenType() { return Token.descType(token); }
Example 13
Source File: Node.java From jdk8u_nashorn with GNU General Public License v2.0 | 2 votes |
/** * Returns this node's token's type. If you want to check for the node having a specific token type, * consider using {@link #isTokenType(TokenType)} instead. * * @return type of token. */ public TokenType tokenType() { return Token.descType(token); }
Example 14
Source File: Node.java From openjdk-jdk9 with GNU General Public License v2.0 | 2 votes |
/** * Returns this node's token's type. If you want to check for the node having a specific token type, * consider using {@link #isTokenType(TokenType)} instead. * * @return type of token. */ public TokenType tokenType() { return Token.descType(token); }
Example 15
Source File: Node.java From openjdk-8 with GNU General Public License v2.0 | 2 votes |
/** * Test token tokenType. * * @param type a type to check this token against * @return true if token types match. */ public boolean isTokenType(final TokenType type) { return Token.descType(token) == type; }
Example 16
Source File: Node.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 2 votes |
/** * Returns this node's token's type. If you want to check for the node having a specific token type, * consider using {@link #isTokenType(TokenType)} instead. * * @return type of token. */ public TokenType tokenType() { return Token.descType(token); }
Example 17
Source File: Node.java From nashorn with GNU General Public License v2.0 | 2 votes |
/** * Return token tokenType from a token descriptor. * * @return Type of token. */ public TokenType tokenType() { return Token.descType(token); }
Example 18
Source File: Node.java From openjdk-8-source with GNU General Public License v2.0 | 2 votes |
/** * Test token tokenType. * * @param type a type to check this token against * @return true if token types match. */ public boolean isTokenType(final TokenType type) { return Token.descType(token) == type; }
Example 19
Source File: Node.java From openjdk-8 with GNU General Public License v2.0 | 2 votes |
/** * Return token tokenType from a token descriptor. * * @return Type of token. */ public TokenType tokenType() { return Token.descType(token); }
Example 20
Source File: Node.java From nashorn with GNU General Public License v2.0 | 2 votes |
/** * Test token tokenType. * * @param type a type to check this token against * @return true if token types match. */ public boolean isTokenType(final TokenType type) { return Token.descType(token) == type; }