这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@regisd
Copy link
Contributor

@regisd regisd commented Mar 25, 2020

Starting from JFlex 1.8.0, yychar is a long.

However, it is used to build an antlr CommonToken which takes an int.
Hence, explicit casting is needed.

I propose to cast the yychar with java.lang.Math.toIntExact() which throw an ArithmeticException in case of overflow.
This is acceptable because the previous code would have returned an overflowed (negative) position.

See jflex-de/jflex#605 for details.

Starting from JFlex 1.8.0, `yychar` is a long.

However, it is used to build an antlr `CommonToken` which takes an int.
Hence, explicit casting is needed.

I propose to cast the `yychar` with `java.lang.Math.toIntExact()` which throw an ArithmeticException in case of overflow.
This is acceptable because the previous code would have returned an overflowed (negative) position.

See jflex-de/jflex#605 for details.
@JesusFreke
Copy link
Owner

Thanks! LGTM

@JesusFreke JesusFreke merged commit c1534fc into JesusFreke:master Mar 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants