コード例 #1
0
ファイル: test.c プロジェクト: Absolight/poudriere
static enum token
t_lex(char *s)
{
	int num;

	if (s == NULL) {
		return EOI;
	}
	num = find_op(s);
	if (((TOKEN_TYPE(num) == UNOP || TOKEN_TYPE(num) == BUNOP)
				&& isunopoperand()) ||
	    (num == LPAREN && islparenoperand()) ||
	    (num == RPAREN && isrparenoperand()))
		return OPERAND;
	return num;
}
コード例 #2
0
ファイル: test.c プロジェクト: AhmadTux/freebsd
static enum token
t_lex(char *s)
{
	struct t_op const *op = ops;

	if (s == 0) {
		t_wp_op = NULL;
		return EOI;
	}
	while (*op->op_text) {
		if (strcmp(s, op->op_text) == 0) {
			if (((op->op_type == UNOP || op->op_type == BUNOP)
						&& isunopoperand()) ||
			    (op->op_num == LPAREN && islparenoperand()) ||
			    (op->op_num == RPAREN && isrparenoperand()))
				break;
			t_wp_op = op;
			return op->op_num;
		}
		op++;
	}
	t_wp_op = NULL;
	return OPERAND;
}