#include "phpdbg_parser.h"
#include <stdio.h>
#include <string.h>
+
+static inline int phpdbg_needs_params(phpdbg_param_t *param TSRMLS_DC) {
+ return 0;
+}
%}
%s RAW
OPCODE ?i:ZEND_([A-Za-z])+
INPUT [^\n]+
%%
+<INITIAL>[a-zA-Z]+ {
+ phpdbg_init_param(yylval, STR_PARAM);
+ yylval->str = strndup(yytext, yyleng);
+ yylval->len = yyleng;
+ if (phpdbg_needs_params(yylval TSRMLS_CC)) {
+ BEGIN(PARAMS);
+ }
+ return T_ID;
+}
+
+<PARAMS>[0-9]+ {
+ phpdbg_init_param(yylval, NUMERIC_PARAM);
+ yylval->num = atoi(yytext);
+ return T_ID;
+}
+
<INITIAL>
{
[#]{1} { return T_POUND; }
array_init(¶ms);
- while (next) {
+ while (next) {
+ char *buffered = NULL;
+
switch (next->type) {
+ case OP_PARAM:
+ case COND_PARAM:
case STR_PARAM:
add_next_index_stringl(
¶ms,
add_next_index_long(¶ms, next->num);
break;
+ case METHOD_PARAM:
+ spprintf(&buffered, 0, "%s::%s"
+ TSRMLS_CC, next->method.class, next->method.name);
+ add_next_index_string(¶ms, buffered, 0);
+ break;
+
+ case NUMERIC_METHOD_PARAM:
+ spprintf(&buffered, 0, "%s::%s#%ld"
+ TSRMLS_CC, next->method.class, next->method.name, next->num);
+ add_next_index_string(¶ms, buffered, 0);
+ break;
+
+ case NUMERIC_FUNCTION_PARAM:
+ spprintf(&buffered, 0, "%s#%ld"
+ TSRMLS_CC, next->str, next->num);
+ add_next_index_string(¶ms, buffered, 0);
+ break;
+
+ case FILE_PARAM:
+ spprintf(&buffered, 0, "%s:%ld"
+ TSRMLS_CC, next->file.name, next->file.line);
+ add_next_index_string(¶ms, buffered, 0);
+ break;
+
+ case NUMERIC_FILE_PARAM:
+ spprintf(&buffered, 0, "%s:#%ld"
+ TSRMLS_CC, next->file.name, next->file.line);
+ add_next_index_string(¶ms, buffered, 0);
+ break;
+
default: {
/* not yet */
}
}
- phpdbg_debug(
- "created param[%d] from argv[%d]: %s",
- param, param+1, next->str);
next = next->next;
}