mojoshader_parser_hlsl.lemon
changeset 937 94e50ba3f956
parent 931 4aa1f68d8292
child 964 e8c09c28162e
equal deleted inserted replaced
936:b4a15ef390c4 937:94e50ba3f956
    93 //compilation_unit(A) ::= error SEMICOLON. { A = NULL; }  // !!! FIXME: research using the error nonterminal
    93 //compilation_unit(A) ::= error SEMICOLON. { A = NULL; }  // !!! FIXME: research using the error nonterminal
    94 
    94 
    95 %type typedef { MOJOSHADER_astTypedef * }
    95 %type typedef { MOJOSHADER_astTypedef * }
    96 %destructor typedef { delete_typedef(ctx, $$); }
    96 %destructor typedef { delete_typedef(ctx, $$); }
    97 // !!! FIXME: should CONST be here, or in datatype?
    97 // !!! FIXME: should CONST be here, or in datatype?
    98 typedef(A) ::= TYPEDEF CONST datatype(B) scalar_or_array(C). { A = new_typedef(ctx, 1, B, C); push_usertype(ctx, C->identifier, NULL); }
    98 typedef(A) ::= TYPEDEF CONST datatype(B) scalar_or_array(C). { A = new_typedef(ctx, 1, B, C); push_usertype(ctx, C->identifier, "?"); }
    99 typedef(A) ::= TYPEDEF datatype(B) scalar_or_array(C). { A = new_typedef(ctx, 0, B, C); push_usertype(ctx, C->identifier, NULL); }
    99 typedef(A) ::= TYPEDEF datatype(B) scalar_or_array(C). { A = new_typedef(ctx, 0, B, C); push_usertype(ctx, C->identifier, "?"); }
   100 
   100 
   101 %type function_signature { MOJOSHADER_astFunctionSignature * }
   101 %type function_signature { MOJOSHADER_astFunctionSignature * }
   102 %destructor function_signature { delete_function_signature(ctx, $$); }
   102 %destructor function_signature { delete_function_signature(ctx, $$); }
   103 function_signature(A) ::= function_storageclass(B) function_details(C) semantic(D). { A = C; A->storage_class = B; A->semantic = D; }
   103 function_signature(A) ::= function_storageclass(B) function_details(C) semantic(D). { A = C; A->storage_class = B; A->semantic = D; }
   104 function_signature(A) ::= function_storageclass(B) function_details(C). { A = C; A->storage_class = B; }
   104 function_signature(A) ::= function_storageclass(B) function_details(C). { A = C; A->storage_class = B; }
   222 %destructor struct_declaration { delete_struct_declaration(ctx, $$); }
   222 %destructor struct_declaration { delete_struct_declaration(ctx, $$); }
   223 struct_declaration(A) ::= struct_intro(B) LBRACE struct_member_list(C) RBRACE. { REVERSE_LINKED_LIST(MOJOSHADER_astStructMembers, C); A = new_struct_declaration(ctx, B, C); }
   223 struct_declaration(A) ::= struct_intro(B) LBRACE struct_member_list(C) RBRACE. { REVERSE_LINKED_LIST(MOJOSHADER_astStructMembers, C); A = new_struct_declaration(ctx, B, C); }
   224 
   224 
   225 // This has to be separate from struct_declaration so that the struct is in the usertypemap when parsing its members.
   225 // This has to be separate from struct_declaration so that the struct is in the usertypemap when parsing its members.
   226 %type struct_intro { const char * }
   226 %type struct_intro { const char * }
   227 struct_intro(A) ::= STRUCT IDENTIFIER(B). { A = B.string; push_usertype(ctx, A, NULL); }
   227 struct_intro(A) ::= STRUCT IDENTIFIER(B). { A = B.string; push_usertype(ctx, A, "?"); }
   228 
   228 
   229 %type struct_member_list { MOJOSHADER_astStructMembers * }
   229 %type struct_member_list { MOJOSHADER_astStructMembers * }
   230 %destructor struct_member_list { delete_struct_member(ctx, $$); }
   230 %destructor struct_member_list { delete_struct_member(ctx, $$); }
   231 struct_member_list(A) ::= struct_member(B). { A = B; }
   231 struct_member_list(A) ::= struct_member(B). { A = B; }
   232 struct_member_list(A) ::= struct_member_list(B) struct_member(C). { A = C; A->next = B; }
   232 struct_member_list(A) ::= struct_member_list(B) struct_member(C). { A = C; A->next = B; }