]> granicus.if.org Git - php/commitdiff
execute new stack now
authorkrakjoe <joe.watkins@live.co.uk>
Tue, 18 Feb 2014 19:48:33 +0000 (19:48 +0000)
committerkrakjoe <joe.watkins@live.co.uk>
Tue, 18 Feb 2014 19:48:33 +0000 (19:48 +0000)
12 files changed:
dev/phpdbg_lexer.l
dev/phpdbg_parser.y
phpdbg.h
phpdbg_bp.c
phpdbg_cmd.c
phpdbg_cmd.h
phpdbg_help.c
phpdbg_lexer.c
phpdbg_parser.c
phpdbg_parser.h
phpdbg_prompt.c
phpdbg_set.c

index bf74cbdc68138e52744ddde2e3eecad99c8ef465..46137d6676878486f4362de7f0392393f9934b4e 100644 (file)
@@ -34,7 +34,7 @@ C_SHELL                               ?i:"shell"
 C_IF                           ?i:"if"
 
 DIGITS                         [0-9]+
-ID                                     [a-zA-Z_\x7f-\xff\-][a-zA-Z0-9_\x7f-\xff\-]*
+ID                                     [a-zA-Z_\x7f-\xff\-][a-zA-Z0-9_\x7f-\xff\-\./]*
 NSID                           [\\\\]?{ID}
 METHOD                         {NSID}+::{ID}
 NUMERIC_METHOD         {METHOD}[#]{DIGITS}
index 24bcc685372745ac6fac24314c4c63b2337e0265..49925f6709838559b67f96f8f415243fd450ec12 100644 (file)
@@ -111,7 +111,7 @@ static void phpdbg_stack_push(phpdbg_param_t *stack, phpdbg_param_t *param) {
                next->top = stack->top;
                stack->top = next;
        }
-       phpdbg_debug_param(next, "push ->");
+       
        stack->len++;
 }
 
@@ -146,16 +146,10 @@ phpdbg_command_t* phpdbg_stack_resolve(const phpdbg_command_t *commands, phpdbg_
                        if (matched[0]->subs && (*top) && ((*top)->type == STR_PARAM)) {
                                command = phpdbg_stack_resolve(matched[0]->subs, top, why);
                                if (command) {
-                                       phpdbg_notice(
-                                               "Command matching with sub command %s %s", 
-                                               matched[0]->name, command->name);
                                        return command;
                                }
                        }
                        
-                       phpdbg_notice(
-                               "Command matching with %s", 
-                               matched[0]->name);
                        return matched[0];
                } break;
                
@@ -191,29 +185,17 @@ int phpdbg_stack_execute(phpdbg_param_t *stack, char **why) {
        
        switch (command->type) {
                case EVAL_PARAM:
-                       PHPDBG_COMMAND_HANDLER(eval)(command, NULL TSRMLS_CC);
-               break;
+                       return PHPDBG_COMMAND_HANDLER(eval)(command, NULL TSRMLS_CC);
                
                case SHELL_PARAM:
-                       PHPDBG_COMMAND_HANDLER(shell)(command, NULL TSRMLS_CC);
-               break;
+                       return PHPDBG_COMMAND_HANDLER(shell)(command, NULL TSRMLS_CC);
                
                case STR_PARAM: {
-                       /* do resolve command(s) */
                        handler = phpdbg_stack_resolve(
                                phpdbg_prompt_commands, &command, why);
                        
                        if (handler) {
-                               /* get top of stack */
-                               params = command;
-                               
-                               /* prepare params */
-                               while (params) {
-                                       phpdbg_debug_param(params, "-> ...");
-                                       params = params->next;
-                               }
-                               
-                               return SUCCESS;
+                               return handler->handler(command, NULL TSRMLS_CC);
                        } else {
                                return FAILURE;
                        }
index 68c505ca6367e7dcc7983a5165aa015994bf2bef..414500cab729da702edd5d627e96a931bb663b35 100644 (file)
--- a/phpdbg.h
+++ b/phpdbg.h
 #define PHPDBG_STDERR                  2
 #define PHPDBG_IO_FDS                  3 /* }}} */
 
+
 /* {{{ structs */
 ZEND_BEGIN_MODULE_GLOBALS(phpdbg)
        HashTable bp[PHPDBG_BREAK_TABLES];           /* break points */
index 609644548fa816e8f7d5720205b909a85f2c9b42..acb53450cb290271c3154189d6b8de108892f54d 100644 (file)
@@ -762,6 +762,7 @@ PHPDBG_API void phpdbg_set_breakpoint_expression(const char *expr, size_t expr_l
 
 PHPDBG_API void phpdbg_set_breakpoint_at(const phpdbg_param_t *param, const phpdbg_input_t *input TSRMLS_DC) /* {{{ */
 {
+       /*
        if (input->argc > 3 && phpdbg_argv_is(2, "if")) {
                phpdbg_breakcond_t new_break;
                phpdbg_param_t new_param;
@@ -776,7 +777,6 @@ PHPDBG_API void phpdbg_set_breakpoint_at(const phpdbg_param_t *param, const phpd
                expr_hash = zend_inline_hash_func(expr, expr_len);
 
                {
-                       /* get a clean parameter from input string */
                        size_t sparam_len = 0L;
                        char *sparam = input->string;
 
@@ -791,7 +791,7 @@ PHPDBG_API void phpdbg_set_breakpoint_at(const phpdbg_param_t *param, const phpd
                                                &new_param TSRMLS_CC);
                                        goto usage;
 
-                               default: { /* do nothing */ } break;
+                               default: {  } break;
                        }
 
                        expr_hash += phpdbg_hash_param(&new_param TSRMLS_CC);
@@ -810,6 +810,7 @@ PHPDBG_API void phpdbg_set_breakpoint_at(const phpdbg_param_t *param, const phpd
 usage:
                phpdbg_error("usage: break at <func|method|file:line|address> if <expression>");
        }
+       */
 } /* }}} */
 
 static inline phpdbg_breakbase_t *phpdbg_find_breakpoint_file(zend_op_array *op_array TSRMLS_DC) /* {{{ */
index 526d1183a572098b2914344e6799b7215278e20f..dde0c813fa8f0336aaa7de5be42f7303bebda1c9 100644 (file)
 #include "phpdbg_cmd.h"
 #include "phpdbg_utils.h"
 #include "phpdbg_set.h"
-#include "phpdbg_parser.h"
-#include "phpdbg_lexer.h"
-
-int phpdbg_stack_execute(phpdbg_param_t *stack, char **why);
-void phpdbg_stack_free(phpdbg_param_t *stack);
-int yyparse(phpdbg_param_t *stack, yyscan_t scanner);
 
 ZEND_EXTERN_MODULE_GLOBALS(phpdbg);
 
@@ -382,106 +376,13 @@ PHPDBG_API zend_bool phpdbg_match_param(const phpdbg_param_t *l, const phpdbg_pa
        return 0;
 } /* }}} */
 
-PHPDBG_API phpdbg_input_t **phpdbg_read_argv(char *buffer, int *argc TSRMLS_DC) /* {{{ */
-{
-       char *p;
-       char b[PHPDBG_MAX_CMD];
-       int l=0;
-       enum states {
-               IN_BETWEEN,
-               IN_WORD,
-               IN_STRING
-       } state = IN_BETWEEN;
-       phpdbg_input_t **argv = NULL;
-
-       argv = (phpdbg_input_t**) emalloc(sizeof(phpdbg_input_t*));
-       (*argc) = 0;
-
-#define RESET_STATE() do { \
-       phpdbg_input_t *arg = emalloc(sizeof(phpdbg_input_t)); \
-       if (arg) { \
-               b[l]=0; \
-               arg->length = l; \
-               arg->string = estrndup(b, arg->length); \
-               arg->argv = NULL; \
-               arg->argc = 0; \
-               argv = (phpdbg_input_t**) erealloc(argv, sizeof(phpdbg_input_t*) * ((*argc)+1)); \
-               argv[(*argc)++] = arg; \
-               l = 0; \
-       } \
-       state = IN_BETWEEN; \
-} while (0)
-
-       for (p = buffer; *p != '\0'; p++) {
-               int c = (unsigned char) *p;
-               switch (state) {
-                       case IN_BETWEEN:
-                               if (isspace(c)) {
-                                       continue;
-                               }
-                               if (c == '"') {
-                                       state = IN_STRING;
-                                       continue;
-                               }
-                               state = IN_WORD;
-                               b[l++]=c;
-                               continue;
-
-                       case IN_STRING:
-                               if (c == '"') {
-                                       if (buffer[(p - buffer)-1] == '\\') {
-                                               b[l-1]=c;
-                                               continue;
-                                       }
-                                       RESET_STATE();
-                               } else {
-                                       b[l++]=c;
-                               }
-                               continue;
-
-                       case IN_WORD:
-                               if (isspace(c)) {
-                                       RESET_STATE();
-                               } else {
-                                       b[l++]=c;
-                               }
-                               continue;
-               }
-       }
-
-       switch (state) {
-               case IN_WORD: {
-                       RESET_STATE();
-               } break;
-
-               case IN_STRING:
-                       phpdbg_error(
-                               "Malformed command line (unclosed quote) @ %ld: %s!",
-                               (p - buffer)-1, &buffer[(p - buffer)-1]);
-               break;
-
-               case IN_BETWEEN:
-               break;
-       }
-
-       if ((*argc) == 0) {
-               /* not needed */
-               efree(argv);
-
-               /* to be sure */
-               return NULL;
-       }
-
-       return argv;
-} /* }}} */
-
-PHPDBG_API phpdbg_input_t *phpdbg_read_input(char *buffered TSRMLS_DC) /* {{{ */
+PHPDBG_API char* phpdbg_read_input(char *buffered TSRMLS_DC) /* {{{ */
 {
-       phpdbg_input_t *buffer = NULL;
        char *cmd = NULL;
 #ifndef HAVE_LIBREADLINE
        char buf[PHPDBG_MAX_CMD];
 #endif
+       char *buffer = NULL;
 
        if (!(PHPDBG_G(flags) & PHPDBG_IS_QUITTING)) {
                if ((PHPDBG_G(flags) & PHPDBG_IS_REMOTE) &&
@@ -533,65 +434,8 @@ readline:
                        }
 #endif
                } else cmd = buffered;
-
-               /* allocate and sanitize buffer */
-               buffer = (phpdbg_input_t*) ecalloc(1, sizeof(phpdbg_input_t));
-               if (!buffer) {
-                       return NULL;
-               }
-
-               buffer->string = phpdbg_trim(cmd, strlen(cmd), &buffer->length);
-
-               /* store constant pointer to start of buffer */
-               buffer->start = (char* const*) buffer->string;
-
-               buffer->argv = phpdbg_read_argv(
-                       buffer->string, &buffer->argc TSRMLS_CC);
-
-               {
-                       yyscan_t scanner;
-                       YY_BUFFER_STATE state;
-                       phpdbg_param_t stack;
-               
-                       phpdbg_init_param(&stack, STACK_PARAM);
                
-                       if (yylex_init(&scanner)) {
-                               phpdbg_error("could not initialize scanner");
-                               return buffer;
-                       }
-
-                       state = yy_scan_string(buffer->string, scanner);
-                       
-                       if (yyparse(&stack, scanner) <= 0) {
-                               char *why = NULL;
-                       
-                               if (phpdbg_stack_execute(&stack, &why) != SUCCESS) {
-                                       phpdbg_error( 
-                                               "Execution Error: %s", 
-                                               why ? why : "for no particular reason");
-                               }
-
-                               if (why) {
-                                       free(why);
-                               }
-                       }
-                       yy_delete_buffer(state, scanner);
-                       yylex_destroy(scanner);
-               
-                       phpdbg_stack_free(&stack);
-               }
-               
-#ifdef PHPDBG_DEBUG
-               if (buffer->argc) {
-                       int arg = 0;
-
-                       while (arg < buffer->argc) {
-                               phpdbg_debug(
-                                       "argv %d=%s", arg, buffer->argv[arg]->string);
-                               arg++;
-                       }
-               }
-#endif
+               buffer = estrdup(cmd);
 
 #ifdef HAVE_LIBREADLINE
                if (!buffered && cmd &&
@@ -599,144 +443,13 @@ readline:
                        free(cmd);
                }
 #endif
-
-               return buffer;
        }
 
-       return NULL;
+       return buffer;
 } /* }}} */
 
-PHPDBG_API void phpdbg_destroy_argv(phpdbg_input_t **argv, int argc TSRMLS_DC) /* {{{ */
+PHPDBG_API void phpdbg_destroy_input(char **input TSRMLS_DC) /*{{{ */
 {
-       if (argv) {
-               if (argc) {
-                       int arg;
-                       for (arg=0; arg<argc; arg++) {
-                               phpdbg_destroy_input(
-                                       &argv[arg] TSRMLS_CC);
-                       }
-               }
-               efree(argv);
-       }
-
-} /* }}} */
-
-PHPDBG_API void phpdbg_destroy_input(phpdbg_input_t **input TSRMLS_DC) /*{{{ */
-{
-       if (*input) {
-               if ((*input)->string) {
-                       efree((*input)->string);
-               }
-
-               phpdbg_destroy_argv(
-                       (*input)->argv, (*input)->argc TSRMLS_CC);
-
-               efree(*input);
-       }
-} /* }}} */
-
-PHPDBG_API int phpdbg_do_cmd(const phpdbg_command_t *command, phpdbg_input_t *input TSRMLS_DC) /* {{{ */
-{
-       int rc = FAILURE;
-
-       if (input->argc > 0) {
-               while (command && command->name && command->handler) {
-                       if (((command->name_len == input->argv[0]->length) &&
-                               (memcmp(command->name, input->argv[0]->string, command->name_len) == SUCCESS)) ||
-                               (command->alias &&
-                               (input->argv[0]->length == 1) &&
-                               (command->alias == *input->argv[0]->string))) {
-
-                               phpdbg_param_t param;
-                               phpdbg_command_t *initial_last_cmd;
-                               phpdbg_param_t initial_last_param;
-
-                               param.type = EMPTY_PARAM;
-
-                               if (input->argc > 1) {
-                                       if (command->subs) {
-                                               phpdbg_input_t sub = *input;
-
-                                               sub.string += input->argv[0]->length;
-                                               sub.length -= input->argv[0]->length;
-
-                                               sub.string = phpdbg_trim(
-                                                       sub.string, sub.length, &sub.length);
-
-                                               sub.argc--;
-                                               sub.argv++;
-
-                                               phpdbg_debug(
-                                                       "trying sub commands in \"%s\" for \"%s\" with %d arguments",
-                                                       command->name, sub.argv[0]->string, sub.argc-1);
-
-                                               if (phpdbg_do_cmd(command->subs, &sub TSRMLS_CC) == SUCCESS) {
-                                                       efree(sub.string);
-                                                       return SUCCESS;
-                                               }
-
-                                               efree(sub.string);
-                                       }
-
-                                       /* no sub command found */
-                                       {
-                                               char *store = input->string;
-
-                                               input->string += input->argv[0]->length;
-                                               input->length -= input->argv[0]->length;
-
-                                               input->string = phpdbg_trim(
-                                                       input->string, input->length, &input->length);
-
-                                               efree(store);
-                                       }
-
-                                       /* pass parameter on */
-                                       phpdbg_parse_param(
-                                               input->string,
-                                               input->length,
-                                               &param TSRMLS_CC);
-                               }
-
-                               phpdbg_debug(
-                                       "found command %s for %s with %d arguments",
-                                       command->name, input->argv[0]->string, input->argc-1);
-                               {
-                                       int arg;
-                                       for (arg=1; arg<input->argc; arg++) {
-                                               phpdbg_debug(
-                                                       "\t#%d: [%s=%zu]",
-                                                       arg,
-                                                       input->argv[arg]->string,
-                                                       input->argv[arg]->length);
-                                       }
-                               }
-
-                               initial_last_param = PHPDBG_G(lparam);
-                               initial_last_cmd = (phpdbg_command_t *)PHPDBG_G(lcmd);
-                               PHPDBG_G(lparam) = param;
-                               PHPDBG_G(lcmd) = (phpdbg_command_t *)command;
-
-                               rc = command->handler(&param, input TSRMLS_CC);
-
-                               /* only set last command when it is worth it! */
-                               if (rc != FAILURE && !(PHPDBG_G(flags) & PHPDBG_IS_INITIALIZING)) {
-                                       phpdbg_clear_param(&initial_last_param TSRMLS_CC);
-                               } else if (PHPDBG_G(lcmd) == command && !memcmp(&PHPDBG_G(lparam),& initial_last_param, sizeof(phpdbg_param_t))) {
-                                       PHPDBG_G(lparam) = initial_last_param;
-                                       PHPDBG_G(lcmd) = initial_last_cmd;
-                                       phpdbg_clear_param(&param TSRMLS_CC);
-                               }
-                               break;
-                       }
-                       command++;
-               }
-       } else {
-               /* this should NEVER happen */
-               phpdbg_error(
-                       "No function executed!!");
-       }
-
-       return rc;
+       efree(*input);
 } /* }}} */
 
index cf503812a72e8fe0618ef21933fd65fc51f251d8..af24837d946467bf1bd3db47d961397e65af71a0 100644 (file)
@@ -140,16 +140,8 @@ typedef struct {
 /*
 * Input Management
 */
-PHPDBG_API phpdbg_input_t* phpdbg_read_input(char *buffered TSRMLS_DC);
-PHPDBG_API void phpdbg_destroy_input(phpdbg_input_t** TSRMLS_DC);
-
-/*
-* Argument Management
-*/
-PHPDBG_API phpdbg_input_t** phpdbg_read_argv(char *buffer, int *argc TSRMLS_DC);
-PHPDBG_API void phpdbg_destroy_argv(phpdbg_input_t **argv, int argc TSRMLS_DC);
-#define phpdbg_argv_is(n, s) \
-       (memcmp(input->argv[n]->string, s, input->argv[n]->length) == SUCCESS)
+PHPDBG_API char* phpdbg_read_input(char *buffered TSRMLS_DC);
+PHPDBG_API void phpdbg_destroy_input(char** TSRMLS_DC);
 
 /*
 * Parameter Management
@@ -162,11 +154,6 @@ PHPDBG_API zend_ulong phpdbg_hash_param(const phpdbg_param_t * TSRMLS_DC);
 PHPDBG_API const char* phpdbg_get_param_type(const phpdbg_param_t* TSRMLS_DC);
 PHPDBG_API char* phpdbg_param_tostring(const phpdbg_param_t *param, char **pointer TSRMLS_DC);
 
-/*
-* Command Executor
-*/
-PHPDBG_API int phpdbg_do_cmd(const phpdbg_command_t*, phpdbg_input_t* TSRMLS_DC);
-
 /**
  * Command Declarators
  */
index 3aa82848e00993178b5341dd2bdfb2124ceb11c8..8dcc89007d037ebeb45daa02d5c7304da5c521d3 100644 (file)
@@ -208,13 +208,13 @@ PHPDBG_COMMAND(help) /* {{{ */
        phpdbg_command_t const *cmd;
        int n;
 
-       if (param->type == EMPTY_PARAM) {
+       if (!param || param->type == EMPTY_PARAM) {
                pretty_print(get_help("overview!" TSRMLS_CC) TSRMLS_CC);
                return SUCCESS;
        }
 
-       if (param->type == STR_PARAM) {
-           n = get_command( param->str, param->len, &cmd, phpdbg_prompt_commands TSRMLS_CC);
+       if (param && param->type == STR_PARAM) {
+           n = get_command(param->str, param->len, &cmd, phpdbg_prompt_commands TSRMLS_CC);
 
                if (n==1) {
                        summary_print(cmd TSRMLS_CC);
index e9e243c5e5503715d91fd650b8cbe68ac9d4d017..9999a6397862247e706d4f2956089f5696c2c429 100644 (file)
@@ -379,16 +379,16 @@ static yyconst flex_int32_t yy_ec[256] =
         1,    1,    2,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    4,    1,    5,    6,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    7,    1,    1,    8,    9,    9,
-        9,    9,    9,    9,    9,    9,    9,   10,    1,    1,
-        1,    1,    1,    1,   11,   12,   13,   14,   15,   16,
-        7,   17,   18,    7,    7,   19,    7,   20,   21,    7,
-        7,   22,   23,   24,   25,   26,    7,    7,   27,    7,
-        1,   28,    1,    1,    7,    1,   29,   30,   13,   31,
-
-       32,   33,    7,   34,   35,    7,    7,   36,    7,   37,
-       38,    7,    7,   39,   40,   41,   42,   43,    7,   44,
-       45,    7,    1,    1,    1,    1,    7,    7,    7,    7,
+        1,    1,    1,    1,    7,    8,    8,    9,   10,   10,
+       10,   10,   10,   10,   10,   10,   10,   11,    1,    1,
+        1,    1,    1,    1,   12,   13,   14,   15,   16,   17,
+        7,   18,   19,    7,    7,   20,    7,   21,   22,    7,
+        7,   23,   24,   25,   26,   27,    7,    7,   28,    7,
+        1,   29,    1,    1,    7,    1,   30,   31,   14,   32,
+
+       33,   34,    7,   35,   36,    7,    7,   37,    7,   38,
+       39,    7,    7,   40,   41,   42,   43,   44,    7,   45,
+       46,    7,    1,    1,    1,    1,    7,    7,    7,    7,
         7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
         7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
         7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
@@ -405,29 +405,29 @@ static yyconst flex_int32_t yy_ec[256] =
         7,    7,    7,    7,    7
     } ;
 
-static yyconst flex_int32_t yy_meta[46] =
+static yyconst flex_int32_t yy_meta[47] =
     {   0,
-        1,    1,    2,    3,    1,    4,    5,    4,    4,    1,
+        1,    1,    2,    3,    1,    4,    5,    4,    4,    4,
+        1,    5,    5,    5,    5,    5,    5,    5,    5,    5,
+        5,    5,    5,    5,    5,    5,    5,    5,    1,    5,
         5,    5,    5,    5,    5,    5,    5,    5,    5,    5,
-        5,    5,    5,    5,    5,    5,    5,    1,    5,    5,
-        5,    5,    5,    5,    5,    5,    5,    5,    5,    5,
-        5,    5,    5,    5,    5
+        5,    5,    5,    5,    5,    5
     } ;
 
 static yyconst flex_int16_t yy_base[107] =
     {   0,
-        0,    0,   44,   47,  160,  136,   50,   53,   62,   57,
-       85,   60,   63,  433,  113,   63,   91,   64,   89,  112,
-       41,   90,  118,  153,    0,   75,  135,  101,  126,  162,
-      140,  147,  112,   95,  162,  170,  168,   66,  150,  174,
-      190,  178,  211,  171,  199,  218,  195,  197,  198,  219,
-      220,  230,  221,  241,  231,    0,  199,  196,  433,  100,
-      252,  199,    0,  281,    0,  240,  267,  259,  270,  232,
-      280,  285,  278,   90,  320,    0,  289,  314,  296,  319,
-      317,  309,  262,   86,  320,  325,  323,  324,  264,  346,
-      348,  349,  347,  350,  433,  385,  390,  395,  400,  405,
-
-      410,  415,  420,   69,  425,  427
+        0,    0,   45,   48,  148,  133,   51,   54,   57,   59,
+       88,   57,   62,  448,  117,   65,   94,   95,  113,  120,
+      115,   64,  124,  160,    0,   72,   75,  105,   71,  170,
+      173,  174,  116,   94,  177,  104,  181,  119,  123,  184,
+      206,  187,  227,  164,  215,  234,  182,  128,  148,  213,
+      185,  236,  237,  243,  212,    0,  220,  101,  448,   92,
+      266,  272,    0,  295,    0,  280,  255,  289,  266,  214,
+      292,  298,  258,   79,  334,    0,  302,  328,  294,  333,
+      331,  322,  216,   76,  334,  340,  336,  338,  219,  359,
+      362,  364,  361,  363,  448,  400,  405,  410,  415,  420,
+
+      425,  430,  435,   64,  440,  442
     } ;
 
 static yyconst flex_int16_t yy_def[107] =
@@ -446,116 +446,122 @@ static yyconst flex_int16_t yy_def[107] =
        95,   95,   95,   95,   95,   95
     } ;
 
-static yyconst flex_int16_t yy_nxt[479] =
+static yyconst flex_int16_t yy_nxt[495] =
     {   0,
-        6,    7,    8,    9,   10,    6,   11,   12,   13,   14,
-       11,   11,   11,   15,   16,   17,   11,   18,   11,   19,
-       20,   11,   21,   22,   11,   11,   23,   24,   11,   11,
-       15,   16,   17,   11,   18,   11,   19,   20,   11,   21,
-       22,   11,   11,   11,   23,   26,   27,   26,   26,   27,
-       26,   30,   30,   31,   30,   30,   31,   52,   38,   29,
-       33,   34,   29,   31,   31,   31,   35,   42,   42,   29,
-       42,   42,   29,   74,   52,   38,   57,   31,   57,   48,
-       38,   38,   45,   38,   36,   28,   28,   28,   46,   28,
-       37,   83,   39,   39,   40,   83,   48,   38,   38,   45,
-
-       38,   47,   95,   43,   29,   46,   38,   38,   38,   49,
-       29,   53,   41,   28,   28,   28,   59,   28,   37,   47,
-       39,   39,   40,   38,   38,   38,   49,   50,   53,   38,
-       44,   51,   54,   58,   58,   38,   31,   31,   31,   60,
-       41,   31,   31,   31,   50,   29,   38,   44,   51,   54,
-       33,   34,   38,   28,   28,   28,   35,   28,   28,   95,
-       28,   28,   29,   30,   30,   31,   59,   38,   95,   61,
-       61,   29,   28,   33,   36,   62,   62,   29,   95,   35,
-       28,   58,   58,   63,   38,   42,   42,   29,   38,   60,
-       28,   28,   28,   66,   28,   28,   95,   28,   28,   29,
-
-       57,   31,   57,   58,   58,   38,   62,   62,   29,   67,
-       66,   95,   38,   69,   38,   38,   38,   28,   65,   65,
-       29,   65,   65,   65,   65,   65,   65,   67,   68,   38,
-       69,   38,   38,   38,   70,   38,   38,   38,   38,   65,
-       65,   65,   65,   65,   71,   72,   68,   38,   38,   38,
-       77,   70,   38,   38,   38,   38,   59,   38,   38,   61,
-       61,   71,   72,   73,   38,   38,   38,   95,   77,   89,
-       89,   89,   89,   95,   38,   38,   38,   79,   78,   60,
-       73,   28,   28,   28,   38,   28,   28,   38,   76,   76,
-       40,   95,   80,   38,   79,   38,   78,   38,   81,   82,
-
-       85,   38,   38,   95,   38,   95,   38,   95,   41,   80,
-       95,   95,   38,   38,   38,   81,   82,   95,   85,   38,
-       28,   28,   28,   38,   28,   28,   38,   76,   76,   40,
-       38,   38,   86,   87,   38,   88,   38,   38,   90,   91,
-       38,   38,   38,   38,   95,   95,   95,   41,   38,   86,
-       87,   38,   88,   38,   38,   90,   91,   38,   38,   38,
-       92,   93,   94,   38,   38,   38,   38,   38,   95,   95,
-       95,   95,   95,   95,   95,   95,   95,   92,   93,   94,
-       38,   38,   38,   38,   38,   25,   25,   25,   25,   25,
-       28,   28,   95,   28,   28,   32,   32,   32,   32,   32,
-
-       38,   38,   95,   38,   38,   55,   55,   95,   55,   55,
-       56,   95,   56,   56,   56,   33,   33,   33,   33,   33,
-       64,   64,   95,   64,   64,   75,   75,   95,   75,   75,
-       84,   84,    5,   95,   95,   95,   95,   95,   95,   95,
+        6,    7,    8,    9,   10,    6,   11,    6,   12,   13,
+       14,   11,   11,   11,   15,   16,   17,   11,   18,   11,
+       19,   20,   11,   21,   22,   11,   11,   23,   24,   11,
+       11,   15,   16,   17,   11,   18,   11,   19,   20,   11,
+       21,   22,   11,   11,   11,   23,   26,   27,   26,   26,
+       27,   26,   30,   30,   31,   30,   30,   31,   31,   31,
+       31,   29,   33,   34,   29,   42,   42,   29,   74,   35,
+       42,   42,   29,   57,   31,   57,   31,   31,   31,   58,
+       58,   83,   38,   38,   83,   45,   53,   36,   28,   28,
+       28,   46,   28,   37,   95,   39,   39,   39,   40,   38,
+
+       38,   43,   45,   53,   29,   47,   28,   33,   46,   58,
+       58,   48,   38,   38,   35,   29,   41,   28,   28,   28,
+       59,   28,   37,   47,   39,   39,   39,   40,   48,   38,
+       38,   38,   52,   38,   49,   44,   50,   38,   38,   54,
+       51,   38,   38,   29,   60,   41,   38,   95,   38,   52,
+       38,   49,   44,   50,   38,   38,   54,   51,   38,   38,
+       28,   28,   28,   38,   28,   28,   38,   28,   28,   28,
+       29,   30,   30,   31,   31,   31,   31,   33,   34,   95,
+       29,   59,   38,   38,   35,   61,   61,   66,   28,   62,
+       62,   29,   58,   58,   63,   42,   42,   29,   95,   38,
+
+       38,   69,   36,   38,   66,   60,   28,   28,   28,   95,
+       28,   28,   95,   28,   28,   28,   29,   38,   69,   95,
+       38,   57,   31,   57,   89,   89,   67,   89,   89,   70,
+       38,   38,   38,   38,   28,   65,   65,   29,   65,   65,
+       65,   65,   65,   65,   67,   68,   70,   38,   38,   38,
+       38,   71,   38,   95,   38,   38,   65,   65,   65,   65,
+       65,   38,   72,   68,   95,   95,   73,   78,   71,   38,
+       59,   38,   38,   38,   61,   61,   38,   95,   38,   72,
+       62,   62,   29,   73,   38,   78,   95,   95,   95,   80,
+       38,   77,   95,   38,   60,   28,   28,   28,   38,   28,
+
+       28,   38,   76,   76,   76,   40,   80,   38,   79,   77,
+       38,   81,   38,   82,   85,   38,   38,   95,   95,   95,
+       38,   95,   95,   41,   38,   79,   95,   38,   81,   38,
+       82,   95,   85,   38,   28,   28,   28,   38,   28,   28,
+       38,   76,   76,   76,   40,   95,   38,   86,   87,   38,
+       88,   38,   38,   90,   38,   91,   38,   38,   38,   95,
+       95,   95,   41,   38,   86,   87,   38,   88,   38,   38,
+       90,   38,   91,   38,   92,   38,   93,   38,   94,   38,
+       38,   38,   38,   95,   95,   95,   95,   95,   95,   95,
+       95,   92,   95,   93,   38,   94,   38,   38,   38,   38,
+
+       25,   25,   25,   25,   25,   28,   28,   95,   28,   28,
+       32,   32,   32,   32,   32,   38,   38,   95,   38,   38,
+       55,   55,   95,   55,   55,   56,   95,   56,   56,   56,
+       33,   33,   33,   33,   33,   64,   64,   95,   64,   64,
+       75,   75,   95,   75,   75,   84,   84,    5,   95,   95,
+       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,
        95,   95,   95,   95,   95,   95,   95,   95,   95,   95,
        95,   95,   95,   95,   95,   95,   95,   95,   95,   95,
        95,   95,   95,   95,   95,   95,   95,   95,   95,   95,
-       95,   95,   95,   95,   95,   95,   95,   95
+       95,   95,   95,   95
+
     } ;
 
-static yyconst flex_int16_t yy_chk[479] =
+static yyconst flex_int16_t yy_chk[495] =
     {   0,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    3,    3,    3,    4,    4,
-        4,    7,    7,    7,    8,    8,    8,   21,   21,    7,
-       10,   10,    8,    9,    9,    9,   10,   12,   12,   12,
-       13,   13,   13,  104,   21,   21,   26,   26,   26,   18,
-       16,   18,   16,   38,   10,   11,   11,   11,   16,   11,
-       11,   84,   11,   11,   11,   74,   18,   16,   18,   16,
-
-       38,   17,   60,   12,   34,   16,   19,   22,   17,   19,
-       28,   22,   11,   15,   15,   15,   33,   15,   15,   17,
-       15,   15,   15,   19,   22,   17,   19,   20,   22,   20,
-       15,   20,   23,   29,   29,   23,   27,   27,   27,   33,
-       15,   31,   31,   31,   20,    6,   20,   15,   20,   23,
-       32,   32,   23,   24,   24,   24,   32,   24,   24,    5,
-       24,   24,   24,   30,   30,   30,   35,   39,    0,   35,
-       35,   30,   36,   36,   32,   37,   37,   37,    0,   36,
-       24,   40,   40,   40,   39,   42,   42,   42,   44,   35,
-       41,   41,   41,   44,   41,   41,    0,   41,   41,   41,
-
-       57,   57,   57,   58,   58,   44,   62,   62,   62,   45,
-       44,    0,   47,   47,   48,   49,   45,   41,   43,   43,
-       43,   43,   43,   43,   43,   43,   43,   45,   46,   47,
-       47,   48,   49,   45,   50,   46,   50,   51,   53,   43,
-       43,   43,   43,   43,   52,   53,   46,   52,   55,   70,
-       66,   50,   46,   50,   51,   53,   61,   66,   54,   61,
-       61,   52,   53,   54,   52,   55,   70,    0,   66,   83,
-       83,   89,   89,    0,   66,   54,   68,   68,   67,   61,
-       54,   64,   64,   64,   67,   64,   64,   69,   64,   64,
-       64,    0,   69,   68,   68,   73,   67,   71,   71,   72,
-
-       77,   67,   72,    0,   69,    0,   77,    0,   64,   69,
-        0,    0,   73,   79,   71,   71,   72,    0,   77,   72,
-       75,   75,   75,   77,   75,   75,   82,   75,   75,   75,
-       79,   78,   78,   80,   81,   81,   80,   85,   85,   86,
-       87,   88,   86,   82,    0,    0,    0,   75,   78,   78,
-       80,   81,   81,   80,   85,   85,   86,   87,   88,   86,
-       90,   91,   92,   90,   93,   91,   92,   94,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,   90,   91,   92,
-       90,   93,   91,   92,   94,   96,   96,   96,   96,   96,
-       97,   97,    0,   97,   97,   98,   98,   98,   98,   98,
-
-       99,   99,    0,   99,   99,  100,  100,    0,  100,  100,
-      101,    0,  101,  101,  101,  102,  102,  102,  102,  102,
-      103,  103,    0,  103,  103,  105,  105,    0,  105,  105,
-      106,  106,   95,   95,   95,   95,   95,   95,   95,   95,
+        1,    1,    1,    1,    1,    1,    3,    3,    3,    4,
+        4,    4,    7,    7,    7,    8,    8,    8,    9,    9,
+        9,    7,   10,   10,    8,   12,   12,   12,  104,   10,
+       13,   13,   13,   26,   26,   26,   27,   27,   27,   29,
+       29,   84,   22,   16,   74,   16,   22,   10,   11,   11,
+       11,   16,   11,   11,   60,   11,   11,   11,   11,   22,
+
+       16,   12,   16,   22,   34,   17,   36,   36,   16,   58,
+       58,   18,   17,   18,   36,   28,   11,   15,   15,   15,
+       33,   15,   15,   17,   15,   15,   15,   15,   18,   17,
+       18,   19,   21,   21,   19,   15,   20,   38,   20,   23,
+       20,   39,   23,    6,   33,   15,   48,    5,   19,   21,
+       21,   19,   15,   20,   38,   20,   23,   20,   39,   23,
+       24,   24,   24,   48,   24,   24,   49,   24,   24,   24,
+       24,   30,   30,   30,   31,   31,   31,   32,   32,    0,
+       30,   35,   44,   49,   32,   35,   35,   44,   24,   37,
+       37,   37,   40,   40,   40,   42,   42,   42,    0,   44,
+
+       47,   47,   32,   51,   44,   35,   41,   41,   41,    0,
+       41,   41,    0,   41,   41,   41,   41,   47,   47,    0,
+       51,   57,   57,   57,   83,   83,   45,   89,   89,   50,
+       55,   50,   70,   45,   41,   43,   43,   43,   43,   43,
+       43,   43,   43,   43,   45,   46,   50,   55,   50,   70,
+       45,   52,   46,    0,   52,   53,   43,   43,   43,   43,
+       43,   54,   53,   46,    0,    0,   54,   67,   52,   46,
+       61,   52,   53,   67,   61,   61,   73,    0,   54,   53,
+       62,   62,   62,   54,   69,   67,    0,    0,    0,   69,
+       67,   66,    0,   73,   61,   64,   64,   64,   66,   64,
+
+       64,   69,   64,   64,   64,   64,   69,   68,   68,   66,
+       71,   71,   79,   72,   77,   66,   72,    0,    0,    0,
+       77,    0,    0,   64,   68,   68,    0,   71,   71,   79,
+       72,    0,   77,   72,   75,   75,   75,   77,   75,   75,
+       82,   75,   75,   75,   75,    0,   78,   78,   80,   81,
+       81,   80,   85,   85,   87,   86,   88,   82,   86,    0,
+        0,    0,   75,   78,   78,   80,   81,   81,   80,   85,
+       85,   87,   86,   88,   90,   86,   91,   90,   92,   93,
+       91,   94,   92,    0,    0,    0,    0,    0,    0,    0,
+        0,   90,    0,   91,   90,   92,   93,   91,   94,   92,
+
+       96,   96,   96,   96,   96,   97,   97,    0,   97,   97,
+       98,   98,   98,   98,   98,   99,   99,    0,   99,   99,
+      100,  100,    0,  100,  100,  101,    0,  101,  101,  101,
+      102,  102,  102,  102,  102,  103,  103,    0,  103,  103,
+      105,  105,    0,  105,  105,  106,  106,   95,   95,   95,
        95,   95,   95,   95,   95,   95,   95,   95,   95,   95,
        95,   95,   95,   95,   95,   95,   95,   95,   95,   95,
        95,   95,   95,   95,   95,   95,   95,   95,   95,   95,
-       95,   95,   95,   95,   95,   95,   95,   95
+       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,
+       95,   95,   95,   95
+
     } ;
 
 /* The intent behind this definition is that it'll catch
@@ -581,7 +587,7 @@ static yyconst flex_int16_t yy_chk[479] =
 #include <string.h>
 
 #define YY_NO_UNISTD_H 1
-#line 585 "sapi/phpdbg/phpdbg_lexer.c"
+#line 591 "sapi/phpdbg/phpdbg_lexer.c"
 
 #define INITIAL 0
 #define RAW 1
@@ -821,7 +827,7 @@ YY_DECL
 
 #line 47 "sapi/phpdbg/dev/phpdbg_lexer.l"
 
-#line 825 "sapi/phpdbg/phpdbg_lexer.c"
+#line 831 "sapi/phpdbg/phpdbg_lexer.c"
 
     yylval = yylval_param;
 
@@ -1060,7 +1066,7 @@ YY_RULE_SETUP
 #line 136 "sapi/phpdbg/dev/phpdbg_lexer.l"
 YY_FATAL_ERROR( "flex scanner jammed" );
        YY_BREAK
-#line 1064 "sapi/phpdbg/phpdbg_lexer.c"
+#line 1070 "sapi/phpdbg/phpdbg_lexer.c"
 case YY_STATE_EOF(INITIAL):
 case YY_STATE_EOF(RAW):
        yyterminate();
index 79745cef8be73653a1a7b3a2628a8fec0fa7c2aa..ffc8de0b4a17a712ecbc314d6b4dd70732301160 100644 (file)
@@ -179,7 +179,7 @@ static void phpdbg_stack_push(phpdbg_param_t *stack, phpdbg_param_t *param) {
                next->top = stack->top;
                stack->top = next;
        }
-       phpdbg_debug_param(next, "push ->");
+       
        stack->len++;
 }
 
@@ -214,16 +214,10 @@ phpdbg_command_t* phpdbg_stack_resolve(const phpdbg_command_t *commands, phpdbg_
                        if (matched[0]->subs && (*top) && ((*top)->type == STR_PARAM)) {
                                command = phpdbg_stack_resolve(matched[0]->subs, top, why);
                                if (command) {
-                                       phpdbg_notice(
-                                               "Command matching with sub command %s %s", 
-                                               matched[0]->name, command->name);
                                        return command;
                                }
                        }
                        
-                       phpdbg_notice(
-                               "Command matching with %s", 
-                               matched[0]->name);
                        return matched[0];
                } break;
                
@@ -259,29 +253,17 @@ int phpdbg_stack_execute(phpdbg_param_t *stack, char **why) {
        
        switch (command->type) {
                case EVAL_PARAM:
-                       PHPDBG_COMMAND_HANDLER(eval)(command, NULL TSRMLS_CC);
-               break;
+                       return PHPDBG_COMMAND_HANDLER(eval)(command, NULL TSRMLS_CC);
                
                case SHELL_PARAM:
-                       PHPDBG_COMMAND_HANDLER(shell)(command, NULL TSRMLS_CC);
-               break;
+                       return PHPDBG_COMMAND_HANDLER(shell)(command, NULL TSRMLS_CC);
                
                case STR_PARAM: {
-                       /* do resolve command(s) */
                        handler = phpdbg_stack_resolve(
                                phpdbg_prompt_commands, &command, why);
                        
                        if (handler) {
-                               /* get top of stack */
-                               params = command;
-                               
-                               /* prepare params */
-                               while (params) {
-                                       phpdbg_debug_param(params, "-> ...");
-                                       params = params->next;
-                               }
-                               
-                               return SUCCESS;
+                               return handler->handler(command, NULL TSRMLS_CC);
                        } else {
                                return FAILURE;
                        }
@@ -298,9 +280,8 @@ int phpdbg_stack_execute(phpdbg_param_t *stack, char **why) {
 
 
 
-
 /* Line 268 of yacc.c  */
-#line 304 "sapi/phpdbg/phpdbg_parser.c"
+#line 285 "sapi/phpdbg/phpdbg_parser.c"
 
 /* Enabling traces.  */
 #ifndef YYDEBUG
@@ -323,7 +304,7 @@ int phpdbg_stack_execute(phpdbg_param_t *stack, char **why) {
 /* "%code requires" blocks.  */
 
 /* Line 288 of yacc.c  */
-#line 234 "sapi/phpdbg/dev/phpdbg_parser.y"
+#line 215 "sapi/phpdbg/dev/phpdbg_parser.y"
 
 #include "phpdbg.h"
 #ifndef YY_TYPEDEF_YY_SCANNER_T
@@ -334,7 +315,7 @@ typedef void* yyscan_t;
 
 
 /* Line 288 of yacc.c  */
-#line 338 "sapi/phpdbg/phpdbg_parser.c"
+#line 319 "sapi/phpdbg/phpdbg_parser.c"
 
 /* Tokens.  */
 #ifndef YYTOKENTYPE
@@ -375,7 +356,7 @@ typedef int YYSTYPE;
 
 
 /* Line 343 of yacc.c  */
-#line 379 "sapi/phpdbg/phpdbg_parser.c"
+#line 360 "sapi/phpdbg/phpdbg_parser.c"
 
 #ifdef short
 # undef short
@@ -669,9 +650,9 @@ static const yytype_int8 yyrhs[] =
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const yytype_uint16 yyrline[] =
 {
-       0,   270,   270,   274,   275,   279,   280,   284,   285,   289,
-     290,   294,   295,   299,   300,   301,   302,   303,   304,   305,
-     306,   307,   308,   309,   313
+       0,   251,   251,   255,   256,   260,   261,   265,   266,   270,
+     271,   275,   276,   280,   281,   282,   283,   284,   285,   286,
+     287,   288,   289,   290,   294
 };
 #endif
 
@@ -1629,133 +1610,133 @@ yyreduce:
         case 3:
 
 /* Line 1806 of yacc.c  */
-#line 274 "sapi/phpdbg/dev/phpdbg_parser.y"
+#line 255 "sapi/phpdbg/dev/phpdbg_parser.y"
     { phpdbg_stack_push(stack, &(yyvsp[(1) - (1)])); }
     break;
 
   case 4:
 
 /* Line 1806 of yacc.c  */
-#line 275 "sapi/phpdbg/dev/phpdbg_parser.y"
+#line 256 "sapi/phpdbg/dev/phpdbg_parser.y"
     { phpdbg_stack_push(stack, &(yyvsp[(2) - (2)])); }
     break;
 
   case 7:
 
 /* Line 1806 of yacc.c  */
-#line 284 "sapi/phpdbg/dev/phpdbg_parser.y"
+#line 265 "sapi/phpdbg/dev/phpdbg_parser.y"
     { phpdbg_stack_push(stack, &(yyvsp[(1) - (1)])); }
     break;
 
   case 8:
 
 /* Line 1806 of yacc.c  */
-#line 285 "sapi/phpdbg/dev/phpdbg_parser.y"
+#line 266 "sapi/phpdbg/dev/phpdbg_parser.y"
     { phpdbg_stack_push(stack, &(yyvsp[(2) - (2)])); }
     break;
 
   case 9:
 
 /* Line 1806 of yacc.c  */
-#line 289 "sapi/phpdbg/dev/phpdbg_parser.y"
+#line 270 "sapi/phpdbg/dev/phpdbg_parser.y"
     { (yyval) = (yyvsp[(2) - (2)]); (yyval).type = EVAL_PARAM;  }
     break;
 
   case 10:
 
 /* Line 1806 of yacc.c  */
-#line 290 "sapi/phpdbg/dev/phpdbg_parser.y"
+#line 271 "sapi/phpdbg/dev/phpdbg_parser.y"
     { (yyval) = (yyvsp[(2) - (2)]); (yyval).type = SHELL_PARAM; }
     break;
 
   case 12:
 
 /* Line 1806 of yacc.c  */
-#line 295 "sapi/phpdbg/dev/phpdbg_parser.y"
+#line 276 "sapi/phpdbg/dev/phpdbg_parser.y"
     { phpdbg_stack_push(stack, &(yyvsp[(1) - (1)])); }
     break;
 
   case 13:
 
 /* Line 1806 of yacc.c  */
-#line 299 "sapi/phpdbg/dev/phpdbg_parser.y"
+#line 280 "sapi/phpdbg/dev/phpdbg_parser.y"
     { (yyval) = (yyvsp[(1) - (1)]); }
     break;
 
   case 14:
 
 /* Line 1806 of yacc.c  */
-#line 300 "sapi/phpdbg/dev/phpdbg_parser.y"
+#line 281 "sapi/phpdbg/dev/phpdbg_parser.y"
     { (yyval) = (yyvsp[(1) - (1)]); }
     break;
 
   case 15:
 
 /* Line 1806 of yacc.c  */
-#line 301 "sapi/phpdbg/dev/phpdbg_parser.y"
+#line 282 "sapi/phpdbg/dev/phpdbg_parser.y"
     { (yyval) = (yyvsp[(1) - (1)]); }
     break;
 
   case 16:
 
 /* Line 1806 of yacc.c  */
-#line 302 "sapi/phpdbg/dev/phpdbg_parser.y"
+#line 283 "sapi/phpdbg/dev/phpdbg_parser.y"
     { (yyval) = (yyvsp[(1) - (1)]); }
     break;
 
   case 17:
 
 /* Line 1806 of yacc.c  */
-#line 303 "sapi/phpdbg/dev/phpdbg_parser.y"
+#line 284 "sapi/phpdbg/dev/phpdbg_parser.y"
     { (yyval) = (yyvsp[(1) - (1)]); }
     break;
 
   case 18:
 
 /* Line 1806 of yacc.c  */
-#line 304 "sapi/phpdbg/dev/phpdbg_parser.y"
+#line 285 "sapi/phpdbg/dev/phpdbg_parser.y"
     { (yyval) = (yyvsp[(1) - (1)]); }
     break;
 
   case 19:
 
 /* Line 1806 of yacc.c  */
-#line 305 "sapi/phpdbg/dev/phpdbg_parser.y"
+#line 286 "sapi/phpdbg/dev/phpdbg_parser.y"
     { (yyval) = (yyvsp[(1) - (1)]); }
     break;
 
   case 20:
 
 /* Line 1806 of yacc.c  */
-#line 306 "sapi/phpdbg/dev/phpdbg_parser.y"
+#line 287 "sapi/phpdbg/dev/phpdbg_parser.y"
     { (yyval) = (yyvsp[(1) - (1)]); }
     break;
 
   case 21:
 
 /* Line 1806 of yacc.c  */
-#line 307 "sapi/phpdbg/dev/phpdbg_parser.y"
+#line 288 "sapi/phpdbg/dev/phpdbg_parser.y"
     { (yyval) = (yyvsp[(1) - (1)]); }
     break;
 
   case 22:
 
 /* Line 1806 of yacc.c  */
-#line 308 "sapi/phpdbg/dev/phpdbg_parser.y"
+#line 289 "sapi/phpdbg/dev/phpdbg_parser.y"
     { (yyval) = (yyvsp[(1) - (1)]); }
     break;
 
   case 23:
 
 /* Line 1806 of yacc.c  */
-#line 309 "sapi/phpdbg/dev/phpdbg_parser.y"
+#line 290 "sapi/phpdbg/dev/phpdbg_parser.y"
     { (yyval) = (yyvsp[(2) - (2)]); (yyval).type = COND_PARAM; }
     break;
 
 
 
 /* Line 1806 of yacc.c  */
-#line 1759 "sapi/phpdbg/phpdbg_parser.c"
+#line 1740 "sapi/phpdbg/phpdbg_parser.c"
       default: break;
     }
   /* User semantic actions sometimes alter yychar, and that requires
@@ -1986,6 +1967,6 @@ yyreturn:
 
 
 /* Line 2067 of yacc.c  */
-#line 315 "sapi/phpdbg/dev/phpdbg_parser.y"
+#line 296 "sapi/phpdbg/dev/phpdbg_parser.y"
 
 
index 612982c46fa80aa2c83bd49a035a02535f5abdc1..b307843dec1cd0eb8b1db806ef18bc90fde3bbc0 100644 (file)
@@ -33,7 +33,7 @@
 /* "%code requires" blocks.  */
 
 /* Line 2068 of yacc.c  */
-#line 234 "sapi/phpdbg/dev/phpdbg_parser.y"
+#line 215 "sapi/phpdbg/dev/phpdbg_parser.y"
 
 #include "phpdbg.h"
 #ifndef YY_TYPEDEF_YY_SCANNER_T
index 632ceb9761127aff8e500d67f82265b6c4fd1f65..9a0946138c47a5aa0e178e7c01c7e4312eb21966 100644 (file)
 #include "phpdbg_cmd.h"
 #include "phpdbg_set.h"
 #include "phpdbg_frame.h"
+#include "phpdbg_lexer.h"
+#include "phpdbg_parser.h"
+
+int phpdbg_stack_execute(phpdbg_param_t *stack, char **why);
+void phpdbg_stack_free(phpdbg_param_t *stack);
+int yyparse(phpdbg_param_t *stack, yyscan_t scanner);
 
 /* {{{ command declarations */
 const phpdbg_command_t phpdbg_prompt_commands[] = {
@@ -188,8 +194,8 @@ void phpdbg_try_file_init(char *init_file, size_t init_file_len, zend_bool free_
                                                goto next_line;
                                        }
 
-                                       {
-                                               phpdbg_input_t *input = phpdbg_read_input(cmd TSRMLS_CC);
+                                       /*{
+                                               phpdbg_param_t *input = phpdbg_read_input(cmd TSRMLS_CC);
                                                switch (phpdbg_do_cmd(phpdbg_prompt_commands, input TSRMLS_CC)) {
                                                        case FAILURE:
                                                                if (!(PHPDBG_G(flags) & PHPDBG_IS_QUITTING)) {
@@ -200,7 +206,7 @@ void phpdbg_try_file_init(char *init_file, size_t init_file_len, zend_bool free_
                                                        break;
                                                }
                                                phpdbg_destroy_input(&input TSRMLS_CC);
-                                       }
+                                       }*/
 
                                }
 next_line:
@@ -798,6 +804,7 @@ PHPDBG_COMMAND(shell) /* {{{ */
 
 PHPDBG_COMMAND(source) /* {{{ */
 {
+       /*
        switch (param->type) {
                case STR_PARAM: {
                        if (input->argc > 2) {
@@ -820,7 +827,7 @@ PHPDBG_COMMAND(source) /* {{{ */
                } break;
 
                phpdbg_default_switch_case();
-       }
+       }*/
        return SUCCESS;
 } /* }}} */
 
@@ -860,9 +867,6 @@ PHPDBG_COMMAND(quit) /* {{{ */
 {
        /* don't allow this to loop, ever ... */
        if (!(PHPDBG_G(flags) & PHPDBG_IS_QUITTING)) {
-
-               phpdbg_destroy_input((phpdbg_input_t**)&input TSRMLS_CC);
-
                PHPDBG_G(flags) |= PHPDBG_IS_QUITTING;
                zend_bailout();
        }
@@ -928,9 +932,10 @@ PHPDBG_COMMAND(quiet) /* {{{ */
 
 PHPDBG_COMMAND(list) /* {{{ */
 {
-       switch (param->type) {
+       if (!param || param->type == EMPTY_PARAM) {
+               return PHPDBG_LIST_HANDLER(lines)(PHPDBG_COMMAND_ARGS);
+       } else switch (param->type) {
                case NUMERIC_PARAM:
-               case EMPTY_PARAM:
                        return PHPDBG_LIST_HANDLER(lines)(PHPDBG_COMMAND_ARGS);
 
                case FILE_PARAM:
@@ -952,38 +957,65 @@ PHPDBG_COMMAND(list) /* {{{ */
 int phpdbg_interactive(TSRMLS_D) /* {{{ */
 {
        int ret = SUCCESS;
-       phpdbg_input_t *input;
-
+       char *why = NULL;
+       char *input = NULL;
+       phpdbg_param_t stack;
+       
        PHPDBG_G(flags) |= PHPDBG_IS_INTERACTIVE;
 
        input = phpdbg_read_input(NULL TSRMLS_CC);
-
-       if (input && input->length > 0L) {
+       
+       printf("got input %s\n", input);
+       
+       if (input) {
                do {
-                       switch (ret = phpdbg_do_cmd(phpdbg_prompt_commands, input TSRMLS_CC)) {
-                               case FAILURE:
-                                       if (!(PHPDBG_G(flags) & PHPDBG_IS_QUITTING)) {
-                                               if (phpdbg_call_register(input TSRMLS_CC) == FAILURE) {
-                                                       phpdbg_error("Failed to execute %s!", input->string);
+                       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) {
+                               switch (ret = phpdbg_stack_execute(&stack, &why)) {
+                                       case FAILURE:
+                                               if (!(PHPDBG_G(flags) & PHPDBG_IS_QUITTING)) {
+                                                       /*if (phpdbg_call_register(input TSRMLS_CC) == FAILURE) {
+                                                               
+                                                       }*/
+                                                       phpdbg_error("%s", why);
                                                }
-                                       }
-                               break;
+                                               if (why)
+                                                       free(why);
+                                       break;
 
-                               case PHPDBG_LEAVE:
-                               case PHPDBG_FINISH:
-                               case PHPDBG_UNTIL:
-                               case PHPDBG_NEXT: {
-                                       if (!EG(in_execution)) {
-                                               phpdbg_error("Not running");
+                                       case PHPDBG_LEAVE:
+                                       case PHPDBG_FINISH:
+                                       case PHPDBG_UNTIL:
+                                       case PHPDBG_NEXT: {
+                                               if (!EG(in_execution)) {
+                                                       phpdbg_error("Not running");
+                                               }
+                                               goto out;
                                        }
-                                       goto out;
                                }
                        }
-
+                       
+                       yy_delete_buffer(state, scanner);
+                       yylex_destroy(scanner);
+       
+                       phpdbg_stack_free(&stack);
                        phpdbg_destroy_input(&input TSRMLS_CC);
-               } while ((input = phpdbg_read_input(NULL TSRMLS_CC)) && (input->length > 0L));
+                       
+               } while ((input = phpdbg_read_input(NULL TSRMLS_CC)));
 
-               if (input && !input->length)
+               if (!input)
                        goto last;
 
        } else {
@@ -996,7 +1028,11 @@ last:
        }
 
 out:
-       phpdbg_destroy_input(&input TSRMLS_CC);
+       if (input) {
+               phpdbg_destroy_input(&input TSRMLS_CC);
+       }
+       
+       phpdbg_stack_free(&stack);
 
        if (EG(in_execution)) {
                phpdbg_restore_frame(TSRMLS_C);
index 50c07b66d85eb922c0c7e15826f1b62f70cc2ecd..6280086da49cad1868bde1fdbbee7baa44c85d3b 100644 (file)
@@ -56,12 +56,10 @@ PHPDBG_SET(prompt) /* {{{ */
 
 PHPDBG_SET(break) /* {{{ */
 {
-       switch (param->type) {
-               case EMPTY_PARAM:
-                       phpdbg_writeln("%s",
-                               PHPDBG_G(flags) & PHPDBG_IS_BP_ENABLED ? "on" : "off");
-                       break;
-
+       if (!param || param->type == EMPTY_PARAM) {
+               phpdbg_writeln("%s",
+                       PHPDBG_G(flags) & PHPDBG_IS_BP_ENABLED ? "on" : "off");
+       } else switch (param->type) {
                case STR_PARAM:
                        if (strncasecmp(param->str, PHPDBG_STRL("on")) == 0) {
                                phpdbg_enable_breakpoints(TSRMLS_C);
@@ -71,12 +69,14 @@ PHPDBG_SET(break) /* {{{ */
                        break;
                        
                case NUMERIC_PARAM: {
-                       if (input->argc > 2) {
+                       if (input && input->argc > 2) {
+                                       /*
                                        if (phpdbg_argv_is(2, "on")) {
                                                phpdbg_enable_breakpoint(param->num TSRMLS_CC);
                                        } else if (phpdbg_argv_is(2, "off")) {
                                                phpdbg_disable_breakpoint(param->num TSRMLS_CC);
                                        }
+                                       */
                        } else {
                                phpdbg_breakbase_t *brake = phpdbg_find_breakbase(param->num TSRMLS_CC);
                                if (brake) {
@@ -106,7 +106,7 @@ PHPDBG_SET(color) /* {{{ */
 
                /* @TODO(anyone) make this consistent with other set commands */
                if (color) {
-                       if (phpdbg_argv_is(1, "prompt")) {
+                       /*if (phpdbg_argv_is(1, "prompt")) {
                                phpdbg_notice(
                                        "setting prompt color to %s (%s)", color->name, color->code);
                                element = PHPDBG_COLOR_PROMPT;
@@ -125,9 +125,9 @@ PHPDBG_SET(color) /* {{{ */
                                element = PHPDBG_COLOR_NOTICE;
 
                        } else goto usage;
-
+*/
                        /* set color for element */
-                       phpdbg_set_color(element, color TSRMLS_CC);
+                       /* phpdbg_set_color(element, color TSRMLS_CC); */
                } else {
                        phpdbg_error(
                                "Failed to find the requested color (%s)", input->argv[2]->string);