本文整理汇总了Java中jdk.nashorn.internal.runtime.Source.getContent方法的典型用法代码示例。如果您正苦于以下问题:Java Source.getContent方法的具体用法?Java Source.getContent怎么用?Java Source.getContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jdk.nashorn.internal.runtime.Source
的用法示例。
在下文中一共展示了Source.getContent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Lexer
import jdk.nashorn.internal.runtime.Source; //导入方法依赖的package包/类
/**
* Constructor
*
* @param source the source
* @param start start position in source from which to start lexing
* @param len length of source segment to lex
* @param stream token stream to lex
* @param scripting are we in scripting mode
* @param pauseOnFunctionBody if true, lexer will return from {@link #lexify()} when it encounters a
* function body. This is used with the feature where the parser is skipping nested function bodies to
* avoid reading ahead unnecessarily when we skip the function bodies.
*/
public Lexer(final Source source, final int start, final int len, final TokenStream stream, final boolean scripting, final boolean pauseOnFunctionBody) {
super(source.getContent(), 1, start, len);
this.source = source;
this.stream = stream;
this.scripting = scripting;
this.nested = false;
this.pendingLine = 1;
this.last = EOL;
this.pauseOnFunctionBody = pauseOnFunctionBody;
}
示例2: testSources
import jdk.nashorn.internal.runtime.Source; //导入方法依赖的package包/类
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()));
}
示例3: Lexer
import jdk.nashorn.internal.runtime.Source; //导入方法依赖的package包/类
/**
* Constructor
*
* @param source the source
* @param start start position in source from which to start lexing
* @param len length of source segment to lex
* @param stream token stream to lex
* @param scripting are we in scripting mode
* @param es6 are we in ECMAScript 6 mode
* @param pauseOnFunctionBody if true, lexer will return from {@link #lexify()} when it encounters a
* function body. This is used with the feature where the parser is skipping nested function bodies to
* avoid reading ahead unnecessarily when we skip the function bodies.
*/
public Lexer(final Source source, final int start, final int len, final TokenStream stream, final boolean scripting, final boolean es6, final boolean pauseOnFunctionBody) {
super(source.getContent(), 1, start, len);
this.source = source;
this.stream = stream;
this.scripting = scripting;
this.es6 = es6;
this.nested = false;
this.pendingLine = 1;
this.last = EOL;
this.pauseOnFunctionBody = pauseOnFunctionBody;
}