From 4c79fe6afa25c87f89b46d48968fdaf36b085f8c Mon Sep 17 00:00:00 2001 From: Bob Weinand Date: Sun, 8 Jun 2014 20:34:30 +0000 Subject: Updated parser & leer to be usable with re2c Fixes some weird temporary compilation errors too --- phpdbg_prompt.c | 35 ++++------------------------------- 1 file changed, 4 insertions(+), 31 deletions(-) (limited to 'phpdbg_prompt.c') diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c index 7a28a75129..3fbda219d1 100644 --- a/phpdbg_prompt.c +++ b/phpdbg_prompt.c @@ -248,20 +248,10 @@ void phpdbg_try_file_init(char *init_file, size_t init_file_len, zend_bool free_ char *why = NULL; char *input = phpdbg_read_input(cmd TSRMLS_CC); phpdbg_param_t stack; - yyscan_t scanner; - YY_BUFFER_STATE state; phpdbg_init_param(&stack, STACK_PARAM); - - if (yylex_init(&scanner)) { - phpdbg_error( - "could not initialize scanner"); - break; - } - state = yy_scan_string(input, scanner); - - if (yyparse(&stack, scanner) <= 0) { + if (phpdbg_do_parse(&stack, input) <= 0) { switch (phpdbg_stack_execute(&stack, &why TSRMLS_CC)) { case FAILURE: // if (!(PHPDBG_G(flags) & PHPDBG_IS_QUITTING)) { @@ -274,15 +264,12 @@ void phpdbg_try_file_init(char *init_file, size_t init_file_len, zend_bool free_ break; } } - + if (why) { free(why); why = NULL; } - - yy_delete_buffer(state, scanner); - yylex_destroy(scanner); - + phpdbg_stack_free(&stack); phpdbg_destroy_input(&input TSRMLS_CC); } @@ -1014,20 +1001,9 @@ int phpdbg_interactive(TSRMLS_D) /* {{{ */ if (input) { do { - yyscan_t scanner; - YY_BUFFER_STATE state; - phpdbg_init_param(&stack, STACK_PARAM); - if (yylex_init(&scanner)) { - phpdbg_error( - "could not initialize scanner"); - return FAILURE; - } - - state = yy_scan_string(input, scanner); - - if (yyparse(&stack, scanner) <= 0) { + if (phpdbg_do_parse(&stack, input) <= 0) { switch (ret = phpdbg_stack_execute(&stack, &why TSRMLS_CC)) { case FAILURE: if (!(PHPDBG_G(flags) & PHPDBG_IS_QUITTING)) { @@ -1061,9 +1037,6 @@ int phpdbg_interactive(TSRMLS_D) /* {{{ */ why = NULL; } - yy_delete_buffer(state, scanner); - yylex_destroy(scanner); - phpdbg_stack_free(&stack); phpdbg_destroy_input(&input TSRMLS_CC); -- cgit v1.2.1