本文整理了Java中org.mozilla.javascript.Parser.lineBeginningFor()
方法的一些代码示例,展示了Parser.lineBeginningFor()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Parser.lineBeginningFor()
方法的具体详情如下:
包路径:org.mozilla.javascript.Parser
类名称:Parser
方法名:lineBeginningFor
[英]Return the file offset of the beginning of the input source line containing the passed position.
[中]返回包含传递位置的输入源行开头的文件偏移量。
代码示例来源:origin: io.apigee/rhino
private void warnMissingSemi(int pos, int end) {
// Should probably change this to be a CompilerEnvirons setting,
// with an enum Never, Always, Permissive, where Permissive means
// don't warn for 1-line functions like function (s) {return x+2}
if (compilerEnv.isStrictMode()) {
int beg = Math.max(pos, lineBeginningFor(end));
if (end == -1)
end = ts.cursor;
addStrictWarning("msg.missing.semi", "",
beg, end - beg);
}
}
代码示例来源:origin: com.github.tntim96/rhino
private void warnMissingSemi(int pos, int end) {
// Should probably change this to be a CompilerEnvirons setting,
// with an enum Never, Always, Permissive, where Permissive means
// don't warn for 1-line functions like function (s) {return x+2}
if (compilerEnv.isStrictMode()) {
int beg = Math.max(pos, lineBeginningFor(end));
if (end == -1)
end = ts.cursor;
addStrictWarning("msg.missing.semi", "",
beg, end - beg);
}
}
代码示例来源:origin: ro.isdc.wro4j/rhino
private void warnMissingSemi(int pos, int end) {
// Should probably change this to be a CompilerEnvirons setting,
// with an enum Never, Always, Permissive, where Permissive means
// don't warn for 1-line functions like function (s) {return x+2}
if (compilerEnv.isStrictMode()) {
int beg = Math.max(pos, lineBeginningFor(end));
if (end == -1)
end = ts.cursor;
addStrictWarning("msg.missing.semi", "",
beg, end - beg);
}
}
代码示例来源:origin: geogebra/geogebra
private void warnTrailingComma(int pos, List<?> elems, int commaPos) {
if (compilerEnv.getWarnTrailingComma()) {
// back up from comma to beginning of line or array/objlit
if (!elems.isEmpty()) {
pos = ((AstNode)elems.get(0)).getPosition();
}
pos = Math.max(pos, lineBeginningFor(commaPos));
addWarning("msg.extra.trailing.comma", pos, commaPos - pos);
}
}
代码示例来源:origin: io.apigee/rhino
private void warnTrailingComma(int pos, List<?> elems, int commaPos) {
if (compilerEnv.getWarnTrailingComma()) {
// back up from comma to beginning of line or array/objlit
if (!elems.isEmpty()) {
pos = ((AstNode)elems.get(0)).getPosition();
}
pos = Math.max(pos, lineBeginningFor(commaPos));
addWarning("msg.extra.trailing.comma", pos, commaPos - pos);
}
}
代码示例来源:origin: com.github.tntim96/rhino
private void warnTrailingComma(int pos, List<?> elems, int commaPos) {
if (compilerEnv.getWarnTrailingComma()) {
// back up from comma to beginning of line or array/objlit
if (!elems.isEmpty()) {
pos = ((AstNode)elems.get(0)).getPosition();
}
pos = Math.max(pos, lineBeginningFor(commaPos));
addWarning("msg.extra.trailing.comma", pos, commaPos - pos);
}
}
代码示例来源:origin: ro.isdc.wro4j/rhino
private void warnTrailingComma(int pos, List<?> elems, int commaPos) {
if (compilerEnv.getWarnTrailingComma()) {
// back up from comma to beginning of line or array/objlit
if (!elems.isEmpty()) {
pos = ((AstNode)elems.get(0)).getPosition();
}
pos = Math.max(pos, lineBeginningFor(commaPos));
addWarning("msg.extra.trailing.comma", pos, commaPos - pos);
}
}
代码示例来源:origin: io.apigee/rhino
if (compilerEnv.isStrictMode() && !pn.hasSideEffects()) {
int beg = pn.getPosition();
beg = Math.max(beg, lineBeginningFor(beg));
addStrictWarning(pn instanceof EmptyStatement
? "msg.extra.trailing.semi"
代码示例来源:origin: com.github.tntim96/rhino
if (compilerEnv.isStrictMode() && !pn.hasSideEffects()) {
int beg = pn.getPosition();
beg = Math.max(beg, lineBeginningFor(beg));
addStrictWarning(pn instanceof EmptyStatement
? "msg.extra.trailing.semi"
代码示例来源:origin: ro.isdc.wro4j/rhino
if (compilerEnv.isStrictMode() && !pn.hasSideEffects()) {
int beg = pn.getPosition();
beg = Math.max(beg, lineBeginningFor(beg));
addStrictWarning(pn instanceof EmptyStatement
? "msg.extra.trailing.semi"
代码示例来源:origin: geogebra/geogebra
if (compilerEnv.isStrictMode() && !pn.hasSideEffects()) {
int beg = pn.getPosition();
beg = Math.max(beg, lineBeginningFor(beg));
addStrictWarning(pn instanceof EmptyStatement
? "msg.extra.trailing.semi"
内容来源于网络,如有侵权,请联系作者删除!