From: Michael Wallner Date: Wed, 31 Oct 2018 08:23:31 +0000 (+0100) Subject: fix leaks X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=47dd00ab6df0a093b13d4f573ba01c79a6bcc72f;p=m6w6%2Fext-psi fix leaks --- diff --git a/src/context.c b/src/context.c index 995a001..da36c8e 100644 --- a/src/context.c +++ b/src/context.c @@ -142,7 +142,7 @@ void psi_context_build(struct psi_context *C, const char *paths) psi_parser_parse(&P, I); psi_context_add(C, &P); psi_parser_dtor(&P); - free(I); + psi_parser_input_free(&I); } } diff --git a/src/cpp.c b/src/cpp.c index 5a1130c..2a53df8 100644 --- a/src/cpp.c +++ b/src/cpp.c @@ -60,7 +60,7 @@ bool psi_cpp_load_defaults(struct psi_cpp *cpp) if ((predef = psi_parser_open_string(cpp->parser, psi_cpp_predef, sizeof(psi_cpp_predef) - 1))) { bool parsed = psi_parser_parse(cpp->parser, predef); - free(predef); + psi_parser_input_free(&predef); return parsed; } @@ -436,7 +436,7 @@ static inline bool try_include(struct psi_cpp *cpp, const char *path, bool *pars psi_plist_free(tokens); } } - free(include); + psi_parser_input_free(&include); zend_hash_str_add_empty_element(&cpp->once, path, strlen(path)); return true; diff --git a/src/cpp_tokiter.c b/src/cpp_tokiter.c index 9ebe191..8073281 100644 --- a/src/cpp_tokiter.c +++ b/src/cpp_tokiter.c @@ -259,7 +259,7 @@ static size_t psi_cpp_tokiter_expand_tokens(struct psi_cpp *cpp, tmp_tok = psi_token_init(old_tok->type, "", 0, target->col, target->line, - target->file ? target->file->val : ""); + target->file ? target->file : zend_empty_string); new_tok = psi_token_cat(NULL, 3, tmp_tok, old_tok, tok); psi_token_free(&old_tok); @@ -268,7 +268,8 @@ static size_t psi_cpp_tokiter_expand_tokens(struct psi_cpp *cpp, exp_tokens[n - 1] = new_tok; } else { new_tok = psi_token_init(stringify ? PSI_T_QUOTED_STRING : tok->type, - tok->text->val, tok->text->len, target->col, target->line, target->file?:""); + tok->text->val, tok->text->len, target->col, target->line, + target->file ?: zend_empty_string); exp_tokens[n++] = new_tok; } diff --git a/src/module.c b/src/module.c index 338f945..0aba564 100644 --- a/src/module.c +++ b/src/module.c @@ -232,7 +232,7 @@ static PHP_FUNCTION(psi_validate) psi_validate_scope_dtor(&S); psi_data_dtor(&D); psi_parser_dtor(&P); - free(I); + psi_parser_input_free(&I); } ZEND_BEGIN_ARG_INFO_EX(ai_psi_validate_string, 0, 0, 1) @@ -284,7 +284,7 @@ static PHP_FUNCTION(psi_validate_string) psi_validate_scope_dtor(&S); psi_data_dtor(&D); psi_parser_dtor(&P); - free(I); + psi_parser_input_free(&I); } static ZEND_RESULT_CODE psi_ops_load() diff --git a/src/parser.c b/src/parser.c index 70e4ba2..af5d7fd 100644 --- a/src/parser.c +++ b/src/parser.c @@ -1,4 +1,4 @@ -/* Generated by re2c 1.1.1 on Tue Oct 30 13:23:48 2018 */ +/* Generated by re2c 1.1.1 on Wed Oct 31 09:21:44 2018 */ #line 1 "src/parser.re" /******************************************************************************* Copyright (c) 2016, Michael Wallner . @@ -167,19 +167,20 @@ void psi_parser_postprocess(struct psi_parser *P) struct psi_const *cnst; struct psi_num_exp *num; smart_str ns_name = {0}; - zend_string *name_str; + zend_string *name_str, *type_str; smart_str_appendl_ex(&ns_name, ZEND_STRL("psi\\"), 1); smart_str_append_ex(&ns_name, name, 1); name_str = smart_str_extract(&ns_name); + type_str = zend_string_init(ZEND_STRL(""), 1); num = psi_num_exp_copy(scope.macro->exp); def = psi_impl_def_val_init(PSI_T_NUMBER, num); - type = psi_impl_type_init(PSI_T_NUMBER, - zend_string_init(ZEND_STRL(""), 1)); + type = psi_impl_type_init(PSI_T_NUMBER, type_str); cnst = psi_const_init(type, name_str, def); P->consts = psi_plist_add(P->consts, &cnst); zend_string_release(name_str); + zend_string_release(type_str); } } else { if (psi_plist_count(scope.macro->tokens) == 1) { @@ -191,18 +192,19 @@ void psi_parser_postprocess(struct psi_parser *P) struct psi_impl_def_val *def; struct psi_const *cnst; smart_str ns_name = {0}; - zend_string *name_str; + zend_string *name_str, *type_str; smart_str_appendl_ex(&ns_name, ZEND_STRL("psi\\"), 1); smart_str_append_ex(&ns_name, name, 1); name_str = smart_str_extract(&ns_name); + type_str = zend_string_init(ZEND_STRL("string"), 1); - type = psi_impl_type_init(PSI_T_STRING, - zend_string_init(ZEND_STRL("string"), 1)); + type = psi_impl_type_init(PSI_T_STRING, type_str); def = psi_impl_def_val_init(PSI_T_QUOTED_STRING, t->text); cnst = psi_const_init(type, name_str, def); P->consts = psi_plist_add(P->consts, &cnst); zend_string_release(name_str); + zend_string_release(type_str); } } } @@ -298,7 +300,7 @@ struct psi_plist *psi_parser_scan(struct psi_parser *P, struct psi_parser_input (void) ctxmrk; -#line 302 "src/parser.c" +#line 304 "src/parser.c" { unsigned char yych; unsigned int yyaccept = 0; @@ -423,9 +425,9 @@ struct psi_plist *psi_parser_scan(struct psi_parser *P, struct psi_parser_input yy2: ++cur; yy3: -#line 467 "src/parser.re" +#line 469 "src/parser.re" { NEWTOKEN(-2); goto error; } -#line 429 "src/parser.c" +#line 431 "src/parser.c" yy4: ++cur; if (lim <= cur) if (cur >= lim) goto done;; @@ -437,14 +439,14 @@ yy4: default: goto yy6; } yy6: -#line 466 "src/parser.re" +#line 468 "src/parser.re" { NEWTOKEN(PSI_T_WHITESPACE); goto start; } -#line 443 "src/parser.c" +#line 445 "src/parser.c" yy7: ++cur; -#line 465 "src/parser.re" +#line 467 "src/parser.re" { NEWTOKEN(PSI_T_EOL); NEWLINE(); goto start; } -#line 448 "src/parser.c" +#line 450 "src/parser.c" yy9: yych = *++cur; switch (yych) { @@ -452,14 +454,14 @@ yy9: default: goto yy10; } yy10: -#line 368 "src/parser.re" +#line 370 "src/parser.re" { NEWTOKEN(PSI_T_NOT); goto start; } -#line 458 "src/parser.c" +#line 460 "src/parser.c" yy11: ++cur; -#line 341 "src/parser.re" +#line 343 "src/parser.re" { escaped = false; tok += 1; goto string; } -#line 463 "src/parser.c" +#line 465 "src/parser.c" yy13: yych = *++cur; switch (yych) { @@ -467,9 +469,9 @@ yy13: default: goto yy14; } yy14: -#line 351 "src/parser.re" +#line 353 "src/parser.re" { NEWTOKEN(PSI_T_HASH); goto start; } -#line 473 "src/parser.c" +#line 475 "src/parser.c" yy15: yych = *++cur; switch (yych) { @@ -542,9 +544,9 @@ yy15: } yy16: ++cur; -#line 369 "src/parser.re" +#line 371 "src/parser.re" { NEWTOKEN(PSI_T_MODULO); goto start; } -#line 548 "src/parser.c" +#line 550 "src/parser.c" yy18: yych = *++cur; switch (yych) { @@ -552,29 +554,29 @@ yy18: default: goto yy19; } yy19: -#line 370 "src/parser.re" +#line 372 "src/parser.re" { NEWTOKEN(PSI_T_AMPERSAND); goto start; } -#line 558 "src/parser.c" +#line 560 "src/parser.c" yy20: ++cur; -#line 340 "src/parser.re" +#line 342 "src/parser.re" { escaped = false; tok += 1; goto character; } -#line 563 "src/parser.c" +#line 565 "src/parser.c" yy22: ++cur; -#line 352 "src/parser.re" +#line 354 "src/parser.re" { NEWTOKEN(PSI_T_LPAREN); goto start; } -#line 568 "src/parser.c" +#line 570 "src/parser.c" yy24: ++cur; -#line 353 "src/parser.re" +#line 355 "src/parser.re" { NEWTOKEN(PSI_T_RPAREN); goto start; } -#line 573 "src/parser.c" +#line 575 "src/parser.c" yy26: ++cur; -#line 366 "src/parser.re" +#line 368 "src/parser.re" { NEWTOKEN(PSI_T_ASTERISK); goto start; } -#line 578 "src/parser.c" +#line 580 "src/parser.c" yy28: yyaccept = 0; yych = *(mrk = ++cur); @@ -593,14 +595,14 @@ yy28: default: goto yy29; } yy29: -#line 371 "src/parser.re" +#line 373 "src/parser.re" { NEWTOKEN(PSI_T_PLUS); goto start; } -#line 599 "src/parser.c" +#line 601 "src/parser.c" yy30: ++cur; -#line 355 "src/parser.re" +#line 357 "src/parser.re" { NEWTOKEN(PSI_T_COMMA); goto start; } -#line 604 "src/parser.c" +#line 606 "src/parser.c" yy32: yyaccept = 1; yych = *(mrk = ++cur); @@ -619,9 +621,9 @@ yy32: default: goto yy33; } yy33: -#line 372 "src/parser.re" +#line 374 "src/parser.re" { NEWTOKEN(PSI_T_MINUS); goto start; } -#line 625 "src/parser.c" +#line 627 "src/parser.c" yy34: yyaccept = 2; yych = *(mrk = ++cur); @@ -640,9 +642,9 @@ yy34: default: goto yy35; } yy35: -#line 383 "src/parser.re" +#line 385 "src/parser.re" { NEWTOKEN(PSI_T_PERIOD); goto start; } -#line 646 "src/parser.c" +#line 648 "src/parser.c" yy36: yych = *++cur; switch (yych) { @@ -651,9 +653,9 @@ yy36: default: goto yy37; } yy37: -#line 373 "src/parser.re" +#line 375 "src/parser.re" { NEWTOKEN(PSI_T_SLASH); goto start; } -#line 657 "src/parser.c" +#line 659 "src/parser.c" yy38: yyaccept = 3; yych = *(mrk = ++cur); @@ -666,9 +668,9 @@ yy38: default: goto yy126; } yy39: -#line 327 "src/parser.re" +#line 329 "src/parser.re" { NEWTOKEN(PSI_T_NUMBER); token->flags = PSI_NUMBER_INT; goto start; } -#line 672 "src/parser.c" +#line 674 "src/parser.c" yy40: yyaccept = 3; mrk = ++cur; @@ -696,14 +698,14 @@ yy40: } yy42: ++cur; -#line 356 "src/parser.re" +#line 358 "src/parser.re" { NEWTOKEN(PSI_T_COLON); goto start; } -#line 702 "src/parser.c" +#line 704 "src/parser.c" yy44: ++cur; -#line 354 "src/parser.re" +#line 356 "src/parser.re" { NEWTOKEN(PSI_T_EOS); goto start; } -#line 707 "src/parser.c" +#line 709 "src/parser.c" yy46: yyaccept = 4; yych = *(mrk = ++cur); @@ -779,9 +781,9 @@ yy46: default: goto yy47; } yy47: -#line 381 "src/parser.re" +#line 383 "src/parser.re" { NEWTOKEN(PSI_T_LCHEVR); goto start; } -#line 785 "src/parser.c" +#line 787 "src/parser.c" yy48: yych = *++cur; switch (yych) { @@ -789,9 +791,9 @@ yy48: default: goto yy49; } yy49: -#line 365 "src/parser.re" +#line 367 "src/parser.re" { NEWTOKEN(PSI_T_EQUALS); goto start; } -#line 795 "src/parser.c" +#line 797 "src/parser.c" yy50: yych = *++cur; switch (yych) { @@ -800,14 +802,14 @@ yy50: default: goto yy51; } yy51: -#line 382 "src/parser.re" +#line 384 "src/parser.re" { NEWTOKEN(PSI_T_RCHEVR); goto start; } -#line 806 "src/parser.c" +#line 808 "src/parser.c" yy52: ++cur; -#line 385 "src/parser.re" +#line 387 "src/parser.re" { NEWTOKEN(PSI_T_IIF); goto start; } -#line 811 "src/parser.c" +#line 813 "src/parser.c" yy54: yyaccept = 5; yych = *(mrk = ++cur); @@ -819,9 +821,9 @@ yy54: default: goto yy62; } yy55: -#line 460 "src/parser.re" +#line 462 "src/parser.re" { NEWTOKEN(PSI_T_NAME); goto start; } -#line 825 "src/parser.c" +#line 827 "src/parser.c" yy56: yyaccept = 5; yych = *(mrk = ++cur); @@ -1064,9 +1066,9 @@ yy74: } yy75: ++cur; -#line 359 "src/parser.re" +#line 361 "src/parser.re" { NEWTOKEN(PSI_T_LBRACKET); goto start; } -#line 1070 "src/parser.c" +#line 1072 "src/parser.c" yy77: yych = *++cur; switch (yych) { @@ -1148,19 +1150,19 @@ yy77: default: goto yy184; } yy78: -#line 374 "src/parser.re" +#line 376 "src/parser.re" { NEWTOKEN(PSI_T_BSLASH); goto start; } -#line 1154 "src/parser.c" +#line 1156 "src/parser.c" yy79: ++cur; -#line 360 "src/parser.re" +#line 362 "src/parser.re" { NEWTOKEN(PSI_T_RBRACKET); goto start; } -#line 1159 "src/parser.c" +#line 1161 "src/parser.c" yy81: ++cur; -#line 376 "src/parser.re" +#line 378 "src/parser.re" { NEWTOKEN(PSI_T_CARET); goto start; } -#line 1164 "src/parser.c" +#line 1166 "src/parser.c" yy83: yyaccept = 5; yych = *(mrk = ++cur); @@ -1300,9 +1302,9 @@ yy95: } yy96: ++cur; -#line 357 "src/parser.re" +#line 359 "src/parser.re" { NEWTOKEN(PSI_T_LBRACE); goto start; } -#line 1306 "src/parser.c" +#line 1308 "src/parser.c" yy98: yych = *++cur; switch (yych) { @@ -1310,29 +1312,29 @@ yy98: default: goto yy99; } yy99: -#line 375 "src/parser.re" +#line 377 "src/parser.re" { NEWTOKEN(PSI_T_PIPE); goto start; } -#line 1316 "src/parser.c" +#line 1318 "src/parser.c" yy100: ++cur; -#line 358 "src/parser.re" +#line 360 "src/parser.re" { NEWTOKEN(PSI_T_RBRACE); goto start; } -#line 1321 "src/parser.c" +#line 1323 "src/parser.c" yy102: ++cur; -#line 367 "src/parser.re" +#line 369 "src/parser.re" { NEWTOKEN(PSI_T_TILDE); goto start; } -#line 1326 "src/parser.c" +#line 1328 "src/parser.c" yy104: ++cur; -#line 361 "src/parser.re" +#line 363 "src/parser.re" { NEWTOKEN(PSI_T_CMP_NE); goto start; } -#line 1331 "src/parser.c" +#line 1333 "src/parser.c" yy106: ++cur; -#line 350 "src/parser.re" +#line 352 "src/parser.re" { NEWTOKEN(PSI_T_CPP_PASTE); goto start; } -#line 1336 "src/parser.c" +#line 1338 "src/parser.c" yy108: ++cur; if (lim <= cur) if (cur >= lim) goto done;; @@ -1406,14 +1408,14 @@ yy108: default: goto yy108; } yy110: -#line 462 "src/parser.re" +#line 464 "src/parser.re" { NEWTOKEN(PSI_T_DOLLAR_NAME); goto start; } -#line 1412 "src/parser.c" +#line 1414 "src/parser.c" yy111: ++cur; -#line 363 "src/parser.re" +#line 365 "src/parser.re" { NEWTOKEN(PSI_T_AND); goto start; } -#line 1417 "src/parser.c" +#line 1419 "src/parser.c" yy113: yych = *++cur; switch (yych) { @@ -1547,19 +1549,19 @@ yy116: default: goto yy118; } yy118: -#line 333 "src/parser.re" +#line 335 "src/parser.re" { NEWTOKEN(PSI_T_NUMBER); token->flags = PSI_NUMBER_FLT; goto start; } -#line 1553 "src/parser.c" +#line 1555 "src/parser.c" yy119: ++cur; -#line 347 "src/parser.re" +#line 349 "src/parser.re" { goto comment; } -#line 1558 "src/parser.c" +#line 1560 "src/parser.c" yy121: ++cur; -#line 348 "src/parser.re" +#line 350 "src/parser.re" { goto comment_sl; } -#line 1563 "src/parser.c" +#line 1565 "src/parser.c" yy123: yyaccept = 6; mrk = ++cur; @@ -1635,9 +1637,9 @@ yy128: } yy129: cur -= 1; -#line 329 "src/parser.re" +#line 331 "src/parser.re" { NEWTOKEN(PSI_T_NUMBER); token->flags = PSI_NUMBER_INT | PSI_NUMBER_L; cur += 1; goto start; } -#line 1641 "src/parser.c" +#line 1643 "src/parser.c" yy130: yych = *++cur; switch (yych) { @@ -1647,9 +1649,9 @@ yy130: } yy131: cur -= 1; -#line 328 "src/parser.re" +#line 330 "src/parser.re" { NEWTOKEN(PSI_T_NUMBER); token->flags = PSI_NUMBER_INT | PSI_NUMBER_U; cur += 1; goto start; } -#line 1653 "src/parser.c" +#line 1655 "src/parser.c" yy132: yych = *++cur; switch (yych) { @@ -1753,29 +1755,29 @@ yy133: } yy135: ++cur; -#line 377 "src/parser.re" +#line 379 "src/parser.re" { NEWTOKEN(PSI_T_LSHIFT); goto start; } -#line 1759 "src/parser.c" +#line 1761 "src/parser.c" yy137: ++cur; -#line 379 "src/parser.re" +#line 381 "src/parser.re" { NEWTOKEN(PSI_T_CMP_LE); goto start; } -#line 1764 "src/parser.c" +#line 1766 "src/parser.c" yy139: ++cur; -#line 362 "src/parser.re" +#line 364 "src/parser.re" { NEWTOKEN(PSI_T_CMP_EQ); goto start; } -#line 1769 "src/parser.c" +#line 1771 "src/parser.c" yy141: ++cur; -#line 380 "src/parser.re" +#line 382 "src/parser.re" { NEWTOKEN(PSI_T_CMP_GE); goto start; } -#line 1774 "src/parser.c" +#line 1776 "src/parser.c" yy143: ++cur; -#line 378 "src/parser.re" +#line 380 "src/parser.re" { NEWTOKEN(PSI_T_RSHIFT); goto start; } -#line 1779 "src/parser.c" +#line 1781 "src/parser.c" yy145: yyaccept = 5; yych = *(mrk = ++cur); @@ -1856,9 +1858,9 @@ yy146: default: goto yy61; } yy147: -#line 440 "src/parser.re" +#line 442 "src/parser.re" { NEWTOKEN(PSI_T_AS); goto start; } -#line 1862 "src/parser.c" +#line 1864 "src/parser.c" yy148: ++cur; if (lim <= cur) if (cur >= lim) goto done;; @@ -2107,9 +2109,9 @@ yy160: default: goto yy61; } yy161: -#line 410 "src/parser.re" +#line 412 "src/parser.re" { NEWTOKEN(PSI_T_IF); goto start; } -#line 2113 "src/parser.c" +#line 2115 "src/parser.c" yy162: yyaccept = 5; yych = *(mrk = ++cur); @@ -2123,9 +2125,9 @@ yy162: yy163: ++cur; cur -= 1; -#line 345 "src/parser.re" +#line 347 "src/parser.re" { char_width = sizeof(wchar_t)/8; } -#line 2129 "src/parser.c" +#line 2131 "src/parser.c" yy165: yyaccept = 5; yych = *(mrk = ++cur); @@ -2242,9 +2244,9 @@ yy178: yy179: ++cur; cur -= 1; -#line 344 "src/parser.re" +#line 346 "src/parser.re" { char_width = 4; } -#line 2248 "src/parser.c" +#line 2250 "src/parser.c" yy181: yyaccept = 5; yych = *(mrk = ++cur); @@ -2343,9 +2345,9 @@ yy184: default: goto yy184; } yy186: -#line 461 "src/parser.re" +#line 463 "src/parser.re" { NEWTOKEN(PSI_T_NSNAME); goto start; } -#line 2349 "src/parser.c" +#line 2351 "src/parser.c" yy187: yyaccept = 5; yych = *(mrk = ++cur); @@ -2474,9 +2476,9 @@ yy201: yy202: ++cur; cur -= 1; -#line 343 "src/parser.re" +#line 345 "src/parser.re" { char_width = 2; } -#line 2480 "src/parser.c" +#line 2482 "src/parser.c" yy204: yyaccept = 5; yych = *(mrk = ++cur); @@ -2504,14 +2506,14 @@ yy206: } yy207: ++cur; -#line 364 "src/parser.re" +#line 366 "src/parser.re" { NEWTOKEN(PSI_T_OR); goto start; } -#line 2510 "src/parser.c" +#line 2512 "src/parser.c" yy209: ++cur; -#line 384 "src/parser.re" +#line 386 "src/parser.re" { NEWTOKEN(PSI_T_ELLIPSIS); goto start; } -#line 2515 "src/parser.c" +#line 2517 "src/parser.c" yy211: yych = *++cur; switch (yych) { @@ -2526,15 +2528,15 @@ yy211: yy212: ++cur; cur -= 1; -#line 334 "src/parser.re" +#line 336 "src/parser.re" { NEWTOKEN(PSI_T_NUMBER); token->flags = PSI_NUMBER_FLT | PSI_NUMBER_F; cur += 1; goto start; } -#line 2532 "src/parser.c" +#line 2534 "src/parser.c" yy214: ++cur; cur -= 1; -#line 335 "src/parser.re" +#line 337 "src/parser.re" { NEWTOKEN(PSI_T_NUMBER); token->flags = PSI_NUMBER_FLT | PSI_NUMBER_L; cur += 1; goto start; } -#line 2538 "src/parser.c" +#line 2540 "src/parser.c" yy216: yych = *++cur; switch (yych) { @@ -2546,9 +2548,9 @@ yy217: ++cur; yy218: cur -= 2; -#line 330 "src/parser.re" +#line 332 "src/parser.re" { NEWTOKEN(PSI_T_NUMBER); token->flags = PSI_NUMBER_INT | PSI_NUMBER_UL; cur += 2; goto start; } -#line 2552 "src/parser.c" +#line 2554 "src/parser.c" yy219: yych = *++cur; switch (yych) { @@ -2595,9 +2597,9 @@ yy220: } yy222: ++cur; -#line 463 "src/parser.re" +#line 465 "src/parser.re" { tok += 1; cur -= 1; NEWTOKEN(PSI_T_CPP_HEADER); cur += 1; goto start; } -#line 2601 "src/parser.c" +#line 2603 "src/parser.c" yy224: yyaccept = 5; yych = *(mrk = ++cur); @@ -2808,9 +2810,9 @@ yy241: default: goto yy61; } yy242: -#line 435 "src/parser.re" +#line 437 "src/parser.re" { NEWTOKEN(PSI_T_LET); goto start; } -#line 2814 "src/parser.c" +#line 2816 "src/parser.c" yy243: yyaccept = 12; yych = *(mrk = ++cur); @@ -2883,9 +2885,9 @@ yy243: default: goto yy61; } yy244: -#line 434 "src/parser.re" +#line 436 "src/parser.re" { NEWTOKEN(PSI_T_LIB); goto start; } -#line 2889 "src/parser.c" +#line 2891 "src/parser.c" yy245: yyaccept = 5; yych = *(mrk = ++cur); @@ -3015,9 +3017,9 @@ yy252: default: goto yy61; } yy253: -#line 436 "src/parser.re" +#line 438 "src/parser.re" { NEWTOKEN(PSI_T_SET); goto start; } -#line 3021 "src/parser.c" +#line 3023 "src/parser.c" yy254: yyaccept = 5; yych = *(mrk = ++cur); @@ -3243,9 +3245,9 @@ yy272: default: goto yy61; } yy273: -#line 404 "src/parser.re" +#line 406 "src/parser.re" { NEWTOKEN(PSI_T_INT); goto start; } -#line 3249 "src/parser.c" +#line 3251 "src/parser.c" yy274: yyaccept = 5; yych = *(mrk = ++cur); @@ -3311,9 +3313,9 @@ yy281: yy282: ++cur; cur -= 1; -#line 342 "src/parser.re" +#line 344 "src/parser.re" { char_width = 1; } -#line 3317 "src/parser.c" +#line 3319 "src/parser.c" yy284: yyaccept = 5; yych = *(mrk = ++cur); @@ -3345,27 +3347,27 @@ yy287: yy288: ++cur; cur -= 2; -#line 337 "src/parser.re" +#line 339 "src/parser.re" { NEWTOKEN(PSI_T_NUMBER); token->flags = PSI_NUMBER_FLT | PSI_NUMBER_DD; cur += 2; goto start; } -#line 3351 "src/parser.c" +#line 3353 "src/parser.c" yy290: ++cur; cur -= 2; -#line 336 "src/parser.re" +#line 338 "src/parser.re" { NEWTOKEN(PSI_T_NUMBER); token->flags = PSI_NUMBER_FLT | PSI_NUMBER_DF; cur += 2; goto start; } -#line 3357 "src/parser.c" +#line 3359 "src/parser.c" yy292: ++cur; cur -= 2; -#line 338 "src/parser.re" +#line 340 "src/parser.re" { NEWTOKEN(PSI_T_NUMBER); token->flags = PSI_NUMBER_FLT | PSI_NUMBER_DL; cur += 2; goto start; } -#line 3363 "src/parser.c" +#line 3365 "src/parser.c" yy294: ++cur; cur -= 3; -#line 331 "src/parser.re" +#line 333 "src/parser.re" { NEWTOKEN(PSI_T_NUMBER); token->flags = PSI_NUMBER_INT | PSI_NUMBER_ULL; cur += 3; goto start; } -#line 3369 "src/parser.c" +#line 3371 "src/parser.c" yy296: ++cur; if ((lim - cur) < 3) if (cur >= lim) goto done;; @@ -3521,9 +3523,9 @@ yy304: default: goto yy61; } yy305: -#line 414 "src/parser.re" +#line 416 "src/parser.re" { NEWTOKEN(PSI_T_ELIF); goto start; } -#line 3527 "src/parser.c" +#line 3529 "src/parser.c" yy306: yyaccept = 16; yych = *(mrk = ++cur); @@ -3596,9 +3598,9 @@ yy306: default: goto yy61; } yy307: -#line 413 "src/parser.re" +#line 415 "src/parser.re" { NEWTOKEN(PSI_T_ELSE); goto start; } -#line 3602 "src/parser.c" +#line 3604 "src/parser.c" yy308: yyaccept = 5; yych = *(mrk = ++cur); @@ -3703,9 +3705,9 @@ yy312: default: goto yy61; } yy313: -#line 441 "src/parser.re" +#line 443 "src/parser.re" { NEWTOKEN(PSI_T_FREE); goto start; } -#line 3709 "src/parser.c" +#line 3711 "src/parser.c" yy314: yyaccept = 5; yych = *(mrk = ++cur); @@ -3826,9 +3828,9 @@ yy320: default: goto yy61; } yy321: -#line 425 "src/parser.re" +#line 427 "src/parser.re" { NEWTOKEN(PSI_T_NULL); goto start; } -#line 3832 "src/parser.c" +#line 3834 "src/parser.c" yy322: yyaccept = 5; yych = *(mrk = ++cur); @@ -3980,9 +3982,9 @@ yy332: default: goto yy61; } yy333: -#line 442 "src/parser.re" +#line 444 "src/parser.re" { NEWTOKEN(PSI_T_TEMP); goto start; } -#line 3986 "src/parser.c" +#line 3988 "src/parser.c" yy334: yyaccept = 5; yych = *(mrk = ++cur); @@ -4103,9 +4105,9 @@ yy340: default: goto yy61; } yy341: -#line 423 "src/parser.re" +#line 425 "src/parser.re" { NEWTOKEN(PSI_T_TRUE); goto start; } -#line 4109 "src/parser.c" +#line 4111 "src/parser.c" yy342: yyaccept = 5; yych = *(mrk = ++cur); @@ -4194,9 +4196,9 @@ yy344: default: goto yy61; } yy345: -#line 451 "src/parser.re" +#line 453 "src/parser.re" { NEWTOKEN(PSI_T_ZVAL); goto start; } -#line 4200 "src/parser.c" +#line 4202 "src/parser.c" yy346: yyaccept = 5; yych = *(mrk = ++cur); @@ -4306,9 +4308,9 @@ yy351: default: goto yy61; } yy352: -#line 401 "src/parser.re" +#line 403 "src/parser.re" { NEWTOKEN(PSI_T_BOOL); goto start; } -#line 4312 "src/parser.c" +#line 4314 "src/parser.c" yy353: yyaccept = 23; yych = *(mrk = ++cur); @@ -4381,9 +4383,9 @@ yy353: default: goto yy61; } yy354: -#line 402 "src/parser.re" +#line 404 "src/parser.re" { NEWTOKEN(PSI_T_CHAR); goto start; } -#line 4387 "src/parser.c" +#line 4389 "src/parser.c" yy355: yyaccept = 5; yych = *(mrk = ++cur); @@ -4470,9 +4472,9 @@ yy357: default: goto yy61; } yy358: -#line 398 "src/parser.re" +#line 400 "src/parser.re" { NEWTOKEN(PSI_T_ENUM); goto start; } -#line 4476 "src/parser.c" +#line 4478 "src/parser.c" yy359: yyaccept = 5; yych = *(mrk = ++cur); @@ -4553,9 +4555,9 @@ yy360: default: goto yy61; } yy361: -#line 394 "src/parser.re" +#line 396 "src/parser.re" { NEWTOKEN(PSI_T_LINE); goto start; } -#line 4559 "src/parser.c" +#line 4561 "src/parser.c" yy362: yyaccept = 26; yych = *(mrk = ++cur); @@ -4628,9 +4630,9 @@ yy362: default: goto yy61; } yy363: -#line 405 "src/parser.re" +#line 407 "src/parser.re" { NEWTOKEN(PSI_T_LONG); goto start; } -#line 4634 "src/parser.c" +#line 4636 "src/parser.c" yy364: yyaccept = 5; yych = *(mrk = ++cur); @@ -4759,9 +4761,9 @@ yy372: default: goto yy61; } yy373: -#line 400 "src/parser.re" +#line 402 "src/parser.re" { NEWTOKEN(PSI_T_VOID); goto start; } -#line 4765 "src/parser.c" +#line 4767 "src/parser.c" yy374: yyaccept = 5; yych = *(mrk = ++cur); @@ -4841,9 +4843,9 @@ yy375: default: goto yy61; } yy376: -#line 429 "src/parser.re" +#line 431 "src/parser.re" { NEWTOKEN(PSI_T_ARRAY); goto start; } -#line 4847 "src/parser.c" +#line 4849 "src/parser.c" yy377: yyaccept = 5; yych = *(mrk = ++cur); @@ -4956,9 +4958,9 @@ yy382: default: goto yy61; } yy383: -#line 452 "src/parser.re" +#line 454 "src/parser.re" { NEWTOKEN(PSI_T_COUNT); goto start; } -#line 4962 "src/parser.c" +#line 4964 "src/parser.c" yy384: yyaccept = 5; yych = *(mrk = ++cur); @@ -5039,9 +5041,9 @@ yy385: default: goto yy61; } yy386: -#line 415 "src/parser.re" +#line 417 "src/parser.re" { NEWTOKEN(PSI_T_ENDIF); goto start; } -#line 5045 "src/parser.c" +#line 5047 "src/parser.c" yy387: yyaccept = 31; yych = *(mrk = ++cur); @@ -5114,9 +5116,9 @@ yy387: default: goto yy61; } yy388: -#line 420 "src/parser.re" +#line 422 "src/parser.re" { NEWTOKEN(PSI_T_ERROR); goto start; } -#line 5120 "src/parser.c" +#line 5122 "src/parser.c" yy389: yyaccept = 32; yych = *(mrk = ++cur); @@ -5189,9 +5191,9 @@ yy389: default: goto yy61; } yy390: -#line 424 "src/parser.re" +#line 426 "src/parser.re" { NEWTOKEN(PSI_T_FALSE); goto start; } -#line 5195 "src/parser.c" +#line 5197 "src/parser.c" yy391: yyaccept = 5; yych = *(mrk = ++cur); @@ -5280,9 +5282,9 @@ yy393: default: goto yy61; } yy394: -#line 411 "src/parser.re" +#line 413 "src/parser.re" { NEWTOKEN(PSI_T_IFDEF); goto start; } -#line 5286 "src/parser.c" +#line 5288 "src/parser.c" yy395: yyaccept = 5; yych = *(mrk = ++cur); @@ -5379,9 +5381,9 @@ yy398: default: goto yy61; } yy399: -#line 426 "src/parser.re" +#line 428 "src/parser.re" { NEWTOKEN(PSI_T_MIXED); goto start; } -#line 5385 "src/parser.c" +#line 5387 "src/parser.c" yy400: yyaccept = 5; yych = *(mrk = ++cur); @@ -5582,9 +5584,9 @@ yy416: default: goto yy61; } yy417: -#line 418 "src/parser.re" +#line 420 "src/parser.re" { NEWTOKEN(PSI_T_UNDEF); goto start; } -#line 5588 "src/parser.c" +#line 5590 "src/parser.c" yy418: yyaccept = 5; yych = *(mrk = ++cur); @@ -5700,9 +5702,9 @@ yy424: default: goto yy61; } yy425: -#line 399 "src/parser.re" +#line 401 "src/parser.re" { NEWTOKEN(PSI_T_CONST); goto start; } -#line 5706 "src/parser.c" +#line 5708 "src/parser.c" yy426: yyaccept = 5; yych = *(mrk = ++cur); @@ -5784,9 +5786,9 @@ yy427: default: goto yy61; } yy428: -#line 406 "src/parser.re" +#line 408 "src/parser.re" { NEWTOKEN(PSI_T_FLOAT); goto start; } -#line 5790 "src/parser.c" +#line 5792 "src/parser.c" yy429: yyaccept = 5; yych = *(mrk = ++cur); @@ -5866,9 +5868,9 @@ yy430: default: goto yy61; } yy431: -#line 403 "src/parser.re" +#line 405 "src/parser.re" { NEWTOKEN(PSI_T_SHORT); goto start; } -#line 5872 "src/parser.c" +#line 5874 "src/parser.c" yy432: yyaccept = 5; yych = *(mrk = ++cur); @@ -5969,9 +5971,9 @@ yy436: default: goto yy61; } yy437: -#line 397 "src/parser.re" +#line 399 "src/parser.re" { NEWTOKEN(PSI_T_UNION); goto start; } -#line 5975 "src/parser.c" +#line 5977 "src/parser.c" yy438: yyaccept = 5; yych = *(mrk = ++cur); @@ -6058,9 +6060,9 @@ yy440: default: goto yy61; } yy441: -#line 449 "src/parser.re" +#line 451 "src/parser.re" { NEWTOKEN(PSI_T_ARRVAL); goto start; } -#line 6064 "src/parser.c" +#line 6066 "src/parser.c" yy442: yyaccept = 5; yych = *(mrk = ++cur); @@ -6157,9 +6159,9 @@ yy445: default: goto yy61; } yy446: -#line 453 "src/parser.re" +#line 455 "src/parser.re" { NEWTOKEN(PSI_T_CALLOC); goto start; } -#line 6163 "src/parser.c" +#line 6165 "src/parser.c" yy447: yyaccept = 42; yych = *(mrk = ++cur); @@ -6234,9 +6236,9 @@ yy447: default: goto yy61; } yy448: -#line 416 "src/parser.re" +#line 418 "src/parser.re" { NEWTOKEN(PSI_T_DEFINE); goto start; } -#line 6240 "src/parser.c" +#line 6242 "src/parser.c" yy449: yyaccept = 5; yych = *(mrk = ++cur); @@ -6325,9 +6327,9 @@ yy451: default: goto yy61; } yy452: -#line 412 "src/parser.re" +#line 414 "src/parser.re" { NEWTOKEN(PSI_T_IFNDEF); goto start; } -#line 6331 "src/parser.c" +#line 6333 "src/parser.c" yy453: yyaccept = 5; yych = *(mrk = ++cur); @@ -6408,9 +6410,9 @@ yy454: default: goto yy61; } yy455: -#line 446 "src/parser.re" +#line 448 "src/parser.re" { NEWTOKEN(PSI_T_INTVAL); goto start; } -#line 6414 "src/parser.c" +#line 6416 "src/parser.c" yy456: yyaccept = 45; yych = *(mrk = ++cur); @@ -6483,9 +6485,9 @@ yy456: default: goto yy61; } yy457: -#line 430 "src/parser.re" +#line 432 "src/parser.re" { NEWTOKEN(PSI_T_OBJECT); goto start; } -#line 6489 "src/parser.c" +#line 6491 "src/parser.c" yy458: yyaccept = 46; yych = *(mrk = ++cur); @@ -6558,9 +6560,9 @@ yy458: default: goto yy61; } yy459: -#line 450 "src/parser.re" +#line 452 "src/parser.re" { NEWTOKEN(PSI_T_OBJVAL); goto start; } -#line 6564 "src/parser.c" +#line 6566 "src/parser.c" yy460: yyaccept = 5; yych = *(mrk = ++cur); @@ -6657,9 +6659,9 @@ yy463: default: goto yy61; } yy464: -#line 439 "src/parser.re" +#line 441 "src/parser.re" { NEWTOKEN(PSI_T_RETURN); goto start; } -#line 6663 "src/parser.c" +#line 6665 "src/parser.c" yy465: yyaccept = 48; yych = *(mrk = ++cur); @@ -6732,9 +6734,9 @@ yy465: default: goto yy61; } yy466: -#line 432 "src/parser.re" +#line 434 "src/parser.re" { NEWTOKEN(PSI_T_STATIC); goto start; } -#line 6738 "src/parser.c" +#line 6740 "src/parser.c" yy467: yyaccept = 49; yych = *(mrk = ++cur); @@ -6807,9 +6809,9 @@ yy467: default: goto yy61; } yy468: -#line 428 "src/parser.re" +#line 430 "src/parser.re" { NEWTOKEN(PSI_T_STRING); goto start; } -#line 6813 "src/parser.c" +#line 6815 "src/parser.c" yy469: yyaccept = 50; yych = *(mrk = ++cur); @@ -6882,9 +6884,9 @@ yy469: default: goto yy61; } yy470: -#line 443 "src/parser.re" +#line 445 "src/parser.re" { NEWTOKEN(PSI_T_STRLEN); goto start; } -#line 6888 "src/parser.c" +#line 6890 "src/parser.c" yy471: yyaccept = 51; yych = *(mrk = ++cur); @@ -6957,9 +6959,9 @@ yy471: default: goto yy61; } yy472: -#line 444 "src/parser.re" +#line 446 "src/parser.re" { NEWTOKEN(PSI_T_STRVAL); goto start; } -#line 6963 "src/parser.c" +#line 6965 "src/parser.c" yy473: yyaccept = 5; yych = *(mrk = ++cur); @@ -7056,9 +7058,9 @@ yy476: default: goto yy61; } yy477: -#line 457 "src/parser.re" +#line 459 "src/parser.re" { NEWTOKEN(PSI_T_TO_INT); goto start; } -#line 7062 "src/parser.c" +#line 7064 "src/parser.c" yy478: yyaccept = 5; yych = *(mrk = ++cur); @@ -7190,9 +7192,9 @@ yy486: default: goto yy61; } yy487: -#line 407 "src/parser.re" +#line 409 "src/parser.re" { NEWTOKEN(PSI_T_DOUBLE); goto start; } -#line 7196 "src/parser.c" +#line 7198 "src/parser.c" yy488: yyaccept = 54; yych = *(mrk = ++cur); @@ -7265,9 +7267,9 @@ yy488: default: goto yy527; } yy489: -#line 386 "src/parser.re" +#line 388 "src/parser.re" { NEWTOKEN(PSI_T_PRAGMA); goto start; } -#line 7271 "src/parser.c" +#line 7273 "src/parser.c" yy490: yyaccept = 55; yych = *(mrk = ++cur); @@ -7340,9 +7342,9 @@ yy490: default: goto yy61; } yy491: -#line 409 "src/parser.re" +#line 411 "src/parser.re" { NEWTOKEN(PSI_T_SIGNED); goto start; } -#line 7346 "src/parser.c" +#line 7348 "src/parser.c" yy492: yyaccept = 56; yych = *(mrk = ++cur); @@ -7415,9 +7417,9 @@ yy492: default: goto yy61; } yy493: -#line 393 "src/parser.re" +#line 395 "src/parser.re" { NEWTOKEN(PSI_T_SIZEOF); goto start; } -#line 7421 "src/parser.c" +#line 7423 "src/parser.c" yy494: yyaccept = 57; yych = *(mrk = ++cur); @@ -7490,9 +7492,9 @@ yy494: default: goto yy61; } yy495: -#line 396 "src/parser.re" +#line 398 "src/parser.re" { NEWTOKEN(PSI_T_STRUCT); goto start; } -#line 7496 "src/parser.c" +#line 7498 "src/parser.c" yy496: yyaccept = 5; yych = *(mrk = ++cur); @@ -7586,9 +7588,9 @@ yy499: default: goto yy61; } yy500: -#line 448 "src/parser.re" +#line 450 "src/parser.re" { NEWTOKEN(PSI_T_BOOLVAL); goto start; } -#line 7592 "src/parser.c" +#line 7594 "src/parser.c" yy501: yyaccept = 5; yych = *(mrk = ++cur); @@ -7677,9 +7679,9 @@ yy503: default: goto yy61; } yy504: -#line 417 "src/parser.re" +#line 419 "src/parser.re" { NEWTOKEN(PSI_T_DEFINED); goto start; } -#line 7683 "src/parser.c" +#line 7685 "src/parser.c" yy505: yyaccept = 5; yych = *(mrk = ++cur); @@ -7769,9 +7771,9 @@ yy507: default: goto yy61; } yy508: -#line 421 "src/parser.re" +#line 423 "src/parser.re" { NEWTOKEN(PSI_T_INCLUDE); goto start; } -#line 7775 "src/parser.c" +#line 7777 "src/parser.c" yy509: yyaccept = 61; yych = *(mrk = ++cur); @@ -7844,9 +7846,9 @@ yy509: default: goto yy61; } yy510: -#line 445 "src/parser.re" +#line 447 "src/parser.re" { NEWTOKEN(PSI_T_PATHVAL); goto start; } -#line 7850 "src/parser.c" +#line 7852 "src/parser.c" yy511: yyaccept = 5; yych = *(mrk = ++cur); @@ -7943,9 +7945,9 @@ yy514: default: goto yy61; } yy515: -#line 459 "src/parser.re" +#line 461 "src/parser.re" { NEWTOKEN(PSI_T_TO_BOOL); goto start; } -#line 7949 "src/parser.c" +#line 7951 "src/parser.c" yy516: yyaccept = 5; yych = *(mrk = ++cur); @@ -8042,9 +8044,9 @@ yy519: default: goto yy61; } yy520: -#line 419 "src/parser.re" +#line 421 "src/parser.re" { NEWTOKEN(PSI_T_WARNING); goto start; } -#line 8048 "src/parser.c" +#line 8050 "src/parser.c" yy521: yyaccept = 64; yych = *(mrk = ++cur); @@ -8117,9 +8119,9 @@ yy521: default: goto yy61; } yy522: -#line 391 "src/parser.re" +#line 393 "src/parser.re" { NEWTOKEN(PSI_T_CPP_ASM); goto start; } -#line 8123 "src/parser.c" +#line 8125 "src/parser.c" yy523: yyaccept = 5; yych = *(mrk = ++cur); @@ -8294,9 +8296,9 @@ yy529: default: goto yy61; } yy530: -#line 395 "src/parser.re" +#line 397 "src/parser.re" { NEWTOKEN(PSI_T_TYPEDEF); goto start; } -#line 8300 "src/parser.c" +#line 8302 "src/parser.c" yy531: yyaccept = 5; yych = *(mrk = ++cur); @@ -8383,9 +8385,9 @@ yy533: default: goto yy61; } yy534: -#line 427 "src/parser.re" +#line 429 "src/parser.re" { NEWTOKEN(PSI_T_CALLABLE); goto start; } -#line 8389 "src/parser.c" +#line 8391 "src/parser.c" yy535: yyaccept = 67; yych = *(mrk = ++cur); @@ -8458,9 +8460,9 @@ yy535: default: goto yy61; } yy536: -#line 431 "src/parser.re" +#line 433 "src/parser.re" { NEWTOKEN(PSI_T_CALLBACK); goto start; } -#line 8464 "src/parser.c" +#line 8466 "src/parser.c" yy537: yyaccept = 68; yych = *(mrk = ++cur); @@ -8533,9 +8535,9 @@ yy537: default: goto yy61; } yy538: -#line 447 "src/parser.re" +#line 449 "src/parser.re" { NEWTOKEN(PSI_T_FLOATVAL); goto start; } -#line 8539 "src/parser.c" +#line 8541 "src/parser.c" yy539: yyaccept = 69; yych = *(mrk = ++cur); @@ -8608,9 +8610,9 @@ yy539: default: goto yy61; } yy540: -#line 433 "src/parser.re" +#line 435 "src/parser.re" { NEWTOKEN(PSI_T_FUNCTION); goto start; } -#line 8614 "src/parser.c" +#line 8616 "src/parser.c" yy541: yyaccept = 5; yych = *(mrk = ++cur); @@ -8707,9 +8709,9 @@ yy544: default: goto yy61; } yy545: -#line 455 "src/parser.re" +#line 457 "src/parser.re" { NEWTOKEN(PSI_T_TO_ARRAY); goto start; } -#line 8713 "src/parser.c" +#line 8715 "src/parser.c" yy546: yyaccept = 71; yych = *(mrk = ++cur); @@ -8782,9 +8784,9 @@ yy546: default: goto yy61; } yy547: -#line 458 "src/parser.re" +#line 460 "src/parser.re" { NEWTOKEN(PSI_T_TO_FLOAT); goto start; } -#line 8788 "src/parser.c" +#line 8790 "src/parser.c" yy548: yyaccept = 5; yych = *(mrk = ++cur); @@ -8887,9 +8889,9 @@ yy552: default: goto yy61; } yy553: -#line 388 "src/parser.re" +#line 390 "src/parser.re" { NEWTOKEN(PSI_T_CPP_INLINE); goto start; } -#line 8893 "src/parser.c" +#line 8895 "src/parser.c" yy554: yyaccept = 5; yych = *(mrk = ++cur); @@ -9044,9 +9046,9 @@ yy557: default: goto yy61; } yy558: -#line 408 "src/parser.re" +#line 410 "src/parser.re" { NEWTOKEN(PSI_T_UNSIGNED); goto start; } -#line 9050 "src/parser.c" +#line 9052 "src/parser.c" yy559: yyaccept = 74; yych = *(mrk = ++cur); @@ -9119,9 +9121,9 @@ yy559: default: goto yy61; } yy560: -#line 392 "src/parser.re" +#line 394 "src/parser.re" { NEWTOKEN(PSI_T_VOLATILE); goto start; } -#line 9125 "src/parser.c" +#line 9127 "src/parser.c" yy561: yyaccept = 5; yych = *(mrk = ++cur); @@ -9218,9 +9220,9 @@ yy564: default: goto yy61; } yy565: -#line 454 "src/parser.re" +#line 456 "src/parser.re" { NEWTOKEN(PSI_T_TO_OBJECT); goto start; } -#line 9224 "src/parser.c" +#line 9226 "src/parser.c" yy566: yyaccept = 76; yych = *(mrk = ++cur); @@ -9293,9 +9295,9 @@ yy566: default: goto yy61; } yy567: -#line 456 "src/parser.re" +#line 458 "src/parser.re" { NEWTOKEN(PSI_T_TO_STRING); goto start; } -#line 9299 "src/parser.c" +#line 9301 "src/parser.c" yy568: yyaccept = 5; yych = *(mrk = ++cur); @@ -9480,9 +9482,9 @@ yy574: default: goto yy61; } yy575: -#line 437 "src/parser.re" +#line 439 "src/parser.re" { NEWTOKEN(PSI_T_PRE_ASSERT); goto start; } -#line 9486 "src/parser.c" +#line 9488 "src/parser.c" yy576: yyaccept = 5; yych = *(mrk = ++cur); @@ -9569,9 +9571,9 @@ yy578: default: goto yy61; } yy579: -#line 389 "src/parser.re" +#line 391 "src/parser.re" { NEWTOKEN(PSI_T_CPP_RESTRICT); goto start; } -#line 9575 "src/parser.c" +#line 9577 "src/parser.c" yy580: yyaccept = 5; mrk = ++cur; @@ -9727,9 +9729,9 @@ yy582: default: goto yy61; } yy583: -#line 438 "src/parser.re" +#line 440 "src/parser.re" { NEWTOKEN(PSI_T_POST_ASSERT); goto start; } -#line 9733 "src/parser.c" +#line 9735 "src/parser.c" yy584: yyaccept = 5; yych = *(mrk = ++cur); @@ -9819,9 +9821,9 @@ yy586: default: goto yy527; } yy587: -#line 387 "src/parser.re" +#line 389 "src/parser.re" { NEWTOKEN(PSI_T_PRAGMA_ONCE); goto start; } -#line 9825 "src/parser.c" +#line 9827 "src/parser.c" yy588: yyaccept = 81; yych = *(mrk = ++cur); @@ -9894,9 +9896,9 @@ yy588: default: goto yy61; } yy589: -#line 422 "src/parser.re" +#line 424 "src/parser.re" { NEWTOKEN(PSI_T_INCLUDE_NEXT); goto start; } -#line 9900 "src/parser.c" +#line 9902 "src/parser.c" yy590: yyaccept = 5; yych = *(mrk = ++cur); @@ -9993,9 +9995,9 @@ yy593: default: goto yy61; } yy594: -#line 390 "src/parser.re" +#line 392 "src/parser.re" { NEWTOKEN(PSI_T_CPP_EXTENSION); goto start; } -#line 9999 "src/parser.c" +#line 10001 "src/parser.c" yy595: ++cur; if ((lim - cur) < 2) if (cur >= lim) goto done;; @@ -10015,16 +10017,16 @@ yy597: } yy598: ++cur; -#line 464 "src/parser.re" +#line 466 "src/parser.re" { parens = 2; goto cpp_attribute; } -#line 10021 "src/parser.c" +#line 10023 "src/parser.c" } -#line 470 "src/parser.re" +#line 472 "src/parser.re" character: ; -#line 10028 "src/parser.c" +#line 10030 "src/parser.c" { unsigned char yych; if (lim <= cur) if (cur >= lim) goto done;; @@ -10038,17 +10040,17 @@ yy598: } yy602: ++cur; -#line 488 "src/parser.re" +#line 490 "src/parser.re" { escaped = false; goto character; } -#line 10044 "src/parser.c" +#line 10046 "src/parser.c" yy604: ++cur; -#line 475 "src/parser.re" +#line 477 "src/parser.re" { NEWLINE(); goto character; } -#line 10049 "src/parser.c" +#line 10051 "src/parser.c" yy606: ++cur; -#line 477 "src/parser.re" +#line 479 "src/parser.re" { if (escaped) { escaped = false; @@ -10060,19 +10062,19 @@ yy606: token->flags = char_width; goto start; } -#line 10064 "src/parser.c" +#line 10066 "src/parser.c" yy608: ++cur; -#line 476 "src/parser.re" +#line 478 "src/parser.re" { escaped = !escaped; goto character; } -#line 10069 "src/parser.c" +#line 10071 "src/parser.c" } -#line 490 "src/parser.re" +#line 492 "src/parser.re" string: ; -#line 10076 "src/parser.c" +#line 10078 "src/parser.c" { unsigned char yych; if (lim <= cur) if (cur >= lim) goto done;; @@ -10086,17 +10088,17 @@ yy608: } yy612: ++cur; -#line 508 "src/parser.re" +#line 510 "src/parser.re" { escaped = false; goto string; } -#line 10092 "src/parser.c" +#line 10094 "src/parser.c" yy614: ++cur; -#line 495 "src/parser.re" +#line 497 "src/parser.re" { NEWLINE(); goto string; } -#line 10097 "src/parser.c" +#line 10099 "src/parser.c" yy616: ++cur; -#line 497 "src/parser.re" +#line 499 "src/parser.re" { if (escaped) { escaped = false; @@ -10108,19 +10110,19 @@ yy616: token->flags = char_width; goto start; } -#line 10112 "src/parser.c" +#line 10114 "src/parser.c" yy618: ++cur; -#line 496 "src/parser.re" +#line 498 "src/parser.re" { escaped = !escaped; goto string; } -#line 10117 "src/parser.c" +#line 10119 "src/parser.c" } -#line 510 "src/parser.re" +#line 512 "src/parser.re" comment: ; -#line 10124 "src/parser.c" +#line 10126 "src/parser.c" { unsigned char yych; if ((lim - cur) < 2) if (cur >= lim) goto done;; @@ -10134,14 +10136,14 @@ yy618: yy622: ++cur; yy623: -#line 517 "src/parser.re" +#line 519 "src/parser.re" { goto comment; } -#line 10140 "src/parser.c" +#line 10142 "src/parser.c" yy624: ++cur; -#line 515 "src/parser.re" +#line 517 "src/parser.re" { NEWLINE(); goto comment; } -#line 10145 "src/parser.c" +#line 10147 "src/parser.c" yy626: yych = *++cur; switch (yych) { @@ -10150,16 +10152,16 @@ yy626: } yy627: ++cur; -#line 516 "src/parser.re" +#line 518 "src/parser.re" { NEWTOKEN(PSI_T_COMMENT); goto start; } -#line 10156 "src/parser.c" +#line 10158 "src/parser.c" } -#line 519 "src/parser.re" +#line 521 "src/parser.re" comment_sl: ; -#line 10163 "src/parser.c" +#line 10165 "src/parser.c" { unsigned char yych; if (lim <= cur) if (cur >= lim) goto done;; @@ -10171,22 +10173,22 @@ yy627: } yy631: ++cur; -#line 525 "src/parser.re" +#line 527 "src/parser.re" { goto comment_sl; } -#line 10177 "src/parser.c" +#line 10179 "src/parser.c" yy633: ++cur; -#line 524 "src/parser.re" +#line 526 "src/parser.re" { NEWTOKEN(PSI_T_COMMENT); NEWLINE(); goto start; } -#line 10182 "src/parser.c" +#line 10184 "src/parser.c" } -#line 527 "src/parser.re" +#line 529 "src/parser.re" cpp_attribute: ; -#line 10190 "src/parser.c" +#line 10192 "src/parser.c" { unsigned char yych; if (lim <= cur) if (cur >= lim) goto done;; @@ -10200,26 +10202,26 @@ yy633: } yy637: ++cur; -#line 536 "src/parser.re" +#line 538 "src/parser.re" { goto cpp_attribute; } -#line 10206 "src/parser.c" +#line 10208 "src/parser.c" yy639: ++cur; -#line 535 "src/parser.re" +#line 537 "src/parser.re" { NEWLINE(); goto cpp_attribute; } -#line 10211 "src/parser.c" +#line 10213 "src/parser.c" yy641: ++cur; -#line 533 "src/parser.re" +#line 535 "src/parser.re" { ++parens; goto cpp_attribute; } -#line 10216 "src/parser.c" +#line 10218 "src/parser.c" yy643: ++cur; -#line 534 "src/parser.re" +#line 536 "src/parser.re" { if (parens == 1) { NEWTOKEN(PSI_T_CPP_ATTRIBUTE); goto start; } else { --parens; goto cpp_attribute; } } -#line 10221 "src/parser.c" +#line 10223 "src/parser.c" } -#line 538 "src/parser.re" +#line 540 "src/parser.re" error: ; diff --git a/src/parser.h b/src/parser.h index 261b2b9..7aef5f5 100644 --- a/src/parser.h +++ b/src/parser.h @@ -51,6 +51,16 @@ struct psi_parser_input { char buffer[1]; }; +static inline void psi_parser_input_free(struct psi_parser_input **I) { + if (*I) { + struct psi_parser_input *i = *I; + + *I = NULL; + zend_string_release(i->file); + free(i); + } +} + struct psi_parser *psi_parser_init(struct psi_parser *P, psi_error_cb error, unsigned flags); struct psi_parser_input *psi_parser_open_file(struct psi_parser *P, const char *filename, bool report_errors); struct psi_parser_input *psi_parser_open_string(struct psi_parser *P, const char *string, size_t length); diff --git a/src/parser.re b/src/parser.re index 2085a12..926cc7c 100644 --- a/src/parser.re +++ b/src/parser.re @@ -164,19 +164,20 @@ void psi_parser_postprocess(struct psi_parser *P) struct psi_const *cnst; struct psi_num_exp *num; smart_str ns_name = {0}; - zend_string *name_str; + zend_string *name_str, *type_str; smart_str_appendl_ex(&ns_name, ZEND_STRL("psi\\"), 1); smart_str_append_ex(&ns_name, name, 1); name_str = smart_str_extract(&ns_name); + type_str = zend_string_init(ZEND_STRL(""), 1); num = psi_num_exp_copy(scope.macro->exp); def = psi_impl_def_val_init(PSI_T_NUMBER, num); - type = psi_impl_type_init(PSI_T_NUMBER, - zend_string_init(ZEND_STRL(""), 1)); + type = psi_impl_type_init(PSI_T_NUMBER, type_str); cnst = psi_const_init(type, name_str, def); P->consts = psi_plist_add(P->consts, &cnst); zend_string_release(name_str); + zend_string_release(type_str); } } else { if (psi_plist_count(scope.macro->tokens) == 1) { @@ -188,18 +189,19 @@ void psi_parser_postprocess(struct psi_parser *P) struct psi_impl_def_val *def; struct psi_const *cnst; smart_str ns_name = {0}; - zend_string *name_str; + zend_string *name_str, *type_str; smart_str_appendl_ex(&ns_name, ZEND_STRL("psi\\"), 1); smart_str_append_ex(&ns_name, name, 1); name_str = smart_str_extract(&ns_name); + type_str = zend_string_init(ZEND_STRL("string"), 1); - type = psi_impl_type_init(PSI_T_STRING, - zend_string_init(ZEND_STRL("string"), 1)); + type = psi_impl_type_init(PSI_T_STRING, type_str); def = psi_impl_def_val_init(PSI_T_QUOTED_STRING, t->text); cnst = psi_const_init(type, name_str, def); P->consts = psi_plist_add(P->consts, &cnst); zend_string_release(name_str); + zend_string_release(type_str); } } } diff --git a/src/parser_proc.c b/src/parser_proc.c index ff70d2b..b239d6d 100644 --- a/src/parser_proc.c +++ b/src/parser_proc.c @@ -151,7 +151,7 @@ static inline void psi_parser_proc_deanon_typedef(struct psi_decl_arg *def) default: return; } - free(def->type->name); + zend_string_release(def->type->name); def->type->name = zend_string_copy(def->var->name); } static inline void psi_parser_proc_add_typedef(struct psi_parser *P, struct psi_decl_arg *def) diff --git a/src/parser_proc_grammar.y b/src/parser_proc_grammar.y index 7101d0e..32e673b 100644 --- a/src/parser_proc_grammar.y +++ b/src/parser_proc_grammar.y @@ -60,7 +60,7 @@ static inline void psi_parser_proc_deanon_typedef(struct psi_decl_arg *def) default: return; } - free(def->type->name); + zend_string_release(def->type->name); def->type->name = zend_string_copy(def->var->name); } static inline void psi_parser_proc_add_typedef(struct psi_parser *P, struct psi_decl_arg *def) diff --git a/src/token.c b/src/token.c index 95eaf7a..29dcb42 100644 --- a/src/token.c +++ b/src/token.c @@ -91,7 +91,7 @@ struct psi_token *psi_token_cat(const char *sep, unsigned argc, ...) { T->type = PSI_T_NAME; T->file = zend_string_copy(T->file); - for (i = 0; i < argc; ++i) { + for (i = 1; i < argc; ++i) { struct psi_token *arg = va_arg(argv, struct psi_token *); if (sep_len && text.a) { @@ -173,7 +173,7 @@ static inline uint64_t psi_hash(char *digest_buf, ...) uint64_t psi_token_hash(struct psi_token *t, char *digest_buf) { char loc_buf[48]; - sprintf(digest_buf, "%u%u", t->line, t->col); + sprintf(loc_buf, "%u%u", t->line, t->col); return psi_hash(digest_buf, t->file->val, loc_buf, (char *) NULL); } diff --git a/src/types/cpp_exp.c b/src/types/cpp_exp.c index 2df4854..ded4db5 100644 --- a/src/types/cpp_exp.c +++ b/src/types/cpp_exp.c @@ -73,10 +73,6 @@ void psi_cpp_exp_free(struct psi_cpp_exp **exp_ptr) switch (exp->type) { case PSI_T_WARNING: case PSI_T_ERROR: - if (!exp->data.tok) { - break; - } - /* no break */ case PSI_T_UNDEF: case PSI_T_IFDEF: case PSI_T_IFNDEF: diff --git a/src/types/decl.c b/src/types/decl.c index 56ba81d..581eadd 100644 --- a/src/types/decl.c +++ b/src/types/decl.c @@ -158,10 +158,11 @@ bool psi_decl_validate_nodl(struct psi_data *data, struct psi_decl *decl, struct psi_validate_scope *scope) { if (!decl->abi) { - decl->abi = psi_decl_abi_init(zend_string_init(ZEND_STRL("default"), 1)); + decl->abi = psi_decl_abi_init(NULL); } else if (!psi_decl_abi_validate(data, decl->abi)) { data->error(data, decl->abi->token, PSI_WARNING, - "Invalid calling convention: '%s'", decl->abi->token->text->val); + "Invalid calling convention: '%s'", + decl->abi->token->text->val); return false; } if (!psi_decl_arg_validate(data, decl->func, scope)) { diff --git a/src/types/decl_abi.c b/src/types/decl_abi.c index 75de9da..bf05239 100644 --- a/src/types/decl_abi.c +++ b/src/types/decl_abi.c @@ -29,7 +29,9 @@ struct psi_decl_abi *psi_decl_abi_init(zend_string *convention) { struct psi_decl_abi *abi = calloc(1, sizeof(*abi)); - abi->convention = zend_string_copy(convention); + abi->convention = convention + ? zend_string_copy(convention) + : zend_string_init(ZEND_STRL("default"), 1); return abi; } diff --git a/src/types/decl_arg.c b/src/types/decl_arg.c index f9ed347..4049038 100644 --- a/src/types/decl_arg.c +++ b/src/types/decl_arg.c @@ -264,7 +264,7 @@ struct psi_decl_arg *psi_decl_arg_get_by_var(struct psi_decl_var *var, return var->arg = arg; } - if (func && !zend_string_equals(var->name, func->var->name)) { + if (func && zend_string_equals(var->name, func->var->name)) { return var->arg = func; } diff --git a/src/types/decl_extvar.c b/src/types/decl_extvar.c index c21226e..fc4a5ef 100644 --- a/src/types/decl_extvar.c +++ b/src/types/decl_extvar.c @@ -115,8 +115,8 @@ void psi_decl_extvar_dump(int fd, struct psi_decl_extvar *evar) struct psi_decl *psi_decl_extvar_setter(struct psi_decl_extvar *evar) { - struct psi_decl_type *func_type = psi_decl_type_init(PSI_T_VOID, - zend_string_init(ZEND_STRS("void"), 1)); + zend_string *type_str = zend_string_init(ZEND_STRS("void"), 1); + struct psi_decl_type *func_type = psi_decl_type_init(PSI_T_VOID, type_str); struct psi_decl_var *func_var = psi_decl_var_copy(evar->arg->var); struct psi_decl_arg *func = psi_decl_arg_init(func_type, func_var); struct psi_decl_type *arg_type = psi_decl_type_copy(evar->arg->type); @@ -126,6 +126,8 @@ struct psi_decl *psi_decl_extvar_setter(struct psi_decl_extvar *evar) struct psi_decl *decl = psi_decl_init(func, psi_plist_add(args, &arg)); smart_str name = {0}; + zend_string_release(type_str); + func_var->pointer_level = 0; func_var->array_size = 0; @@ -153,7 +155,7 @@ struct psi_decl *psi_decl_extvar_getter(struct psi_decl_extvar *evar) smart_str name = {0}; smart_str_append_ex(&name, func_var->name, 1); - smart_str_appendl_ex(&name, ZEND_STRL("_set"), 1); + smart_str_appendl_ex(&name, ZEND_STRL("_get"), 1); zend_string_release(func_var->name); func_var->name = smart_str_extract(&name); diff --git a/src/types/decl_struct.c b/src/types/decl_struct.c index cfe46c9..c2b8cc1 100644 --- a/src/types/decl_struct.c +++ b/src/types/decl_struct.c @@ -177,7 +177,7 @@ bool psi_decl_struct_validate(struct psi_data *data, struct psi_decl_struct *s, align = psi_decl_arg_align(darg, &pos, &len); if (darg->layout) { - if (darg->layout->pos != pos) { + if (darg->layout->pos != pos && !darg->layout->bfw) { data->error(data, darg->token, PSI_WARNING, "Computed offset %zu of %s.%s does not match" " pre-defined offset %zu", diff --git a/src/types/let_func.c b/src/types/let_func.c index 468d215..ae8832f 100644 --- a/src/types/let_func.c +++ b/src/types/let_func.c @@ -139,6 +139,7 @@ static inline bool validate_let_func_inner(struct psi_data *data, if (name) { sub_arg = psi_decl_arg_get_by_name(sub_args, name); + zend_string_release(name); } if (!name || !sub_arg) { /* remove expr for portability with different struct members */ diff --git a/src/types/number.c b/src/types/number.c index e877e40..15505e2 100644 --- a/src/types/number.c +++ b/src/types/number.c @@ -156,9 +156,7 @@ void psi_number_free(struct psi_number **exp_ptr) struct psi_number *exp = *exp_ptr; *exp_ptr = NULL; - if (exp->token) { - free(exp->token); - } + psi_token_free(&exp->token); switch (exp->type) { case PSI_T_INT8: case PSI_T_UINT8: diff --git a/src/types/return_exp.c b/src/types/return_exp.c index 78e1aa5..375f096 100644 --- a/src/types/return_exp.c +++ b/src/types/return_exp.c @@ -106,7 +106,7 @@ static inline bool psi_return_exp_validate_decl_args(struct psi_data *data, if (exp->args) { if (psi_plist_count(exp->args) != psi_plist_count(impl->decl->args)) { data->error(data, exp->token, PSI_WARNING, - "Argument count of return statement of implementation '%s'" + "Argument count of return statement of implementation '%s' " "does not match argument count of declaration '%s'", impl->func->name->val, impl->decl->func->var->name->val); return false;