} catch (JsParserException e) {
/*
* count the number of characters to the problem (from the start of
* the JSNI code)
*/
SourceDetail detail = e.getSourceDetail();
int line = detail.getLine();
char[] chars = jsniCode.toCharArray();
int i = 0, n = chars.length;
while (line > 0) {
// CHECKSTYLE_OFF
switch (chars[i]) {
case '\r':
// if skip an extra character if this is a CR/LF
if (i + 1 < n && chars[i + 1] == '\n') {
++i;
}
// intentional fall-through
case '\n':
--line;
// intentional fall-through
default:
++i;
}
// CHECKSTYLE_ON
}
// TODO: check this
// Map into the original source stream;
i += startPos + detail.getLineOffset();
info = new SourceInfo(i, i, info.getStartLine() + detail.getLine(),
info.getFileName());
GenerateJavaAST.reportJsniError(info, methodDeclaration,
e.getMessage());
}
}