Java Code Examples for jdk.nashorn.internal.runtime.Source#getLength()

The following examples show how to use jdk.nashorn.internal.runtime.Source#getLength() . 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: AbstractParser.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Construct a parser.
 *
 * @param source     Source to parse.
 * @param errors     Error reporting manager.
 * @param strict     True if we are in strict mode
 * @param lineOffset Offset from which lines should be counted
 */
protected AbstractParser(final Source source, final ErrorManager errors, final boolean strict, final int lineOffset) {
    if (source.getLength() > Token.LENGTH_MASK) {
        throw new RuntimeException("Source exceeds size limit of " + Token.LENGTH_MASK + " bytes");
    }
    this.source       = source;
    this.errors       = errors;
    this.k            = -1;
    this.token        = Token.toDesc(EOL, 0, 1);
    this.type         = EOL;
    this.last         = EOL;
    this.isStrictMode = strict;
    this.lineOffset   = lineOffset;
}
 
Example 2
Source File: Lexer.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructor
 *
 * @param source    the source
 * @param stream    the token stream to lex
 * @param scripting are we in scripting mode
 */
public Lexer(final Source source, final TokenStream stream, final boolean scripting) {
    super(source.getContent(), 1, 0, source.getLength());

    this.source      = source;
    this.stream      = stream;
    this.scripting   = scripting;
    this.nested      = false;
    this.pendingLine = 1;
    this.last        = EOL;
}
 
Example 3
Source File: Lexer.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructor
 *
 * @param source    the source
 * @param stream    the token stream to lex
 * @param scripting are we in scripting mode
 */
public Lexer(final Source source, final TokenStream stream, final boolean scripting) {
    super(source.getContent(), 1, 0, source.getLength());

    this.source      = source;
    this.stream      = stream;
    this.scripting   = scripting;
    this.nested      = false;
    this.pendingLine = 1;
    this.last        = EOL;
}
 
Example 4
Source File: Lexer.java    From nashorn with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructor
 *
 * @param source    the source
 * @param stream    the token stream to lex
 * @param scripting are we in scripting mode
 */
public Lexer(final Source source, final TokenStream stream, final boolean scripting) {
    super(source.getContent(), 1, 0, source.getLength());

    this.source      = source;
    this.stream      = stream;
    this.scripting   = scripting;
    this.nested      = false;
    this.pendingLine = 1;
    this.last        = EOL;
}
 
Example 5
Source File: Lexer.java    From TencentKona-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructor
 *
 * @param source    the source
 * @param stream    the token stream to lex
 * @param scripting are we in scripting mode
 */
public Lexer(final Source source, final TokenStream stream, final boolean scripting) {
    this(source, 0, source.getLength(), stream, scripting, false);
}
 
Example 6
Source File: Lexer.java    From jdk8u60 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructor
 *
 * @param source    the source
 * @param stream    the token stream to lex
 * @param scripting are we in scripting mode
 */
public Lexer(final Source source, final TokenStream stream, final boolean scripting) {
    this(source, 0, source.getLength(), stream, scripting, false);
}
 
Example 7
Source File: Lexer.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructor
 *
 * @param source    the source
 * @param stream    the token stream to lex
 * @param scripting are we in scripting mode
 */
public Lexer(final Source source, final TokenStream stream, final boolean scripting) {
    this(source, 0, source.getLength(), stream, scripting, false);
}
 
Example 8
Source File: Lexer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructor
 *
 * @param source    the source
 * @param stream    the token stream to lex
 * @param scripting are we in scripting mode
 */
public Lexer(final Source source, final TokenStream stream, final boolean scripting) {
    this(source, 0, source.getLength(), stream, scripting, false);
}
 
Example 9
Source File: Lexer.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructor
 *
 * @param source    the source
 * @param stream    the token stream to lex
 * @param scripting are we in scripting mode
 * @param es6       are we in ECMAScript 6 mode
 */
public Lexer(final Source source, final TokenStream stream, final boolean scripting, final boolean es6) {
    this(source, 0, source.getLength(), stream, scripting, es6, false);
}
 
Example 10
Source File: Lexer.java    From hottub with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructor
 *
 * @param source    the source
 * @param stream    the token stream to lex
 * @param scripting are we in scripting mode
 */
public Lexer(final Source source, final TokenStream stream, final boolean scripting) {
    this(source, 0, source.getLength(), stream, scripting, false);
}
 
Example 11
Source File: Lexer.java    From jdk8u_nashorn with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructor
 *
 * @param source    the source
 * @param stream    the token stream to lex
 * @param scripting are we in scripting mode
 */
public Lexer(final Source source, final TokenStream stream, final boolean scripting) {
    this(source, 0, source.getLength(), stream, scripting, false);
}