summaryrefslogtreecommitdiff
path: root/sapi/phpdbg/phpdbg_parser.y
diff options
context:
space:
mode:
Diffstat (limited to 'sapi/phpdbg/phpdbg_parser.y')
-rw-r--r--sapi/phpdbg/phpdbg_parser.y71
1 files changed, 36 insertions, 35 deletions
diff --git a/sapi/phpdbg/phpdbg_parser.y b/sapi/phpdbg/phpdbg_parser.y
index 702bf78455..8b3ab27f85 100644
--- a/sapi/phpdbg/phpdbg_parser.y
+++ b/sapi/phpdbg/phpdbg_parser.y
@@ -1,12 +1,12 @@
%{
-
+
/*
* phpdbg_parser.y
* (from php-src root)
* flex sapi/phpdbg/dev/phpdbg_lexer.l
* bison sapi/phpdbg/dev/phpdbg_parser.y
*/
-
+
#include "phpdbg.h"
#include "phpdbg_cmd.h"
#include "phpdbg_utils.h"
@@ -19,7 +19,7 @@
#include "phpdbg_lexer.h"
#undef yyerror
-static int yyerror(void ***tsrm_ls, const char *msg);
+static int yyerror(const char *msg);
ZEND_EXTERN_MODULE_GLOBALS(phpdbg);
@@ -27,7 +27,7 @@ ZEND_EXTERN_MODULE_GLOBALS(phpdbg);
%pure-parser
%error-verbose
-
+
%code requires {
#include "phpdbg.h"
#ifndef YY_TYPEDEF_YY_SCANNER_T
@@ -36,8 +36,6 @@ typedef void* yyscan_t;
#endif
}
-%parse-param { void *tsrm_ls }
-
%output "sapi/phpdbg/phpdbg_parser.c"
%defines "sapi/phpdbg/phpdbg_parser.h"
@@ -59,6 +57,7 @@ typedef void* yyscan_t;
%token T_ID "identifier (command or function name)"
%token T_INPUT "input (input string or data)"
%token T_UNEXPECTED "input"
+%token T_REQ_ID "request id (-r %d)"
%% /* Rules */
@@ -71,10 +70,11 @@ input
parameters
: parameter { phpdbg_stack_push(PHPDBG_G(parser_stack), &$1); }
| parameters parameter { phpdbg_stack_push(PHPDBG_G(parser_stack), &$2); }
+ | parameters req_id { $$ = $1; }
;
parameter
- : T_ID T_COLON T_DIGITS {
+ : T_ID T_COLON T_DIGITS {
$$.type = FILE_PARAM;
$$.file.name = $2.str;
$$.file.line = $3.num;
@@ -104,25 +104,25 @@ parameter
}
$$.file.line = $5.num;
}
- | T_ID T_DCOLON T_ID {
+ | T_ID T_DCOLON T_ID {
$$.type = METHOD_PARAM;
$$.method.class = $1.str;
$$.method.name = $3.str;
}
- | T_ID T_DCOLON T_ID T_POUND T_DIGITS {
+ | T_ID T_DCOLON T_ID T_POUND T_DIGITS {
$$.type = NUMERIC_METHOD_PARAM;
$$.method.class = $1.str;
$$.method.name = $3.str;
- $$.num = $5.num;
+ $$.num = $5.num;
}
| T_ID T_POUND T_DIGITS {
$$.type = NUMERIC_FUNCTION_PARAM;
$$.str = $1.str;
$$.len = $1.len;
- $$.num = $3.num;
+ $$.num = $3.num;
}
| T_IF T_INPUT {
- $$.type = COND_PARAM;
+ $$.type = COND_PARAM;
$$.str = $2.str;
$$.len = $2.len;
}
@@ -135,36 +135,41 @@ parameter
| T_ID { $$ = $1; }
;
+req_id
+ : T_REQ_ID { PHPDBG_G(req_id) = $1.num; }
+ | /* empty */
+;
+
full_expression
- : T_EVAL T_INPUT {
- $$.type = EVAL_PARAM;
- $$.str = $2.str;
- $$.len = $2.len;
+ : T_EVAL req_id T_INPUT {
+ $$.type = EVAL_PARAM;
+ $$.str = $3.str;
+ $$.len = $3.len;
}
- | T_SHELL T_INPUT {
- $$.type = SHELL_PARAM;
- $$.str = $2.str;
- $$.len = $2.len;
+ | T_SHELL req_id T_INPUT {
+ $$.type = SHELL_PARAM;
+ $$.str = $3.str;
+ $$.len = $3.len;
}
- | T_RUN {
+ | T_RUN req_id {
$$.type = RUN_PARAM;
$$.len = 0;
}
- | T_RUN T_INPUT {
- $$.type = RUN_PARAM;
- $$.str = $2.str;
- $$.len = $2.len;
+ | T_RUN req_id T_INPUT {
+ $$.type = RUN_PARAM;
+ $$.str = $3.str;
+ $$.len = $3.len;
}
;
%%
-static int yyerror(void ***tsrm_ls, const char *msg) {
- phpdbg_error("Parse Error: %s", msg);
+static int yyerror(const char *msg) {
+ phpdbg_error("command", "type=\"parseerror\" msg=\"%s\"", "Parse Error: %s", msg);
{
const phpdbg_param_t *top = PHPDBG_G(parser_stack);
-
+
while (top) {
phpdbg_param_debug(top, "--> ");
top = top->next;
@@ -173,12 +178,8 @@ static int yyerror(void ***tsrm_ls, const char *msg) {
return 0;
}
-int phpdbg_do_parse(phpdbg_param_t *stack, char *input TSRMLS_DC) {
- phpdbg_init_lexer(stack, input TSRMLS_CC);
+int phpdbg_do_parse(phpdbg_param_t *stack, char *input) {
+ phpdbg_init_lexer(stack, input);
-#ifdef ZTS
- return yyparse(TSRMLS_C);
-#else
- return yyparse(NULL);
-#endif
+ return yyparse();
}