Get rid of chval - it's really not necessary and seems to be confusing people

This commit is contained in:
Zeev Suraski 2000-05-11 19:18:11 +00:00
parent 9a751419cf
commit 0d6a794d85
4 changed files with 21 additions and 22 deletions

View File

@ -681,11 +681,11 @@ encaps_list:
| encaps_list T_ENCAPSED_AND_WHITESPACE { do_add_string(&$$, &$1, &$2 CLS_CC); }
| encaps_list T_CHARACTER { do_add_char(&$$, &$1, &$2 CLS_CC); }
| encaps_list T_BAD_CHARACTER { do_add_string(&$$, &$1, &$2 CLS_CC); }
| encaps_list '[' { $2.u.constant.value.chval = '['; do_add_char(&$$, &$1, &$2 CLS_CC); }
| encaps_list ']' { $2.u.constant.value.chval = ']'; do_add_char(&$$, &$1, &$2 CLS_CC); }
| encaps_list '{' { $2.u.constant.value.chval = '{'; do_add_char(&$$, &$1, &$2 CLS_CC); }
| encaps_list '}' { $2.u.constant.value.chval = '}'; do_add_char(&$$, &$1, &$2 CLS_CC); }
| encaps_list T_OBJECT_OPERATOR { znode tmp; $2.u.constant.value.chval = '-'; do_add_char(&tmp, &$1, &$2 CLS_CC); $2.u.constant.value.chval = '>'; do_add_char(&$$, &tmp, &$2 CLS_CC); }
| encaps_list '[' { $2.u.constant.value.lval = (long) '['; do_add_char(&$$, &$1, &$2 CLS_CC); }
| encaps_list ']' { $2.u.constant.value.lval = (long) ']'; do_add_char(&$$, &$1, &$2 CLS_CC); }
| encaps_list '{' { $2.u.constant.value.lval = (long) '{'; do_add_char(&$$, &$1, &$2 CLS_CC); }
| encaps_list '}' { $2.u.constant.value.lval = (long) '}'; do_add_char(&$$, &$1, &$2 CLS_CC); }
| encaps_list T_OBJECT_OPERATOR { znode tmp; $2.u.constant.value.lval = (long) '-'; do_add_char(&tmp, &$1, &$2 CLS_CC); $2.u.constant.value.lval = (long) '>'; do_add_char(&$$, &tmp, &$2 CLS_CC); }
| /* empty */ { do_init_string(&$$ CLS_CC); }
;

View File

@ -1556,7 +1556,7 @@ ESCAPED_AND_WHITESPACE [\n\t\r #'.:;,()|^&+-/*=%!~<>?@]+
<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"$"[^a-zA-Z_\x7f-\xff{] {
zendlval->value.chval = yytext[0];
zendlval->value.lval = (long) yytext[0];
if (yyleng == 2) {
yyless(1);
/*unput(yytext[1]);
@ -1568,12 +1568,12 @@ ESCAPED_AND_WHITESPACE [\n\t\r #'.:;,()|^&+-/*=%!~<>?@]+
<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>{ENCAPSED_TOKENS} {
zendlval->value.chval = yytext[0];
zendlval->value.lval = (long) yytext[0];
return yytext[0];
}
<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"{$" {
zendlval->value.chval = yytext[0];
zendlval->value.lval = (long) yytext[0];
yy_push_state(ST_IN_SCRIPTING);
/*unput('$');*/
yyless(1);
@ -1582,54 +1582,54 @@ ESCAPED_AND_WHITESPACE [\n\t\r #'.:;,()|^&+-/*=%!~<>?@]+
<ST_SINGLE_QUOTE>"\\'" {
zendlval->value.chval='\'';
zendlval->value.lval = (long) '\'';
return T_CHARACTER;
}
<ST_SINGLE_QUOTE>"\\\\" {
zendlval->value.chval='\\';
zendlval->value.lval = (long)'\\';
return T_CHARACTER;
}
<ST_DOUBLE_QUOTES>"\\\"" {
zendlval->value.chval='"';
zendlval->value.lval = (long) '"';
return T_CHARACTER;
}
<ST_BACKQUOTE>"\\`" {
zendlval->value.chval='`';
zendlval->value.lval = (long) '`';
return T_CHARACTER;
}
<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"\\"[0-7]{1,3} {
zendlval->value.chval = (char) strtol (yytext+1, NULL, 8);
zendlval->value.lval = strtol(yytext+1, NULL, 8);
return T_CHARACTER;
}
<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"\\x"[0-9A-Fa-f]{1,2} {
zendlval->value.chval = (char) strtol (yytext+2, NULL, 16);
zendlval->value.lval = strtol (yytext+2, NULL, 16);
return T_CHARACTER;
}
<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"\\". {
switch (yytext[1]) {
case 'n':
zendlval->value.chval='\n';
zendlval->value.lval = (long) '\n';
break;
case 't':
zendlval->value.chval='\t';
zendlval->value.lval = (long) '\t';
break;
case 'r':
zendlval->value.chval='\r';
zendlval->value.lval = (long) '\r';
break;
case '\\':
zendlval->value.chval='\\';
zendlval->value.lval = (long) '\\';
break;
case '$':
zendlval->value.chval=yytext[1];
zendlval->value.lval = (long) yytext[1];
break;
case '{':
zendlval->value.chval=yytext[1];
zendlval->value.lval = (long) yytext[1];
break;
default:
zendlval->value.str.val = estrndup(yytext,yyleng);

View File

@ -159,7 +159,6 @@ typedef union _zvalue_value {
char *val;
int len;
} str;
char chval; /* char value */
HashTable *ht; /* hash table value */
struct {
zend_class_entry *ce;

View File

@ -880,7 +880,7 @@ ZEND_API int add_char_to_string(zval *result, zval *op1, zval *op2)
{
result->value.str.len = op1->value.str.len + 1;
result->value.str.val = (char *) erealloc(op1->value.str.val, result->value.str.len+1);
result->value.str.val[result->value.str.len - 1] = op2->value.chval;
result->value.str.val[result->value.str.len - 1] = (char) op2->value.lval;
result->value.str.val[result->value.str.len] = 0;
result->type = IS_STRING;
return SUCCESS;