return NULL;
}
-typedef struct
-{
+struct sy_elem {
size_t etype; /* 0 = expression, others are operators */
- bool isparen;
- size_t off;
+ bool isparen;
+ size_t off;
ast_expression *out;
- ast_block *block; /* for commas and function calls */
+ ast_block *block; /* for commas and function calls */
lex_ctx_t ctx;
-} sy_elem;
+};
enum {
PAREN_EXPR,
PAREN_TERNARY1,
PAREN_TERNARY2
};
-typedef struct
-{
+
+struct shunt {
sy_elem *out;
sy_elem *ops;
size_t *argc;
unsigned int *paren;
-} shunt;
+};
static sy_elem syexp(lex_ctx_t ctx, ast_expression *v) {
sy_elem e;
if (!mod) return false; /* can return null for missing floor */
call = ast_call_new(parser_ctx(parser), mod);
- vec_push(call->params, exprs[0]);
- vec_push(call->params, exprs[1]);
+ call->params.push_back(exprs[0]);
+ call->params.push_back(exprs[1]);
out = (ast_expression*)call;
}
if (!(out = fold_op(parser->fold, op, exprs))) {
ast_expression *shift = intrin_func(parser->intrin, (op->id == opid2('<','<')) ? "__builtin_lshift" : "__builtin_rshift");
ast_call *call = ast_call_new(parser_ctx(parser), shift);
- vec_push(call->params, exprs[0]);
- vec_push(call->params, exprs[1]);
+ call->params.push_back(exprs[0]);
+ call->params.push_back(exprs[1]);
out = (ast_expression*)call;
}
break;
if(!(out = fold_op(parser->fold, op, exprs))) {
ast_expression *shift = intrin_func(parser->intrin, (op->id == opid3('<','<','=')) ? "__builtin_lshift" : "__builtin_rshift");
ast_call *call = ast_call_new(parser_ctx(parser), shift);
- vec_push(call->params, exprs[0]);
- vec_push(call->params, exprs[1]);
+ call->params.push_back(exprs[0]);
+ call->params.push_back(exprs[1]);
out = (ast_expression*)ast_store_new(
parser_ctx(parser),
INSTR_STORE_F,
if (!(out = fold_op(parser->fold, op, exprs))) {
ast_call *gencall = ast_call_new(parser_ctx(parser), intrin_func(parser->intrin, "pow"));
- vec_push(gencall->params, exprs[0]);
- vec_push(gencall->params, exprs[1]);
+ gencall->params.push_back(exprs[0]);
+ gencall->params.push_back(exprs[1]);
out = (ast_expression*)gencall;
}
break;
}
for (i = 0; i < paramcount; ++i)
- vec_push(call->params, sy->out[fid+1 + i].out);
+ call->params.push_back(sy->out[fid+1 + i].out);
vec_shrinkby(sy->out, paramcount);
(void)!ast_call_check_types(call, parser->function->vtype->expression.varparam);
if (parser->max_param_count < paramcount)
/* returns true when it was a variable qualifier, false otherwise!
* on error, cvq is set to CV_WRONG
*/
-typedef struct {
+struct attribute_t {
const char *name;
size_t flag;
-} attribute_t;
+};
static bool parse_qualifiers(parser_t *parser, bool with_local, int *cvq, bool *noref, bool *is_static, uint32_t *_flags, char **message)
{