From 1d85f6f97e6f45494c8555ff8039927e613f6e72 Mon Sep 17 00:00:00 2001 From: Christian Neukirchen Date: Tue, 2 Feb 2016 13:52:06 +0100 Subject: add type != X --- lr.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'lr.c') diff --git a/lr.c b/lr.c index 41054e0..e1348df 100644 --- a/lr.c +++ b/lr.c @@ -327,8 +327,11 @@ parse_inner() static struct expr * parse_type() { + int negate = 0; + if (token("type")) { - if (token("==") || token("=")) { // TODO != + if (token("==") || token("=") + || (token("!=") && ++negate)) { struct expr *e = mkexpr(EXPR_TYPE); if (token("b")) e->a.filetype = TYPE_BLOCK; @@ -348,7 +351,13 @@ parse_type() parse_error("invalid file type '%c'", *pos); else parse_error("no file type given"); - return e; + if (negate) { + struct expr *not = mkexpr(EXPR_NOT); + not->a.expr = e; + return not; + } else { + return e; + } } else { parse_error("invalid file type comparison at '%.15s'", pos); -- cgit 1.4.1