Add missing operators and make the grammar more readable while using
spaces and tabs consistently.
Feedback? Comments?
Index: test.c
===================================================================
RCS file: /cvs/src/bin/test/test.c,v
retrieving revision 1.17
diff -u -p -r1.17 test.c
--- test.c 21 Jan 2017 11:03:42 -0000 1.17
+++ test.c 24 Jul 2017 15:02:03 -0000
@@ -22,20 +23,18 @@
#include <err.h>
/* test(1) accepts the following grammar:
- oexpr ::= aexpr | aexpr "-o" oexpr ;
- aexpr ::= nexpr | nexpr "-a" aexpr ;
- nexpr ::= primary | "!" primary
- primary ::= unary-operator operand
- | operand binary-operator operand
- | operand
- | "(" oexpr ")"
- ;
- unary-operator ::= "-r"|"-w"|"-x"|"-f"|"-d"|"-c"|"-b"|"-p"|
- "-u"|"-g"|"-k"|"-s"|"-t"|"-z"|"-n"|"-o"|"-O"|"-G"|"-L"|"-S";
-
- binary-operator ::= "="|"!="|"-eq"|"-ne"|"-ge"|"-gt"|"-le"|"-lt"|
- "-nt"|"-ot"|"-ef";
- operand ::= <any legal UNIX file name>
+ oexpr ::= aexpr | aexpr "-o" oexpr
+ aexpr ::= nexpr | nexpr "-a" aexpr
+ nexpr ::= primary | "!" primary
+ primary ::= unary-operator operand |
+ operand binary-operator operand |
+ operand |
+ "(" oexpr ")"
+ unary-operator ::= "-r"|"-w"|"-x"|"-f"|"-d"|"-c"|"-b"|"-p"|"-u"|"-g"|
+ "-k"|"-s"|"-t"|"-z"|"-n"|"-o"|"-O"|"-G"|"-L"|"-S"
+ binary-operator ::= "="|"!="|"<"|">"|"-eq"|"-ne"|"-ge"|"-gt"|"-le"|
+ "-lt"|"-nt"|"-ot"|"-ef"
+ operand ::= <pathname> | <string> | <integer>
*/
enum token {