}
-<IN_SCRIPTING>(["]([^"$\\]|([\\]+[^\\$]))*["])|([']([^'\\]|([\\]+['\\]))*[']) {
+<IN_SCRIPTING>(["]([^$"\\]|("\\".))*["]) {
register char *s, *t;
char *end;
zendlval->value.str.len--;
break;
case '\\':
- *t++ = '\\';
- zendlval->value.str.len--;
- break;
case '$':
case '"':
*t++ = *s;
}
+<IN_SCRIPTING>([']([^'\\]|("\\".))*[']) {
+ register char *s, *t;
+ char *end;
+
+ zendlval->value.str.val = estrndup(yytext+1, yyleng-2);
+ zendlval->value.str.len = yyleng-2;
+ zendlval->type = IS_STRING;
+ HANDLE_NEWLINES(yytext,yyleng);
+
+ /* convert escape sequences */
+ s = t = zendlval->value.str.val;
+ end = s+zendlval->value.str.len;
+ while (s<end) {
+ if (*s=='\\') {
+ s++;
+ if (s>=end) {
+ continue;
+ }
+ switch(*s) {
+ case '\\':
+ case '\'':
+ *t++ = *s;
+ zendlval->value.str.len--;
+ break;
+ default:
+ *t++ = '\\';
+ *t++ = *s;
+ break;
+ }
+ s++;
+ } else {
+ *t++ = *s++;
+ }
+ }
+ *t = 0;
+
+ return T_CONSTANT_ENCAPSED_STRING;
+}
+
+
<IN_SCRIPTING>["] {
BEGIN(DOUBLE_QUOTES);
return '\"';
}
-
-
<IN_SCRIPTING,INITIAL,DOUBLE_QUOTES,BACKQUOTE,SINGLE_QUOTE>. {
zend_error(E_COMPILE_WARNING,"Unexpected character in input: '%c' (ASCII=%d) state=%d",yytext[0],yytext[0],YYSTATE);
}
case ZEND_CT:
*result = *constant_name;
result->u.constant.type = IS_CONSTANT;
- printf("Fetching compiletime constant: '%s'\n", result->u.constant.value.str.val);
break;
case ZEND_RT: {
zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);