X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;ds=inline;f=rpcgen_parse.y;h=652a7f3141de49f4b9b4270508fdfa34b3d9acbe;hb=b92428b2c1588d37e8c1eb42a4548fa3524c6b22;hp=5ccc7dd27d4e1ba7257f2f197eba64c232a2c053;hpb=1b9cc11ece64ac12f63e6c96e32b404b32fb0f32;p=portablexdr.git diff --git a/rpcgen_parse.y b/rpcgen_parse.y index 5ccc7dd..652a7f3 100644 --- a/rpcgen_parse.y +++ b/rpcgen_parse.y @@ -38,7 +38,7 @@ extern void yyerror (const char *str); %type const %type decl %type simple_decl fixed_array_decl variable_array_decl pointer_decl -%type string_decl +%type string_decl opaque_decl %type enum_value %type union_case %type decls enum_values union_cases @@ -59,6 +59,7 @@ extern void yyerror (const char *str); %token SHORT %token INT %token HYPER +%token FLOAT %token DOUBLE %token STRING %token OPAQUE @@ -132,6 +133,7 @@ decls : decl ';' ; decl : string_decl + | opaque_decl | simple_decl | fixed_array_decl | variable_array_decl @@ -141,15 +143,22 @@ decl : string_decl string_decl : STRING IDENT '<' const '>' { - $$ = new_decl (decl_type_simple, - new_type (type_string, 0, NULL, $4), - $2, NULL); + $$ = new_decl (decl_type_string, NULL, $2, $4); } | STRING IDENT '<' '>' { - $$ = new_decl (decl_type_simple, - new_type (type_string, 0, NULL, NULL), - $2, NULL); + $$ = new_decl (decl_type_string, NULL, $2, NULL); + } + ; + +opaque_decl + : OPAQUE IDENT '[' const ']' + { + $$ = new_decl (decl_type_opaque_fixed, NULL, $2, $4); + } + | OPAQUE IDENT '<' const '>' + { + $$ = new_decl (decl_type_opaque_variable, NULL, $2, $4); } ; @@ -215,44 +224,50 @@ const : INTLIT | IDENT ; -/* Types. Note 'string' and 'void' are handled by special cases above. */ +/* Types. Note 'string', 'opaque' and 'void' are handled by + * special cases above. + */ type_ident : CHAR - { $$ = new_type (type_char, 1, NULL, NULL); } + /* NB: Unlike SunRPC we make char explicitly signed. This + * will give some warnings in GCC if you mix PortableXDR + * code with SunRPC headers or vice versa. + */ + { $$ = new_type (type_char, 1, NULL); } | SIGNED CHAR - { $$ = new_type (type_char, 1, NULL, NULL); } + { $$ = new_type (type_char, 1, NULL); } | UNSIGNED CHAR - { $$ = new_type (type_char, 0, NULL, NULL); } + { $$ = new_type (type_char, 0, NULL); } | SHORT - { $$ = new_type (type_short, 1, NULL, NULL); } + { $$ = new_type (type_short, 1, NULL); } | SIGNED SHORT - { $$ = new_type (type_short, 1, NULL, NULL); } + { $$ = new_type (type_short, 1, NULL); } | UNSIGNED SHORT - { $$ = new_type (type_short, 0, NULL, NULL); } + { $$ = new_type (type_short, 0, NULL); } | INT - { $$ = new_type (type_int, 1, NULL, NULL); } + { $$ = new_type (type_int, 1, NULL); } | SIGNED INT - { $$ = new_type (type_int, 1, NULL, NULL); } + { $$ = new_type (type_int, 1, NULL); } | UNSIGNED INT - { $$ = new_type (type_int, 0, NULL, NULL); } + { $$ = new_type (type_int, 0, NULL); } | HYPER - { $$ = new_type (type_hyper, 1, NULL, NULL); } + { $$ = new_type (type_hyper, 1, NULL); } | SIGNED HYPER - { $$ = new_type (type_hyper, 1, NULL, NULL); } + { $$ = new_type (type_hyper, 1, NULL); } | UNSIGNED HYPER - { $$ = new_type (type_hyper, 0, NULL, NULL); } + { $$ = new_type (type_hyper, 0, NULL); } | SIGNED - { $$ = new_type (type_int, 1, NULL, NULL); } + { $$ = new_type (type_int, 1, NULL); } | UNSIGNED - { $$ = new_type (type_int, 0, NULL, NULL); } + { $$ = new_type (type_int, 0, NULL); } + | FLOAT + { $$ = new_type (type_float, 0, NULL); } | DOUBLE - { $$ = new_type (type_double, 0, NULL, NULL); } - | OPAQUE - { $$ = new_type (type_opaque, 0, NULL, NULL); } + { $$ = new_type (type_double, 0, NULL); } | BOOL - { $$ = new_type (type_bool, 0, NULL, NULL); } + { $$ = new_type (type_bool, 0, NULL); } | IDENT - { $$ = new_type (type_ident, 0, $1, NULL); } + { $$ = new_type (type_ident, 0, $1); } ; %%