com php-src: Revert "handle strings better": phpdbg_lexer.l phpdbg_parser.y

From: Date: Sat, 15 Feb 2014 23:34:35 +0000
Subject: com php-src: Revert "handle strings better": phpdbg_lexer.l phpdbg_parser.y
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-77074@lists.php.net to get a copy of this message
Commit: 5f899346865bba0657015c4552fd5b90ebdb643e Author: krakjoe <joe.watkins@live.co.uk> Sat, 15 Feb 2014 23:34:35 +0000 Parents: a32f1b46540fd8add78f53cc8059f7f749ca3ab8 Branches: PHP-5.6 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=5f899346865bba0657015c4552fd5b90ebdb643e Log: Revert "handle strings better" This reverts commit a32f1b46540fd8add78f53cc8059f7f749ca3ab8. Changed paths: M phpdbg_lexer.l M phpdbg_parser.y Diff: diff --git a/phpdbg_lexer.l b/phpdbg_lexer.l index f916a0b..6915ab6 100644 --- a/phpdbg_lexer.l +++ b/phpdbg_lexer.l @@ -11,21 +11,9 @@ #include "phpdbg_parser.h" #include <stdio.h> #include <string.h> - -static inline void phpdbg_param_append(phpdbg_param_t *param, const char *next, size_t nlen) { - if (param->len + nlen > param->addr) { - param->str = realloc( - param->str, param->len + 1024); - param->addr += 1024; - } - memcpy(&param->str[param->len], next, nlen); - param->len += nlen; - param->str[param->len] = 0; -} %} %s RAW -%s STRING %option outfile="phpdbg_lexer.c" header-file="phpdbg_lexer.h" %option warn nodefault @@ -41,7 +29,6 @@ C_FALSE "false" C_NO "no" C_OFF "off" C_DISABLED "disabled" - C_EVAL "eval" C_SHELL "shell" @@ -50,6 +37,7 @@ ID [a-zA-Z][a-zA-Z0-9_]+ METHOD {ID}::{ID} FILE [^ :0-9]{1,}:[0-9]+ OPLINE 0x[a-fA-F0-9]+ +LITERAL \"(\\.|[^\\"])*\" WS [ \r\n\t]+ INPUT [^\n]+ %% @@ -67,11 +55,11 @@ INPUT [^\n]+ } {C_EVAL} { BEGIN(RAW); - return C_EVAL; + return C_EVAL; } {C_SHELL} { BEGIN(RAW); - return C_SHELL; + return C_SHELL; } {DIGITS} { yylval->type = NUMERIC_PARAM; @@ -95,26 +83,17 @@ INPUT [^\n]+ yylval->addr = strtoul(yytext, NULL, 10); return T_OPLINE; } - {ID} { + {LITERAL} { yylval->type = STR_PARAM; yylval->str = strndup(yytext, yyleng); yylval->len = yyleng; - return T_ID; + return T_LITERAL; } - \" { - BEGIN(STRING); + {ID} { yylval->type = STR_PARAM; - yylval->str = (char*) malloc(28); - yylval->len = 0; - yylval->addr = 28; - } - <STRING>[^\\"\n]* { phpdbg_param_append(yylval, yytext); } - <STRING>\\n { phpdbg_param_append(yylval, "\n"); } - <STRING>\\t { phpdbg_param_append(yylval, "\t"); } - <STRING>\\[\\"] { phpdbg_param_append(yylval, "\\"); } - <STRING>\" { - BEGIN(INITIAL); - return T_STRING; + yylval->str = strndup(yytext, yyleng); + yylval->len = yyleng; + return T_ID; } } <RAW>{INPUT} { diff --git a/phpdbg_parser.y b/phpdbg_parser.y index f8fc5a0..9b87847 100644 --- a/phpdbg_parser.y +++ b/phpdbg_parser.y @@ -98,7 +98,7 @@ typedef void* yyscan_t; %token C_SHELL "shell" %token T_DIGITS "digits (numbers)" -%token T_STRING "literal (T_LITERAL)" +%token T_LITERAL "literal (T_LITERAL)" %token T_METHOD "method (T_METHOD)" %token T_OPLINE "opline (T_OPLINE)" %token T_FILE "file (T_FILE)" @@ -135,7 +135,7 @@ parameter | T_METHOD { $$ = $1; } | T_OPLINE { $$ = $1; } | T_ID { $$ = $1; } - | T_STRING { $$ = $1; } + | T_LITERAL { $$ = $1; } | C_TRUTHY { $$ = $1; } | C_FALSY { $$ = $1; } ;

« previous php.cvs (#77074) next »