com php-src: better-ness, I think: dev/phpdbg_lexer.l dev /phpdbg_parser.y phpdbg_break.c phpdbg_break.h phpdbg_help.c phpdbg_lexer.c phpdbg_lexer.h
phpdbg_parser.c phpdbg_parser.h phpdbg_prompt .c

From: Date: Fri, 21 Feb 2014 14:44:16 +0000
Subject: com php-src: better-ness, I think: dev/phpdbg_lexer.l dev /phpdbg_parser.y phpdbg_break.c phpdbg_break.h phpdbg_help.c phpdbg_lexer.c phpdbg_lexer.h
phpdbg_parser.c phpdbg_parser.h phpdbg_prompt .c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-77049@lists.php.net to get a copy of this message
Commit: 5db16dd9892d7aa4e5be5f049141051da35542d9 Author: krakjoe <joe.watkins@live.co.uk> Fri, 21 Feb 2014 14:44:16 +0000 Parents: e2fcc870e34510dc4cc47ad69d77b28ae9eb21df Branches: PHP-5.6 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=5db16dd9892d7aa4e5be5f049141051da35542d9 Log: better-ness, I think Changed paths: M dev/phpdbg_lexer.l M dev/phpdbg_parser.y M phpdbg_break.c M phpdbg_break.h M phpdbg_help.c M phpdbg_lexer.c M phpdbg_lexer.h M phpdbg_parser.c M phpdbg_parser.h M phpdbg_prompt.c

diff --git a/dev/phpdbg_lexer.l b/dev/phpdbg_lexer.l index e20f9dc..52d1d44 100644 --- a/dev/phpdbg_lexer.l +++ b/dev/phpdbg_lexer.l @@ -21,88 +21,61 @@ %option reentrant noyywrap never-interactive nounistd %option bison-bridge -C_TRUE ?i:"true" -C_YES ?i:"yes" -C_ON ?i:"on" -C_ENABLED ?i:"enabled" -C_FALSE ?i:"false" -C_NO ?i:"no" -C_OFF ?i:"off" -C_DISABLED ?i:"disabled" -C_EVAL ?i:"eval" -C_SHELL ?i:"shell" -C_IF ?i:"if" +T_TRUE ?i:"true" +T_YES ?i:"yes" +T_ON ?i:"on" +T_ENABLED ?i:"enabled" +T_FALSE ?i:"false" +T_NO ?i:"no" +T_OFF ?i:"off" +T_DISABLED ?i:"disabled" +T_EVAL ?i:"eval" +T_SHELL ?i:"shell" +T_IF ?i:"if" WS [ \r\n\t]+ DIGITS [0-9\.]+ -ID [^ \r\n\t]+ -NSID [\\\\]?{ID} -METHOD {NSID}+::{ID} -NUMERIC_METHOD {METHOD}[#]{DIGITS} -NUMERIC_FUNCTION {NSID}[#]{DIGITS} -FILE [^ :\r\n\t]+:[0-9]+ +ID [^ \r\n\t:#]+ OPLINE 0x[a-fA-F0-9]+ LITERAL \"(\\.|[^\\"])*\" INPUT [^\n]+ %% <INITIAL> { - {C_EVAL} { + [#]{1} { return T_POUND; } + [:]{2} { return T_DCOLON; } + [:]{1} { return T_COLON; } + + {T_EVAL} { BEGIN(RAW); phpdbg_init_param(yylval, EMPTY_PARAM); - return C_EVAL; + return T_EVAL; } - {C_SHELL} { + {T_SHELL} { BEGIN(RAW); phpdbg_init_param(yylval, EMPTY_PARAM); - return C_SHELL; + return T_SHELL; } - {C_IF} { + {T_IF} { BEGIN(RAW); phpdbg_init_param(yylval, EMPTY_PARAM); - return C_IF; + return T_IF; } - {C_YES}|{C_ON}|{C_ENABLED}|{C_TRUE} { + {T_YES}|{T_ON}|{T_ENABLED}|{T_TRUE} { phpdbg_init_param(yylval, NUMERIC_PARAM); yylval->num = 1; - return C_TRUTHY; + return T_TRUTHY; } - {C_NO}|{C_OFF}|{C_DISABLED}|{C_FALSE} { + {T_NO}|{T_OFF}|{T_DISABLED}|{T_FALSE} { phpdbg_init_param(yylval, NUMERIC_PARAM); yylval->num = 0; - return C_FALSY; + return T_FALSY; } {DIGITS} { phpdbg_init_param(yylval, NUMERIC_PARAM); yylval->num = atoi(yytext); return T_DIGITS; } - {NUMERIC_METHOD} { - phpdbg_init_param(yylval, NUMERIC_METHOD_PARAM); - yylval->method.class = "class"; - yylval->method.name = "func"; - yylval->num = 0; - return T_METHOD; - } - {NUMERIC_FUNCTION} { - phpdbg_init_param(yylval, NUMERIC_FUNCTION_PARAM); - yylval->str = strndup(yytext, yyleng); - yylval->len = yyleng; - yylval->num = 0; - return T_ID; - } - {METHOD} { - phpdbg_init_param(yylval, METHOD_PARAM); - yylval->method.class = "class"; - yylval->method.name = "func"; - return T_METHOD; - } - {FILE} { - phpdbg_init_param(yylval, FILE_PARAM); - yylval->file.name = strndup(yytext, yyleng); - yylval->file.line = 0; - return T_FILE; - } {OPLINE} { phpdbg_init_param(yylval, ADDR_PARAM); yylval->addr = strtoul(yytext, NULL, 10); @@ -114,7 +87,7 @@ INPUT [^\n]+ yylval->len = yyleng; return T_LITERAL; } - {NSID} { + {ID} { phpdbg_init_param(yylval, STR_PARAM); yylval->str = strndup(yytext, yyleng); yylval->len = yyleng; diff --git a/dev/phpdbg_parser.y b/dev/phpdbg_parser.y index 90e79f8..842f6a2 100644 --- a/dev/phpdbg_parser.y +++ b/dev/phpdbg_parser.y @@ -43,7 +43,6 @@ int yyerror(phpdbg_param_t *stack, yyscan_t scanner, const char *msg) { typedef void* yyscan_t; #endif } -%expect 1 %output "sapi/phpdbg/phpdbg_parser.c" %defines "sapi/phpdbg/phpdbg_parser.h" @@ -52,27 +51,27 @@ typedef void* yyscan_t; %parse-param { phpdbg_param_t *stack } %parse-param { yyscan_t scanner } -%token C_TRUTHY "truthy (true, on, yes or enabled)" -%token C_FALSY "falsy (false, off, no or disabled)" -%token C_STRING "string (some input, perhaps)" -%token C_EVAL "eval" -%token C_SHELL "shell" -%token C_IF "if (condition)" +%token T_EVAL "eval" +%token T_SHELL "shell" +%token T_IF "if (condition)" +%token T_TRUTHY "truthy (true, on, yes or enabled)" +%token T_FALSY "falsy (false, off, no or disabled)" +%token T_STRING "string (some input, perhaps)" +%token T_COLON ": (colon)" +%token T_DCOLON ":: (double colon)" +%token T_POUND "# (pound sign)" %token T_DIGITS "digits (numbers)" %token T_LITERAL "literal (string)" -%token T_METHOD "method" -%token T_NUMERIC_METHOD "method opline address" -%token T_NUMERIC_FUNCTION "function opline address" %token T_OPLINE "opline" -%token T_FILE "file" %token T_ID "identifier (command or function name)" %token T_INPUT "input (input string or data)" %token T_UNEXPECTED "input" %% input - : handler + : parameters + | /* nothing */ ; parameters @@ -80,41 +79,50 @@ parameters | parameters parameter { phpdbg_stack_push(stack, &$2); } ; -params - : parameters - | /* empty */ - ; - -normal - : T_ID { phpdbg_stack_push(stack, &$1); } - | normal T_ID { phpdbg_stack_push(stack, &$2); } - ; - -special - : C_EVAL T_INPUT { $$ = $2; $$.type = EVAL_PARAM; } - | C_SHELL T_INPUT { $$ = $2; $$.type = SHELL_PARAM; } - ; - -command - : normal - | special { phpdbg_stack_push(stack, &$1); } - ; - parameter - : T_DIGITS { $$ = $1; } - | T_FILE { $$ = $1; } - | T_METHOD { $$ = $1; } - | T_NUMERIC_METHOD { $$ = $1; } - | T_NUMERIC_FUNCTION { $$ = $1; } + : T_ID T_COLON T_DIGITS { + $$.type = FILE_PARAM; + $$.file.name = $1.str; + $$.file.line = $3.num; + } + | 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 { + $$.type = NUMERIC_METHOD_PARAM; + $$.method.class = $1.str; + $$.method.name = $3.str; + $$.num = $5.num; + } + | T_ID T_POUND T_DIGITS { + $$.type = NUMERIC_FUNCTION_PARAM; + $$.str = $1.str; + $$.len = $1.len; + $$.num = $3.num; + } + | T_IF T_INPUT { + $$.type = COND_PARAM; + $$.str = $2.str; + $$.len = $2.len; + } + | T_EVAL T_INPUT { + $$.type = EVAL_PARAM; + $$.str = $2.str; + $$.len = $2.len; + } + | T_SHELL T_INPUT { + $$.type = SHELL_PARAM; + $$.str = $2.str; + $$.len = $2.len; + } | T_OPLINE { $$ = $1; } - | T_ID { $$ = $1; } | T_LITERAL { $$ = $1; } - | C_TRUTHY { $$ = $1; } - | C_FALSY { $$ = $1; } - | C_IF T_INPUT { $$ = $2; $$.type = COND_PARAM; } + | T_TRUTHY { $$ = $1; } + | T_FALSY { $$ = $1; } + | T_DIGITS { $$ = $1; } + | T_ID { $$ = $1; } ; -handler - : command params - ; %% diff --git a/phpdbg_break.c b/phpdbg_break.c index fdf4e19..92b4e2e 100644 --- a/phpdbg_break.c +++ b/phpdbg_break.c @@ -39,8 +39,7 @@ const phpdbg_command_t phpdbg_break_commands[] = { PHPDBG_BREAK_COMMAND_D(func, "specify breakpoint by global function name", 'f', break_func, NULL, "s"), PHPDBG_BREAK_COMMAND_D(method, "specify breakpoint by class::method", 'm', break_method, NULL, "m"), PHPDBG_BREAK_COMMAND_D(address, "specify breakpoint by address", 'a', break_address, NULL, "a"), - PHPDBG_BREAK_COMMAND_D(op, "specify breakpoint by opcode", 'O', break_op, NULL, "s"), - PHPDBG_BREAK_COMMAND_D(on, "specify breakpoint by condition", 'o', break_on, NULL, "c"), + PHPDBG_BREAK_COMMAND_D(op, "specify breakpoint by opcode", 'o', break_op, NULL, "s"), PHPDBG_BREAK_COMMAND_D(at, "specify breakpoint by location and condition", 'A', break_at, NULL, "*c"), PHPDBG_BREAK_COMMAND_D(lineno, "specify breakpoint by line of currently executing file", 'l', break_lineno, NULL, "n"), PHPDBG_BREAK_COMMAND_D(del, "delete breakpoint by identifier number", 'd', break_del, NULL, "n"), @@ -98,19 +97,6 @@ PHPDBG_BREAK(address) /* {{{ */ return SUCCESS; } /* }}} */ -PHPDBG_BREAK(on) /* {{{ */ -{ - switch (param->type) { - case STR_PARAM: - phpdbg_set_breakpoint_expression(param->str, param->len TSRMLS_CC); - break; - - phpdbg_default_switch_case(); - } - - return SUCCESS; -} /* }}} */ - PHPDBG_BREAK(at) /* {{{ */ { phpdbg_set_breakpoint_at(param TSRMLS_CC); diff --git a/phpdbg_break.h b/phpdbg_break.h index 38f1298..d356fa0 100644 --- a/phpdbg_break.h +++ b/phpdbg_break.h @@ -35,7 +35,6 @@ PHPDBG_BREAK(method); PHPDBG_BREAK(address); PHPDBG_BREAK(at); PHPDBG_BREAK(op); -PHPDBG_BREAK(on); PHPDBG_BREAK(lineno); PHPDBG_BREAK(del); diff --git a/phpdbg_help.c b/phpdbg_help.c index c5da19b..115cf2d 100644 --- a/phpdbg_help.c +++ b/phpdbg_help.c @@ -507,15 +507,12 @@ phpdbg_help_text_t phpdbg_help_text[] = { " **method** **m** specify breakpoint by class::method" CR " **address** **a** specify breakpoint by address" CR " **op** **O** specify breakpoint by opcode" CR -" **on** **o** specify breakpoint by condition" CR " **at** **A** specify breakpoint by location and condition" CR " **del** **d** delete breakpoint by breakpoint identifier number" CR CR "The syntax of the target argument is dependent on the target type and in the case of address, " "file, func, line and method targets the target keyword or alias is optional and can be omitted." CR CR -"**Break on** takes a string argument which must be a valid PHP expression." CR CR - "**Break at** takes two arguments. The first is any valid target as per the file, lineno, func " "and address types. The second is a valid PHP expression which will trigger the break in " "execution, if evaluated as true in a boolean context at the specified target." CR CR @@ -562,8 +559,8 @@ phpdbg_help_text_t phpdbg_help_text[] = { " $P b a test.php#3" CR " Break at the opline #3 of test.php" CR CR -" $P break on $cnt > 10" CR -" $P b o $cnt > 10" CR +" $P break if $cnt > 10" CR +" $P b if $cnt > 10" CR " Break when the condition ($cnt > 10) evaluates to true" CR CR " $P break at phpdbg::isGreat if $opt == 'S'" CR @@ -573,7 +570,7 @@ phpdbg_help_text_t phpdbg_help_text[] = { " Break at every opcode on line 20 of test.php when the condition evaluates to true" CR CR " $P break op ZEND_ADD" CR -" $P b O ZEND_ADD" CR +" $P b o ZEND_ADD" CR " Break on any occurence of the opcode ZEND_ADD" CR CR " $P break del 2" CR diff --git a/phpdbg_lexer.c b/phpdbg_lexer.c index 4515b6d..76ef431 100644 --- a/phpdbg_lexer.c +++ b/phpdbg_lexer.c @@ -349,8 +349,8 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); *yy_cp = '\0'; \ yyg->yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 16 -#define YY_END_OF_BUFFER 17 +#define YY_NUM_RULES 15 +#define YY_END_OF_BUFFER 16 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -358,21 +358,16 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[112] = +static yyconst flex_int16_t yy_accept[73] = { 0, - 0, 0, 0, 0, 17, 13, 15, 13, 6, 6, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 14, 14, 13, 13, 13, 13, 15, 13, 0, - 12, 13, 13, 13, 6, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 3, 5, 13, 4, 13, 13, - 13, 14, 14, 8, 10, 13, 12, 0, 8, 13, - 12, 13, 10, 13, 13, 13, 11, 8, 13, 13, - 13, 13, 5, 13, 13, 4, 9, 9, 9, 9, - 13, 8, 9, 9, 9, 9, 9, 13, 13, 13, - 1, 13, 13, 4, 9, 8, 9, 8, 9, 13, - - 13, 5, 2, 7, 7, 13, 13, 13, 4, 5, - 0 + 0, 0, 0, 0, 16, 12, 14, 12, 1, 9, + 9, 3, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 13, 13, 12, 14, 12, 0, 11, 12, 9, + 12, 2, 12, 12, 12, 12, 6, 8, 12, 7, + 12, 12, 12, 13, 13, 11, 0, 10, 12, 12, + 12, 12, 8, 12, 12, 7, 12, 12, 4, 12, + 12, 7, 12, 12, 8, 5, 12, 12, 12, 7, + 8, 0 } ; static yyconst flex_int32_t yy_ec[256] = @@ -409,201 +404,95 @@ static yyconst flex_int32_t yy_ec[256] = static yyconst flex_int32_t yy_meta[45] = { 0, - 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 3, 1, 2, 1, 1, 1, 2, 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 } ; -static yyconst flex_int16_t yy_base[121] = +static yyconst flex_int16_t yy_base[78] = { 0, - 0, 0, 43, 45, 106, 44, 48, 52, 57, 80, - 63, 64, 119, 65, 90, 92, 157, 99, 73, 104, - 116, 0, 56, 125, 142, 132, 148, 74, 176, 56, - 155, 202, 228, 165, 189, 251, 212, 217, 240, 241, - 248, 264, 267, 279, 280, 281, 294, 291, 296, 293, - 306, 0, 100, 330, 335, 320, 628, 93, 0, 346, - 347, 373, 180, 356, 361, 193, 0, 384, 389, 392, - 397, 400, 399, 420, 409, 425, 426, 436, 441, 449, - 206, 0, 457, 460, 486, 212, 469, 234, 470, 493, - 477, 496, 498, 503, 529, 534, 324, 0, 361, 539, - - 540, 541, 542, 570, 378, 575, 577, 578, 554, 583, - 628, 610, 79, 613, 66, 616, 618, 621, 51, 624 + 0, 0, 43, 45, 135, 0, 47, 49, 187, 49, + 53, 96, 45, 44, 54, 51, 47, 53, 54, 50, + 59, 0, 72, 0, 75, 89, 77, 0, 97, 101, + 110, 187, 73, 87, 91, 92, 0, 0, 96, 0, + 99, 90, 104, 0, 130, 187, 100, 0, 119, 123, + 118, 115, 0, 126, 131, 0, 135, 130, 0, 135, + 132, 0, 133, 141, 0, 0, 142, 144, 145, 0, + 0, 187, 175, 64, 178, 181, 183 } ; -static yyconst flex_int16_t yy_def[121] = +static yyconst flex_int16_t yy_def[78] = { 0, - 111, 1, 112, 112, 111, 113, 111, 114, 113, 113, - 115, 113, 113, 113, 113, 113, 113, 113, 113, 113, - 113, 116, 116, 113, 113, 115, 113, 111, 114, 117, - 113, 114, 118, 114, 113, 113, 115, 115, 115, 115, - 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, - 113, 116, 116, 113, 115, 119, 111, 117, 32, 118, - 115, 118, 62, 120, 118, 32, 36, 115, 113, 113, - 113, 113, 113, 113, 113, 113, 119, 119, 119, 119, - 62, 62, 120, 119, 120, 85, 120, 62, 113, 113, - 113, 113, 113, 113, 119, 119, 85, 85, 85, 113, - - 113, 113, 113, 119, 85, 113, 113, 113, 113, 113, - 0, 111, 111, 111, 111, 111, 111, 111, 111, 111 + 72, 1, 73, 73, 72, 74, 72, 75, 72, 74, + 74, 72, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 76, 76, 74, 72, 75, 77, 74, 75, 74, + 74, 72, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 76, 76, 72, 77, 31, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 0, 72, 72, 72, 72, 72 } ; -static yyconst flex_int16_t yy_nxt[673] = +static yyconst flex_int16_t yy_nxt[232] = { 0, - 6, 7, 7, 8, 6, 9, 10, 9, 11, 6, - 6, 6, 12, 13, 14, 6, 15, 6, 16, 17, - 6, 18, 19, 6, 6, 20, 21, 6, 6, 12, - 13, 14, 6, 15, 6, 16, 17, 6, 18, 19, - 6, 6, 6, 20, 23, 7, 23, 7, 25, 28, - 28, 77, 26, 30, 30, 31, 32, 53, 28, 57, - 33, 25, 35, 35, 35, 26, 37, 38, 25, 25, - 27, 39, 26, 26, 44, 28, 28, 25, 34, 24, - 41, 26, 58, 27, 25, 35, 35, 35, 26, 40, - 27, 27, 44, 50, 25, 111, 25, 41, 26, 27, - - 26, 53, 28, 25, 45, 111, 27, 26, 25, 111, - 50, 46, 26, 111, 49, 111, 27, 51, 27, 111, - 25, 45, 36, 25, 26, 27, 111, 26, 46, 25, - 27, 49, 111, 26, 51, 111, 38, 42, 55, 55, - 56, 111, 27, 43, 111, 27, 25, 54, 54, 54, - 26, 27, 25, 111, 42, 111, 26, 111, 40, 25, - 43, 25, 111, 26, 111, 26, 30, 111, 27, 32, - 111, 47, 111, 33, 27, 48, 111, 30, 30, 31, - 32, 27, 111, 27, 33, 60, 63, 63, 47, 111, - 111, 66, 48, 25, 35, 35, 35, 26, 29, 29, - - 29, 111, 34, 30, 30, 31, 32, 59, 59, 59, - 33, 60, 60, 60, 64, 27, 38, 83, 83, 83, - 39, 38, 68, 68, 68, 39, 111, 111, 34, 30, - 30, 61, 62, 111, 63, 63, 64, 111, 40, 60, - 60, 60, 111, 40, 38, 38, 111, 111, 56, 39, - 111, 111, 25, 111, 65, 25, 26, 67, 67, 26, - 67, 67, 67, 67, 67, 67, 40, 40, 25, 69, - 111, 25, 26, 70, 27, 26, 71, 27, 67, 67, - 67, 67, 67, 25, 25, 25, 69, 26, 26, 26, - 27, 70, 111, 27, 71, 25, 72, 25, 25, 26, - - 25, 26, 26, 111, 26, 27, 27, 27, 73, 74, - 25, 111, 111, 72, 26, 111, 75, 27, 111, 27, - 27, 111, 27, 111, 78, 73, 74, 76, 79, 105, - 105, 105, 27, 75, 25, 54, 54, 54, 26, 38, - 111, 55, 55, 39, 76, 111, 80, 30, 30, 61, - 62, 38, 111, 111, 81, 39, 27, 30, 30, 84, - 85, 40, 30, 111, 86, 62, 83, 83, 83, 81, - 111, 111, 65, 40, 30, 30, 61, 62, 82, 82, - 82, 81, 87, 105, 105, 105, 111, 88, 38, 68, - 68, 68, 39, 25, 111, 111, 25, 26, 89, 65, - - 26, 25, 90, 25, 25, 26, 111, 26, 26, 111, - 40, 111, 111, 25, 91, 27, 89, 26, 27, 111, - 90, 92, 94, 27, 25, 27, 27, 111, 26, 25, - 95, 91, 111, 26, 79, 27, 111, 93, 92, 94, - 95, 96, 96, 96, 79, 95, 27, 111, 111, 79, - 111, 27, 80, 95, 93, 111, 111, 79, 30, 30, - 84, 97, 80, 111, 95, 86, 111, 80, 79, 111, - 30, 111, 111, 97, 25, 80, 111, 86, 26, 111, - 100, 25, 111, 87, 111, 26, 80, 30, 30, 84, - 97, 98, 98, 98, 86, 99, 27, 25, 100, 111, - - 25, 26, 25, 27, 26, 111, 26, 25, 111, 102, - 101, 26, 87, 111, 111, 103, 111, 111, 111, 27, - 111, 111, 27, 111, 27, 111, 102, 101, 111, 27, - 111, 111, 103, 95, 104, 104, 104, 79, 95, 96, - 96, 96, 79, 25, 25, 25, 25, 26, 26, 26, - 26, 111, 111, 107, 111, 80, 106, 111, 25, 111, - 80, 111, 26, 111, 111, 27, 27, 27, 27, 111, - 107, 111, 111, 106, 95, 104, 104, 104, 79, 25, - 27, 25, 25, 26, 111, 26, 26, 25, 108, 109, - 110, 26, 111, 111, 111, 111, 80, 111, 111, 111, - - 111, 27, 111, 27, 27, 108, 109, 110, 111, 27, - 22, 22, 22, 29, 29, 29, 52, 52, 30, 30, - 30, 60, 60, 60, 83, 83, 83, 5, 111, 111, - 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, - 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, - 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, - 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, - 111, 111 + 6, 7, 7, 8, 9, 10, 11, 10, 12, 6, + 6, 6, 13, 14, 15, 6, 16, 6, 17, 18, + 6, 19, 20, 6, 6, 21, 6, 6, 6, 13, + 14, 15, 6, 16, 6, 17, 18, 6, 19, 20, + 6, 6, 6, 21, 23, 7, 23, 7, 25, 25, + 27, 27, 28, 27, 30, 30, 30, 27, 30, 30, + 30, 33, 34, 36, 24, 37, 38, 39, 35, 41, + 42, 40, 43, 45, 25, 29, 25, 25, 33, 34, + 46, 36, 37, 38, 39, 35, 41, 42, 40, 43, + 27, 27, 28, 27, 49, 31, 50, 27, 27, 72, + + 51, 27, 72, 47, 32, 27, 30, 30, 30, 52, + 53, 49, 54, 55, 50, 29, 48, 48, 51, 48, + 48, 48, 48, 48, 48, 56, 52, 53, 57, 54, + 55, 45, 25, 58, 72, 59, 60, 48, 48, 48, + 48, 48, 56, 61, 62, 63, 57, 64, 65, 66, + 67, 58, 59, 60, 68, 69, 70, 71, 72, 72, + 61, 62, 72, 63, 64, 65, 66, 67, 72, 72, + 72, 68, 69, 70, 71, 22, 22, 22, 26, 26, + 26, 44, 44, 27, 27, 27, 5, 72, 72, 72, + 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, + + 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, + 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, + 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, + 72 } ; -static yyconst flex_int16_t yy_chk[673] = +static yyconst flex_int16_t yy_chk[232] = { 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, 3, 3, 4, 4, 6, 7, - 7, 119, 6, 8, 8, 8, 8, 23, 23, 30, - 8, 9, 9, 9, 9, 9, 115, 11, 12, 14, - 6, 11, 12, 14, 14, 28, 28, 19, 8, 113, - 12, 19, 30, 9, 10, 10, 10, 10, 10, 11, - 12, 14, 14, 19, 15, 58, 16, 12, 15, 19, - - 16, 53, 53, 18, 15, 5, 10, 18, 20, 0, - 19, 16, 20, 0, 18, 0, 15, 20, 16, 0, - 21, 15, 10, 13, 21, 18, 0, 13, 16, 24, - 20, 18, 0, 24, 20, 0, 26, 13, 26, 26, - 26, 0, 21, 13, 0, 13, 25, 25, 25, 25, - 25, 24, 27, 0, 13, 0, 27, 0, 26, 31, - 13, 17, 0, 31, 0, 17, 34, 34, 25, 34, - 0, 17, 0, 34, 27, 17, 0, 29, 29, 29, - 29, 31, 0, 17, 29, 63, 63, 63, 17, 0, - 0, 34, 17, 35, 35, 35, 35, 35, 66, 66, - - 66, 0, 29, 32, 32, 32, 32, 32, 32, 32, - 32, 81, 81, 81, 81, 35, 37, 86, 86, 86, - 37, 38, 38, 38, 38, 38, 0, 0, 32, 33, - 33, 33, 33, 0, 33, 33, 33, 0, 37, 88, - 88, 88, 0, 38, 39, 40, 0, 0, 39, 40, - 0, 0, 41, 0, 33, 36, 41, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 39, 40, 42, 41, - 0, 43, 42, 42, 41, 43, 43, 36, 36, 36, - 36, 36, 36, 44, 45, 46, 41, 44, 45, 46, - 42, 42, 0, 43, 43, 48, 44, 50, 47, 48, - - 49, 50, 47, 0, 49, 44, 45, 46, 47, 49, - 51, 0, 0, 44, 51, 0, 50, 48, 0, 50, - 47, 0, 49, 0, 56, 47, 49, 51, 56, 97, - 97, 97, 51, 50, 54, 54, 54, 54, 54, 55, - 0, 55, 55, 55, 51, 0, 56, 60, 60, 60, - 60, 61, 0, 0, 60, 61, 54, 64, 64, 64, - 64, 55, 65, 65, 64, 65, 99, 99, 99, 65, - 0, 0, 60, 61, 62, 62, 62, 62, 62, 62, - 62, 62, 64, 105, 105, 105, 0, 65, 68, 68, - 68, 68, 68, 69, 0, 0, 70, 69, 69, 62, - - 70, 71, 70, 73, 72, 71, 0, 73, 72, 0, - 68, 0, 0, 75, 71, 69, 69, 75, 70, 0, - 70, 72, 75, 71, 74, 73, 72, 0, 74, 76, - 77, 71, 0, 76, 77, 75, 0, 74, 72, 75, - 78, 78, 78, 78, 78, 79, 74, 0, 0, 79, - 0, 76, 77, 80, 74, 0, 0, 80, 83, 83, - 83, 83, 78, 0, 84, 83, 0, 79, 84, 0, - 87, 87, 0, 87, 89, 80, 0, 87, 89, 0, - 89, 91, 0, 83, 0, 91, 84, 85, 85, 85, - 85, 85, 85, 85, 85, 87, 89, 90, 89, 0, - - 92, 90, 93, 91, 92, 0, 93, 94, 0, 92, - 90, 94, 85, 0, 0, 93, 0, 0, 0, 90, - 0, 0, 92, 0, 93, 0, 92, 90, 0, 94, - 0, 0, 93, 95, 95, 95, 95, 95, 96, 96, - 96, 96, 96, 100, 101, 102, 103, 100, 101, 102, - 103, 0, 0, 101, 0, 95, 100, 0, 109, 0, - 96, 0, 109, 0, 0, 100, 101, 102, 103, 0, - 101, 0, 0, 100, 104, 104, 104, 104, 104, 106, - 109, 107, 108, 106, 0, 107, 108, 110, 106, 107, - 108, 110, 0, 0, 0, 0, 104, 0, 0, 0, - - 0, 106, 0, 107, 108, 106, 107, 108, 0, 110, - 112, 112, 112, 114, 114, 114, 116, 116, 117, 117, - 117, 118, 118, 118, 120, 120, 120, 111, 111, 111, - 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, - 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, - 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, - 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, - 111, 111 + 1, 1, 1, 1, 3, 3, 4, 4, 7, 7, + 8, 8, 8, 8, 10, 10, 10, 8, 11, 11, + 11, 13, 14, 15, 74, 16, 17, 18, 14, 19, + 20, 18, 21, 23, 23, 8, 25, 25, 13, 14, + 27, 15, 16, 17, 18, 14, 19, 20, 18, 21, + 26, 26, 26, 26, 33, 11, 34, 26, 29, 29, + + 35, 29, 47, 27, 12, 29, 30, 30, 30, 36, + 39, 33, 41, 42, 34, 26, 31, 31, 35, 31, + 31, 31, 31, 31, 31, 43, 36, 39, 49, 41, + 42, 45, 45, 50, 5, 51, 52, 31, 31, 31, + 31, 31, 43, 54, 55, 57, 49, 58, 60, 61, + 63, 50, 51, 52, 64, 67, 68, 69, 0, 0, + 54, 55, 0, 57, 58, 60, 61, 63, 0, 0, + 0, 64, 67, 68, 69, 73, 73, 73, 75, 75, + 75, 76, 76, 77, 77, 77, 72, 72, 72, 72, + 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, + + 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, + 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, + 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, + 72 } ; /* The intent behind this definition is that it'll catch @@ -629,7 +518,7 @@ static yyconst flex_int16_t yy_chk[673] = #include <string.h> #define YY_NO_UNISTD_H 1 -#line 633 "sapi/phpdbg/phpdbg_lexer.c" +#line 522 "sapi/phpdbg/phpdbg_lexer.c" #define INITIAL 0 #define RAW 1 @@ -867,9 +756,9 @@ YY_DECL register int yy_act; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; -#line 47 "sapi/phpdbg/dev/phpdbg_lexer.l" +#line 42 "sapi/phpdbg/dev/phpdbg_lexer.l" -#line 873 "sapi/phpdbg/phpdbg_lexer.c" +#line 762 "sapi/phpdbg/phpdbg_lexer.c" yylval = yylval_param; @@ -924,13 +813,13 @@ yy_match: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 112 ) + if ( yy_current_state >= 73 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - while ( yy_current_state != 111 ); + while ( yy_current_state != 72 ); yy_cp = yyg->yy_last_accepting_cpos; yy_current_state = yyg->yy_last_accepting_state; @@ -952,113 +841,86 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 50 "sapi/phpdbg/dev/phpdbg_lexer.l" -{ - BEGIN(RAW); - phpdbg_init_param(yylval, EMPTY_PARAM); - return C_EVAL; - } +#line 45 "sapi/phpdbg/dev/phpdbg_lexer.l" +{ return T_POUND; } YY_BREAK case 2: YY_RULE_SETUP -#line 55 "sapi/phpdbg/dev/phpdbg_lexer.l" -{ - BEGIN(RAW); - phpdbg_init_param(yylval, EMPTY_PARAM); - return C_SHELL; - } +#line 46 "sapi/phpdbg/dev/phpdbg_lexer.l" +{ return T_DCOLON; } YY_BREAK case 3: YY_RULE_SETUP -#line 60 "sapi/phpdbg/dev/phpdbg_lexer.l" -{ - BEGIN(RAW); - phpdbg_init_param(yylval, EMPTY_PARAM); - return C_IF; - } +#line 47 "sapi/phpdbg/dev/phpdbg_lexer.l" +{ return T_COLON; } YY_BREAK case 4: YY_RULE_SETUP -#line 65 "sapi/phpdbg/dev/phpdbg_lexer.l" +#line 49 "sapi/phpdbg/dev/phpdbg_lexer.l" { - phpdbg_init_param(yylval, NUMERIC_PARAM); - yylval->num = 1; - return C_TRUTHY; + BEGIN(RAW); + phpdbg_init_param(yylval, EMPTY_PARAM); + return T_EVAL; } YY_BREAK case 5: YY_RULE_SETUP -#line 70 "sapi/phpdbg/dev/phpdbg_lexer.l" +#line 54 "sapi/phpdbg/dev/phpdbg_lexer.l" { - phpdbg_init_param(yylval, NUMERIC_PARAM); - yylval->num = 0; - return C_FALSY; + BEGIN(RAW); + phpdbg_init_param(yylval, EMPTY_PARAM); + return T_SHELL; } YY_BREAK case 6: YY_RULE_SETUP -#line 75 "sapi/phpdbg/dev/phpdbg_lexer.l" +#line 59 "sapi/phpdbg/dev/phpdbg_lexer.l" { - phpdbg_init_param(yylval, NUMERIC_PARAM); - yylval->num = atoi(yytext); - return T_DIGITS; + BEGIN(RAW); + phpdbg_init_param(yylval, EMPTY_PARAM); + return T_IF; } YY_BREAK case 7: YY_RULE_SETUP -#line 80 "sapi/phpdbg/dev/phpdbg_lexer.l" +#line 64 "sapi/phpdbg/dev/phpdbg_lexer.l" { - phpdbg_init_param(yylval, NUMERIC_METHOD_PARAM); - yylval->method.class = "class"; - yylval->method.name = "func"; - yylval->num = 0; - return T_METHOD; + phpdbg_init_param(yylval, NUMERIC_PARAM); + yylval->num = 1; + return T_TRUTHY; } YY_BREAK case 8: YY_RULE_SETUP -#line 87 "sapi/phpdbg/dev/phpdbg_lexer.l" +#line 69 "sapi/phpdbg/dev/phpdbg_lexer.l" { - phpdbg_init_param(yylval, NUMERIC_FUNCTION_PARAM); - yylval->str = strndup(yytext, yyleng); - yylval->len = yyleng; + phpdbg_init_param(yylval, NUMERIC_PARAM); yylval->num = 0; - return T_ID; + return T_FALSY; } YY_BREAK case 9: YY_RULE_SETUP -#line 94 "sapi/phpdbg/dev/phpdbg_lexer.l" +#line 74 "sapi/phpdbg/dev/phpdbg_lexer.l" { - phpdbg_init_param(yylval, METHOD_PARAM); - yylval->method.class = "class"; - yylval->method.name = "func"; - return T_METHOD; + phpdbg_init_param(yylval, NUMERIC_PARAM); + yylval->num = atoi(yytext); + return T_DIGITS; } YY_BREAK case 10: YY_RULE_SETUP -#line 100 "sapi/phpdbg/dev/phpdbg_lexer.l" -{ - phpdbg_init_param(yylval, FILE_PARAM); - yylval->file.name = strndup(yytext, yyleng); - yylval->file.line = 0; - return T_FILE; - } - YY_BREAK -case 11: -YY_RULE_SETUP -#line 106 "sapi/phpdbg/dev/phpdbg_lexer.l" +#line 79 "sapi/phpdbg/dev/phpdbg_lexer.l" { phpdbg_init_param(yylval, ADDR_PARAM); yylval->addr = strtoul(yytext, NULL, 10); return T_OPLINE; } YY_BREAK -case 12: -/* rule 12 can match eol */ +case 11: +/* rule 11 can match eol */ YY_RULE_SETUP -#line 111 "sapi/phpdbg/dev/phpdbg_lexer.l" +#line 84 "sapi/phpdbg/dev/phpdbg_lexer.l" { phpdbg_init_param(yylval, STR_PARAM); yylval->str = strndup(yytext, yyleng); @@ -1066,9 +928,9 @@ YY_RULE_SETUP return T_LITERAL; } YY_BREAK -case 13: +case 12: YY_RULE_SETUP -#line 117 "sapi/phpdbg/dev/phpdbg_lexer.l" +#line 90 "sapi/phpdbg/dev/phpdbg_lexer.l" { phpdbg_init_param(yylval, STR_PARAM); yylval->str = strndup(yytext, yyleng); @@ -1077,9 +939,9 @@ YY_RULE_SETUP } YY_BREAK -case 14: +case 13: YY_RULE_SETUP -#line 124 "sapi/phpdbg/dev/phpdbg_lexer.l" +#line 97 "sapi/phpdbg/dev/phpdbg_lexer.l" { phpdbg_init_param(yylval, STR_PARAM); yylval->str = strndup(yytext, yyleng); @@ -1088,18 +950,18 @@ YY_RULE_SETUP return T_INPUT; } YY_BREAK -case 15: -/* rule 15 can match eol */ +case 14: +/* rule 14 can match eol */ YY_RULE_SETUP -#line 131 "sapi/phpdbg/dev/phpdbg_lexer.l" +#line 104 "sapi/phpdbg/dev/phpdbg_lexer.l" { /* ignore whitespace */ } YY_BREAK -case 16: +case 15: YY_RULE_SETUP -#line 132 "sapi/phpdbg/dev/phpdbg_lexer.l" +#line 105 "sapi/phpdbg/dev/phpdbg_lexer.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK -#line 1103 "sapi/phpdbg/phpdbg_lexer.c" +#line 965 "sapi/phpdbg/phpdbg_lexer.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(RAW): yyterminate(); @@ -1395,7 +1257,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 112 ) + if ( yy_current_state >= 73 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -1424,11 +1286,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 112 ) + if ( yy_current_state >= 73 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 111); + yy_is_jam = (yy_current_state == 72); return yy_is_jam ? 0 : yy_current_state; } @@ -2264,7 +2126,7 @@ void yyfree (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 132 "sapi/phpdbg/dev/phpdbg_lexer.l" +#line 105 "sapi/phpdbg/dev/phpdbg_lexer.l" diff --git a/phpdbg_lexer.h b/phpdbg_lexer.h index f5d949a..6a799c6 100644 --- a/phpdbg_lexer.h +++ b/phpdbg_lexer.h @@ -338,7 +338,7 @@ extern int yylex \ #undef YY_DECL #endif -#line 132 "sapi/phpdbg/dev/phpdbg_lexer.l" +#line 105 "sapi/phpdbg/dev/phpdbg_lexer.l" #line 345 "sapi/phpdbg/phpdbg_lexer.h" diff --git a/phpdbg_parser.c b/phpdbg_parser.c index 37bd4d8..099daa3 100644 --- a/phpdbg_parser.c +++ b/phpdbg_parser.c @@ -147,22 +147,21 @@ typedef void* yyscan_t; /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { - C_TRUTHY = 258, - C_FALSY = 259, - C_STRING = 260, - C_EVAL = 261, - C_SHELL = 262, - C_IF = 263, - T_DIGITS = 264, - T_LITERAL = 265, - T_METHOD = 266, - T_NUMERIC_METHOD = 267, - T_NUMERIC_FUNCTION = 268, + T_EVAL = 258, + T_SHELL = 259, + T_IF = 260, + T_TRUTHY = 261, + T_FALSY = 262, + T_STRING = 263, + T_COLON = 264, + T_DCOLON = 265, + T_POUND = 266, + T_DIGITS = 267, + T_LITERAL = 268, T_OPLINE = 269, - T_FILE = 270, - T_ID = 271, - T_INPUT = 272, - T_UNEXPECTED = 273 + T_ID = 270, + T_INPUT = 271, + T_UNEXPECTED = 272 }; #endif @@ -180,7 +179,7 @@ typedef int YYSTYPE; /* Line 343 of yacc.c */ -#line 184 "sapi/phpdbg/phpdbg_parser.c" +#line 183 "sapi/phpdbg/phpdbg_parser.c" #ifdef short # undef short @@ -397,22 +396,22 @@ union yyalloc #endif /* !YYCOPY_NEEDED */ /* YYFINAL -- State number of the termination state. */ -#define YYFINAL 11 +#define YYFINAL 19 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 24 +#define YYLAST 22 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 19 +#define YYNTOKENS 18 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 9 +#define YYNNTS 4 /* YYNRULES -- Number of rules. */ -#define YYNRULES 24 +#define YYNRULES 18 /* YYNRULES -- Number of states. */ -#define YYNSTATES 29 +#define YYNSTATES 26 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 273 +#define YYMAXUTOK 272 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -447,7 +446,7 @@ static const yytype_uint8 yytranslate[] = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18 + 15, 16, 17 }; #if YYDEBUG @@ -455,28 +454,25 @@ static const yytype_uint8 yytranslate[] = YYRHS. */ static const yytype_uint8 yyprhs[] = { - 0, 0, 3, 5, 7, 10, 12, 13, 15, 18, - 21, 24, 26, 28, 30, 32, 34, 36, 38, 40, - 42, 44, 46, 48, 51 + 0, 0, 3, 5, 6, 8, 11, 15, 19, 25, + 29, 31, 33, 35, 37, 39, 41, 44, 47 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int8 yyrhs[] = { - 20, 0, -1, 27, -1, 26, -1, 21, 26, -1, - 21, -1, -1, 16, -1, 23, 16, -1, 6, 17, - -1, 7, 17, -1, 23, -1, 24, -1, 9, -1, - 15, -1, 11, -1, 12, -1, 13, -1, 14, -1, - 16, -1, 10, -1, 3, -1, 4, -1, 8, 17, - -1, 25, 22, -1 + 19, 0, -1, 20, -1, -1, 21, -1, 20, 21, + -1, 15, 9, 12, -1, 15, 10, 15, -1, 15, + 10, 15, 11, 12, -1, 15, 11, 12, -1, 14, + -1, 13, -1, 6, -1, 7, -1, 12, -1, 15, + -1, 5, 16, -1, 3, 16, -1, 4, 16, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { - 0, 75, 75, 79, 80, 84, 85, 89, 90, 94, - 95, 99, 100, 104, 105, 106, 107, 108, 109, 110, - 111, 112, 113, 114, 118 + 0, 73, 73, 74, 78, 79, 83, 88, 93, 99, + 104, 105, 106, 107, 108, 109, 110, 111, 112 }; #endif @@ -485,15 +481,15 @@ static const yytype_uint8 yyrline[] = First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { - "$end", "error", "$undefined", "\"truthy (true, on, yes or enabled)\"", + "$end", "error", "$undefined", "\"eval\"", "\"shell\"", + "\"if (condition)\"", "\"truthy (true, on, yes or enabled)\"", "\"falsy (false, off, no or disabled)\"", - "\"string (some input, perhaps)\"", "\"eval\"", "\"shell\"", - "\"if (condition)\"", "\"digits (numbers)\"", "\"literal (string)\"", - "\"method\"", "\"method opline address\"", "\"function opline address\"", - "\"opline\"", "\"file\"", "\"identifier (command or function name)\"", + "\"string (some input, perhaps)\"", "\": (colon)\"", + "\":: (double colon)\"", "\"# (pound sign)\"", "\"digits (numbers)\"", + "\"literal (string)\"", "\"opline\"", + "\"identifier (command or function name)\"", "\"input (input string or data)\"", "\"input\"", "$accept", "input", - "parameters", "params", "normal", "special", "command", "parameter", - "handler", 0 + "parameters", "parameter", 0 }; #endif @@ -503,24 +499,22 @@ static const char *const yytname[] = static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273 + 265, 266, 267, 268, 269, 270, 271, 272 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 0, 19, 20, 21, 21, 22, 22, 23, 23, 24, - 24, 25, 25, 26, 26, 26, 26, 26, 26, 26, - 26, 26, 26, 26, 27 + 0, 18, 19, 19, 20, 20, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { - 0, 2, 1, 1, 2, 1, 0, 1, 2, 2, - 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 2, 2 + 0, 2, 1, 0, 1, 2, 3, 3, 5, 3, + 1, 1, 1, 1, 1, 1, 2, 2, 2 }; /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. @@ -528,31 +522,31 @@ static const yytype_uint8 yyr2[] = means the default is an error. */ static const yytype_uint8 yydefact[] = { - 0, 0, 0, 7, 0, 11, 12, 6, 2, 9, - 10, 1, 8, 21, 22, 0, 13, 20, 15, 16, - 17, 18, 14, 19, 5, 24, 3, 23, 4 + 3, 0, 0, 0, 12, 13, 14, 11, 10, 15, + 0, 2, 4, 17, 18, 16, 0, 0, 0, 1, + 5, 6, 7, 9, 0, 8 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { - -1, 4, 24, 25, 5, 6, 7, 26, 8 + -1, 10, 11, 12 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -16 +#define YYPACT_NINF -9 static const yytype_int8 yypact[] = { - 8, -15, -14, -16, 4, 0, -16, -3, -16, -16, - -16, -16, -16, -16, -16, 1, -16, -16, -16, -16, - -16, -16, -16, -16, -3, -16, -16, -16, -16 + -3, -8, -2, -1, -9, -9, -9, -9, -9, -4, + 13, -3, -9, -9, -9, -9, 4, 2, 6, -9, + -9, -9, 8, -9, 9, -9 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { - -16, -16, -16, -16, -16, -16, -16, -7, -16 + -9, -9, -9, 11 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -561,31 +555,31 @@ static const yytype_int8 yypgoto[] = #define YYTABLE_NINF -1 static const yytype_uint8 yytable[] = { - 13, 14, 9, 10, 11, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 1, 2, 12, 28, 27, 0, - 0, 0, 0, 0, 3 + 1, 2, 3, 4, 5, 16, 17, 18, 13, 6, + 7, 8, 9, 19, 14, 15, 21, 22, 23, 24, + 0, 25, 20 }; #define yypact_value_is_default(yystate) \ - ((yystate) == (-16)) + ((yystate) == (-9)) #define yytable_value_is_error(yytable_value) \ YYID (0) static const yytype_int8 yycheck[] = { - 3, 4, 17, 17, 0, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 6, 7, 16, 24, 17, -1, - -1, -1, -1, -1, 16 + 3, 4, 5, 6, 7, 9, 10, 11, 16, 12, + 13, 14, 15, 0, 16, 16, 12, 15, 12, 11, + -1, 12, 11 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 6, 7, 16, 20, 23, 24, 25, 27, 17, - 17, 0, 16, 3, 4, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 21, 22, 26, 17, 26 + 0, 3, 4, 5, 6, 7, 12, 13, 14, 15, + 19, 20, 21, 16, 16, 16, 9, 10, 11, 0, + 21, 12, 15, 12, 11, 12 }; #define yyerrok (yyerrstatus = 0) @@ -1431,136 +1425,132 @@ yyreduce: YY_REDUCE_PRINT (yyn); switch (yyn) { - case 3: + case 4: /* Line 1806 of yacc.c */ -#line 79 "sapi/phpdbg/dev/phpdbg_parser.y" +#line 78 "sapi/phpdbg/dev/phpdbg_parser.y" { phpdbg_stack_push(stack, &(yyvsp[(1) - (1)])); } break; - case 4: + case 5: /* Line 1806 of yacc.c */ -#line 80 "sapi/phpdbg/dev/phpdbg_parser.y" +#line 79 "sapi/phpdbg/dev/phpdbg_parser.y" { phpdbg_stack_push(stack, &(yyvsp[(2) - (2)])); } break; - case 7: - -/* Line 1806 of yacc.c */ -#line 89 "sapi/phpdbg/dev/phpdbg_parser.y" - { phpdbg_stack_push(stack, &(yyvsp[(1) - (1)])); } - break; - - case 8: + case 6: /* Line 1806 of yacc.c */ -#line 90 "sapi/phpdbg/dev/phpdbg_parser.y" - { phpdbg_stack_push(stack, &(yyvsp[(2) - (2)])); } +#line 83 "sapi/phpdbg/dev/phpdbg_parser.y" + { + (yyval).type = FILE_PARAM; + (yyval).file.name = (yyvsp[(1) - (3)]).str; + (yyval).file.line = (yyvsp[(3) - (3)]).num; + } break; - case 9: + case 7: /* Line 1806 of yacc.c */ -#line 94 "sapi/phpdbg/dev/phpdbg_parser.y" - { (yyval) = (yyvsp[(2) - (2)]); (yyval).type = EVAL_PARAM; } +#line 88 "sapi/phpdbg/dev/phpdbg_parser.y" + { + (yyval).type = METHOD_PARAM; + (yyval).method.class = (yyvsp[(1) - (3)]).str; + (yyval).method.name = (yyvsp[(3) - (3)]).str; + } break; - case 10: + case 8: /* Line 1806 of yacc.c */ -#line 95 "sapi/phpdbg/dev/phpdbg_parser.y" - { (yyval) = (yyvsp[(2) - (2)]); (yyval).type = SHELL_PARAM; } +#line 93 "sapi/phpdbg/dev/phpdbg_parser.y" + { + (yyval).type = NUMERIC_METHOD_PARAM; + (yyval).method.class = (yyvsp[(1) - (5)]).str; + (yyval).method.name = (yyvsp[(3) - (5)]).str; + (yyval).num = (yyvsp[(5) - (5)]).num; + } break; - case 12: + case 9: /* Line 1806 of yacc.c */ -#line 100 "sapi/phpdbg/dev/phpdbg_parser.y" - { phpdbg_stack_push(stack, &(yyvsp[(1) - (1)])); } +#line 99 "sapi/phpdbg/dev/phpdbg_parser.y" + { + (yyval).type = NUMERIC_FUNCTION_PARAM; + (yyval).str = (yyvsp[(1) - (3)]).str; + (yyval).num = (yyvsp[(3) - (3)]).num; + } break; - case 13: + case 10: /* Line 1806 of yacc.c */ #line 104 "sapi/phpdbg/dev/phpdbg_parser.y" { (yyval) = (yyvsp[(1) - (1)]); } break; - case 14: + case 11: /* Line 1806 of yacc.c */ #line 105 "sapi/phpdbg/dev/phpdbg_parser.y" { (yyval) = (yyvsp[(1) - (1)]); } break; - case 15: + case 12: /* Line 1806 of yacc.c */ #line 106 "sapi/phpdbg/dev/phpdbg_parser.y" { (yyval) = (yyvsp[(1) - (1)]); } break; - case 16: + case 13: /* Line 1806 of yacc.c */ #line 107 "sapi/phpdbg/dev/phpdbg_parser.y" { (yyval) = (yyvsp[(1) - (1)]); } break; - case 17: + case 14: /* Line 1806 of yacc.c */ #line 108 "sapi/phpdbg/dev/phpdbg_parser.y" { (yyval) = (yyvsp[(1) - (1)]); } break; - case 18: + case 15: /* Line 1806 of yacc.c */ #line 109 "sapi/phpdbg/dev/phpdbg_parser.y" { (yyval) = (yyvsp[(1) - (1)]); } break; - case 19: + case 16: /* Line 1806 of yacc.c */ #line 110 "sapi/phpdbg/dev/phpdbg_parser.y" - { (yyval) = (yyvsp[(1) - (1)]); } + { (yyval) = (yyvsp[(2) - (2)]); (yyval).type = COND_PARAM; } break; - case 20: + case 17: /* Line 1806 of yacc.c */ #line 111 "sapi/phpdbg/dev/phpdbg_parser.y" - { (yyval) = (yyvsp[(1) - (1)]); } + { (yyval) = (yyvsp[(2) - (2)]); (yyval).type = EVAL_PARAM; } break; - case 21: + case 18: /* Line 1806 of yacc.c */ #line 112 "sapi/phpdbg/dev/phpdbg_parser.y" - { (yyval) = (yyvsp[(1) - (1)]); } - break; - - case 22: - -/* Line 1806 of yacc.c */ -#line 113 "sapi/phpdbg/dev/phpdbg_parser.y" - { (yyval) = (yyvsp[(1) - (1)]); } - break; - - case 23: - -/* Line 1806 of yacc.c */ -#line 114 "sapi/phpdbg/dev/phpdbg_parser.y" - { (yyval) = (yyvsp[(2) - (2)]); (yyval).type = COND_PARAM; } + { (yyval) = (yyvsp[(2) - (2)]); (yyval).type = SHELL_PARAM; } break; /* Line 1806 of yacc.c */ -#line 1564 "sapi/phpdbg/phpdbg_parser.c" +#line 1554 "sapi/phpdbg/phpdbg_parser.c" default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1791,6 +1781,6 @@ yyreturn: /* Line 2067 of yacc.c */ -#line 120 "sapi/phpdbg/dev/phpdbg_parser.y" +#line 115 "sapi/phpdbg/dev/phpdbg_parser.y" diff --git a/phpdbg_parser.h b/phpdbg_parser.h index 5c0ac48..d0ba3b1 100644 --- a/phpdbg_parser.h +++ b/phpdbg_parser.h @@ -52,22 +52,21 @@ typedef void* yyscan_t; /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { - C_TRUTHY = 258, - C_FALSY = 259, - C_STRING = 260, - C_EVAL = 261, - C_SHELL = 262, - C_IF = 263, - T_DIGITS = 264, - T_LITERAL = 265, - T_METHOD = 266, - T_NUMERIC_METHOD = 267, - T_NUMERIC_FUNCTION = 268, + T_EVAL = 258, + T_SHELL = 259, + T_IF = 260, + T_TRUTHY = 261, + T_FALSY = 262, + T_STRING = 263, + T_COLON = 264, + T_DCOLON = 265, + T_POUND = 266, + T_DIGITS = 267, + T_LITERAL = 268, T_OPLINE = 269, - T_FILE = 270, - T_ID = 271, - T_INPUT = 272, - T_UNEXPECTED = 273 + T_ID = 270, + T_INPUT = 271, + T_UNEXPECTED = 272 }; #endif diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c index 3830f44..24d2495 100644 --- a/phpdbg_prompt.c +++ b/phpdbg_prompt.c @@ -778,6 +778,9 @@ PHPDBG_COMMAND(break) /* {{{ */ case FILE_PARAM: phpdbg_set_breakpoint_file(param->file.name, param->file.line TSRMLS_CC); break; + case COND_PARAM: + phpdbg_set_breakpoint_expression(param->str, param->len TSRMLS_CC); + break; case STR_PARAM: phpdbg_set_breakpoint_symbol(param->str, param->len TSRMLS_CC); break;
« previous php.cvs (#77049) next »