当前位置: 首页>>代码示例>>Java>>正文


Java Source.getContent方法代码示例

本文整理汇总了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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:Lexer.java

示例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()));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:SourceTest.java

示例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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:Lexer.java


注:本文中的jdk.nashorn.internal.runtime.Source.getContent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。