about summary refs log tree commit diff
path: root/lr.c
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2016-02-02 13:52:06 +0100
committerChristian Neukirchen <chneukirchen@gmail.com>2016-02-02 13:52:06 +0100
commit1d85f6f97e6f45494c8555ff8039927e613f6e72 (patch)
tree51ccb34274638f32b1efbec49922a055e9c8d958 /lr.c
parenta5631bb6cd97f60f61b857ad365b1853ef6aa487 (diff)
downloadlr-1d85f6f97e6f45494c8555ff8039927e613f6e72.tar.gz
lr-1d85f6f97e6f45494c8555ff8039927e613f6e72.tar.xz
lr-1d85f6f97e6f45494c8555ff8039927e613f6e72.zip
add type != X
Diffstat (limited to 'lr.c')
-rw-r--r--lr.c13
1 files changed, 11 insertions, 2 deletions
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);