<commit_before>public class Rel extends Node {

	public Node left, right;
	public int op;

	public Rel(int op, Node left, Node right) {
		this.op = op;
		this.left = left;
		this.right = right;
	}

	@Override
	public Value interp(Scope s) {
		Value lv = left.interp(s);
		Value rv = right.interp(s);

		if (lv instanceof StringValue && rv instanceof StringValue) {
			String l = ((StringValue) lv).value;
			String r = ((StringValue) rv).value;
			return new BoolValue(op(l.compareTo(r), 0));
		}
		if (lv instanceof IntValue && rv instanceof IntValue) {
			int l = ((IntValue) lv).value;
			int r = ((IntValue) rv).value;
			return new BoolValue(op(l, r));
		}
		if (lv instanceof FloatValue && rv instanceof FloatValue) {
			int l = (int) ((FloatValue) lv).value;
			int r = (int) ((FloatValue) rv).value;
			return new BoolValue(op(l, r));
		}
		return Value.FALSE;
	}

	private boolean op(int l, int r) {
		boolean ret = false;
		switch (op) {
		case '>':
			ret = l > r;
			break;
		case '<':
			ret = l < r;
			break;
		case Tag.EQ:
			ret = l == r;
			break;
		case Tag.NE:
			ret = l != r;
			break;
		case Tag.LE:
			ret = l <= r;
			break;
		case Tag.GE:
			ret = l >= r;
			break;
		}
		return ret;
	}

	@Override
	public Value typecheck(Scope s) {
		Value lv = left.interp(s);
		Value rv = right.interp(s);
		if ((lv instanceof FloatValue && rv instanceof FloatValue)
				|| (lv instanceof IntValue && rv instanceof IntValue)
				|| (lv instanceof StringValue && lv instanceof StringValue))
			return Type.BOOL;
		S.error("Type math error!");
		return null;
	}
}<commit_msg>improve typechek and interp<commit_after>public class Rel extends Node {

	public Node left, right;
	public int op;

	public Rel(int op, Node left, Node right) {
		this.op = op;
		this.left = left;
		this.right = right;
	}

	@Override
	public Value interp(Scope s) {
		Value lv = left.interp(s);
		Value rv = right.interp(s);

		if (lv instanceof StringValue && rv instanceof StringValue) {
			String l = ((StringValue) lv).value;
			String r = ((StringValue) rv).value;
			return new BoolValue(op(l.compareTo(r), 0));
		}
		if (lv instanceof IntValue && rv instanceof IntValue) {
			int l = ((IntValue) lv).value;
			int r = ((IntValue) rv).value;
			return new BoolValue(op(l, r));
		}
		if (lv instanceof FloatValue && rv instanceof FloatValue) {
			int l = (int) ((FloatValue) lv).value;
			int r = (int) ((FloatValue) rv).value;
			return new BoolValue(op(l, r));
		}
		return Value.FALSE;
	}

	private boolean op(int l, int r) {
		boolean ret = false;
		switch (op) {
		case '>':
			ret = l > r;
			break;
		case '<':
			ret = l < r;
			break;
		case Tag.EQ:
			ret = l == r;
			break;
		case Tag.NE:
			ret = l != r;
			break;
		case Tag.LE:
			ret = l <= r;
			break;
		case Tag.GE:
			ret = l >= r;
			break;
		default:
			S.error("不支持操作符: " + (char) op);
		}
		return ret;
	}

	@Override
	public Value typecheck(Scope s) {
		Value lv = left.interp(s);
		Value rv = right.interp(s);
		if ((lv instanceof FloatValue && rv instanceof FloatValue)
				|| (lv instanceof IntValue && rv instanceof IntValue)
				|| (lv instanceof StringValue && lv instanceof StringValue))
			return Type.BOOL;
		S.error("Type math error!");
		return Value.ANY;
	}
}
{'fraction_non_alphanumeric': 0.14206300185299567, 'fraction_numerical': 0.0006176652254478073, 'mean_word_length': 2.954822954822955, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1010401', 'n_tokens_mistral': 1340, 'n_tokens_neox': 1161, 'n_words': 369}