en) = ' 0';> type = TOK_STRING;
} * parser_value_show_as_string (ParserVal * v)
{
/* Static char buffer, return pointer to it */char buf [MAX_TOKEN_LEN];
/* Це рядок? */(V-> type == TOK_STRING)
{_t len ​​= min (parser_strlen (v-> s), MAX_TOKEN_LEN); (buf, v-> s, len);
* (buf + len) = ' 0'; buf;
}
/* Це числове */ceil_diff = ceil (v-> d) - v-> d; floor_diff = v-> d - floor (v-> d); diff, res; (ceil_diff
{= ceil_diff; = ceil (v-> d);
}
{= floor_diff; = floor (v-> d);
} (diff <0.0009) (buf, "% ld", (long) res);/* Показати як ціле */
else (buf, "% .3 f", v-> d)/* Показати як дійсне десяткове число */
return buf;
} parser_value_as_numeric (ParserVal * v)
{(v-> type == TOK_NUMERIC) v-> d; 0.0;
} * parser_value_as_string (ParserVal * v)
{
/* Do not free the value.points to a static char buffer.
*/parser_value_show_as_string (v);
} parser_value_as_boolean (ParserVal * v)
{(v-> type == TOK_NUMERIC) (int) v-> d! = 0; (str_icmp (v-> s, "Істина")) TRUE; (str_icmp (v-> s, "1")) TRUE; (str_icmp (v-> s, "Лож")) FALSE; (str_icmp (v-> s, "0")) FALSE; FALSE ;
} parser_add_strings (ParserVal * v1, ParserVal * v2)
{_convert_to_string (v1); _convert_to_string (v2);
size_t len1 = min (parser_strlen (v1-> s), MAX_TOKEN_LEN); _t len2 = min (parser_strlen (v2-> s), MAX_TOKEN_LEN);
char * p = (char *) calloc (len1 + len2 + 1, sizeof (char)); (len1) (p, v1-> s, len1); (len2) (p + len1, v2-> s, len2);
* (p + len1 + len2) = ' 0'; (v1-> s); -> s = p;
}
/****************************/
/* Numeric and string values ​​*/
/****************************/parser_value_set_to_numeric (ParserVal * v, double d)
{_value_free (v); _value_init_to_numeric (v, d);
} parser_value_set_to_string (ParserVal * v, char * s)
{_value_free (v); _value_init_to_string (v, s);
} parser_value_init_to_numeric (ParserVal * v, double d)
{> d = d;> type = TOK_NUMERIC;> error = NULL;
} parser_value_init_to_string (ParserVal * v, char * s)
{_t len ​​= min (parser_strlen (s), MAX_TOKEN_LEN);> s = (char *) calloc (len + 1, sizeof (char)); (len) (v-> ...