-
Notifications
You must be signed in to change notification settings - Fork 762
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
jflex warnings in multiple lex files about too long Unicode escape sequences #4734
Comments
The limit in JFlex is either 4 or 6 characters in the sequence (LexScan.flex): {Unicode4} { maybeWarnUnicodeMatch(4);
string.append( (char) Integer.parseInt(yytext().substring(2,6), 16));
}
{Unicode6} { maybeWarnUnicodeMatch(6);
int codePoint = Integer.parseInt(yytext().substring(2,8), 16);
if (codePoint <= getMaximumCodePoint()) {
string.append(Character.toChars(codePoint));
} else {
throw new ScannerException(file,ErrorMessages.CODEPOINT_OUT_OF_RANGE, yyline, yycolumn+2);
}
}
"\\u{" { yybegin(STRING_CODEPOINT_SEQUENCE); } The /**
* Warn if the matched length of a Unicode escape sequence is longer than expected. Push back the
* extra characters to be matched again.
*
* @param len expected Unicode escape sequence length
*/
public void maybeWarnUnicodeMatch(int len) {
// 2 for "\"" followed by "u" or "U" at start of match
len += 2;
if (lexLength() > len) {
Out.warning(file, ErrorMessages.UNICODE_TOO_LONG, lexLine(), lexColumn() + len);
lexPushback(lexLength() - len);
}
} so it basically allows up to 4 characters after the |
The Java SE 17 documentation says in section 3.3 Unicode Escapes:
|
Looks like JFlex does not support using 2 consecutive Unicode escapes to specify character range in a regexp. Anyhow, given that it most likely used |
The text was updated successfully, but these errors were encountered: