From a5631bb6cd97f60f61b857ad365b1853ef6aa487 Mon Sep 17 00:00:00 2001 From: Christian Neukirchen Date: Tue, 2 Feb 2016 13:47:27 +0100 Subject: allow = instead of == --- README.md | 8 ++++---- lr.1 | 8 ++++---- lr.c | 8 +++++--- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 67f7d42..4ba11d3 100644 --- a/README.md +++ b/README.md @@ -136,7 +136,7 @@ Default: `n`. ::= depth | dev | entries | gid | inode | links | mode | rdev | size | total | uid - ::= <= | < | >= | > | == | != + ::= <= | < | >= | > | == | = | != ::= "./path" -- mtime of relative path | "/path" -- mtime of absolute path @@ -159,7 +159,7 @@ Default: `n`. ::= fstype | group | name | path | target | user - ::= == -- string equality + ::= == | = -- string equality | === -- case insensitive string equality | ~~ -- glob (fnmatch) | ~~~ -- case insensitive glob (fnmatch) @@ -168,9 +168,9 @@ Default: `n`. ::= " ([^"] | "")+ " -- use "" for a single " inside " - ::= type == ( b | c | d | p | f | l ) + ::= type ( == | = ) ( b | c | d | p | f | l ) - ::= mode ( == -- exact permissions + ::= mode ( == | = -- exact permissions | & -- check if all bits of set | | -- check if any bit of set ) diff --git a/lr.1 b/lr.1 index 2578b2d..880d69f 100644 --- a/lr.1 +++ b/lr.1 @@ -224,7 +224,7 @@ tests are given by the following EBNF: ::= depth | dev | entries | gid | inode | links | mode | rdev | size | total | uid - ::= <= | < | >= | > | == | != + ::= <= | < | >= | > | == | = | != ::= "./path" -- mtime of relative path | "/path" -- mtime of absolute path @@ -247,7 +247,7 @@ tests are given by the following EBNF: ::= fstype | group | name | path | target | user - ::= == -- string equality + ::= == | = -- string equality | === -- case insensitive string equality | ~~ -- glob (fnmatch) | ~~~ -- case insensitive glob (fnmatch) @@ -256,9 +256,9 @@ tests are given by the following EBNF: ::= " ([^"] | "")+ " -- use "" for a single " inside " - ::= type == ( b | c | d | p | f | l ) + ::= type ( == | = ) ( b | c | d | p | f | l ) - ::= mode ( == -- exact permissions + ::= mode ( == | = -- exact permissions | & -- check if all bits of set | | -- check if any bit of set ) diff --git a/lr.c b/lr.c index 56f2d77..41054e0 100644 --- a/lr.c +++ b/lr.c @@ -287,7 +287,7 @@ parse_op() return EXPR_GE; else if (token(">")) return EXPR_GT; - else if (token("==")) + else if (token("==") || token("=")) return EXPR_EQ; else if (token("!=")) return EXPR_NEQ; @@ -328,7 +328,7 @@ static struct expr * parse_type() { if (token("type")) { - if (token("==")) { // TODO != + if (token("==") || token("=")) { // TODO != struct expr *e = mkexpr(EXPR_TYPE); if (token("b")) e->a.filetype = TYPE_BLOCK; @@ -494,6 +494,8 @@ parse_strcmp() op = EXPR_STREQI; else if (token("==")) op = EXPR_STREQ; + else if (token("=")) + op = EXPR_STREQ; else if (token("~~~")) op = EXPR_GLOBI; else if (token("~~")) @@ -542,7 +544,7 @@ parse_mode() e->a.prop = PROP_MODE; - if (token("==")) { + if (token("==") || token("=")) { e->op = EXPR_EQ; } else if (token("&")) { e->op = EXPR_ALLSET; -- cgit 1.4.1