diff --git a/tests/parser-cases/annotations.thrift b/tests/parser-cases/annotations.thrift index 81d93d7..8260031 100644 --- a/tests/parser-cases/annotations.thrift +++ b/tests/parser-cases/annotations.thrift @@ -55,3 +55,7 @@ service foo_service { void foo() ( foo = "bar" ) } (a.b="c") +union foo_union { + 1: optional bool abc + 2: optional i32 xyz +} (a.b="c") diff --git a/thriftpy2/parser/parser.py b/thriftpy2/parser/parser.py index 1a06b3b..69783c3 100644 --- a/thriftpy2/parser/parser.py +++ b/thriftpy2/parser/parser.py @@ -229,7 +229,7 @@ def p_seen_struct(p): def p_union(p): - '''union : seen_union '{' field_seq '}' ''' + '''union : seen_union '{' field_seq '}' type_annotations''' val = _fill_in_struct(p[1], p[3]) _add_thrift_meta('unions', val)