/**
* Execute parse and return the resulting function node.
* Errors will be thrown and the error manager will contain information
* if parsing should fail
*
* This should be used to create one and only one function node
*
* @param scriptName name for the script,given to the parsed FunctionNode
* @param startPos start position in source
* @param len length of parse
* @param allowPropertyFunction if true,"get" and "set" are allowed as first tokens of the program,followed by
* a property getter or setter function. This is used when reparsing a function that can potentially be defined as a
* property getter or setter in an object literal.
*
* @return function node resulting from successful parse
*/
public FunctionNode parse(final String scriptName,final int startPos,final int len,final boolean allowPropertyFunction) {
final boolean isTimingEnabled = env.isTimingEnabled();
final long t0 = isTimingEnabled ? System.nanoTime() : 0L;
log.info(this," begin for '",scriptName,"'");
try {
stream = new TokenStream();
lexer = new Lexer(source,startPos,len,stream,scripting && !env._no_Syntax_extensions,reparsedFunction != null);
lexer.line = lexer.pendingLine = lineOffset + 1;
line = lineOffset;
// Set up first token (skips opening EOL.)
k = -1;
next();
// Begin parse.
return program(scriptName,allowPropertyFunction);
} catch (final Exception e) {
handleParseException(e);
return null;
} finally {
final String end = this + " end '" + scriptName + "'";
if (isTimingEnabled) {
env._timing.accumulateTime(toString(),System.nanoTime() - t0);
log.info(end,"' in ",Timing.toMillisPrint(System.nanoTime() - t0)," ms");
} else {
log.info(end);
}
}
}
项目:openjdk-jdk10
文件:Parser.java
/**
* Execute parse and return the resulting function node.
* Errors will be thrown and the error manager will contain information
* if parsing should fail
*
* This should be used to create one and only one function node
*
* @param scriptName name for the script,given to the parsed FunctionNode
* @param startPos start position in source
* @param len length of parse
* @param reparseFlags flags provided by {@link RecompilableScriptFunctionData} as context for
* the code being reparsed. This allows us to recognize special forms of functions such
* as property getters and setters or instances of ES6 method shorthand in object literals.
*
* @return function node resulting from successful parse
*/
public FunctionNode parse(final String scriptName,final int reparseFlags) {
final boolean isTimingEnabled = env.isTimingEnabled();
final long t0 = isTimingEnabled ? System.nanoTime() : 0L;
log.info(this,env._es6,reparsedFunction != null);
lexer.line = lexer.pendingLine = lineOffset + 1;
line = lineOffset;
scanFirstToken();
// Begin parse.
return program(scriptName,reparseFlags);
} catch (final Exception e) {
handleParseException(e);
return null;
} finally {
final String end = this + " end '" + scriptName + "'";
if (isTimingEnabled) {
env._timing.accumulateTime(toString()," ms");
} else {
log.info(end);
}
}
}
项目:openjdk9
文件:Parser.java
/**
* Execute parse and return the resulting function node.
* Errors will be thrown and the error manager will contain information
* if parsing should fail
*
* This should be used to create one and only one function node
*
* @param scriptName name for the script," ms");
} else {
log.info(end);
}
}
}
项目:kaziranga
文件:Parser.java
/**
* Execute parse and return the resulting function node.
* Errors will be thrown and the error manager will contain information
* if parsing should fail
*
* This should be used to create one and only one function node
*
* @param scriptName name for the script," ms");
} else {
log.info(end);
}
}
}
项目:lookaside_java-1.8.0-openjdk
文件:Parser.java
/**
* Execute parse and return the resulting function node.
* Errors will be thrown and the error manager will contain information
* if parsing should fail
*
* This should be used to create one and only one function node
*
* @param scriptName name for the script," ms");
} else {
log.info(end);
}
}
}
项目:jdk8u_nashorn
文件:Parser.java
/**
* Execute parse and return the resulting function node.
* Errors will be thrown and the error manager will contain information
* if parsing should fail
*
* This should be used to create one and only one function node
*
* @param scriptName name for the script," ms");
} else {
log.info(end);
}
}
}
项目:infobip-open-jdk-8
文件:Parser.java
/**
* Execute parse and return the resulting function node.
* Errors will be thrown and the error manager will contain information
* if parsing should fail
*
* This should be used to create one and only one function node
*
* @param scriptName name for the script," ms");
} else {
log.info(end);
}
}
}
项目:OLD-OpenJDK8
文件:Parser.java
/**
* Execute parse and return the resulting function node.
* Errors will be thrown and the error manager will contain information
* if parsing should fail
*
* @param scriptName name for the script,given to the parsed FunctionNode
*
* @return function node resulting from successful parse
*/
public FunctionNode parse(final String scriptName) {
final long t0 = Timing.isEnabled() ? System.currentTimeMillis() : 0L;
LOG.info(this,scripting && !env._no_Syntax_extensions);
// Set up first token (skips opening EOL.)
k = -1;
next();
// Begin parse.
return program(scriptName);
} catch (final Exception e) {
handleParseException(e);
return null;
} finally {
final String end = this + " end '" + scriptName + "'";
if (Timing.isEnabled()) {
Timing.accumulateTime(toString(),System.currentTimeMillis() - t0);
LOG.info(end,(System.currentTimeMillis() - t0)," ms");
} else {
LOG.info(end);
}
}
}
项目:nashorn-backport
文件:Parser.java
项目:nashorn
文件:Parser.java
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。