Java Code Examples for jdk.nashorn.internal.runtime.Source#getString()
The following examples show how to use
jdk.nashorn.internal.runtime.Source#getString() .
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: Token.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Return a string representation of a token. * @param source Token source. * @param token Token descriptor. * @param verbose True to include details. * @return String representation. */ public static String toString(final Source source, final long token, final boolean verbose) { final TokenType type = Token.descType(token); String result; if (source != null && type.getKind() == LITERAL) { result = source.getString(token); } else { result = type.getNameOrType(); } if (verbose) { final int position = Token.descPosition(token); final int length = Token.descLength(token); result += " (" + position + ", " + length + ")"; } return result; }
Example 2
Source File: Token.java From nashorn with GNU General Public License v2.0 | 6 votes |
/** * Return a string representation of a token. * @param source Token source. * @param token Token descriptor. * @param verbose True to include details. * @return String representation. */ public static String toString(final Source source, final long token, final boolean verbose) { final TokenType type = Token.descType(token); String result; if (source != null && type.getKind() == LITERAL) { result = source.getString(token); } else { result = type.getNameOrType(); } if (verbose) { final int position = Token.descPosition(token); final int length = Token.descLength(token); result += " (" + position + ", " + length + ")"; } return result; }
Example 3
Source File: Token.java From jdk8u_nashorn with GNU General Public License v2.0 | 6 votes |
/** * Return a string representation of a token. * @param source Token source. * @param token Token descriptor. * @param verbose True to include details. * @return String representation. */ public static String toString(final Source source, final long token, final boolean verbose) { final TokenType type = Token.descType(token); String result; if (source != null && type.getKind() == LITERAL) { result = source.getString(token); } else { result = type.getNameOrType(); } if (verbose) { final int position = Token.descPosition(token); final int length = Token.descLength(token); result += " (" + position + ", " + length + ")"; } return result; }
Example 4
Source File: Token.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * Return a string representation of a token. * @param source Token source. * @param token Token descriptor. * @param verbose True to include details. * @return String representation. */ public static String toString(final Source source, final long token, final boolean verbose) { final TokenType type = Token.descType(token); String result; if (source != null && type.getKind() == LITERAL) { result = source.getString(token); } else { result = type.getNameOrType(); } if (verbose) { final int position = Token.descPosition(token); final int length = Token.descLength(token); result += " (" + position + ", " + length + ")"; } return result; }
Example 5
Source File: Token.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** * Return a string representation of a token. * @param source Token source. * @param token Token descriptor. * @param verbose True to include details. * @return String representation. */ public static String toString(final Source source, final long token, final boolean verbose) { final TokenType type = Token.descType(token); String result; if (source != null && type.getKind() == LITERAL) { result = source.getString(token); } else { result = type.getNameOrType(); } if (verbose) { final int position = Token.descPosition(token); final int length = Token.descLength(token); result += " (" + position + ", " + length + ")"; } return result; }
Example 6
Source File: Token.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Return a string representation of a token. * @param source Token source. * @param token Token descriptor. * @param verbose True to include details. * @return String representation. */ public static String toString(final Source source, final long token, final boolean verbose) { final TokenType type = Token.descType(token); String result; if (source != null && type.getKind() == LITERAL) { result = source.getString(token); } else { result = type.getNameOrType(); } if (verbose) { final int position = Token.descPosition(token); final int length = Token.descLength(token); result += " (" + position + ", " + length + ")"; } return result; }
Example 7
Source File: Token.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Return a string representation of a token. * @param source Token source. * @param token Token descriptor. * @param verbose True to include details. * @return String representation. */ public static String toString(final Source source, final long token, final boolean verbose) { final TokenType type = Token.descType(token); String result; if (source != null && type.getKind() == LITERAL) { result = source.getString(token); } else { result = type.getNameOrType(); } if (verbose) { final int position = Token.descPosition(token); final int length = Token.descLength(token); result += " (" + position + ", " + length + ")"; } return result; }
Example 8
Source File: Token.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Return a string representation of a token. * @param source Token source. * @param token Token descriptor. * @param verbose True to include details. * @return String representation. */ public static String toString(final Source source, final long token, final boolean verbose) { final TokenType type = Token.descType(token); String result; if (source != null && type.getKind() == LITERAL) { result = source.getString(token); } else { result = type.getNameOrType(); } if (verbose) { final int position = Token.descPosition(token); final int length = Token.descLength(token); result += " (" + position + ", " + length + ")"; } return result; }
Example 9
Source File: Token.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Return a string representation of a token. * @param source Token source. * @param token Token descriptor. * @param verbose True to include details. * @return String representation. */ public static String toString(final Source source, final long token, final boolean verbose) { final TokenType type = Token.descType(token); String result; if (source != null && type.getKind() == LITERAL) { result = source.getString(token); } else { result = type.getNameOrType(); } if (verbose) { final int position = Token.descPosition(token); final int length = Token.descLength(token); result += " (" + position + ", " + length + ")"; } return result; }
Example 10
Source File: Token.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Return a string representation of a token. * @param source Token source. * @param token Token descriptor. * @param verbose True to include details. * @return String representation. */ public static String toString(final Source source, final long token, final boolean verbose) { final TokenType type = Token.descType(token); String result; if (source != null && type.getKind() == LITERAL) { result = source.getString(token); } else { result = type.getNameOrType(); } if (verbose) { final int position = Token.descPosition(token); final int length = Token.descLength(token); result += " (" + position + ", " + length + ")"; } return result; }
Example 11
Source File: SourceTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private static void testSources(final Source source1, final Source source2) { final char[] chars1 = source1.getContent(); final char[] chars2 = source2.getContent(); final String str1 = source1.getString(); final String str2 = source2.getString(); assertTrue(Arrays.equals(chars1, chars2)); assertEquals(str1, str2); assertEquals(source1.hashCode(), source2.hashCode()); assertTrue(source1.equals(source2)); assertTrue(Arrays.equals(source1.getContent(), str1.toCharArray())); assertTrue(Arrays.equals(source1.getContent(), chars1)); assertTrue(Arrays.equals(source1.getContent(), source2.getContent())); }
Example 12
Source File: SourceTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static void testSources(final Source source1, final Source source2) { final char[] chars1 = source1.getContent(); final char[] chars2 = source2.getContent(); final String str1 = source1.getString(); final String str2 = source2.getString(); assertTrue(Arrays.equals(chars1, chars2)); assertEquals(str1, str2); assertEquals(source1.hashCode(), source2.hashCode()); assertTrue(source1.equals(source2)); assertTrue(Arrays.equals(source1.getContent(), str1.toCharArray())); assertTrue(Arrays.equals(source1.getContent(), chars1)); assertTrue(Arrays.equals(source1.getContent(), source2.getContent())); }
Example 13
Source File: SourceTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static void testSources(final Source source1, final Source source2) { final char[] chars1 = source1.getContent(); final char[] chars2 = source2.getContent(); final String str1 = source1.getString(); final String str2 = source2.getString(); assertTrue(Arrays.equals(chars1, chars2)); assertEquals(str1, str2); assertEquals(source1.hashCode(), source2.hashCode()); assertTrue(source1.equals(source2)); assertTrue(Arrays.equals(source1.getContent(), str1.toCharArray())); assertTrue(Arrays.equals(source1.getContent(), chars1)); assertTrue(Arrays.equals(source1.getContent(), source2.getContent())); }
Example 14
Source File: SourceTest.java From hottub with GNU General Public License v2.0 | 5 votes |
private static void testSources(final Source source1, final Source source2) { final char[] chars1 = source1.getContent(); final char[] chars2 = source2.getContent(); final String str1 = source1.getString(); final String str2 = source2.getString(); assertTrue(Arrays.equals(chars1, chars2)); assertEquals(str1, str2); assertEquals(source1.hashCode(), source2.hashCode()); assertTrue(source1.equals(source2)); assertTrue(Arrays.equals(source1.getContent(), str1.toCharArray())); assertTrue(Arrays.equals(source1.getContent(), chars1)); assertTrue(Arrays.equals(source1.getContent(), source2.getContent())); }
Example 15
Source File: SourceTest.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private static void testSources(final Source source1, final Source source2) { final char[] chars1 = source1.getContent(); final char[] chars2 = source2.getContent(); final String str1 = source1.getString(); final String str2 = source2.getString(); assertTrue(Arrays.equals(chars1, chars2)); assertEquals(str1, str2); assertEquals(source1.hashCode(), source2.hashCode()); assertTrue(source1.equals(source2)); assertTrue(Arrays.equals(source1.getContent(), str1.toCharArray())); assertTrue(Arrays.equals(source1.getContent(), chars1)); assertTrue(Arrays.equals(source1.getContent(), source2.getContent())); }
Example 16
Source File: SourceTest.java From jdk8u_nashorn with GNU General Public License v2.0 | 5 votes |
private static void testSources(final Source source1, final Source source2) { final char[] chars1 = source1.getContent(); final char[] chars2 = source2.getContent(); final String str1 = source1.getString(); final String str2 = source2.getString(); assertTrue(Arrays.equals(chars1, chars2)); assertEquals(str1, str2); assertEquals(source1.hashCode(), source2.hashCode()); assertTrue(source1.equals(source2)); assertTrue(Arrays.equals(source1.getContent(), str1.toCharArray())); assertTrue(Arrays.equals(source1.getContent(), chars1)); assertTrue(Arrays.equals(source1.getContent(), source2.getContent())); }
Example 17
Source File: SourceTest.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static void testSources(final Source source1, final Source source2) { final char[] chars1 = source1.getContent(); final char[] chars2 = source2.getContent(); final String str1 = source1.getString(); final String str2 = source2.getString(); assertTrue(Arrays.equals(chars1, chars2)); assertEquals(str1, str2); assertEquals(source1.hashCode(), source2.hashCode()); assertTrue(source1.equals(source2)); assertTrue(Arrays.equals(source1.getContent(), str1.toCharArray())); assertTrue(Arrays.equals(source1.getContent(), chars1)); assertTrue(Arrays.equals(source1.getContent(), source2.getContent())); }