Client: compiler general
Patch: Dave Watson
This closes #87
commit
078ce57e816eeb3697acf6f2c50e09526da73d3b
Author: Dave Watson <davejwatson@fb.com>
Date: 2014-03-21T19:42:31Z
[thrift] Compiler: allow annotations without "= value"
Summary: (foo) is the same as (foo = 1), for brevity
Test: AnnotationTest.thrift still compiles
%type<ttype> TypeAnnotations
%type<ttype> TypeAnnotationList
%type<tannot> TypeAnnotation
+%type<id> TypeAnnotationValue
%type<tfield> Field
%type<tfieldid> FieldIdentifier
}
TypeAnnotation:
- tok_identifier '=' tok_literal CommaOrSemicolonOptional
+ tok_identifier TypeAnnotationValue CommaOrSemicolonOptional
{
- pdebug("TypeAnnotation -> tok_identifier = tok_literal");
+ pdebug("TypeAnnotation -> TypeAnnotationValue");
$$ = new t_annotation;
$$->key = $1;
- $$->val = $3;
+ $$->val = $2;
+ }
+
+TypeAnnotationValue:
+ '=' tok_literal
+ {
+ pdebug("TypeAnnotationValue -> = tok_literal");
+ $$ = $2;
+ }
+|
+ {
+ pdebug("TypeAnnotationValue ->");
+ $$ = strdup("1");
}
%%
cpp.type = "DenseFoo",
python.type = "DenseFoo",
java.final = "",
+ annotation.without.value,
)
exception foo_error {