[
https://issues.apache.org/jira/browse/THRIFT-233?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14511261#comment-14511261
]
ASF GitHub Bot commented on THRIFT-233:
---------------------------------------
GitHub user mreve opened a pull request:
https://github.com/apache/thrift/pull/461
Support negative hex literals in IDL
As it is now, the parser doesn't allow hex constant values to be negative
(it throws a 'bad syntax' error).
The change updates the regex and the code that parses the hex value from
the string read from the IDL file to support negative values.
Jira issue: https://issues.apache.org/jira/browse/THRIFT-233
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/mreve/thrift THRIFT-233
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/thrift/pull/461.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #461
----
commit 5c14cea3d612d026279b354556472c22647261b9
Author: mreve <[email protected]>
Date: 2015-04-19T11:16:45Z
Update hexconstant regex in thriftl.ll
As it is now, the parser doesn't allow hex constant values to be negative
(it throws a 'bad syntax' error).
The change updates the regex and the part that parses the hex value from
the string read from the IDL file to support negative values.
----
> IDL doesn't support negative hex literals
> -----------------------------------------
>
> Key: THRIFT-233
> URL: https://issues.apache.org/jira/browse/THRIFT-233
> Project: Thrift
> Issue Type: Bug
> Components: Compiler (General)
> Reporter: Bryan Duxbury
> Priority: Trivial
>
> if you try a field def like
> {code}
> i32 my_field = -0x7fff
> {code}
> the compiler complains. If you try to make the value a two's complement
> negative number without the sign, then it assumes it was supposed to be a
> long, and the Java compiler chokes on the assignment.
> It'd be nice if we supported negative hex literals.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)