view src/ploki/op.h @ 8427:1fc808cd5b1f

<b_jonas> learn can\'t is the most frequent word whose pronunciation varies between /\xc9\x91\xcb\x90/ and /\xc3\xa6/ depending on dialect. The list is: advance after answer ask aunt brass can\'t cast castle chance class command dance demand draft enhance example fast father glass graph grass half last laugh mask master nasty pass past path plant rather sample shan\'t staff task vast
author HackBot
date Thu, 09 Jun 2016 21:28:47 +0000
parents ac0403686959
children
line wrap: on
line source

#ifndef OP_H_
#define OP_H_

#include "IO.h"
#include "Str.h"
#include "expr.h"

#include <stddef.h>

enum t_op {
	OP_NOP,
	OP_ASSIGN,
	OP_CALL,
	OP_CALL_BACK,
	OP_CALL_DYN,
	OP_CLOSE,
	OP_ELSE,
	OP_EXIT,
	OP_FI,
	OP_FLUSH,
	OP_GOBACK,
	OP_GOTO,
	OP_HANG,
	OP_IF,
	OP_MODIFY,
	OP_PRINT,
	OP_PUTC,
	OP_RESET,
	OP_RETURN,
	OP_SET_VAL,
	OP_SYSTEM,
	OP_TEMP,
	OP_THROW
};

struct op {
	enum t_op type;
	struct expr *arg;
	union {
		struct expr *expr;
		struct op *op;
	} arh;
	struct op *next;
	String txt;
	size_t line;
};

void op_init(struct op *);
void op_end(struct op *);
void op_getop(struct op *);

#define OP_1ARG_P(op)                                             \
(                                                                 \
 (op) == OP_CALL   || (op) == OP_CALL_DYN || (op) == OP_CLOSE  || \
 (op) == OP_EXIT   || (op) == OP_FLUSH    || (op) == OP_GOTO   || \
 (op) == OP_IF     || (op) == OP_RESET    || (op) == OP_RETURN || \
 (op) == OP_SYSTEM || (op) == OP_THROW                            \
)

#define OP_2ARG_P(op)                                               \
(                                                                   \
 (op) == OP_ASSIGN || (op) == OP_CALL_BACK || (op) == OP_MODIFY  || \
 (op) == OP_PRINT  || (op) == OP_PUTC      || (op) == OP_SET_VAL || \
 (op) == OP_TEMP                                                    \
)

#endif /* OP_H_ */