};
static const struct operator *
-match_operator (struct lexer *lexer, const struct operator ops[], size_t n_ops)
+ctable_pcexpr_match_operator (struct lexer *lexer,
+ const struct operator ops[], size_t n_ops)
{
for (const struct operator *op = ops; op < ops + n_ops; op++)
if (lex_token (lexer) == op->token)
}
static struct ctables_pcexpr *
-parse_binary_operators__ (struct lexer *lexer, struct dictionary *dict,
- const struct operator ops[], size_t n_ops,
- parse_recursively_func *parse_next_level,
- const char *chain_warning,
- struct ctables_pcexpr *lhs)
+ctable_pcexpr_parse_binary_operators__ (
+ struct lexer *lexer, struct dictionary *dict,
+ const struct operator ops[], size_t n_ops,
+ parse_recursively_func *parse_next_level,
+ const char *chain_warning, struct ctables_pcexpr *lhs)
{
for (int op_count = 0; ; op_count++)
{
- const struct operator *op = match_operator (lexer, ops, n_ops);
+ const struct operator *op
+ = ctable_pcexpr_match_operator (lexer, ops, n_ops);
if (!op)
{
if (op_count > 1 && chain_warning)
}
static struct ctables_pcexpr *
-parse_binary_operators (struct lexer *lexer, struct dictionary *dict,
- const struct operator ops[], size_t n_ops,
- parse_recursively_func *parse_next_level,
- const char *chain_warning)
+ctable_pcexpr_parse_binary_operators (struct lexer *lexer,
+ struct dictionary *dict,
+ const struct operator ops[], size_t n_ops,
+ parse_recursively_func *parse_next_level,
+ const char *chain_warning)
{
struct ctables_pcexpr *lhs = parse_next_level (lexer, dict);
if (!lhs)
return NULL;
- return parse_binary_operators__ (lexer, dict, ops, n_ops, parse_next_level,
- chain_warning, lhs);
+ return ctable_pcexpr_parse_binary_operators__ (lexer, dict, ops, n_ops,
+ parse_next_level,
+ chain_warning, lhs);
}
-static struct ctables_pcexpr *parse_add (struct lexer *, struct dictionary *);
+static struct ctables_pcexpr *ctable_pcexpr_parse_add (struct lexer *,
+ struct dictionary *);
static struct ctables_pcexpr
ctpo_cat_range (double low, double high)
}
static struct ctables_pcexpr *
-parse_primary (struct lexer *lexer, struct dictionary *dict)
+ctable_pcexpr_parse_primary (struct lexer *lexer, struct dictionary *dict)
{
int start_ofs = lex_ofs (lexer);
struct ctables_pcexpr e;
}
else if (lex_match (lexer, T_LPAREN))
{
- struct ctables_pcexpr *ep = parse_add (lexer, dict);
+ struct ctables_pcexpr *ep = ctable_pcexpr_parse_add (lexer, dict);
if (!ep)
return NULL;
if (!lex_force_match (lexer, T_RPAREN))
}
static struct ctables_pcexpr *
-parse_exp (struct lexer *lexer, struct dictionary *dict)
+ctable_pcexpr_parse_exp (struct lexer *lexer, struct dictionary *dict)
{
static const struct operator op = { T_EXP, CTPO_POW };
"To disable this warning, insert parentheses.");
if (lex_token (lexer) != T_NEG_NUM || lex_next_token (lexer, 1) != T_EXP)
- return parse_binary_operators (lexer, dict, &op, 1,
- parse_primary, chain_warning);
+ return ctable_pcexpr_parse_binary_operators (lexer, dict, &op, 1,
+ ctable_pcexpr_parse_primary,
+ chain_warning);
/* Special case for situations like "-5**6", which must be parsed as
-(5**6). */
};
lex_get (lexer);
- struct ctables_pcexpr *node = parse_binary_operators__ (
- lexer, dict, &op, 1, parse_primary, chain_warning, lhs);
+ struct ctables_pcexpr *node = ctable_pcexpr_parse_binary_operators__ (
+ lexer, dict, &op, 1,
+ ctable_pcexpr_parse_primary, chain_warning, lhs);
if (!node)
return NULL;
/* Parses the unary minus level. */
static struct ctables_pcexpr *
-parse_neg (struct lexer *lexer, struct dictionary *dict)
+ctable_pcexpr_parse_neg (struct lexer *lexer, struct dictionary *dict)
{
int start_ofs = lex_ofs (lexer);
if (!lex_match (lexer, T_DASH))
- return parse_exp (lexer, dict);
+ return ctable_pcexpr_parse_exp (lexer, dict);
- struct ctables_pcexpr *inner = parse_neg (lexer, dict);
+ struct ctables_pcexpr *inner = ctable_pcexpr_parse_neg (lexer, dict);
if (!inner)
return NULL;
/* Parses the multiplication and division level. */
static struct ctables_pcexpr *
-parse_mul (struct lexer *lexer, struct dictionary *dict)
+ctable_pcexpr_parse_mul (struct lexer *lexer, struct dictionary *dict)
{
static const struct operator ops[] =
{
{ T_SLASH, CTPO_DIV },
};
- return parse_binary_operators (lexer, dict, ops, sizeof ops / sizeof *ops,
- parse_neg, NULL);
+ return ctable_pcexpr_parse_binary_operators (lexer, dict, ops,
+ sizeof ops / sizeof *ops,
+ ctable_pcexpr_parse_neg, NULL);
}
/* Parses the addition and subtraction level. */
static struct ctables_pcexpr *
-parse_add (struct lexer *lexer, struct dictionary *dict)
+ctable_pcexpr_parse_add (struct lexer *lexer, struct dictionary *dict)
{
static const struct operator ops[] =
{
{ T_NEG_NUM, CTPO_ADD },
};
- return parse_binary_operators (lexer, dict, ops, sizeof ops / sizeof *ops,
- parse_mul, NULL);
+ return ctable_pcexpr_parse_binary_operators (lexer, dict,
+ ops, sizeof ops / sizeof *ops,
+ ctable_pcexpr_parse_mul, NULL);
}
static struct ctables_postcompute *
}
int expr_start = lex_ofs (lexer);
- struct ctables_pcexpr *expr = parse_add (lexer, dict);
+ struct ctables_pcexpr *expr = ctable_pcexpr_parse_add (lexer, dict);
int expr_end = lex_ofs (lexer) - 1;
if (!expr || !lex_force_match (lexer, T_RPAREN))
{