samuel / go-thrift

A native Thrift package for Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Parser does not permit numeric literal const values to be defined using hex

nick-jones opened this issue · comments

With /tmp/example.thrift containing:

const i64 H = 0x2603;

the go-thrift parser barfs:

$ ./gen /tmp/example.thrift /tmp/example/
<reader>:1:1 (0): rule SyntaxError: parser: syntax error

This is permitted by the official thrift parser, however:

$  thrift -o /tmp/example/ --gen go /tmp/example.thrift
$  grep 'const H' /tmp/example/gen-go/example/constants.go
const H = 9731

I've had a go and fixing this, so I will have a PR open momentarily..