Use function for creating a literal expression node.

This commit is contained in:
Olaf Seibert 2015-11-08 20:51:45 +01:00
parent d6ff111149
commit 0fba6eea33

12
parse.c
View File

@ -792,9 +792,7 @@ EX_TREE *parse_unary(
if (*cp == '\'') {
/* 'x single ASCII character */
cp++;
tp = new_ex_tree();
tp->type = EX_LIT;
tp->data.lit = *cp & 0xff;
tp = new_ex_lit(*cp & 0xff);
tp->cp = ++cp;
return tp;
}
@ -802,9 +800,7 @@ EX_TREE *parse_unary(
if (*cp == '\"') {
/* "xx ASCII character pair */
cp++;
tp = new_ex_tree();
tp->type = EX_LIT;
tp->data.lit = (cp[0] & 0xff) | ((cp[1] & 0xff) << 8);
tp = new_ex_lit((cp[0] & 0xff) | ((cp[1] & 0xff) << 8));
tp->cp = cp + 2;
return tp;
}
@ -832,9 +828,7 @@ EX_TREE *parse_unary(
if (*endcp == '.')
endcp++;
tp = new_ex_tree();
tp->type = EX_LIT;
tp->data.lit = value;
tp = new_ex_lit(value);
tp->cp = endcp;
return tp;