diff --git a/tests/const.thrift b/tests/const.thrift index 032fb54..5eb2fb4 100644 --- a/tests/const.thrift +++ b/tests/const.thrift @@ -1,6 +1,7 @@ const i16 NEGATIVE_I16 = -10 const double NEGATIVE_DOUBLE = -123.456 +const i8 I8_CONST = 10 const i16 I16_CONST = 10 const i32 I32_CONST = 100000 const double DOUBLE_CONST = 123.456 diff --git a/thriftpy/parser/lexer.py b/thriftpy/parser/lexer.py index bde1cb7..1a5d78b 100644 --- a/thriftpy/parser/lexer.py +++ b/thriftpy/parser/lexer.py @@ -122,6 +122,7 @@ 'void', 'bool', 'byte', + 'i8', 'i16', 'i32', 'i64', diff --git a/thriftpy/parser/parser.py b/thriftpy/parser/parser.py index f65320a..e50e3c6 100644 --- a/thriftpy/parser/parser.py +++ b/thriftpy/parser/parser.py @@ -389,6 +389,7 @@ def p_ref_type(p): def p_simple_base_type(p): # noqa '''simple_base_type : BOOL | BYTE + | I8 | I16 | I32 | I64 @@ -399,6 +400,8 @@ def p_simple_base_type(p): # noqa p[0] = TType.BOOL if p[1] == 'byte': p[0] = TType.BYTE + if p[1] == 'i8': + p[0] = TType.BYTE if p[1] == 'i16': p[0] = TType.I16 if p[1] == 'i32':