diff options
author | Dmitry Stogov <dmitry@zend.com> | 2019-03-28 01:21:06 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2019-03-28 01:21:06 +0300 |
commit | 984d05f9484ee0ddb42360523ab2faeb10140d19 (patch) | |
tree | 533da567872a156ad8b7bcbbef427939bd7d0426 | |
parent | 058554810649da431efa3ab851be17b0d2f96fb8 (diff) | |
download | php-git-984d05f9484ee0ddb42360523ab2faeb10140d19.tar.gz |
Use semantic predicates to simplify lookahead and reduce backtracking
-rw-r--r-- | ext/ffi/ffi.g | 111 | ||||
-rw-r--r-- | ext/ffi/ffi_parser.c | 2418 |
2 files changed, 569 insertions, 1960 deletions
diff --git a/ext/ffi/ffi.g b/ext/ffi/ffi.g index 9ffe3c5fa6..573a4597aa 100644 --- a/ext/ffi/ffi.g +++ b/ext/ffi/ffi.g @@ -123,7 +123,7 @@ declaration_specifiers(zend_ffi_dcl *dcl): {zend_ffi_set_abi(dcl, ZEND_FFI_ABI_THISCALL);} | "_Alignas" "(" - ( &type_name + ( &type_name_start {zend_ffi_dcl align_dcl = ZEND_FFI_ATTR_INIT;} type_name(&align_dcl) {zend_ffi_align_as_type(dcl, &align_dcl);} @@ -331,7 +331,6 @@ enumerator(zend_ffi_dcl *enum_dcl, int64_t *min, int64_t *max, int64_t *last): ; declarator(zend_ffi_dcl *dcl, const char **name, size_t *name_len): - /* "char" is used as a terminator of nested declaration */ {zend_ffi_dcl nested_dcl = {ZEND_FFI_DCL_CHAR, 0, 0, 0, NULL};} {zend_bool nested = 0;} pointer(dcl)? @@ -346,44 +345,35 @@ declarator(zend_ffi_dcl *dcl, const char **name, size_t *name_len): {if (nested) zend_ffi_nested_declaration(dcl, &nested_dcl);} ; -abstract_declarator(zend_ffi_dcl *dcl, const char **name, size_t *name_len): - /* "char" is used as a terminator of nested declaration */ +abstract_declarator(zend_ffi_dcl *dcl): {zend_ffi_dcl nested_dcl = {ZEND_FFI_DCL_CHAR, 0, 0, 0, NULL};} {zend_bool nested = 0;} pointer(dcl)? - ( &nested_abstract_declarator - nested_abstract_declarator(&nested_dcl, name, name_len) + ( &nested_declarator_start + "(" + attributes(&nested_dcl)? + abstract_declarator(&nested_dcl) + ")" {nested = 1;} - | ID(name, name_len) - | /* empty */ - ) + )? array_or_function_declarators(dcl)? {if (nested) zend_ffi_nested_declaration(dcl, &nested_dcl);} ; -nested_abstract_declarator(zend_ffi_dcl *dcl, const char **name, size_t *name_len): +parameter_declarator(zend_ffi_dcl *dcl, const char **name, size_t *name_len): {zend_ffi_dcl nested_dcl = {ZEND_FFI_DCL_CHAR, 0, 0, 0, NULL};} {zend_bool nested = 0;} - "(" - attributes(&nested_dcl)? - ( pointer(dcl) - ( &nested_abstract_declarator - nested_abstract_declarator(&nested_dcl, name, name_len) - {nested = 1;} - | ID(name, name_len) - | /* empty */ - ) - array_or_function_declarators(dcl)? - | ( &nested_abstract_declarator - nested_abstract_declarator(&nested_dcl, name, name_len) - array_or_function_declarators(dcl)? - {nested = 1;} - | ID(name, name_len) - array_or_function_declarators(dcl)? - | array_or_function_declarators(dcl) - ) + pointer(dcl)? + ( &nested_declarator_start + "(" + attributes(&nested_dcl)? + parameter_declarator(&nested_dcl, name, name_len) + ")" + {nested = 1;} + | ID(name, name_len) + | /* empty */ ) - ")" + array_or_function_declarators(dcl)? {if (nested) zend_ffi_nested_declaration(dcl, &nested_dcl);} ; @@ -451,17 +441,15 @@ parameter_declaration(HashTable **args): {FFI_G(allow_vla) = 1;} {zend_ffi_dcl param_dcl = ZEND_FFI_ATTR_INIT;} specifier_qualifier_list(¶m_dcl) - abstract_declarator(¶m_dcl, &name, &name_len) + parameter_declarator(¶m_dcl, &name, &name_len) /*attributes(¶m_dcl)? conflict ???*/ {zend_ffi_add_arg(args, name, name_len, ¶m_dcl);} {FFI_G(allow_vla) = old_allow_vla;} ; type_name(zend_ffi_dcl *dcl): - {const char *name = NULL;} - {size_t name_len = 0;} specifier_qualifier_list(dcl) - abstract_declarator(dcl, &name, &name_len) + abstract_declarator(dcl) ; attributes(zend_ffi_dcl *dcl): @@ -685,7 +673,7 @@ multiplicative_expression(zend_ffi_val *val): cast_expression(zend_ffi_val *val): {int do_cast = 0;} {zend_ffi_dcl dcl = ZEND_FFI_ATTR_INIT;} - ( &( "(" type_name ")" ) + ( &( "(" type_name_start ) "(" type_name(&dcl) ")" @@ -751,7 +739,7 @@ unary_expression(zend_ffi_val *val): cast_expression(val) {zend_ffi_expr_bool_not(val);} | "sizeof" - ( &( "(" type_name ")" ) + ( &( "(" type_name_start ) "(" type_name(&dcl) ")" @@ -765,7 +753,7 @@ unary_expression(zend_ffi_val *val): ")" {zend_ffi_expr_alignof_type(val, &dcl);} | ("__alignof"|"__alignof__") - ( &( "(" type_name ")" ) + ( &( "(" type_name_start ) "(" type_name(&dcl) ")" @@ -776,6 +764,57 @@ unary_expression(zend_ffi_val *val): ) ; +/* lookahead rules */ +nested_declarator_start: + "(" + ( ?{!zend_ffi_is_typedef_name((const char*)yy_text, yy_pos - yy_text)} + ID + | "__attribute" + | "__attribute__" + | "__declspec" + | "*" + | "(" + | "[" + ) +; + +type_name_start: + ( ?{zend_ffi_is_typedef_name((const char*)yy_text, yy_pos - yy_text)} + ID + | "void" + | "char" + | "short" + | "int" + | "long" + | "float" + | "double" + | "signed" + | "unsigned" + | "_Bool" + | "_Complex" + | "complex" + | "__complex" + | "__complex__" + | "struct" + | "union" + | "enum" + | "const" + | "__const" + | "__const__" + | "restrict" + | "__restict" + | "__restrict__" + | "volatile" + | "__volatile" + | "__volatile__" + | "_Atomic" + | "__attribute" + | "__attribute__" + | "__declspec" + ) +; + +/* scanner rules */ ID(const char **name, size_t *name_len): /[A-Za-z_][A-Za-z_0-9]*/ {*name = (const char*)yy_text; *name_len = yy_pos - yy_text;} diff --git a/ext/ffi/ffi_parser.c b/ext/ffi/ffi_parser.c index 2e3bc3c510..fe2107df66 100644 --- a/ext/ffi/ffi_parser.c +++ b/ext/ffi/ffi_parser.c @@ -245,50 +245,9 @@ static int skip_WS(int sym); static int skip_ONE_LINE_COMMENT(int sym); static int skip_COMMENT(int sym); static int get_sym(void); -static int check_specifier_qualifier_list(int sym); -static int check_type_qualifier_list(int sym); -static int check_type_qualifier(int sym); -static int check_type_specifier(int sym); -static int check_struct_or_union_specifier(int sym); -static int check_struct_contents(int sym); -static int check_struct_declaration(int sym); -static int check_struct_declarator(int sym); -static int check_enum_specifier(int sym); -static int check_enumerator_list(int sym); -static int check_enumerator(int sym); -static int check_declarator(int sym); -static int check_abstract_declarator(int sym); -static int check_nested_abstract_declarator(int sym); -static int check_pointer(int sym); -static int check_array_or_function_declarators(int sym); -static int check_parameter_declaration(int sym); -static int check_type_name(int sym); -static int check_attributes(int sym); -static int check_attrib(int sym); -static int check_expr_list(int sym); -static int check_expression(int sym); -static int check_assignment_expression(int sym); -static int check_constant_expression(int sym); -static int check_conditional_expression(int sym); -static int check_logical_or_expression(int sym); -static int check_logical_and_expression(int sym); -static int check_inclusive_or_expression(int sym); -static int check_exclusive_or_expression(int sym); -static int check_and_expression(int sym); -static int check_equality_expression(int sym); -static int check_relational_expression(int sym); -static int check_shift_expression(int sym); -static int check_additive_expression(int sym); -static int check_multiplicative_expression(int sym); -static int check_cast_expression(int sym); -static int check_unary_expression(int sym); +static int check_nested_declarator_start(int sym); +static int check_type_name_start(int sym); static int check_ID(int sym); -static int check_OCTNUMBER(int sym); -static int check_DECNUMBER(int sym); -static int check_HEXNUMBER(int sym); -static int check_FLOATNUMBER(int sym); -static int check_STRING(int sym); -static int check_CHARACTER(int sym); static int parse_declarations(int sym); static int parse_declaration_specifiers(int sym, zend_ffi_dcl *dcl); static int parse_specifier_qualifier_list(int sym, zend_ffi_dcl *dcl); @@ -303,8 +262,8 @@ static int parse_enum_specifier(int sym, zend_ffi_dcl *dcl); static int parse_enumerator_list(int sym, zend_ffi_dcl *enum_dcl); static int parse_enumerator(int sym, zend_ffi_dcl *enum_dcl, int64_t *min, int64_t *max, int64_t *last); static int parse_declarator(int sym, zend_ffi_dcl *dcl, const char **name, size_t *name_len); -static int parse_abstract_declarator(int sym, zend_ffi_dcl *dcl, const char **name, size_t *name_len); -static int parse_nested_abstract_declarator(int sym, zend_ffi_dcl *dcl, const char **name, size_t *name_len); +static int parse_abstract_declarator(int sym, zend_ffi_dcl *dcl); +static int parse_parameter_declarator(int sym, zend_ffi_dcl *dcl, const char **name, size_t *name_len); static int parse_pointer(int sym, zend_ffi_dcl *dcl); static int parse_array_or_function_declarators(int sym, zend_ffi_dcl *dcl); static int parse_parameter_declaration(int sym, HashTable **args); @@ -343,7 +302,6 @@ static int synpred_3(int sym); static int synpred_4(int sym); static int synpred_5(int sym); static int synpred_6(int sym); -static int synpred_7(int sym); static int get_skip_sym(void) { int ch; @@ -359,41 +317,41 @@ _yy_state_start: switch (ch) { case 't': ch = *++YYPOS; - if (ch != 'y') goto _yy_tunnel_15; + if (ch != 'y') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'p') goto _yy_tunnel_15; + if (ch != 'p') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'e') goto _yy_tunnel_15; + if (ch != 'e') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'd') goto _yy_tunnel_15; + if (ch != 'd') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'e') goto _yy_tunnel_15; + if (ch != 'e') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'f') goto _yy_tunnel_15; + if (ch != 'f') goto _yy_tunnel_9; ret = YY_TYPEDEF; goto _yy_state_366; case 'e': ch = *++YYPOS; if (ch == 'x') { ch = *++YYPOS; - if (ch != 't') goto _yy_tunnel_15; + if (ch != 't') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'e') goto _yy_tunnel_15; + if (ch != 'e') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'r') goto _yy_tunnel_15; + if (ch != 'r') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'n') goto _yy_tunnel_15; + if (ch != 'n') goto _yy_tunnel_9; ret = YY_EXTERN; goto _yy_state_366; } else if (ch == 'n') { ch = *++YYPOS; - if (ch != 'u') goto _yy_tunnel_15; + if (ch != 'u') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'm') goto _yy_tunnel_15; + if (ch != 'm') goto _yy_tunnel_9; ret = YY_ENUM; goto _yy_state_366; } else { - goto _yy_tunnel_15; + goto _yy_tunnel_9; } case 's': ch = *++YYPOS; @@ -401,120 +359,120 @@ _yy_state_start: ch = *++YYPOS; if (ch == 'a') { ch = *++YYPOS; - if (ch != 't') goto _yy_tunnel_15; + if (ch != 't') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'i') goto _yy_tunnel_15; + if (ch != 'i') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'c') goto _yy_tunnel_15; + if (ch != 'c') goto _yy_tunnel_9; ret = YY_STATIC; goto _yy_state_366; } else if (ch == 'r') { ch = *++YYPOS; - if (ch != 'u') goto _yy_tunnel_15; + if (ch != 'u') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'c') goto _yy_tunnel_15; + if (ch != 'c') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 't') goto _yy_tunnel_15; + if (ch != 't') goto _yy_tunnel_9; ret = YY_STRUCT; goto _yy_state_366; } else { - goto _yy_tunnel_15; + goto _yy_tunnel_9; } } else if (ch == 'h') { ch = *++YYPOS; - if (ch != 'o') goto _yy_tunnel_15; + if (ch != 'o') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'r') goto _yy_tunnel_15; + if (ch != 'r') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 't') goto _yy_tunnel_15; + if (ch != 't') goto _yy_tunnel_9; ret = YY_SHORT; goto _yy_state_366; } else if (ch == 'i') { ch = *++YYPOS; if (ch == 'g') { ch = *++YYPOS; - if (ch != 'n') goto _yy_tunnel_15; + if (ch != 'n') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'e') goto _yy_tunnel_15; + if (ch != 'e') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'd') goto _yy_tunnel_15; + if (ch != 'd') goto _yy_tunnel_9; ret = YY_SIGNED; goto _yy_state_366; } else if (ch == 'z') { ch = *++YYPOS; - if (ch != 'e') goto _yy_tunnel_15; + if (ch != 'e') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'o') goto _yy_tunnel_15; + if (ch != 'o') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'f') goto _yy_tunnel_15; + if (ch != 'f') goto _yy_tunnel_9; ret = YY_SIZEOF; goto _yy_state_366; } else { - goto _yy_tunnel_15; + goto _yy_tunnel_9; } } else { - goto _yy_tunnel_15; + goto _yy_tunnel_9; } case 'a': ch = *++YYPOS; - if (ch != 'u') goto _yy_tunnel_15; + if (ch != 'u') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 't') goto _yy_tunnel_15; + if (ch != 't') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'o') goto _yy_tunnel_15; + if (ch != 'o') goto _yy_tunnel_9; ret = YY_AUTO; goto _yy_state_366; case 'r': ch = *++YYPOS; - if (ch != 'e') goto _yy_tunnel_15; + if (ch != 'e') goto _yy_tunnel_9; ch = *++YYPOS; if (ch == 'g') { ch = *++YYPOS; - if (ch != 'i') goto _yy_tunnel_15; + if (ch != 'i') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 's') goto _yy_tunnel_15; + if (ch != 's') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 't') goto _yy_tunnel_15; + if (ch != 't') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'e') goto _yy_tunnel_15; + if (ch != 'e') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'r') goto _yy_tunnel_15; + if (ch != 'r') goto _yy_tunnel_9; ret = YY_REGISTER; goto _yy_state_366; } else if (ch == 's') { ch = *++YYPOS; - if (ch != 't') goto _yy_tunnel_15; + if (ch != 't') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'r') goto _yy_tunnel_15; + if (ch != 'r') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'i') goto _yy_tunnel_15; + if (ch != 'i') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'c') goto _yy_tunnel_15; + if (ch != 'c') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 't') goto _yy_tunnel_15; + if (ch != 't') goto _yy_tunnel_9; ret = YY_RESTRICT; goto _yy_state_366; } else { - goto _yy_tunnel_15; + goto _yy_tunnel_9; } case 'i': ch = *++YYPOS; - if (ch != 'n') goto _yy_tunnel_15; + if (ch != 'n') goto _yy_tunnel_9; ch = *++YYPOS; if (ch == 'l') { ch = *++YYPOS; - if (ch != 'i') goto _yy_tunnel_15; + if (ch != 'i') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'n') goto _yy_tunnel_15; + if (ch != 'n') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'e') goto _yy_tunnel_15; + if (ch != 'e') goto _yy_tunnel_9; ret = YY_INLINE; goto _yy_state_366; } else if (ch == 't') { ret = YY_INT; goto _yy_state_366; } else { - goto _yy_tunnel_15; + goto _yy_tunnel_9; } case '_': ch = *++YYPOS; @@ -524,494 +482,494 @@ _yy_state_start: switch (ch) { case 'i': ch = *++YYPOS; - if (ch != 'n') goto _yy_tunnel_15; + if (ch != 'n') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'l') goto _yy_tunnel_15; + if (ch != 'l') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'i') goto _yy_tunnel_15; + if (ch != 'i') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'n') goto _yy_tunnel_15; + if (ch != 'n') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'e') goto _yy_tunnel_15; + if (ch != 'e') goto _yy_tunnel_9; ch = *++YYPOS; if (ch != '_') {ret = YY___INLINE; goto _yy_tunnel_366;} ch = *++YYPOS; - if (ch != '_') goto _yy_tunnel_15; + if (ch != '_') goto _yy_tunnel_9; ret = YY___INLINE__; goto _yy_state_366; case 'c': ch = *++YYPOS; if (ch == 'd') { ch = *++YYPOS; - if (ch != 'e') goto _yy_tunnel_15; + if (ch != 'e') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'c') goto _yy_tunnel_15; + if (ch != 'c') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'l') goto _yy_tunnel_15; + if (ch != 'l') goto _yy_tunnel_9; ret = YY___CDECL; goto _yy_state_366; } else if (ch == 'o') { ch = *++YYPOS; if (ch == 'm') { ch = *++YYPOS; - if (ch != 'p') goto _yy_tunnel_15; + if (ch != 'p') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'l') goto _yy_tunnel_15; + if (ch != 'l') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'e') goto _yy_tunnel_15; + if (ch != 'e') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'x') goto _yy_tunnel_15; + if (ch != 'x') goto _yy_tunnel_9; ch = *++YYPOS; if (ch != '_') {ret = YY___COMPLEX; goto _yy_tunnel_366;} ch = *++YYPOS; - if (ch != '_') goto _yy_tunnel_15; + if (ch != '_') goto _yy_tunnel_9; ret = YY___COMPLEX__; goto _yy_state_366; } else if (ch == 'n') { ch = *++YYPOS; - if (ch != 's') goto _yy_tunnel_15; + if (ch != 's') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 't') goto _yy_tunnel_15; + if (ch != 't') goto _yy_tunnel_9; ch = *++YYPOS; if (ch != '_') {ret = YY___CONST; goto _yy_tunnel_366;} ch = *++YYPOS; - if (ch != '_') goto _yy_tunnel_15; + if (ch != '_') goto _yy_tunnel_9; ret = YY___CONST__; goto _yy_state_366; } else { - goto _yy_tunnel_15; + goto _yy_tunnel_9; } } else { - goto _yy_tunnel_15; + goto _yy_tunnel_9; } case 's': ch = *++YYPOS; - if (ch != 't') goto _yy_tunnel_15; + if (ch != 't') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'd') goto _yy_tunnel_15; + if (ch != 'd') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'c') goto _yy_tunnel_15; + if (ch != 'c') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'a') goto _yy_tunnel_15; + if (ch != 'a') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'l') goto _yy_tunnel_15; + if (ch != 'l') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'l') goto _yy_tunnel_15; + if (ch != 'l') goto _yy_tunnel_9; ret = YY___STDCALL; goto _yy_state_366; case 'f': ch = *++YYPOS; - if (ch != 'a') goto _yy_tunnel_15; + if (ch != 'a') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 's') goto _yy_tunnel_15; + if (ch != 's') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 't') goto _yy_tunnel_15; + if (ch != 't') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'c') goto _yy_tunnel_15; + if (ch != 'c') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'a') goto _yy_tunnel_15; + if (ch != 'a') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'l') goto _yy_tunnel_15; + if (ch != 'l') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'l') goto _yy_tunnel_15; + if (ch != 'l') goto _yy_tunnel_9; ret = YY___FASTCALL; goto _yy_state_366; case 't': ch = *++YYPOS; - if (ch != 'h') goto _yy_tunnel_15; + if (ch != 'h') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'i') goto _yy_tunnel_15; + if (ch != 'i') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 's') goto _yy_tunnel_15; + if (ch != 's') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'c') goto _yy_tunnel_15; + if (ch != 'c') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'a') goto _yy_tunnel_15; + if (ch != 'a') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'l') goto _yy_tunnel_15; + if (ch != 'l') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'l') goto _yy_tunnel_15; + if (ch != 'l') goto _yy_tunnel_9; ret = YY___THISCALL; goto _yy_state_366; case 'a': ch = *++YYPOS; - if (ch == 't') { + if (ch == 'l') { ch = *++YYPOS; - if (ch != 't') goto _yy_tunnel_15; + if (ch != 'i') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'r') goto _yy_tunnel_15; + if (ch != 'g') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'i') goto _yy_tunnel_15; + if (ch != 'n') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'b') goto _yy_tunnel_15; + if (ch != 'o') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'u') goto _yy_tunnel_15; + if (ch != 'f') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 't') goto _yy_tunnel_15; + if (ch != '_') {ret = YY___ALIGNOF; goto _yy_tunnel_366;} ch = *++YYPOS; - if (ch != 'e') goto _yy_tunnel_15; + if (ch != '_') goto _yy_tunnel_9; + ret = YY___ALIGNOF__; + goto _yy_state_366; + } else if (ch == 't') { ch = *++YYPOS; - if (ch != '_') {ret = YY___ATTRIBUTE; goto _yy_tunnel_366;} + if (ch != 't') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != '_') goto _yy_tunnel_15; - ret = YY___ATTRIBUTE__; - goto _yy_state_366; - } else if (ch == 'l') { + if (ch != 'r') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'i') goto _yy_tunnel_15; + if (ch != 'i') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'g') goto _yy_tunnel_15; + if (ch != 'b') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'n') goto _yy_tunnel_15; + if (ch != 'u') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'o') goto _yy_tunnel_15; + if (ch != 't') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'f') goto _yy_tunnel_15; + if (ch != 'e') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != '_') {ret = YY___ALIGNOF; goto _yy_tunnel_366;} + if (ch != '_') {ret = YY___ATTRIBUTE; goto _yy_tunnel_366;} ch = *++YYPOS; - if (ch != '_') goto _yy_tunnel_15; - ret = YY___ALIGNOF__; + if (ch != '_') goto _yy_tunnel_9; + ret = YY___ATTRIBUTE__; goto _yy_state_366; } else { - goto _yy_tunnel_15; + goto _yy_tunnel_9; } case 'd': ch = *++YYPOS; - if (ch != 'e') goto _yy_tunnel_15; + if (ch != 'e') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'c') goto _yy_tunnel_15; + if (ch != 'c') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'l') goto _yy_tunnel_15; + if (ch != 'l') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 's') goto _yy_tunnel_15; + if (ch != 's') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'p') goto _yy_tunnel_15; + if (ch != 'p') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'e') goto _yy_tunnel_15; + if (ch != 'e') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'c') goto _yy_tunnel_15; + if (ch != 'c') goto _yy_tunnel_9; ret = YY___DECLSPEC; goto _yy_state_366; case 'r': ch = *++YYPOS; - if (ch != 'e') goto _yy_tunnel_15; + if (ch != 'e') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 's') goto _yy_tunnel_15; + if (ch != 's') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 't') goto _yy_tunnel_15; + if (ch != 't') goto _yy_tunnel_9; ch = *++YYPOS; if (ch == 'i') { ch = *++YYPOS; - if (ch != 'c') goto _yy_tunnel_15; + if (ch != 'c') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 't') goto _yy_tunnel_15; + if (ch != 't') goto _yy_tunnel_9; ret = YY___RESTICT; goto _yy_state_366; } else if (ch == 'r') { ch = *++YYPOS; - if (ch != 'i') goto _yy_tunnel_15; + if (ch != 'i') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'c') goto _yy_tunnel_15; + if (ch != 'c') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 't') goto _yy_tunnel_15; + if (ch != 't') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != '_') goto _yy_tunnel_15; + if (ch != '_') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != '_') goto _yy_tunnel_15; + if (ch != '_') goto _yy_tunnel_9; ret = YY___RESTRICT__; goto _yy_state_366; } else { - goto _yy_tunnel_15; + goto _yy_tunnel_9; } case 'v': ch = *++YYPOS; - if (ch != 'o') goto _yy_tunnel_15; + if (ch != 'o') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'l') goto _yy_tunnel_15; + if (ch != 'l') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'a') goto _yy_tunnel_15; + if (ch != 'a') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 't') goto _yy_tunnel_15; + if (ch != 't') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'i') goto _yy_tunnel_15; + if (ch != 'i') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'l') goto _yy_tunnel_15; + if (ch != 'l') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'e') goto _yy_tunnel_15; + if (ch != 'e') goto _yy_tunnel_9; ch = *++YYPOS; if (ch != '_') {ret = YY___VOLATILE; goto _yy_tunnel_366;} ch = *++YYPOS; - if (ch != '_') goto _yy_tunnel_15; + if (ch != '_') goto _yy_tunnel_9; ret = YY___VOLATILE__; goto _yy_state_366; default: - goto _yy_tunnel_15; + goto _yy_tunnel_9; } case 'N': ch = *++YYPOS; - if (ch != 'o') goto _yy_tunnel_15; + if (ch != 'o') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'r') goto _yy_tunnel_15; + if (ch != 'r') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'e') goto _yy_tunnel_15; + if (ch != 'e') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 't') goto _yy_tunnel_15; + if (ch != 't') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'u') goto _yy_tunnel_15; + if (ch != 'u') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'r') goto _yy_tunnel_15; + if (ch != 'r') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'n') goto _yy_tunnel_15; + if (ch != 'n') goto _yy_tunnel_9; ret = YY__NORETURN; goto _yy_state_366; case 'A': ch = *++YYPOS; if (ch == 'l') { ch = *++YYPOS; - if (ch != 'i') goto _yy_tunnel_15; + if (ch != 'i') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'g') goto _yy_tunnel_15; + if (ch != 'g') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'n') goto _yy_tunnel_15; + if (ch != 'n') goto _yy_tunnel_9; ch = *++YYPOS; if (ch == 'a') { ch = *++YYPOS; - if (ch != 's') goto _yy_tunnel_15; + if (ch != 's') goto _yy_tunnel_9; ret = YY__ALIGNAS; goto _yy_state_366; } else if (ch == 'o') { ch = *++YYPOS; - if (ch != 'f') goto _yy_tunnel_15; + if (ch != 'f') goto _yy_tunnel_9; ret = YY__ALIGNOF; goto _yy_state_366; } else { - goto _yy_tunnel_15; + goto _yy_tunnel_9; } } else if (ch == 't') { ch = *++YYPOS; - if (ch != 'o') goto _yy_tunnel_15; + if (ch != 'o') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'm') goto _yy_tunnel_15; + if (ch != 'm') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'i') goto _yy_tunnel_15; + if (ch != 'i') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'c') goto _yy_tunnel_15; + if (ch != 'c') goto _yy_tunnel_9; ret = YY__ATOMIC; goto _yy_state_366; } else { - goto _yy_tunnel_15; + goto _yy_tunnel_9; } case 'B': ch = *++YYPOS; - if (ch != 'o') goto _yy_tunnel_15; + if (ch != 'o') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'o') goto _yy_tunnel_15; + if (ch != 'o') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'l') goto _yy_tunnel_15; + if (ch != 'l') goto _yy_tunnel_9; ret = YY__BOOL; goto _yy_state_366; case 'C': ch = *++YYPOS; - if (ch != 'o') goto _yy_tunnel_15; + if (ch != 'o') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'm') goto _yy_tunnel_15; + if (ch != 'm') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'p') goto _yy_tunnel_15; + if (ch != 'p') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'l') goto _yy_tunnel_15; + if (ch != 'l') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'e') goto _yy_tunnel_15; + if (ch != 'e') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'x') goto _yy_tunnel_15; + if (ch != 'x') goto _yy_tunnel_9; ret = YY__COMPLEX; goto _yy_state_366; default: - goto _yy_tunnel_15; + goto _yy_tunnel_9; } case '(': YYPOS++; ret = YY__LPAREN; goto _yy_fin; - case 'v': - ch = *++YYPOS; - if (ch != 'o') goto _yy_tunnel_15; + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case 'b': + case 'g': + case 'h': + case 'j': + case 'k': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'w': + case 'x': + case 'y': + case 'z': + goto _yy_state_9; + case 'L': + case 'U': ch = *++YYPOS; - if (ch == 'i') { - ch = *++YYPOS; - if (ch != 'd') goto _yy_tunnel_15; - ret = YY_VOID; - goto _yy_state_366; - } else if (ch == 'l') { - ch = *++YYPOS; - if (ch != 'a') goto _yy_tunnel_15; - ch = *++YYPOS; - if (ch != 't') goto _yy_tunnel_15; - ch = *++YYPOS; - if (ch != 'i') goto _yy_tunnel_15; - ch = *++YYPOS; - if (ch != 'l') goto _yy_tunnel_15; - ch = *++YYPOS; - if (ch != 'e') goto _yy_tunnel_15; - ret = YY_VOLATILE; - goto _yy_state_366; + if (ch == '"') { + goto _yy_state_27; + } else if (ch == '\'') { + goto _yy_state_28; } else { - goto _yy_tunnel_15; + goto _yy_tunnel_9; } case 'c': ch = *++YYPOS; if (ch == 'h') { ch = *++YYPOS; - if (ch != 'a') goto _yy_tunnel_15; + if (ch != 'a') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'r') goto _yy_tunnel_15; + if (ch != 'r') goto _yy_tunnel_9; ret = YY_CHAR; goto _yy_state_366; } else if (ch == 'o') { ch = *++YYPOS; if (ch == 'm') { ch = *++YYPOS; - if (ch != 'p') goto _yy_tunnel_15; + if (ch != 'p') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'l') goto _yy_tunnel_15; + if (ch != 'l') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'e') goto _yy_tunnel_15; + if (ch != 'e') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'x') goto _yy_tunnel_15; + if (ch != 'x') goto _yy_tunnel_9; ret = YY_COMPLEX; goto _yy_state_366; } else if (ch == 'n') { ch = *++YYPOS; - if (ch != 's') goto _yy_tunnel_15; + if (ch != 's') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 't') goto _yy_tunnel_15; + if (ch != 't') goto _yy_tunnel_9; ret = YY_CONST; goto _yy_state_366; } else { - goto _yy_tunnel_15; + goto _yy_tunnel_9; } } else { - goto _yy_tunnel_15; + goto _yy_tunnel_9; } - case 'l': + case 'd': ch = *++YYPOS; - if (ch != 'o') goto _yy_tunnel_15; + if (ch != 'o') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'n') goto _yy_tunnel_15; + if (ch != 'u') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'g') goto _yy_tunnel_15; - ret = YY_LONG; + if (ch != 'b') goto _yy_tunnel_9; + ch = *++YYPOS; + if (ch != 'l') goto _yy_tunnel_9; + ch = *++YYPOS; + if (ch != 'e') goto _yy_tunnel_9; + ret = YY_DOUBLE; goto _yy_state_366; case 'f': ch = *++YYPOS; - if (ch != 'l') goto _yy_tunnel_15; + if (ch != 'l') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'o') goto _yy_tunnel_15; + if (ch != 'o') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'a') goto _yy_tunnel_15; + if (ch != 'a') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 't') goto _yy_tunnel_15; + if (ch != 't') goto _yy_tunnel_9; ret = YY_FLOAT; goto _yy_state_366; - case 'd': - ch = *++YYPOS; - if (ch != 'o') goto _yy_tunnel_15; - ch = *++YYPOS; - if (ch != 'u') goto _yy_tunnel_15; + case 'l': ch = *++YYPOS; - if (ch != 'b') goto _yy_tunnel_15; + if (ch != 'o') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'l') goto _yy_tunnel_15; + if (ch != 'n') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'e') goto _yy_tunnel_15; - ret = YY_DOUBLE; + if (ch != 'g') goto _yy_tunnel_9; + ret = YY_LONG; goto _yy_state_366; case 'u': ch = *++YYPOS; if (ch == 'n') { ch = *++YYPOS; - if (ch == 's') { + if (ch == 'i') { ch = *++YYPOS; - if (ch != 'i') goto _yy_tunnel_15; + if (ch != 'o') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'g') goto _yy_tunnel_15; + if (ch != 'n') goto _yy_tunnel_9; + ret = YY_UNION; + goto _yy_state_366; + } else if (ch == 's') { ch = *++YYPOS; - if (ch != 'n') goto _yy_tunnel_15; + if (ch != 'i') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'e') goto _yy_tunnel_15; + if (ch != 'g') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'd') goto _yy_tunnel_15; - ret = YY_UNSIGNED; - goto _yy_state_366; - } else if (ch == 'i') { + if (ch != 'n') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'o') goto _yy_tunnel_15; + if (ch != 'e') goto _yy_tunnel_9; ch = *++YYPOS; - if (ch != 'n') goto _yy_tunnel_15; - ret = YY_UNION; + if (ch != 'd') goto _yy_tunnel_9; + ret = YY_UNSIGNED; goto _yy_state_366; } else { - goto _yy_tunnel_15; + goto _yy_tunnel_9; } } else if (ch == '8') { ch = *++YYPOS; - if (ch != '"') goto _yy_tunnel_15; + if (ch != '"') goto _yy_tunnel_9; goto _yy_state_27; } else if (ch == '"') { goto _yy_state_27; } else if (ch == '\'') { goto _yy_state_28; } else { - goto _yy_tunnel_15; + goto _yy_tunnel_9; } - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case 'b': - case 'g': - case 'h': - case 'j': - case 'k': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'w': - case 'x': - case 'y': - case 'z': - goto _yy_state_15; - case 'L': - case 'U': + case 'v': ch = *++YYPOS; - if (ch == '"') { - goto _yy_state_27; - } else if (ch == '\'') { - goto _yy_state_28; + if (ch != 'o') goto _yy_tunnel_9; + ch = *++YYPOS; + if (ch == 'i') { + ch = *++YYPOS; + if (ch != 'd') goto _yy_tunnel_9; + ret = YY_VOID; + goto _yy_state_366; + } else if (ch == 'l') { + ch = *++YYPOS; + if (ch != 'a') goto _yy_tunnel_9; + ch = *++YYPOS; + if (ch != 't') goto _yy_tunnel_9; + ch = *++YYPOS; + if (ch != 'i') goto _yy_tunnel_9; + ch = *++YYPOS; + if (ch != 'l') goto _yy_tunnel_9; + ch = *++YYPOS; + if (ch != 'e') goto _yy_tunnel_9; + ret = YY_VOLATILE; + goto _yy_state_366; } else { - goto _yy_tunnel_15; + goto _yy_tunnel_9; } case ')': YYPOS++; @@ -1242,11 +1200,11 @@ _yy_state_start: default: goto _yy_state_error; } -_yy_state_15: +_yy_state_9: ch = *++YYPOS; -_yy_tunnel_15: +_yy_tunnel_9: if ((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'Z') || ch == '_' || (ch >= 'a' && ch <= 'z')) { - goto _yy_state_15; + goto _yy_state_9; } else { ret = YY_ID; goto _yy_fin; @@ -1637,7 +1595,7 @@ _yy_state_366: ch = *++YYPOS; _yy_tunnel_366: if ((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'Z') || ch == '_' || (ch >= 'a' && ch <= 'z')) { - goto _yy_state_15; + goto _yy_state_9; } else { goto _yy_fin; } @@ -1709,1437 +1667,144 @@ static int get_sym(void) { return sym; } -static int check_specifier_qualifier_list(int sym) { - do { - if (YY_IN_SET(sym, (YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID), "\000\000\000\340\377\037\001\000\000\000\040\000")) { - sym = check_type_specifier(sym); - if (sym == -1) { - return -1; - } - } else if (YY_IN_SET(sym, (YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC), "\000\000\370\037\000\000\000\000\000\000\000\000")) { - sym = check_type_qualifier(sym); - if (sym == -1) { - return -1; - } - } else if (sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__ || sym == YY___DECLSPEC) { - sym = check_attributes(sym); - if (sym == -1) { - return -1; - } - } else { - return -1; - } - } while ((YY_IN_SET(sym, (YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC), "\000\000\370\377\377\037\301\001\000\000\040\000")) && (sym != YY_ID || zend_ffi_is_typedef_name((const char*)yy_text, yy_pos - yy_text))); - return sym; -} - -static int check_type_qualifier_list(int sym) { - do { - if (YY_IN_SET(sym, (YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC), "\000\000\370\037\000\000\000\000\000\000\000\000")) { - sym = check_type_qualifier(sym); - if (sym == -1) { - return -1; - } - } else if (sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__ || sym == YY___DECLSPEC) { - sym = check_attributes(sym); - if (sym == -1) { - return -1; - } - } else { - return -1; - } - } while (YY_IN_SET(sym, (YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC), "\000\000\370\037\000\000\300\001\000\000\000\000")); - return sym; -} - -static int check_type_qualifier(int sym) { - if (sym == YY_CONST || sym == YY___CONST || sym == YY___CONST__) { - sym = get_sym(); - } else if (sym == YY_RESTRICT || sym == YY___RESTICT || sym == YY___RESTRICT__) { - sym = get_sym(); - } else if (sym == YY_VOLATILE || sym == YY___VOLATILE || sym == YY___VOLATILE__) { - sym = get_sym(); - } else if (sym == YY__ATOMIC) { - sym = get_sym(); - } else { - return -1; - } - return sym; -} - -static int check_type_specifier(int sym) { - switch (sym) { - case YY_VOID: - sym = get_sym(); - break; - case YY_CHAR: - sym = get_sym(); - break; - case YY_SHORT: - sym = get_sym(); - break; - case YY_INT: - sym = get_sym(); - break; - case YY_LONG: - sym = get_sym(); - break; - case YY_FLOAT: - sym = get_sym(); - break; - case YY_DOUBLE: - sym = get_sym(); - break; - case YY_SIGNED: - sym = get_sym(); - break; - case YY_UNSIGNED: - sym = get_sym(); - break; - case YY__BOOL: - sym = get_sym(); - break; - case YY__COMPLEX: - case YY_COMPLEX: - case YY___COMPLEX: - case YY___COMPLEX__: - sym = get_sym(); - break; - case YY_STRUCT: - case YY_UNION: - sym = check_struct_or_union_specifier(sym); - if (sym == -1) { - return -1; - } - break; - case YY_ENUM: - sym = check_enum_specifier(sym); - if (sym == -1) { - return -1; - } - break; - case YY_ID: - sym = check_ID(sym); - if (sym == -1) { - return -1; - } - break; - default: - return -1; - } - return sym; -} - -static int check_struct_or_union_specifier(int sym) { - if (sym == YY_STRUCT) { - sym = get_sym(); - } else if (sym == YY_UNION) { - sym = get_sym(); - } else { - return -1; - } - if (sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__ || sym == YY___DECLSPEC) { - sym = check_attributes(sym); - if (sym == -1) { - return -1; - } - } - if (sym == YY_ID) { - sym = check_ID(sym); - if (sym == -1) { - return -1; - } - if (sym == YY__LBRACE) { - sym = check_struct_contents(sym); - if (sym == -1) { - return -1; - } - } - } else if (sym == YY__LBRACE) { - sym = check_struct_contents(sym); - if (sym == -1) { - return -1; - } - } else { - return -1; - } - return sym; -} - -static int check_struct_contents(int sym) { - int sym2; - const unsigned char *save_pos; - const unsigned char *save_text; - int save_line; - int alt2; - if (sym != YY__LBRACE) { - return -1; - } - sym = get_sym(); - if (YY_IN_SET(sym, (YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC), "\000\000\370\377\377\037\301\001\000\000\040\000")) { - sym = check_struct_declaration(sym); - if (sym == -1) { - return -1; - } - while (1) { - save_pos = yy_pos; - save_text = yy_text; - save_line = yy_line; - alt2 = -2; - sym2 = sym; - if (sym2 == YY__SEMICOLON) { - sym2 = get_sym(); - goto _yy_state_2_1; - } else if (sym2 == YY__RBRACE) { - alt2 = 6; - goto _yy_state_2; - } else { - return -1; - } -_yy_state_2_1: - if (YY_IN_SET(sym2, (YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC), "\000\000\370\377\377\037\301\001\000\000\040\000")) { - alt2 = 3; - goto _yy_state_2; - } else if (sym2 == YY__RBRACE) { - alt2 = 5; - goto _yy_state_2; - } else { - return -1; - } -_yy_state_2: - yy_pos = save_pos; - yy_text = save_text; - yy_line = save_line; - if (alt2 != 3) { - break; - } - sym = get_sym(); - sym = check_struct_declaration(sym); - if (sym == -1) { - return -1; - } - } - if (alt2 == 5) { - sym = get_sym(); - } - } - if (sym != YY__RBRACE) { - return -1; - } - sym = get_sym(); - if (sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__ || sym == YY___DECLSPEC) { - sym = check_attributes(sym); - if (sym == -1) { - return -1; - } - } - return sym; -} - -static int check_struct_declaration(int sym) { - sym = check_specifier_qualifier_list(sym); - if (sym == -1) { - return -1; - } - if (sym == YY__SEMICOLON || sym == YY__RBRACE) { - } else if (sym == YY__STAR || sym == YY_ID || sym == YY__LPAREN || sym == YY__COLON) { - sym = check_struct_declarator(sym); - if (sym == -1) { - return -1; - } - while (sym == YY__COMMA) { - sym = get_sym(); - if (sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__ || sym == YY___DECLSPEC) { - sym = check_attributes(sym); - if (sym == -1) { - return -1; - } - } - sym = check_struct_declarator(sym); - if (sym == -1) { - return -1; - } - } - } else { - return -1; - } - return sym; -} - -static int check_struct_declarator(int sym) { - if (sym == YY__STAR || sym == YY_ID || sym == YY__LPAREN) { - sym = check_declarator(sym); - if (sym == -1) { - return -1; - } - if (sym == YY__COLON) { - sym = get_sym(); - sym = check_constant_expression(sym); - if (sym == -1) { - return -1; - } - if (sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__ || sym == YY___DECLSPEC) { - sym = check_attributes(sym); - if (sym == -1) { - return -1; - } - } - } else if (YY_IN_SET(sym, (YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY__COMMA,YY__SEMICOLON,YY__RBRACE), "\006\000\000\000\000\100\300\001\000\000\000\000")) { - if (sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__ || sym == YY___DECLSPEC) { - sym = check_attributes(sym); - if (sym == -1) { - return -1; - } - } - } else { - return -1; - } - } else if (sym == YY__COLON) { - sym = get_sym(); - sym = check_constant_expression(sym); - if (sym == -1) { - return -1; - } - } else { - return -1; - } - return sym; -} - -static int check_enum_specifier(int sym) { - if (sym != YY_ENUM) { +static int check_nested_declarator_start(int sym) { + if (sym != YY__LPAREN) { return -1; } sym = get_sym(); - if (sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__ || sym == YY___DECLSPEC) { - sym = check_attributes(sym); - if (sym == -1) { - return -1; - } - } - if (sym == YY_ID) { + if ((sym == YY_ID) && (!zend_ffi_is_typedef_name((const char*)yy_text, yy_pos - yy_text))) { sym = check_ID(sym); if (sym == -1) { return -1; } - if (sym == YY__LBRACE) { - sym = get_sym(); - sym = check_enumerator_list(sym); - if (sym == -1) { - return -1; - } - if (sym != YY__RBRACE) { - return -1; - } - sym = get_sym(); - if (sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__ || sym == YY___DECLSPEC) { - sym = check_attributes(sym); - if (sym == -1) { - return -1; - } - } - } else if (YY_IN_SET(sym, (YY_TYPEDEF,YY_EXTERN,YY_STATIC,YY_AUTO,YY_REGISTER,YY_INLINE,YY___INLINE,YY___INLINE__,YY__NORETURN,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY__ALIGNAS,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY__STAR,YY__LPAREN,YY__SEMICOLON,YY__COLON,YY__LBRACK,YY__RBRACE,YY__COMMA,YY__RPAREN,YY_EOF), "\377\377\377\377\377\337\315\001\000\000\040\000")) { - } else { - return -1; - } - } else if (sym == YY__LBRACE) { - sym = get_sym(); - sym = check_enumerator_list(sym); - if (sym == -1) { - return -1; - } - if (sym != YY__RBRACE) { - return -1; - } - sym = get_sym(); - if (sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__ || sym == YY___DECLSPEC) { - sym = check_attributes(sym); - if (sym == -1) { - return -1; - } - } } else { - return -1; - } - return sym; -} - -static int check_enumerator_list(int sym) { - int sym2; - const unsigned char *save_pos; - const unsigned char *save_text; - int save_line; - int alt243; - sym = check_enumerator(sym); - if (sym == -1) { - return -1; - } - while (1) { - save_pos = yy_pos; - save_text = yy_text; - save_line = yy_line; - alt243 = -2; - sym2 = sym; - if (sym2 == YY__COMMA) { - sym2 = get_sym(); - goto _yy_state_243_1; - } else if (sym2 == YY__RBRACE) { - alt243 = -1; - goto _yy_state_243; - } else { - return -1; - } -_yy_state_243_1: - if (sym2 == YY_ID) { - alt243 = 244; - goto _yy_state_243; - } else if (sym2 == YY__RBRACE) { - alt243 = 246; - goto _yy_state_243; - } else { - return -1; - } -_yy_state_243: - yy_pos = save_pos; - yy_text = save_text; - yy_line = save_line; - if (alt243 != 244) { - break; - } - sym = get_sym(); - sym = check_enumerator(sym); - if (sym == -1) { - return -1; - } - } - if (alt243 == 246) { - sym = get_sym(); - } - return sym; -} - -static int check_enumerator(int sym) { - sym = check_ID(sym); - if (sym == -1) { - return -1; - } - if (sym == YY__EQUAL) { - sym = get_sym(); - sym = check_constant_expression(sym); - if (sym == -1) { - return -1; - } - } - return sym; -} - -static int check_declarator(int sym) { - if (sym == YY__STAR) { - sym = check_pointer(sym); - if (sym == -1) { - return -1; - } - } - if (sym == YY_ID) { - sym = check_ID(sym); - if (sym == -1) { - return -1; - } - } else if (sym == YY__LPAREN) { - sym = get_sym(); - if (sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__ || sym == YY___DECLSPEC) { - sym = check_attributes(sym); - if (sym == -1) { + switch (sym) { + case YY___ATTRIBUTE: + sym = get_sym(); + break; + case YY___ATTRIBUTE__: + sym = get_sym(); + break; + case YY___DECLSPEC: + sym = get_sym(); + break; + case YY__STAR: + sym = get_sym(); + break; + case YY__LPAREN: + sym = get_sym(); + break; + case YY__LBRACK: + sym = get_sym(); + break; + default: return -1; - } - } - sym = check_declarator(sym); - if (sym == -1) { - return -1; - } - if (sym != YY__RPAREN) { - return -1; - } - sym = get_sym(); - } else { - return -1; - } - if (sym == YY__LBRACK || sym == YY__LPAREN) { - sym = check_array_or_function_declarators(sym); - if (sym == -1) { - return -1; } } return sym; } -static int check_abstract_declarator(int sym) { - if (sym == YY__STAR) { - sym = check_pointer(sym); - if (sym == -1) { - return -1; - } - } - if ((sym == YY__LPAREN) && synpred_2(sym)) { - sym = check_nested_abstract_declarator(sym); - if (sym == -1) { - return -1; - } - } else if (sym == YY_ID) { +static int check_type_name_start(int sym) { + if ((sym == YY_ID) && (zend_ffi_is_typedef_name((const char*)yy_text, yy_pos - yy_text))) { sym = check_ID(sym); if (sym == -1) { return -1; } - } else if (YY_IN_SET(sym, (YY__LBRACK,YY__LPAREN,YY__COMMA,YY__RPAREN,YY_EOF), "\003\000\006\000\000\000\010\000\000\000\000\000")) { } else { - return -1; - } - if (sym == YY__LBRACK || sym == YY__LPAREN) { - sym = check_array_or_function_declarators(sym); - if (sym == -1) { - return -1; - } - } - return sym; -} - -static int check_nested_abstract_declarator(int sym) { - if (sym != YY__LPAREN) { - return -1; - } - sym = get_sym(); - if (sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__ || sym == YY___DECLSPEC) { - sym = check_attributes(sym); - if (sym == -1) { - return -1; - } - } - if (sym == YY__STAR) { - sym = check_pointer(sym); - if (sym == -1) { - return -1; - } - if ((sym == YY__LPAREN) && synpred_3(sym)) { - sym = check_nested_abstract_declarator(sym); - if (sym == -1) { - return -1; - } - } else if (sym == YY_ID) { - sym = check_ID(sym); - if (sym == -1) { - return -1; - } - } else if (sym == YY__LBRACK || sym == YY__LPAREN || sym == YY__RPAREN) { - } else { - return -1; - } - if (sym == YY__LBRACK || sym == YY__LPAREN) { - sym = check_array_or_function_declarators(sym); - if (sym == -1) { - return -1; - } - } - } else if (sym == YY__LPAREN || sym == YY_ID || sym == YY__LBRACK) { - if ((sym == YY__LPAREN) && synpred_4(sym)) { - sym = check_nested_abstract_declarator(sym); - if (sym == -1) { - return -1; - } - if (sym == YY__LBRACK || sym == YY__LPAREN) { - sym = check_array_or_function_declarators(sym); - if (sym == -1) { - return -1; - } - } - } else if (sym == YY_ID) { - sym = check_ID(sym); - if (sym == -1) { - return -1; - } - if (sym == YY__LBRACK || sym == YY__LPAREN) { - sym = check_array_or_function_declarators(sym); - if (sym == -1) { - return -1; - } - } - } else { - sym = check_array_or_function_declarators(sym); - if (sym == -1) { - return -1; - } - } - } else { - return -1; - } - if (sym != YY__RPAREN) { - return -1; - } - sym = get_sym(); - return sym; -} - -static int check_pointer(int sym) { - if (sym != YY__STAR) { - return -1; - } - do { - sym = get_sym(); - if (YY_IN_SET(sym, (YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC), "\000\000\370\037\000\000\300\001\000\000\000\000")) { - sym = check_type_qualifier_list(sym); - if (sym == -1) { - return -1; - } - } - } while (sym == YY__STAR); - return sym; -} - -static int check_array_or_function_declarators(int sym) { - int sym2; - const unsigned char *save_pos; - const unsigned char *save_text; - int save_line; - int alt114; - int alt110; - int alt124; - if (sym == YY__LBRACK) { - sym = get_sym(); - save_pos = yy_pos; - save_text = yy_text; - save_line = yy_line; - alt110 = -2; - sym2 = sym; - if (sym2 == YY_STATIC) { - alt110 = 111; - goto _yy_state_110; - } else if (YY_IN_SET(sym2, (YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC), "\000\000\370\037\000\000\300\001\000\000\000\000")) { - alt110 = 114; - goto _yy_state_110; - } else if (sym2 == YY__STAR) { - sym2 = get_sym(); - goto _yy_state_110_15; - } else if (YY_IN_SET(sym2, (YY__LPAREN,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__,YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER), "\000\000\002\000\000\000\000\200\000\343\377\017")) { - alt110 = 120; - goto _yy_state_110; - } else if (sym2 == YY__RBRACK) { - alt110 = 121; - goto _yy_state_110; - } else { - return -1; - } -_yy_state_110_15: - if (sym2 == YY__RBRACK) { - alt110 = 119; - goto _yy_state_110; - } else if (YY_IN_SET(sym2, (YY__LPAREN,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__,YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER,YY__STAR), "\000\000\002\000\000\000\004\200\000\343\377\017")) { - alt110 = 120; - goto _yy_state_110; - } else { - return -1; - } -_yy_state_110: - yy_pos = save_pos; - yy_text = save_text; - yy_line = save_line; - if (alt110 == 111) { - sym = get_sym(); - if (YY_IN_SET(sym, (YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC), "\000\000\370\037\000\000\300\001\000\000\000\000")) { - sym = check_type_qualifier_list(sym); - if (sym == -1) { - return -1; - } - } - sym = check_assignment_expression(sym); - if (sym == -1) { - return -1; - } - } else if (alt110 == 114) { - sym = check_type_qualifier_list(sym); - if (sym == -1) { - return -1; - } - save_pos = yy_pos; - save_text = yy_text; - save_line = yy_line; - alt114 = -2; - sym2 = sym; - if (sym2 == YY_STATIC) { - alt114 = 115; - goto _yy_state_114; - } else if (sym2 == YY__STAR) { - sym2 = get_sym(); - goto _yy_state_114_2; - } else if (YY_IN_SET(sym2, (YY__LPAREN,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__,YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER), "\000\000\002\000\000\000\000\200\000\343\377\017")) { - alt114 = 118; - goto _yy_state_114; - } else if (sym2 == YY__RBRACK) { - alt114 = 121; - goto _yy_state_114; - } else { - return -1; - } -_yy_state_114_2: - if (sym2 == YY__RBRACK) { - alt114 = 117; - goto _yy_state_114; - } else if (YY_IN_SET(sym2, (YY__LPAREN,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__,YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER,YY__STAR), "\000\000\002\000\000\000\004\200\000\343\377\017")) { - alt114 = 118; - goto _yy_state_114; - } else { - return -1; - } -_yy_state_114: - yy_pos = save_pos; - yy_text = save_text; - yy_line = save_line; - if (alt114 == 115) { + switch (sym) { + case YY_VOID: sym = get_sym(); - sym = check_assignment_expression(sym); - if (sym == -1) { - return -1; - } - } else if (alt114 == 121) { - } else if (alt114 == 117) { + break; + case YY_CHAR: sym = get_sym(); - } else if (alt114 == 118) { - sym = check_assignment_expression(sym); - if (sym == -1) { - return -1; - } - } else { - return -1; - } - } else if (alt110 == 121 || alt110 == 119 || alt110 == 120) { - if (alt110 == 121) { - } else if (alt110 == 119) { + break; + case YY_SHORT: sym = get_sym(); - } else { - sym = check_assignment_expression(sym); - if (sym == -1) { - return -1; - } - } - } else { - return -1; - } - if (sym != YY__RBRACK) { - return -1; - } - sym = get_sym(); - if (sym == YY__LBRACK || sym == YY__LPAREN) { - sym = check_array_or_function_declarators(sym); - if (sym == -1) { - return -1; - } - } - } else if (sym == YY__LPAREN) { - sym = get_sym(); - if (YY_IN_SET(sym, (YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY__POINT_POINT_POINT), "\000\000\370\377\377\037\341\001\000\000\040\000")) { - if (YY_IN_SET(sym, (YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC), "\000\000\370\377\377\037\301\001\000\000\040\000")) { - sym = check_parameter_declaration(sym); - if (sym == -1) { - return -1; - } - while (1) { - save_pos = yy_pos; - save_text = yy_text; - save_line = yy_line; - alt124 = -2; - sym2 = sym; - if (sym2 == YY__COMMA) { - sym2 = get_sym(); - goto _yy_state_124_1; - } else if (sym2 == YY__RPAREN) { - alt124 = 130; - goto _yy_state_124; - } else { - return -1; - } -_yy_state_124_1: - if (YY_IN_SET(sym2, (YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC), "\000\000\370\377\377\037\301\001\000\000\040\000")) { - alt124 = 125; - goto _yy_state_124; - } else if (sym2 == YY__POINT_POINT_POINT) { - alt124 = 127; - goto _yy_state_124; - } else { - return -1; - } -_yy_state_124: - yy_pos = save_pos; - yy_text = save_text; - yy_line = save_line; - if (alt124 != 125) { - break; - } - sym = get_sym(); - sym = check_parameter_declaration(sym); - if (sym == -1) { - return -1; - } - } - if (alt124 == 127) { - sym = get_sym(); - if (sym != YY__POINT_POINT_POINT) { - return -1; - } - sym = get_sym(); - } - } else { + break; + case YY_INT: sym = get_sym(); - } - } - if (sym != YY__RPAREN) { - return -1; - } - sym = get_sym(); - if (sym == YY__LBRACK || sym == YY__LPAREN) { - sym = check_array_or_function_declarators(sym); - if (sym == -1) { - return -1; - } - } - } else { - return -1; - } - return sym; -} - -static int check_parameter_declaration(int sym) { - sym = check_specifier_qualifier_list(sym); - if (sym == -1) { - return -1; - } - sym = check_abstract_declarator(sym); - if (sym == -1) { - return -1; - } - return sym; -} - -static int check_type_name(int sym) { - sym = check_specifier_qualifier_list(sym); - if (sym == -1) { - return -1; - } - sym = check_abstract_declarator(sym); - if (sym == -1) { - return -1; - } - return sym; -} - -static int check_attributes(int sym) { - do { - if (sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__) { - sym = get_sym(); - if (sym != YY__LPAREN) { - return -1; - } - sym = get_sym(); - if (sym != YY__LPAREN) { - return -1; - } - sym = get_sym(); - sym = check_attrib(sym); - if (sym == -1) { - return -1; - } - while (sym == YY__COMMA) { + break; + case YY_LONG: sym = get_sym(); - sym = check_attrib(sym); - if (sym == -1) { - return -1; - } - } - if (sym != YY__RPAREN) { - return -1; - } - sym = get_sym(); - if (sym != YY__RPAREN) { - return -1; - } - sym = get_sym(); - } else if (sym == YY___DECLSPEC) { - sym = get_sym(); - if (sym != YY__LPAREN) { - return -1; - } - sym = get_sym(); - do { - sym = check_ID(sym); - if (sym == -1) { - return -1; - } - if (sym == YY__LPAREN) { - sym = get_sym(); - sym = check_assignment_expression(sym); - if (sym == -1) { - return -1; - } - if (sym != YY__RPAREN) { - return -1; - } - sym = get_sym(); - } - } while (sym == YY_ID); - if (sym != YY__RPAREN) { - return -1; - } - sym = get_sym(); - } else { - return -1; - } - } while (sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__ || sym == YY___DECLSPEC); - return sym; -} - -static int check_attrib(int sym) { - if (sym == YY_ID) { - sym = check_ID(sym); - if (sym == -1) { - return -1; - } - if (sym == YY__COMMA || sym == YY__RPAREN) { - } else if (sym == YY__LPAREN) { - sym = get_sym(); - sym = check_assignment_expression(sym); - if (sym == -1) { - return -1; - } - while (sym == YY__COMMA) { + break; + case YY_FLOAT: sym = get_sym(); - sym = check_assignment_expression(sym); - if (sym == -1) { - return -1; - } - } - if (sym != YY__RPAREN) { - return -1; - } - sym = get_sym(); - } else { - return -1; - } - } - return sym; -} - -static int check_expr_list(int sym) { - sym = check_assignment_expression(sym); - if (sym == -1) { - return -1; - } - while (sym == YY__COMMA) { - sym = get_sym(); - sym = check_assignment_expression(sym); - if (sym == -1) { - return -1; - } - } - return sym; -} - -static int check_expression(int sym) { - sym = check_assignment_expression(sym); - if (sym == -1) { - return -1; - } - while (sym == YY__COMMA) { - sym = get_sym(); - sym = check_assignment_expression(sym); - if (sym == -1) { - return -1; - } - } - return sym; -} - -static int check_assignment_expression(int sym) { - sym = check_conditional_expression(sym); - if (sym == -1) { - return -1; - } - return sym; -} - -static int check_constant_expression(int sym) { - sym = check_conditional_expression(sym); - if (sym == -1) { - return -1; - } - return sym; -} - -static int check_conditional_expression(int sym) { - sym = check_logical_or_expression(sym); - if (sym == -1) { - return -1; - } - if (sym == YY__QUERY) { - sym = get_sym(); - sym = check_expression(sym); - if (sym == -1) { - return -1; - } - if (sym != YY__COLON) { - return -1; - } - sym = get_sym(); - sym = check_conditional_expression(sym); - if (sym == -1) { - return -1; - } - } - return sym; -} - -static int check_logical_or_expression(int sym) { - sym = check_logical_and_expression(sym); - if (sym == -1) { - return -1; - } - while (sym == YY__BAR_BAR) { - sym = get_sym(); - sym = check_logical_and_expression(sym); - if (sym == -1) { - return -1; - } - } - return sym; -} - -static int check_logical_and_expression(int sym) { - sym = check_inclusive_or_expression(sym); - if (sym == -1) { - return -1; - } - while (sym == YY__AND_AND) { - sym = get_sym(); - sym = check_inclusive_or_expression(sym); - if (sym == -1) { - return -1; - } - } - return sym; -} - -static int check_inclusive_or_expression(int sym) { - sym = check_exclusive_or_expression(sym); - if (sym == -1) { - return -1; - } - while (sym == YY__BAR) { - sym = get_sym(); - sym = check_exclusive_or_expression(sym); - if (sym == -1) { - return -1; - } - } - return sym; -} - -static int check_exclusive_or_expression(int sym) { - sym = check_and_expression(sym); - if (sym == -1) { - return -1; - } - while (sym == YY__UPARROW) { - sym = get_sym(); - sym = check_and_expression(sym); - if (sym == -1) { - return -1; - } - } - return sym; -} - -static int check_and_expression(int sym) { - sym = check_equality_expression(sym); - if (sym == -1) { - return -1; - } - while (sym == YY__AND) { - sym = get_sym(); - sym = check_equality_expression(sym); - if (sym == -1) { - return -1; - } - } - return sym; -} - -static int check_equality_expression(int sym) { - sym = check_relational_expression(sym); - if (sym == -1) { - return -1; - } - while (sym == YY__EQUAL_EQUAL || sym == YY__BANG_EQUAL) { - if (sym == YY__EQUAL_EQUAL) { - sym = get_sym(); - sym = check_relational_expression(sym); - if (sym == -1) { - return -1; - } - } else { - sym = get_sym(); - sym = check_relational_expression(sym); - if (sym == -1) { - return -1; - } - } - } - return sym; -} - -static int check_relational_expression(int sym) { - sym = check_shift_expression(sym); - if (sym == -1) { - return -1; - } - while (sym == YY__LESS || sym == YY__GREATER || sym == YY__LESS_EQUAL || sym == YY__GREATER_EQUAL) { - if (sym == YY__LESS) { - sym = get_sym(); - sym = check_shift_expression(sym); - if (sym == -1) { - return -1; - } - } else if (sym == YY__GREATER) { - sym = get_sym(); - sym = check_shift_expression(sym); - if (sym == -1) { - return -1; - } - } else if (sym == YY__LESS_EQUAL) { - sym = get_sym(); - sym = check_shift_expression(sym); - if (sym == -1) { - return -1; - } - } else { - sym = get_sym(); - sym = check_shift_expression(sym); - if (sym == -1) { - return -1; - } - } - } - return sym; -} - -static int check_shift_expression(int sym) { - sym = check_additive_expression(sym); - if (sym == -1) { - return -1; - } - while (sym == YY__LESS_LESS || sym == YY__GREATER_GREATER) { - if (sym == YY__LESS_LESS) { - sym = get_sym(); - sym = check_additive_expression(sym); - if (sym == -1) { - return -1; - } - } else { - sym = get_sym(); - sym = check_additive_expression(sym); - if (sym == -1) { - return -1; - } - } - } - return sym; -} - -static int check_additive_expression(int sym) { - sym = check_multiplicative_expression(sym); - if (sym == -1) { - return -1; - } - while (sym == YY__PLUS || sym == YY__MINUS) { - if (sym == YY__PLUS) { - sym = get_sym(); - sym = check_multiplicative_expression(sym); - if (sym == -1) { - return -1; - } - } else { - sym = get_sym(); - sym = check_multiplicative_expression(sym); - if (sym == -1) { - return -1; - } - } - } - return sym; -} - -static int check_multiplicative_expression(int sym) { - sym = check_cast_expression(sym); - if (sym == -1) { - return -1; - } - while (sym == YY__STAR || sym == YY__SLASH || sym == YY__PERCENT) { - if (sym == YY__STAR) { - sym = get_sym(); - sym = check_cast_expression(sym); - if (sym == -1) { - return -1; - } - } else if (sym == YY__SLASH) { - sym = get_sym(); - sym = check_cast_expression(sym); - if (sym == -1) { - return -1; - } - } else { - sym = get_sym(); - sym = check_cast_expression(sym); - if (sym == -1) { - return -1; - } - } - } - return sym; -} - -static int check_cast_expression(int sym) { - if ((sym == YY__LPAREN) && synpred_5(sym)) { - sym = get_sym(); - sym = check_type_name(sym); - if (sym == -1) { - return -1; - } - if (sym != YY__RPAREN) { - return -1; - } - sym = get_sym(); - } - sym = check_unary_expression(sym); - if (sym == -1) { - return -1; - } - return sym; -} - -static int check_unary_expression(int sym) { - switch (sym) { - case YY_ID: - sym = check_ID(sym); - if (sym == -1) { - return -1; - } - while (YY_IN_SET(sym, (YY__LBRACK,YY__LPAREN,YY__POINT,YY__MINUS_GREATER,YY__PLUS_PLUS,YY__MINUS_MINUS), "\000\000\002\000\000\000\010\002\000\160\000\000")) { - switch (sym) { - case YY__LBRACK: - sym = get_sym(); - sym = check_expr_list(sym); - if (sym == -1) { - return -1; - } - if (sym != YY__RBRACK) { - return -1; - } - sym = get_sym(); - break; - case YY__LPAREN: - sym = get_sym(); - if (YY_IN_SET(sym, (YY__LPAREN,YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__STAR,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__), "\000\000\002\000\000\000\004\200\000\343\377\017")) { - sym = check_expr_list(sym); - if (sym == -1) { - return -1; - } - } - if (sym != YY__RPAREN) { - return -1; - } - sym = get_sym(); - break; - case YY__POINT: - sym = get_sym(); - sym = check_ID(sym); - if (sym == -1) { - return -1; - } - break; - case YY__MINUS_GREATER: - sym = get_sym(); - sym = check_ID(sym); - if (sym == -1) { - return -1; - } - break; - case YY__PLUS_PLUS: - sym = get_sym(); - break; - default: - sym = get_sym(); - break; - } - } - break; - case YY_OCTNUMBER: - sym = check_OCTNUMBER(sym); - if (sym == -1) { - return -1; - } - break; - case YY_DECNUMBER: - sym = check_DECNUMBER(sym); - if (sym == -1) { - return -1; - } - break; - case YY_HEXNUMBER: - sym = check_HEXNUMBER(sym); - if (sym == -1) { - return -1; - } - break; - case YY_FLOATNUMBER: - sym = check_FLOATNUMBER(sym); - if (sym == -1) { - return -1; - } - break; - case YY_STRING: - sym = check_STRING(sym); - if (sym == -1) { - return -1; - } - break; - case YY_CHARACTER: - sym = check_CHARACTER(sym); - if (sym == -1) { - return -1; - } - break; - case YY__LPAREN: - sym = get_sym(); - sym = check_expression(sym); - if (sym == -1) { - return -1; - } - if (sym != YY__RPAREN) { - return -1; - } - sym = get_sym(); - break; - case YY__PLUS_PLUS: - sym = get_sym(); - sym = check_unary_expression(sym); - if (sym == -1) { - return -1; - } - break; - case YY__MINUS_MINUS: - sym = get_sym(); - sym = check_unary_expression(sym); - if (sym == -1) { - return -1; - } - break; - case YY__AND: - sym = get_sym(); - sym = check_cast_expression(sym); - if (sym == -1) { - return -1; - } - break; - case YY__STAR: - sym = get_sym(); - sym = check_cast_expression(sym); - if (sym == -1) { - return -1; - } - break; - case YY__PLUS: - sym = get_sym(); - sym = check_cast_expression(sym); - if (sym == -1) { - return -1; - } - break; - case YY__MINUS: - sym = get_sym(); - sym = check_cast_expression(sym); - if (sym == -1) { - return -1; - } - break; - case YY__TILDE: - sym = get_sym(); - sym = check_cast_expression(sym); - if (sym == -1) { - return -1; - } - break; - case YY__BANG: - sym = get_sym(); - sym = check_cast_expression(sym); - if (sym == -1) { - return -1; - } - break; - case YY_SIZEOF: - sym = get_sym(); - if ((sym == YY__LPAREN) && synpred_6(sym)) { + break; + case YY_DOUBLE: sym = get_sym(); - sym = check_type_name(sym); - if (sym == -1) { - return -1; - } - if (sym != YY__RPAREN) { - return -1; - } + break; + case YY_SIGNED: sym = get_sym(); - } else if (YY_IN_SET(sym, (YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER,YY__LPAREN,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__STAR,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__), "\000\000\002\000\000\000\004\200\000\343\377\017")) { - sym = check_unary_expression(sym); - if (sym == -1) { - return -1; - } - } else { - return -1; - } - break; - case YY__ALIGNOF: - sym = get_sym(); - if (sym != YY__LPAREN) { - return -1; - } - sym = get_sym(); - sym = check_type_name(sym); - if (sym == -1) { - return -1; - } - if (sym != YY__RPAREN) { - return -1; - } - sym = get_sym(); - break; - case YY___ALIGNOF: - case YY___ALIGNOF__: - sym = get_sym(); - if ((sym == YY__LPAREN) && synpred_7(sym)) { + break; + case YY_UNSIGNED: sym = get_sym(); - sym = check_type_name(sym); - if (sym == -1) { - return -1; - } - if (sym != YY__RPAREN) { - return -1; - } + break; + case YY__BOOL: sym = get_sym(); - } else if (YY_IN_SET(sym, (YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER,YY__LPAREN,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__STAR,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__), "\000\000\002\000\000\000\004\200\000\343\377\017")) { - sym = check_unary_expression(sym); - if (sym == -1) { - return -1; - } - } else { + break; + case YY__COMPLEX: + sym = get_sym(); + break; + case YY_COMPLEX: + sym = get_sym(); + break; + case YY___COMPLEX: + sym = get_sym(); + break; + case YY___COMPLEX__: + sym = get_sym(); + break; + case YY_STRUCT: + sym = get_sym(); + break; + case YY_UNION: + sym = get_sym(); + break; + case YY_ENUM: + sym = get_sym(); + break; + case YY_CONST: + sym = get_sym(); + break; + case YY___CONST: + sym = get_sym(); + break; + case YY___CONST__: + sym = get_sym(); + break; + case YY_RESTRICT: + sym = get_sym(); + break; + case YY___RESTICT: + sym = get_sym(); + break; + case YY___RESTRICT__: + sym = get_sym(); + break; + case YY_VOLATILE: + sym = get_sym(); + break; + case YY___VOLATILE: + sym = get_sym(); + break; + case YY___VOLATILE__: + sym = get_sym(); + break; + case YY__ATOMIC: + sym = get_sym(); + break; + case YY___ATTRIBUTE: + sym = get_sym(); + break; + case YY___ATTRIBUTE__: + sym = get_sym(); + break; + case YY___DECLSPEC: + sym = get_sym(); + break; + default: return -1; - } - break; - default: - return -1; + } } return sym; } @@ -3152,54 +1817,6 @@ static int check_ID(int sym) { return sym; } -static int check_OCTNUMBER(int sym) { - if (sym != YY_OCTNUMBER) { - return -1; - } - sym = get_sym(); - return sym; -} - -static int check_DECNUMBER(int sym) { - if (sym != YY_DECNUMBER) { - return -1; - } - sym = get_sym(); - return sym; -} - -static int check_HEXNUMBER(int sym) { - if (sym != YY_HEXNUMBER) { - return -1; - } - sym = get_sym(); - return sym; -} - -static int check_FLOATNUMBER(int sym) { - if (sym != YY_FLOATNUMBER) { - return -1; - } - sym = get_sym(); - return sym; -} - -static int check_STRING(int sym) { - if (sym != YY_STRING) { - return -1; - } - sym = get_sym(); - return sym; -} - -static int check_CHARACTER(int sym) { - if (sym != YY_CHARACTER) { - return -1; - } - sym = get_sym(); - return sym; -} - static int synpred_1(int sym) { int ret; const unsigned char *save_pos; @@ -3209,7 +1826,7 @@ static int synpred_1(int sym) { save_pos = yy_pos; save_text = yy_text; save_line = yy_line; - ret = check_type_name(sym) != -1; + ret = check_type_name_start(sym) != -1; yy_pos = save_pos; yy_text = save_text; yy_line = save_line; @@ -3225,7 +1842,7 @@ static int synpred_2(int sym) { save_pos = yy_pos; save_text = yy_text; save_line = yy_line; - ret = check_nested_abstract_declarator(sym) != -1; + ret = check_nested_declarator_start(sym) != -1; yy_pos = save_pos; yy_text = save_text; yy_line = save_line; @@ -3241,46 +1858,26 @@ static int synpred_3(int sym) { save_pos = yy_pos; save_text = yy_text; save_line = yy_line; - ret = check_nested_abstract_declarator(sym) != -1; - yy_pos = save_pos; - yy_text = save_text; - yy_line = save_line; - return ret; -} - -static int synpred_4(int sym) { - int ret; - const unsigned char *save_pos; - const unsigned char *save_text; - int save_line; - - save_pos = yy_pos; - save_text = yy_text; - save_line = yy_line; - ret = check_nested_abstract_declarator(sym) != -1; + ret = check_nested_declarator_start(sym) != -1; yy_pos = save_pos; yy_text = save_text; yy_line = save_line; return ret; } -static int _synpred_5(int sym) { +static int _synpred_4(int sym) { if (sym != YY__LPAREN) { return -1; } sym = get_sym(); - sym = check_type_name(sym); + sym = check_type_name_start(sym); if (sym == -1) { return -1; } - if (sym != YY__RPAREN) { - return -1; - } - sym = get_sym(); return sym; } -static int synpred_5(int sym) { +static int synpred_4(int sym) { int ret; const unsigned char *save_pos; const unsigned char *save_text; @@ -3289,30 +1886,26 @@ static int synpred_5(int sym) { save_pos = yy_pos; save_text = yy_text; save_line = yy_line; - ret = _synpred_5(sym) != -1; + ret = _synpred_4(sym) != -1; yy_pos = save_pos; yy_text = save_text; yy_line = save_line; return ret; } -static int _synpred_6(int sym) { +static int _synpred_5(int sym) { if (sym != YY__LPAREN) { return -1; } sym = get_sym(); - sym = check_type_name(sym); + sym = check_type_name_start(sym); if (sym == -1) { return -1; } - if (sym != YY__RPAREN) { - return -1; - } - sym = get_sym(); return sym; } -static int synpred_6(int sym) { +static int synpred_5(int sym) { int ret; const unsigned char *save_pos; const unsigned char *save_text; @@ -3321,30 +1914,26 @@ static int synpred_6(int sym) { save_pos = yy_pos; save_text = yy_text; save_line = yy_line; - ret = _synpred_6(sym) != -1; + ret = _synpred_5(sym) != -1; yy_pos = save_pos; yy_text = save_text; yy_line = save_line; return ret; } -static int _synpred_7(int sym) { +static int _synpred_6(int sym) { if (sym != YY__LPAREN) { return -1; } sym = get_sym(); - sym = check_type_name(sym); + sym = check_type_name_start(sym); if (sym == -1) { return -1; } - if (sym != YY__RPAREN) { - return -1; - } - sym = get_sym(); return sym; } -static int synpred_7(int sym) { +static int synpred_6(int sym) { int ret; const unsigned char *save_pos; const unsigned char *save_text; @@ -3353,7 +1942,7 @@ static int synpred_7(int sym) { save_pos = yy_pos; save_text = yy_text; save_line = yy_line; - ret = _synpred_7(sym) != -1; + ret = _synpred_6(sym) != -1; yy_pos = save_pos; yy_text = save_text; yy_line = save_line; @@ -3937,20 +2526,23 @@ static int parse_declarator(int sym, zend_ffi_dcl *dcl, const char **name, size_ return sym; } -static int parse_abstract_declarator(int sym, zend_ffi_dcl *dcl, const char **name, size_t *name_len) { +static int parse_abstract_declarator(int sym, zend_ffi_dcl *dcl) { zend_ffi_dcl nested_dcl = {ZEND_FFI_DCL_CHAR, 0, 0, 0, NULL}; zend_bool nested = 0; if (sym == YY__STAR) { sym = parse_pointer(sym, dcl); } if ((sym == YY__LPAREN) && synpred_2(sym)) { - sym = parse_nested_abstract_declarator(sym, &nested_dcl, name, name_len); + sym = get_sym(); + if (sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__ || sym == YY___DECLSPEC) { + sym = parse_attributes(sym, &nested_dcl); + } + sym = parse_abstract_declarator(sym, &nested_dcl); + if (sym != YY__RPAREN) { + yy_error_sym("')' expected, got", sym); + } + sym = get_sym(); nested = 1; - } else if (sym == YY_ID) { - sym = parse_ID(sym, name, name_len); - } else if (YY_IN_SET(sym, (YY__LBRACK,YY__LPAREN,YY__COMMA,YY__RPAREN,YY_EOF), "\003\000\006\000\000\000\010\000\000\000\000\000")) { - } else { - yy_error_sym("unexpected", sym); } if (sym == YY__LBRACK || sym == YY__LPAREN) { sym = parse_array_or_function_declarators(sym, dcl); @@ -3959,52 +2551,32 @@ static int parse_abstract_declarator(int sym, zend_ffi_dcl *dcl, const char **na return sym; } -static int parse_nested_abstract_declarator(int sym, zend_ffi_dcl *dcl, const char **name, size_t *name_len) { +static int parse_parameter_declarator(int sym, zend_ffi_dcl *dcl, const char **name, size_t *name_len) { zend_ffi_dcl nested_dcl = {ZEND_FFI_DCL_CHAR, 0, 0, 0, NULL}; zend_bool nested = 0; - if (sym != YY__LPAREN) { - yy_error_sym("'(' expected, got", sym); - } - sym = get_sym(); - if (sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__ || sym == YY___DECLSPEC) { - sym = parse_attributes(sym, &nested_dcl); - } if (sym == YY__STAR) { sym = parse_pointer(sym, dcl); - if ((sym == YY__LPAREN) && synpred_3(sym)) { - sym = parse_nested_abstract_declarator(sym, &nested_dcl, name, name_len); - nested = 1; - } else if (sym == YY_ID) { - sym = parse_ID(sym, name, name_len); - } else if (sym == YY__LBRACK || sym == YY__LPAREN || sym == YY__RPAREN) { - } else { - yy_error_sym("unexpected", sym); - } - if (sym == YY__LBRACK || sym == YY__LPAREN) { - sym = parse_array_or_function_declarators(sym, dcl); + } + if ((sym == YY__LPAREN) && synpred_3(sym)) { + sym = get_sym(); + if (sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__ || sym == YY___DECLSPEC) { + sym = parse_attributes(sym, &nested_dcl); } - } else if (sym == YY__LPAREN || sym == YY_ID || sym == YY__LBRACK) { - if ((sym == YY__LPAREN) && synpred_4(sym)) { - sym = parse_nested_abstract_declarator(sym, &nested_dcl, name, name_len); - if (sym == YY__LBRACK || sym == YY__LPAREN) { - sym = parse_array_or_function_declarators(sym, dcl); - } - nested = 1; - } else if (sym == YY_ID) { - sym = parse_ID(sym, name, name_len); - if (sym == YY__LBRACK || sym == YY__LPAREN) { - sym = parse_array_or_function_declarators(sym, dcl); - } - } else { - sym = parse_array_or_function_declarators(sym, dcl); + sym = parse_parameter_declarator(sym, &nested_dcl, name, name_len); + if (sym != YY__RPAREN) { + yy_error_sym("')' expected, got", sym); } + sym = get_sym(); + nested = 1; + } else if (sym == YY_ID) { + sym = parse_ID(sym, name, name_len); + } else if (sym == YY__LBRACK || sym == YY__LPAREN || sym == YY__RPAREN || sym == YY__COMMA) { } else { yy_error_sym("unexpected", sym); } - if (sym != YY__RPAREN) { - yy_error_sym("')' expected, got", sym); + if (sym == YY__LBRACK || sym == YY__LPAREN) { + sym = parse_array_or_function_declarators(sym, dcl); } - sym = get_sym(); if (nested) zend_ffi_nested_declaration(dcl, &nested_dcl); return sym; } @@ -4028,9 +2600,9 @@ static int parse_array_or_function_declarators(int sym, zend_ffi_dcl *dcl) { const unsigned char *save_pos; const unsigned char *save_text; int save_line; - int alt114; - int alt110; - int alt124; + int alt103; + int alt99; + int alt113; zend_ffi_dcl dummy = ZEND_FFI_ATTR_INIT; zend_ffi_val len = {.kind = ZEND_FFI_VAL_EMPTY}; HashTable *args = NULL; @@ -4040,99 +2612,99 @@ static int parse_array_or_function_declarators(int sym, zend_ffi_dcl *dcl) { save_pos = yy_pos; save_text = yy_text; save_line = yy_line; - alt110 = -2; + alt99 = -2; sym2 = sym; if (sym2 == YY_STATIC) { - alt110 = 111; - goto _yy_state_110; + alt99 = 100; + goto _yy_state_99; } else if (YY_IN_SET(sym2, (YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC), "\000\000\370\037\000\000\300\001\000\000\000\000")) { - alt110 = 114; - goto _yy_state_110; + alt99 = 103; + goto _yy_state_99; } else if (sym2 == YY__STAR) { sym2 = get_sym(); - goto _yy_state_110_15; + goto _yy_state_99_15; } else if (YY_IN_SET(sym2, (YY__LPAREN,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__,YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER), "\000\000\002\000\000\000\000\200\000\343\377\017")) { - alt110 = 120; - goto _yy_state_110; + alt99 = 109; + goto _yy_state_99; } else if (sym2 == YY__RBRACK) { - alt110 = 121; - goto _yy_state_110; + alt99 = 110; + goto _yy_state_99; } else { yy_error_sym("unexpected", sym2); } -_yy_state_110_15: +_yy_state_99_15: if (sym2 == YY__RBRACK) { - alt110 = 119; - goto _yy_state_110; + alt99 = 108; + goto _yy_state_99; } else if (YY_IN_SET(sym2, (YY__LPAREN,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__,YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER,YY__STAR), "\000\000\002\000\000\000\004\200\000\343\377\017")) { - alt110 = 120; - goto _yy_state_110; + alt99 = 109; + goto _yy_state_99; } else { yy_error_sym("unexpected", sym2); } -_yy_state_110: +_yy_state_99: yy_pos = save_pos; yy_text = save_text; yy_line = save_line; - if (alt110 == 111) { + if (alt99 == 100) { sym = get_sym(); if (YY_IN_SET(sym, (YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC), "\000\000\370\037\000\000\300\001\000\000\000\000")) { sym = parse_type_qualifier_list(sym, &dummy); } sym = parse_assignment_expression(sym, &len); - } else if (alt110 == 114) { + } else if (alt99 == 103) { sym = parse_type_qualifier_list(sym, &dummy); save_pos = yy_pos; save_text = yy_text; save_line = yy_line; - alt114 = -2; + alt103 = -2; sym2 = sym; if (sym2 == YY_STATIC) { - alt114 = 115; - goto _yy_state_114; + alt103 = 104; + goto _yy_state_103; } else if (sym2 == YY__STAR) { sym2 = get_sym(); - goto _yy_state_114_2; + goto _yy_state_103_2; } else if (YY_IN_SET(sym2, (YY__LPAREN,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__,YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER), "\000\000\002\000\000\000\000\200\000\343\377\017")) { - alt114 = 118; - goto _yy_state_114; + alt103 = 107; + goto _yy_state_103; } else if (sym2 == YY__RBRACK) { - alt114 = 121; - goto _yy_state_114; + alt103 = 110; + goto _yy_state_103; } else { yy_error_sym("unexpected", sym2); } -_yy_state_114_2: +_yy_state_103_2: if (sym2 == YY__RBRACK) { - alt114 = 117; - goto _yy_state_114; + alt103 = 106; + goto _yy_state_103; } else if (YY_IN_SET(sym2, (YY__LPAREN,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__,YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER,YY__STAR), "\000\000\002\000\000\000\004\200\000\343\377\017")) { - alt114 = 118; - goto _yy_state_114; + alt103 = 107; + goto _yy_state_103; } else { yy_error_sym("unexpected", sym2); } -_yy_state_114: +_yy_state_103: yy_pos = save_pos; yy_text = save_text; yy_line = save_line; - if (alt114 == 115) { + if (alt103 == 104) { sym = get_sym(); sym = parse_assignment_expression(sym, &len); - } else if (alt114 == 121) { + } else if (alt103 == 110) { attr |= ZEND_FFI_ATTR_INCOMPLETE_ARRAY; - } else if (alt114 == 117) { + } else if (alt103 == 106) { sym = get_sym(); attr |= ZEND_FFI_ATTR_VLA; - } else if (alt114 == 118) { + } else if (alt103 == 107) { sym = parse_assignment_expression(sym, &len); } else { yy_error_sym("unexpected", sym); } - } else if (alt110 == 121 || alt110 == 119 || alt110 == 120) { - if (alt110 == 121) { + } else if (alt99 == 110 || alt99 == 108 || alt99 == 109) { + if (alt99 == 110) { attr |= ZEND_FFI_ATTR_INCOMPLETE_ARRAY; - } else if (alt110 == 119) { + } else if (alt99 == 108) { sym = get_sym(); attr |= ZEND_FFI_ATTR_VLA; } else { @@ -4159,38 +2731,38 @@ _yy_state_114: save_pos = yy_pos; save_text = yy_text; save_line = yy_line; - alt124 = -2; + alt113 = -2; sym2 = sym; if (sym2 == YY__COMMA) { sym2 = get_sym(); - goto _yy_state_124_1; + goto _yy_state_113_1; } else if (sym2 == YY__RPAREN) { - alt124 = 130; - goto _yy_state_124; + alt113 = 119; + goto _yy_state_113; } else { yy_error_sym("unexpected", sym2); } -_yy_state_124_1: +_yy_state_113_1: if (YY_IN_SET(sym2, (YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC), "\000\000\370\377\377\037\301\001\000\000\040\000")) { - alt124 = 125; - goto _yy_state_124; + alt113 = 114; + goto _yy_state_113; } else if (sym2 == YY__POINT_POINT_POINT) { - alt124 = 127; - goto _yy_state_124; + alt113 = 116; + goto _yy_state_113; } else { yy_error_sym("unexpected", sym2); } -_yy_state_124: +_yy_state_113: yy_pos = save_pos; yy_text = save_text; yy_line = save_line; - if (alt124 != 125) { + if (alt113 != 114) { break; } sym = get_sym(); sym = parse_parameter_declaration(sym, &args); } - if (alt124 == 127) { + if (alt113 == 116) { sym = get_sym(); if (sym != YY__POINT_POINT_POINT) { yy_error_sym("'...' expected, got", sym); @@ -4225,17 +2797,15 @@ static int parse_parameter_declaration(int sym, HashTable **args) { FFI_G(allow_vla) = 1; zend_ffi_dcl param_dcl = ZEND_FFI_ATTR_INIT; sym = parse_specifier_qualifier_list(sym, ¶m_dcl); - sym = parse_abstract_declarator(sym, ¶m_dcl, &name, &name_len); + sym = parse_parameter_declarator(sym, ¶m_dcl, &name, &name_len); zend_ffi_add_arg(args, name, name_len, ¶m_dcl); FFI_G(allow_vla) = old_allow_vla; return sym; } static int parse_type_name(int sym, zend_ffi_dcl *dcl) { - const char *name = NULL; - size_t name_len = 0; sym = parse_specifier_qualifier_list(sym, dcl); - sym = parse_abstract_declarator(sym, dcl, &name, &name_len); + sym = parse_abstract_declarator(sym, dcl); return sym; } @@ -4622,7 +3192,7 @@ static int parse_multiplicative_expression(int sym, zend_ffi_val *val) { static int parse_cast_expression(int sym, zend_ffi_val *val) { int do_cast = 0; zend_ffi_dcl dcl = ZEND_FFI_ATTR_INIT; - if ((sym == YY__LPAREN) && synpred_5(sym)) { + if ((sym == YY__LPAREN) && synpred_4(sym)) { sym = get_sym(); sym = parse_type_name(sym, &dcl); if (sym != YY__RPAREN) { @@ -4750,7 +3320,7 @@ static int parse_unary_expression(int sym, zend_ffi_val *val) { break; case YY_SIZEOF: sym = get_sym(); - if ((sym == YY__LPAREN) && synpred_6(sym)) { + if ((sym == YY__LPAREN) && synpred_5(sym)) { sym = get_sym(); sym = parse_type_name(sym, &dcl); if (sym != YY__RPAREN) { @@ -4781,7 +3351,7 @@ static int parse_unary_expression(int sym, zend_ffi_val *val) { case YY___ALIGNOF: case YY___ALIGNOF__: sym = get_sym(); - if ((sym == YY__LPAREN) && synpred_7(sym)) { + if ((sym == YY__LPAREN) && synpred_6(sym)) { sym = get_sym(); sym = parse_type_name(sym, &dcl); if (sym != YY__RPAREN) { |