summaryrefslogtreecommitdiff
path: root/dev/phpdbg_parser.y
diff options
context:
space:
mode:
authorkrakjoe <joe.watkins@live.co.uk>2014-02-17 08:53:47 +0000
committerkrakjoe <joe.watkins@live.co.uk>2014-02-17 08:53:47 +0000
commit1641d2afbe559bb3d95a6afe62b006ee90b17f1a (patch)
treee2222b514690d56c1cf079ce2fb67774de6c4d1b /dev/phpdbg_parser.y
parent1fce0887a32b18f11ff08ab81bc11d4b77992f89 (diff)
downloadphp-git-1641d2afbe559bb3d95a6afe62b006ee90b17f1a.tar.gz
case insensitivity where we can
additional param types
Diffstat (limited to 'dev/phpdbg_parser.y')
-rw-r--r--dev/phpdbg_parser.y44
1 files changed, 31 insertions, 13 deletions
diff --git a/dev/phpdbg_parser.y b/dev/phpdbg_parser.y
index 713c0efccf..185283eb8e 100644
--- a/dev/phpdbg_parser.y
+++ b/dev/phpdbg_parser.y
@@ -45,6 +45,10 @@ void phpdbg_debug_param(const phpdbg_param_t *param, const char *msg) {
case NUMERIC_PARAM:
fprintf(stderr, "%s NUMERIC_PARAM(%ld)\n", msg, param->num);
break;
+
+ case COND_PARAM:
+ fprintf(stderr, "%s COND_PARAM(%s=%d)\n", msg, param->str, param->len);
+ break;
}
}
}
@@ -119,16 +123,28 @@ int phpdbg_stack_execute(phpdbg_param_t *stack, char **why) {
}
command = params = (phpdbg_param_t*) stack->next;
-
- if (command->type != STR_PARAM) {
- asprintf(
- why, "the first parameter is expected to be a string !!");
- return FAILURE;
- }
- /* do resolve command(s) */
+ switch (command->type) {
+ case EVAL_PARAM:
+ phpdbg_notice("eval (%s)", command->str);
+ break;
+
+ case SHELL_PARAM:
+ phpdbg_notice("shell (%s)", command->str);
+ break;
+
+ case STR_PARAM: {
+ /* do resolve command(s) */
+ } break;
+
+ default:
+ asprintf(
+ why, "the first parameter makes no sense !!");
+ return FAILURE;
+ }
/* do prepare params for function */
+
while (params) {
phpdbg_debug_param(params, "-> ...");
params = params->next;
@@ -161,6 +177,7 @@ typedef void* yyscan_t;
%token C_STRING "string (some input, perhaps)"
%token C_EVAL "eval"
%token C_SHELL "shell"
+%token C_IF "if (condition)"
%token T_DIGITS "digits (numbers)"
%token T_LITERAL "literal (string)"
@@ -187,18 +204,18 @@ params
;
normal
- : T_ID { phpdbg_stack_push(stack, &$1); }
- | normal T_ID { phpdbg_stack_push(stack, &$2); }
+ : T_ID { $$ = $1; }
+ | normal T_ID { $$ = $2; }
;
special
- : C_EVAL T_INPUT { phpdbg_stack_push(stack, &$1); phpdbg_stack_push(stack, &$2); }
- | C_SHELL T_INPUT { phpdbg_stack_push(stack, &$1); phpdbg_stack_push(stack, &$2); }
+ : C_EVAL T_INPUT { $$ = $2; $$.type = EVAL_PARAM; }
+ | C_SHELL T_INPUT { $$ = $2; $$.type = SHELL_PARAM;; }
;
command
- : normal
- | special
+ : normal { phpdbg_stack_push(stack, &$1); }
+ | special { phpdbg_stack_push(stack, &$1); }
;
parameter
@@ -210,6 +227,7 @@ parameter
| T_LITERAL { $$ = $1; }
| C_TRUTHY { $$ = $1; }
| C_FALSY { $$ = $1; }
+ | C_IF T_INPUT { $$ = $2; $$.type = COND_PARAM; }
;
handler