Skip to content
Browse files

Add iname, wholename. Fix command line parameters

  • Loading branch information...
1 parent 6a4df3f commit d28a260a1dea4a00cce196456dd5752daf979112 @weyrick committed Jul 17, 2012
Showing with 721 additions and 274 deletions.
  1. +1 −3 TODO
  2. +8 −1 src/efind_parser.y
  3. +21 −11 src/main.c
  4. +665 −258 src/scanner.c
  5. +20 −1 src/scanner.re
  6. +6 −0 test/test1.c
View
4 TODO
@@ -2,7 +2,7 @@
- no expression, passthrough
- strtotime port
-- connecting words: with, having, has, files
+- connecting words: with, having, has, files, are, is, a
-amin,cmin,mmin
-anewer,cnewer
@@ -11,8 +11,6 @@
-executable
-fstype
-gid,uid
--name,iname
--wholename,iwholename
-links
-lname,ilname
-newer
View
9 src/efind_parser.y
@@ -89,7 +89,14 @@ expr(RET) ::= GROUPEDBY WORD(B). {
expr(RET) ::= NAMED WORD(B). {
RET = list_create();
- list_push_str(RET, strdup("-name"));
+ if (B->opt == 0)
+ list_push_str(RET, strdup("-name"));
+ else if (B->opt == 1)
+ list_push_str(RET, strdup("-iname"));
+ else if (B->opt == 2)
+ list_push_str(RET, strdup("-wholename"));
+ else if (B->opt == 3)
+ list_push_str(RET, strdup("-iwholename"));
list_push_str(RET, B->data);
}
View
32 src/main.c
@@ -39,10 +39,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
struct option longopts[] = {
{"version", FALSE, 0, 0},
{"command-only", TRUE, 0, 'c'},
+ {"verbose", FALSE, 0, 'v'},
{0, 0, 0, 0}
};
int commandOnly = FALSE;
+int verbose = FALSE;
void version() {
printf("efind v.9\n");
@@ -54,6 +56,7 @@ void usage(int retval) {
printf("Usage:\n");
printf("efind [path] [expression]\n");
printf("\t-c\toutput find command only (do not run find)\n");
+ printf("\t-v\tverbose output\n");
exit(retval);
}
@@ -69,14 +72,18 @@ void runFind(char *path, list *argList)
if (argVec == NULL)
return;
-#if 0
- char *s = argVec[0];
- int i=0;
- while (s) {
- printf("%i: %s\n", i++, s);
- s = argVec[i];
+ if (commandOnly) {
+ if (verbose) {
+ char *s = argVec[0];
+ int i=0;
+ while (s) {
+ printf("%i: %s\n", i++, s);
+ s = argVec[i];
+ }
+ }
+ printf("find %s\n", list_to_str(finalArgs));
+ exit(0);
}
-#endif
if (execvp("find", argVec) == -1)
perror("exec failed");
@@ -91,7 +98,7 @@ int main(int argc, char *argv[]) {
int opt, idx;
int optionsError = FALSE;
- while ((opt = getopt_long(argc, argv, "c", longopts, &idx)) !=
+ while ((opt = getopt_long(argc, argv, "cv", longopts, &idx)) !=
-1) {
switch (opt) {
case 0:
@@ -107,19 +114,22 @@ int main(int argc, char *argv[]) {
case 'c':
commandOnly = TRUE;
break;
+ case 'v':
+ verbose = TRUE;
+ break;
}
}
// check for options errors
- if (optionsError)
+ if (optionsError || argc <= optind+1)
usage(1);
- list *argVec = parse_expr(argv[2]);
+ list *argVec = parse_expr(argv[optind+1]);
if (argVec == NULL) {
printf("null expression\n");
exit(1);
}
- runFind(argv[1], argVec);
+ runFind(argv[optind], argVec);
return 0;
View
923 src/scanner.c
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.13.5 on Mon Jul 16 17:04:36 2012 */
+/* Generated by re2c 0.13.5 on Tue Jul 17 11:47:43 2012 */
#line 1 "/home/weyrick/workspace/efind/src/scanner.re"
/*
@@ -57,21 +57,21 @@ int scan(scanner_state *s, scanner_token *token) {
yych = *YYCURSOR;
switch (yych) {
- case 0x00: goto yy16;
+ case 0x00: goto yy18;
case '\t':
case '\n':
case '\r':
- case ' ': goto yy11;
+ case ' ': goto yy13;
case '*':
case '-':
case '.':
+ case '/':
case '?':
case 'C':
case 'D':
case 'E':
case 'F':
case 'H':
- case 'I':
case 'J':
case 'L':
case 'P':
@@ -80,7 +80,6 @@ int scan(scanner_state *s, scanner_token *token) {
case 'T':
case 'U':
case 'V':
- case 'W':
case 'X':
case 'Y':
case 'Z':
@@ -90,7 +89,6 @@ int scan(scanner_state *s, scanner_token *token) {
case 'e':
case 'f':
case 'h':
- case 'i':
case 'j':
case 'l':
case 'p':
@@ -99,10 +97,9 @@ int scan(scanner_state *s, scanner_token *token) {
case 't':
case 'u':
case 'v':
- case 'w':
case 'x':
case 'y':
- case 'z': goto yy15;
+ case 'z': goto yy17;
case '0':
case '1':
case '2':
@@ -112,13 +109,15 @@ int scan(scanner_state *s, scanner_token *token) {
case '6':
case '7':
case '8':
- case '9': goto yy13;
+ case '9': goto yy15;
case 'A':
case 'a': goto yy4;
case 'B':
case 'b': goto yy7;
case 'G':
case 'g': goto yy10;
+ case 'I':
+ case 'i': goto yy11;
case 'K':
case 'k': goto yy8;
case 'M':
@@ -129,101 +128,120 @@ int scan(scanner_state *s, scanner_token *token) {
case 'o': goto yy2;
case 'S':
case 's': goto yy6;
- default: goto yy18;
+ case 'W':
+ case 'w': goto yy12;
+ default: goto yy20;
}
yy2:
++YYCURSOR;
switch ((yych = *YYCURSOR)) {
case 'R':
- case 'r': goto yy87;
+ case 'r': goto yy116;
case 'W':
- case 'w': goto yy89;
- default: goto yy21;
+ case 'w': goto yy118;
+ default: goto yy23;
}
yy3:
-#line 130 "/home/weyrick/workspace/efind/src/scanner.re"
+#line 149 "/home/weyrick/workspace/efind/src/scanner.re"
{
token->tokType = TOKEN_WORD;
token->data = strndup(q, YYCURSOR - q);
return 0;
}
-#line 151 "/home/weyrick/workspace/efind/src/scanner.c"
+#line 152 "/home/weyrick/workspace/efind/src/scanner.c"
yy4:
yych = *++YYCURSOR;
switch (yych) {
case 'N':
- case 'n': goto yy84;
- default: goto yy21;
+ case 'n': goto yy113;
+ default: goto yy23;
}
yy5:
yych = *++YYCURSOR;
switch (yych) {
case 'A':
- case 'a': goto yy76;
+ case 'a': goto yy105;
case 'O':
- case 'o': goto yy77;
- default: goto yy21;
+ case 'o': goto yy106;
+ default: goto yy23;
}
yy6:
yych = *++YYCURSOR;
switch (yych) {
case 'I':
- case 'i': goto yy72;
- default: goto yy21;
+ case 'i': goto yy101;
+ default: goto yy23;
}
yy7:
yych = *++YYCURSOR;
switch (yych) {
case 'Y':
- case 'y': goto yy67;
- default: goto yy21;
+ case 'y': goto yy96;
+ default: goto yy23;
}
yy8:
yych = *++YYCURSOR;
switch (yych) {
case 'B':
- case 'b': goto yy57;
+ case 'b': goto yy86;
case 'I':
- case 'i': goto yy59;
- default: goto yy21;
+ case 'i': goto yy88;
+ default: goto yy23;
}
yy9:
yych = *++YYCURSOR;
switch (yych) {
case 'B':
- case 'b': goto yy47;
+ case 'b': goto yy76;
case 'E':
- case 'e': goto yy49;
- default: goto yy21;
+ case 'e': goto yy78;
+ default: goto yy23;
}
yy10:
yych = *++YYCURSOR;
switch (yych) {
case 'B':
- case 'b': goto yy26;
+ case 'b': goto yy55;
case 'I':
- case 'i': goto yy28;
+ case 'i': goto yy57;
case 'R':
- case 'r': goto yy29;
- default: goto yy21;
+ case 'r': goto yy58;
+ default: goto yy23;
}
yy11:
+ yych = *++YYCURSOR;
+ switch (yych) {
+ case 'N':
+ case 'n': goto yy38;
+ case 'W':
+ case 'w': goto yy39;
+ default: goto yy23;
+ }
+yy12:
+ yych = *++YYCURSOR;
+ switch (yych) {
+ case 'H':
+ case 'h': goto yy28;
+ default: goto yy23;
+ }
+yy13:
++YYCURSOR;
yych = *YYCURSOR;
- goto yy25;
-yy12:
-#line 119 "/home/weyrick/workspace/efind/src/scanner.re"
+ goto yy27;
+yy14:
+#line 138 "/home/weyrick/workspace/efind/src/scanner.re"
{
token->tokType = TOKEN_WS;
return 0;
}
-#line 221 "/home/weyrick/workspace/efind/src/scanner.c"
-yy13:
+#line 238 "/home/weyrick/workspace/efind/src/scanner.c"
+yy15:
++YYCURSOR;
switch ((yych = *YYCURSOR)) {
case '*':
case '-':
case '.':
+ case '/':
case '?':
case 'A':
case 'B':
@@ -277,7 +295,7 @@ int scan(scanner_state *s, scanner_token *token) {
case 'w':
case 'x':
case 'y':
- case 'z': goto yy20;
+ case 'z': goto yy22;
case '0':
case '1':
case '2':
@@ -287,38 +305,39 @@ int scan(scanner_state *s, scanner_token *token) {
case '6':
case '7':
case '8':
- case '9': goto yy22;
- default: goto yy14;
+ case '9': goto yy24;
+ default: goto yy16;
}
-yy14:
-#line 124 "/home/weyrick/workspace/efind/src/scanner.re"
+yy16:
+#line 143 "/home/weyrick/workspace/efind/src/scanner.re"
{
token->tokType = TOKEN_INT;
token->data = strndup(q, YYCURSOR - q);
return 0;
}
-#line 301 "/home/weyrick/workspace/efind/src/scanner.c"
-yy15:
+#line 319 "/home/weyrick/workspace/efind/src/scanner.c"
+yy17:
yych = *++YYCURSOR;
- goto yy21;
-yy16:
+ goto yy23;
+yy18:
++YYCURSOR;
-#line 136 "/home/weyrick/workspace/efind/src/scanner.re"
+#line 155 "/home/weyrick/workspace/efind/src/scanner.re"
{ r = SCANNER_RETCODE_EOF; break; }
-#line 309 "/home/weyrick/workspace/efind/src/scanner.c"
-yy18:
+#line 327 "/home/weyrick/workspace/efind/src/scanner.c"
+yy20:
++YYCURSOR;
-#line 138 "/home/weyrick/workspace/efind/src/scanner.re"
+#line 157 "/home/weyrick/workspace/efind/src/scanner.re"
{ r = SCANNER_RETCODE_ERR; break; }
-#line 314 "/home/weyrick/workspace/efind/src/scanner.c"
-yy20:
+#line 332 "/home/weyrick/workspace/efind/src/scanner.c"
+yy22:
++YYCURSOR;
yych = *YYCURSOR;
-yy21:
+yy23:
switch (yych) {
case '*':
case '-':
case '.':
+ case '/':
case '0':
case '1':
case '2':
@@ -382,16 +401,17 @@ int scan(scanner_state *s, scanner_token *token) {
case 'w':
case 'x':
case 'y':
- case 'z': goto yy20;
+ case 'z': goto yy22;
default: goto yy3;
}
-yy22:
+yy24:
++YYCURSOR;
yych = *YYCURSOR;
switch (yych) {
case '*':
case '-':
case '.':
+ case '/':
case '?':
case 'A':
case 'B':
@@ -445,7 +465,7 @@ int scan(scanner_state *s, scanner_token *token) {
case 'w':
case 'x':
case 'y':
- case 'z': goto yy20;
+ case 'z': goto yy22;
case '0':
case '1':
case '2':
@@ -455,26 +475,399 @@ int scan(scanner_state *s, scanner_token *token) {
case '6':
case '7':
case '8':
- case '9': goto yy22;
- default: goto yy14;
+ case '9': goto yy24;
+ default: goto yy16;
}
-yy24:
+yy26:
++YYCURSOR;
yych = *YYCURSOR;
-yy25:
+yy27:
switch (yych) {
case '\t':
case '\n':
case '\r':
- case ' ': goto yy24;
- default: goto yy12;
+ case ' ': goto yy26;
+ default: goto yy14;
}
-yy26:
+yy28:
+ yych = *++YYCURSOR;
+ switch (yych) {
+ case 'O':
+ case 'o': goto yy29;
+ default: goto yy23;
+ }
+yy29:
+ yych = *++YYCURSOR;
+ switch (yych) {
+ case 'L':
+ case 'l': goto yy30;
+ default: goto yy23;
+ }
+yy30:
+ yych = *++YYCURSOR;
+ switch (yych) {
+ case 'E':
+ case 'e': goto yy31;
+ default: goto yy23;
+ }
+yy31:
+ yych = *++YYCURSOR;
+ switch (yych) {
+ case 'N':
+ case 'n': goto yy32;
+ default: goto yy23;
+ }
+yy32:
+ yych = *++YYCURSOR;
+ switch (yych) {
+ case 'A':
+ case 'a': goto yy33;
+ default: goto yy23;
+ }
+yy33:
+ yych = *++YYCURSOR;
+ switch (yych) {
+ case 'M':
+ case 'm': goto yy34;
+ default: goto yy23;
+ }
+yy34:
+ yych = *++YYCURSOR;
+ switch (yych) {
+ case 'E':
+ case 'e': goto yy35;
+ default: goto yy23;
+ }
+yy35:
+ ++YYCURSOR;
+ yych = *YYCURSOR;
+ switch (yych) {
+ case '*':
+ case '-':
+ case '.':
+ case '/':
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ case '?':
+ case 'A':
+ case 'B':
+ case 'C':
+ case 'E':
+ case 'F':
+ case 'G':
+ case 'H':
+ case 'I':
+ case 'J':
+ case 'K':
+ case 'L':
+ case 'M':
+ case 'N':
+ case 'O':
+ case 'P':
+ case 'Q':
+ case 'R':
+ case 'S':
+ case 'T':
+ case 'U':
+ case 'V':
+ case 'W':
+ case 'X':
+ case 'Y':
+ case 'Z':
+ case '_':
+ case 'a':
+ case 'b':
+ case 'c':
+ case 'e':
+ case 'f':
+ case 'g':
+ case 'h':
+ case 'i':
+ case 'j':
+ case 'k':
+ case 'l':
+ case 'm':
+ case 'n':
+ case 'o':
+ case 'p':
+ case 'q':
+ case 'r':
+ case 's':
+ case 't':
+ case 'u':
+ case 'v':
+ case 'w':
+ case 'x':
+ case 'y':
+ case 'z': goto yy22;
+ case 'D':
+ case 'd': goto yy35;
+ default: goto yy37;
+ }
+yy37:
+#line 126 "/home/weyrick/workspace/efind/src/scanner.re"
+ {
+ token->tokType = TOKEN_NAMED;
+ token->opt = 2; // wholename
+ return 0;
+ }
+#line 623 "/home/weyrick/workspace/efind/src/scanner.c"
+yy38:
+ yych = *++YYCURSOR;
+ switch (yych) {
+ case 'A':
+ case 'a': goto yy50;
+ default: goto yy23;
+ }
+yy39:
+ yych = *++YYCURSOR;
+ switch (yych) {
+ case 'H':
+ case 'h': goto yy40;
+ default: goto yy23;
+ }
+yy40:
+ yych = *++YYCURSOR;
+ switch (yych) {
+ case 'O':
+ case 'o': goto yy41;
+ default: goto yy23;
+ }
+yy41:
+ yych = *++YYCURSOR;
+ switch (yych) {
+ case 'L':
+ case 'l': goto yy42;
+ default: goto yy23;
+ }
+yy42:
+ yych = *++YYCURSOR;
+ switch (yych) {
+ case 'E':
+ case 'e': goto yy43;
+ default: goto yy23;
+ }
+yy43:
+ yych = *++YYCURSOR;
+ switch (yych) {
+ case 'N':
+ case 'n': goto yy44;
+ default: goto yy23;
+ }
+yy44:
+ yych = *++YYCURSOR;
+ switch (yych) {
+ case 'A':
+ case 'a': goto yy45;
+ default: goto yy23;
+ }
+yy45:
+ yych = *++YYCURSOR;
+ switch (yych) {
+ case 'M':
+ case 'm': goto yy46;
+ default: goto yy23;
+ }
+yy46:
+ yych = *++YYCURSOR;
+ switch (yych) {
+ case 'E':
+ case 'e': goto yy47;
+ default: goto yy23;
+ }
+yy47:
+ ++YYCURSOR;
+ yych = *YYCURSOR;
+ switch (yych) {
+ case '*':
+ case '-':
+ case '.':
+ case '/':
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ case '?':
+ case 'A':
+ case 'B':
+ case 'C':
+ case 'E':
+ case 'F':
+ case 'G':
+ case 'H':
+ case 'I':
+ case 'J':
+ case 'K':
+ case 'L':
+ case 'M':
+ case 'N':
+ case 'O':
+ case 'P':
+ case 'Q':
+ case 'R':
+ case 'S':
+ case 'T':
+ case 'U':
+ case 'V':
+ case 'W':
+ case 'X':
+ case 'Y':
+ case 'Z':
+ case '_':
+ case 'a':
+ case 'b':
+ case 'c':
+ case 'e':
+ case 'f':
+ case 'g':
+ case 'h':
+ case 'i':
+ case 'j':
+ case 'k':
+ case 'l':
+ case 'm':
+ case 'n':
+ case 'o':
+ case 'p':
+ case 'q':
+ case 'r':
+ case 's':
+ case 't':
+ case 'u':
+ case 'v':
+ case 'w':
+ case 'x':
+ case 'y':
+ case 'z': goto yy22;
+ case 'D':
+ case 'd': goto yy47;
+ default: goto yy49;
+ }
+yy49:
+#line 132 "/home/weyrick/workspace/efind/src/scanner.re"
+ {
+ token->tokType = TOKEN_NAMED;
+ token->opt = 3; // iwholename
+ return 0;
+ }
+#line 768 "/home/weyrick/workspace/efind/src/scanner.c"
+yy50:
+ yych = *++YYCURSOR;
+ switch (yych) {
+ case 'M':
+ case 'm': goto yy51;
+ default: goto yy23;
+ }
+yy51:
+ yych = *++YYCURSOR;
+ switch (yych) {
+ case 'E':
+ case 'e': goto yy52;
+ default: goto yy23;
+ }
+yy52:
+ ++YYCURSOR;
+ yych = *YYCURSOR;
+ switch (yych) {
+ case '*':
+ case '-':
+ case '.':
+ case '/':
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ case '?':
+ case 'A':
+ case 'B':
+ case 'C':
+ case 'E':
+ case 'F':
+ case 'G':
+ case 'H':
+ case 'I':
+ case 'J':
+ case 'K':
+ case 'L':
+ case 'M':
+ case 'N':
+ case 'O':
+ case 'P':
+ case 'Q':
+ case 'R':
+ case 'S':
+ case 'T':
+ case 'U':
+ case 'V':
+ case 'W':
+ case 'X':
+ case 'Y':
+ case 'Z':
+ case '_':
+ case 'a':
+ case 'b':
+ case 'c':
+ case 'e':
+ case 'f':
+ case 'g':
+ case 'h':
+ case 'i':
+ case 'j':
+ case 'k':
+ case 'l':
+ case 'm':
+ case 'n':
+ case 'o':
+ case 'p':
+ case 'q':
+ case 'r':
+ case 's':
+ case 't':
+ case 'u':
+ case 'v':
+ case 'w':
+ case 'x':
+ case 'y':
+ case 'z': goto yy22;
+ case 'D':
+ case 'd': goto yy52;
+ default: goto yy54;
+ }
+yy54:
+#line 120 "/home/weyrick/workspace/efind/src/scanner.re"
+ {
+ token->tokType = TOKEN_NAMED;
+ token->opt = 1; // iname
+ return 0;
+ }
+#line 864 "/home/weyrick/workspace/efind/src/scanner.c"
+yy55:
++YYCURSOR;
switch ((yych = *YYCURSOR)) {
case '*':
case '-':
case '.':
+ case '/':
case '0':
case '1':
case '2':
@@ -538,51 +931,52 @@ int scan(scanner_state *s, scanner_token *token) {
case 'w':
case 'x':
case 'y':
- case 'z': goto yy20;
- default: goto yy27;
+ case 'z': goto yy22;
+ default: goto yy56;
}
-yy27:
+yy56:
#line 98 "/home/weyrick/workspace/efind/src/scanner.re"
{
token->tokType = TOKEN_SIZEQUAL;
token->opt = 'G';
return 0;
}
-#line 552 "/home/weyrick/workspace/efind/src/scanner.c"
-yy28:
+#line 945 "/home/weyrick/workspace/efind/src/scanner.c"
+yy57:
yych = *++YYCURSOR;
switch (yych) {
case 'G':
- case 'g': goto yy40;
- default: goto yy21;
+ case 'g': goto yy69;
+ default: goto yy23;
}
-yy29:
+yy58:
yych = *++YYCURSOR;
switch (yych) {
case 'O':
- case 'o': goto yy30;
- default: goto yy21;
+ case 'o': goto yy59;
+ default: goto yy23;
}
-yy30:
+yy59:
yych = *++YYCURSOR;
switch (yych) {
case 'U':
- case 'u': goto yy31;
- default: goto yy21;
+ case 'u': goto yy60;
+ default: goto yy23;
}
-yy31:
+yy60:
yych = *++YYCURSOR;
switch (yych) {
case 'P':
- case 'p': goto yy32;
- default: goto yy21;
+ case 'p': goto yy61;
+ default: goto yy23;
}
-yy32:
+yy61:
++YYCURSOR;
switch ((yych = *YYCURSOR)) {
case '*':
case '-':
case '.':
+ case '/':
case '0':
case '1':
case '2':
@@ -644,93 +1038,94 @@ int scan(scanner_state *s, scanner_token *token) {
case 'w':
case 'x':
case 'y':
- case 'z': goto yy20;
+ case 'z': goto yy22;
case 'E':
- case 'e': goto yy34;
- default: goto yy33;
+ case 'e': goto yy63;
+ default: goto yy62;
}
-yy33:
+yy62:
#line 109 "/home/weyrick/workspace/efind/src/scanner.re"
{
token->tokType = TOKEN_GROUPEDBY;
return 0;
}
-#line 659 "/home/weyrick/workspace/efind/src/scanner.c"
-yy34:
+#line 1053 "/home/weyrick/workspace/efind/src/scanner.c"
+yy63:
yych = *++YYCURSOR;
switch (yych) {
case 'D':
- case 'd': goto yy35;
- default: goto yy21;
+ case 'd': goto yy64;
+ default: goto yy23;
}
-yy35:
+yy64:
yych = *(YYMARKER = ++YYCURSOR);
switch (yych) {
- case ' ': goto yy36;
- default: goto yy21;
+ case ' ': goto yy65;
+ default: goto yy23;
}
-yy36:
+yy65:
yych = *++YYCURSOR;
switch (yych) {
case 'B':
- case 'b': goto yy38;
- default: goto yy37;
+ case 'b': goto yy67;
+ default: goto yy66;
}
-yy37:
+yy66:
YYCURSOR = YYMARKER;
goto yy3;
-yy38:
+yy67:
yych = *++YYCURSOR;
switch (yych) {
case 'Y':
- case 'y': goto yy39;
- default: goto yy37;
+ case 'y': goto yy68;
+ default: goto yy66;
}
-yy39:
+yy68:
yych = *++YYCURSOR;
- goto yy33;
-yy40:
+ goto yy62;
+yy69:
yych = *++YYCURSOR;
switch (yych) {
case 'A':
- case 'a': goto yy41;
- default: goto yy21;
+ case 'a': goto yy70;
+ default: goto yy23;
}
-yy41:
+yy70:
yych = *++YYCURSOR;
switch (yych) {
case 'B':
- case 'b': goto yy42;
- default: goto yy21;
+ case 'b': goto yy71;
+ default: goto yy23;
}
-yy42:
+yy71:
yych = *++YYCURSOR;
switch (yych) {
case 'Y':
- case 'y': goto yy43;
- default: goto yy21;
+ case 'y': goto yy72;
+ default: goto yy23;
}
-yy43:
+yy72:
yych = *++YYCURSOR;
switch (yych) {
case 'T':
- case 't': goto yy44;
- default: goto yy21;
+ case 't': goto yy73;
+ default: goto yy23;
}
-yy44:
+yy73:
yych = *++YYCURSOR;
switch (yych) {
case 'E':
- case 'e': goto yy45;
- default: goto yy21;
+ case 'e': goto yy74;
+ default: goto yy23;
}
-yy45:
+yy74:
++YYCURSOR;
yych = *YYCURSOR;
switch (yych) {
case '*':
case '-':
case '.':
+ case '/':
case '0':
case '1':
case '2':
@@ -792,17 +1187,18 @@ int scan(scanner_state *s, scanner_token *token) {
case 'w':
case 'x':
case 'y':
- case 'z': goto yy20;
+ case 'z': goto yy22;
case 'S':
- case 's': goto yy45;
- default: goto yy27;
+ case 's': goto yy74;
+ default: goto yy56;
}
-yy47:
+yy76:
++YYCURSOR;
switch ((yych = *YYCURSOR)) {
case '*':
case '-':
case '.':
+ case '/':
case '0':
case '1':
case '2':
@@ -866,66 +1262,67 @@ int scan(scanner_state *s, scanner_token *token) {
case 'w':
case 'x':
case 'y':
- case 'z': goto yy20;
- default: goto yy48;
+ case 'z': goto yy22;
+ default: goto yy77;
}
-yy48:
+yy77:
#line 92 "/home/weyrick/workspace/efind/src/scanner.re"
{
token->tokType = TOKEN_SIZEQUAL;
token->opt = 'M';
return 0;
}
-#line 880 "/home/weyrick/workspace/efind/src/scanner.c"
-yy49:
+#line 1276 "/home/weyrick/workspace/efind/src/scanner.c"
+yy78:
yych = *++YYCURSOR;
switch (yych) {
case 'G':
- case 'g': goto yy50;
- default: goto yy21;
+ case 'g': goto yy79;
+ default: goto yy23;
}
-yy50:
+yy79:
yych = *++YYCURSOR;
switch (yych) {
case 'A':
- case 'a': goto yy51;
- default: goto yy21;
+ case 'a': goto yy80;
+ default: goto yy23;
}
-yy51:
+yy80:
yych = *++YYCURSOR;
switch (yych) {
case 'B':
- case 'b': goto yy52;
- default: goto yy21;
+ case 'b': goto yy81;
+ default: goto yy23;
}
-yy52:
+yy81:
yych = *++YYCURSOR;
switch (yych) {
case 'Y':
- case 'y': goto yy53;
- default: goto yy21;
+ case 'y': goto yy82;
+ default: goto yy23;
}
-yy53:
+yy82:
yych = *++YYCURSOR;
switch (yych) {
case 'T':
- case 't': goto yy54;
- default: goto yy21;
+ case 't': goto yy83;
+ default: goto yy23;
}
-yy54:
+yy83:
yych = *++YYCURSOR;
switch (yych) {
case 'E':
- case 'e': goto yy55;
- default: goto yy21;
+ case 'e': goto yy84;
+ default: goto yy23;
}
-yy55:
+yy84:
++YYCURSOR;
yych = *YYCURSOR;
switch (yych) {
case '*':
case '-':
case '.':
+ case '/':
case '0':
case '1':
case '2':
@@ -987,17 +1384,18 @@ int scan(scanner_state *s, scanner_token *token) {
case 'w':
case 'x':
case 'y':
- case 'z': goto yy20;
+ case 'z': goto yy22;
case 'S':
- case 's': goto yy55;
- default: goto yy48;
+ case 's': goto yy84;
+ default: goto yy77;
}
-yy57:
+yy86:
++YYCURSOR;
switch ((yych = *YYCURSOR)) {
case '*':
case '-':
case '.':
+ case '/':
case '0':
case '1':
case '2':
@@ -1061,66 +1459,67 @@ int scan(scanner_state *s, scanner_token *token) {
case 'w':
case 'x':
case 'y':
- case 'z': goto yy20;
- default: goto yy58;
+ case 'z': goto yy22;
+ default: goto yy87;
}
-yy58:
+yy87:
#line 86 "/home/weyrick/workspace/efind/src/scanner.re"
{
token->tokType = TOKEN_SIZEQUAL;
token->opt = 'k';
return 0;
}
-#line 1075 "/home/weyrick/workspace/efind/src/scanner.c"
-yy59:
+#line 1473 "/home/weyrick/workspace/efind/src/scanner.c"
+yy88:
yych = *++YYCURSOR;
switch (yych) {
case 'L':
- case 'l': goto yy60;
- default: goto yy21;
+ case 'l': goto yy89;
+ default: goto yy23;
}
-yy60:
+yy89:
yych = *++YYCURSOR;
switch (yych) {
case 'O':
- case 'o': goto yy61;
- default: goto yy21;
+ case 'o': goto yy90;
+ default: goto yy23;
}
-yy61:
+yy90:
yych = *++YYCURSOR;
switch (yych) {
case 'B':
- case 'b': goto yy62;
- default: goto yy21;
+ case 'b': goto yy91;
+ default: goto yy23;
}
-yy62:
+yy91:
yych = *++YYCURSOR;
switch (yych) {
case 'Y':
- case 'y': goto yy63;
- default: goto yy21;
+ case 'y': goto yy92;
+ default: goto yy23;
}
-yy63:
+yy92:
yych = *++YYCURSOR;
switch (yych) {
case 'T':
- case 't': goto yy64;
- default: goto yy21;
+ case 't': goto yy93;
+ default: goto yy23;
}
-yy64:
+yy93:
yych = *++YYCURSOR;
switch (yych) {
case 'E':
- case 'e': goto yy65;
- default: goto yy21;
+ case 'e': goto yy94;
+ default: goto yy23;
}
-yy65:
+yy94:
++YYCURSOR;
yych = *YYCURSOR;
switch (yych) {
case '*':
case '-':
case '.':
+ case '/':
case '0':
case '1':
case '2':
@@ -1182,32 +1581,33 @@ int scan(scanner_state *s, scanner_token *token) {
case 'w':
case 'x':
case 'y':
- case 'z': goto yy20;
+ case 'z': goto yy22;
case 'S':
- case 's': goto yy65;
- default: goto yy58;
+ case 's': goto yy94;
+ default: goto yy87;
}
-yy67:
+yy96:
yych = *++YYCURSOR;
switch (yych) {
case 'T':
- case 't': goto yy68;
- default: goto yy21;
+ case 't': goto yy97;
+ default: goto yy23;
}
-yy68:
+yy97:
yych = *++YYCURSOR;
switch (yych) {
case 'E':
- case 'e': goto yy69;
- default: goto yy21;
+ case 'e': goto yy98;
+ default: goto yy23;
}
-yy69:
+yy98:
++YYCURSOR;
yych = *YYCURSOR;
switch (yych) {
case '*':
case '-':
case '.':
+ case '/':
case '0':
case '1':
case '2':
@@ -1269,39 +1669,40 @@ int scan(scanner_state *s, scanner_token *token) {
case 'w':
case 'x':
case 'y':
- case 'z': goto yy20;
+ case 'z': goto yy22;
case 'S':
- case 's': goto yy69;
- default: goto yy71;
+ case 's': goto yy98;
+ default: goto yy100;
}
-yy71:
+yy100:
#line 80 "/home/weyrick/workspace/efind/src/scanner.re"
{
token->tokType = TOKEN_SIZEQUAL;
token->opt = 'c';
return 0;
}
-#line 1285 "/home/weyrick/workspace/efind/src/scanner.c"
-yy72:
+#line 1685 "/home/weyrick/workspace/efind/src/scanner.c"
+yy101:
yych = *++YYCURSOR;
switch (yych) {
case 'Z':
- case 'z': goto yy73;
- default: goto yy21;
+ case 'z': goto yy102;
+ default: goto yy23;
}
-yy73:
+yy102:
yych = *++YYCURSOR;
switch (yych) {
case 'E':
- case 'e': goto yy74;
- default: goto yy21;
+ case 'e': goto yy103;
+ default: goto yy23;
}
-yy74:
+yy103:
++YYCURSOR;
switch ((yych = *YYCURSOR)) {
case '*':
case '-':
case '.':
+ case '/':
case '0':
case '1':
case '2':
@@ -1365,36 +1766,37 @@ int scan(scanner_state *s, scanner_token *token) {
case 'w':
case 'x':
case 'y':
- case 'z': goto yy20;
- default: goto yy75;
+ case 'z': goto yy22;
+ default: goto yy104;
}
-yy75:
+yy104:
#line 75 "/home/weyrick/workspace/efind/src/scanner.re"
{
token->tokType = TOKEN_SIZE;
return 0;
}
-#line 1378 "/home/weyrick/workspace/efind/src/scanner.c"
-yy76:
+#line 1779 "/home/weyrick/workspace/efind/src/scanner.c"
+yy105:
yych = *++YYCURSOR;
switch (yych) {
case 'M':
- case 'm': goto yy80;
- default: goto yy21;
+ case 'm': goto yy109;
+ default: goto yy23;
}
-yy77:
+yy106:
yych = *++YYCURSOR;
switch (yych) {
case 'T':
- case 't': goto yy78;
- default: goto yy21;
+ case 't': goto yy107;
+ default: goto yy23;
}
-yy78:
+yy107:
++YYCURSOR;
switch ((yych = *YYCURSOR)) {
case '*':
case '-':
case '.':
+ case '/':
case '0':
case '1':
case '2':
@@ -1458,30 +1860,31 @@ int scan(scanner_state *s, scanner_token *token) {
case 'w':
case 'x':
case 'y':
- case 'z': goto yy20;
- default: goto yy79;
+ case 'z': goto yy22;
+ default: goto yy108;
}
-yy79:
+yy108:
#line 70 "/home/weyrick/workspace/efind/src/scanner.re"
{
token->tokType = TOKEN_NOT;
return 0;
}
-#line 1471 "/home/weyrick/workspace/efind/src/scanner.c"
-yy80:
+#line 1873 "/home/weyrick/workspace/efind/src/scanner.c"
+yy109:
yych = *++YYCURSOR;
switch (yych) {
case 'E':
- case 'e': goto yy81;
- default: goto yy21;
+ case 'e': goto yy110;
+ default: goto yy23;
}
-yy81:
+yy110:
++YYCURSOR;
yych = *YYCURSOR;
switch (yych) {
case '*':
case '-':
case '.':
+ case '/':
case '0':
case '1':
case '2':
@@ -1543,31 +1946,33 @@ int scan(scanner_state *s, scanner_token *token) {
case 'w':
case 'x':
case 'y':
- case 'z': goto yy20;
+ case 'z': goto yy22;
case 'D':
- case 'd': goto yy81;
- default: goto yy83;
+ case 'd': goto yy110;
+ default: goto yy112;
}
-yy83:
+yy112:
#line 114 "/home/weyrick/workspace/efind/src/scanner.re"
{
token->tokType = TOKEN_NAMED;
+ token->opt = 0; // name
return 0;
}
-#line 1558 "/home/weyrick/workspace/efind/src/scanner.c"
-yy84:
+#line 1962 "/home/weyrick/workspace/efind/src/scanner.c"
+yy113:
yych = *++YYCURSOR;
switch (yych) {
case 'D':
- case 'd': goto yy85;
- default: goto yy21;
+ case 'd': goto yy114;
+ default: goto yy23;
}
-yy85:
+yy114:
++YYCURSOR;
switch ((yych = *YYCURSOR)) {
case '*':
case '-':
case '.':
+ case '/':
case '0':
case '1':
case '2':
@@ -1631,22 +2036,23 @@ int scan(scanner_state *s, scanner_token *token) {
case 'w':
case 'x':
case 'y':
- case 'z': goto yy20;
- default: goto yy86;
+ case 'z': goto yy22;
+ default: goto yy115;
}
-yy86:
+yy115:
#line 65 "/home/weyrick/workspace/efind/src/scanner.re"
{
token->tokType = TOKEN_AND;
return 0;
}
-#line 1644 "/home/weyrick/workspace/efind/src/scanner.c"
-yy87:
+#line 2049 "/home/weyrick/workspace/efind/src/scanner.c"
+yy116:
++YYCURSOR;
switch ((yych = *YYCURSOR)) {
case '*':
case '-':
case '.':
+ case '/':
case '0':
case '1':
case '2':
@@ -1710,51 +2116,52 @@ int scan(scanner_state *s, scanner_token *token) {
case 'w':
case 'x':
case 'y':
- case 'z': goto yy20;
- default: goto yy88;
+ case 'z': goto yy22;
+ default: goto yy117;
}
-yy88:
+yy117:
#line 60 "/home/weyrick/workspace/efind/src/scanner.re"
{
token->tokType = TOKEN_OR;
return 0;
}
-#line 1723 "/home/weyrick/workspace/efind/src/scanner.c"
-yy89:
+#line 2129 "/home/weyrick/workspace/efind/src/scanner.c"
+yy118:
yych = *++YYCURSOR;
switch (yych) {
case 'N':
- case 'n': goto yy90;
- default: goto yy21;
+ case 'n': goto yy119;
+ default: goto yy23;
}
-yy90:
+yy119:
yych = *++YYCURSOR;
switch (yych) {
case 'E':
- case 'e': goto yy91;
- default: goto yy21;
+ case 'e': goto yy120;
+ default: goto yy23;
}
-yy91:
+yy120:
yych = *++YYCURSOR;
switch (yych) {
case 'D':
- case 'd': goto yy92;
+ case 'd': goto yy121;
case 'R':
- case 'r': goto yy93;
- default: goto yy21;
+ case 'r': goto yy122;
+ default: goto yy23;
}
-yy92:
+yy121:
yych = *(YYMARKER = ++YYCURSOR);
switch (yych) {
- case ' ': goto yy95;
- default: goto yy21;
+ case ' ': goto yy124;
+ default: goto yy23;
}
-yy93:
+yy122:
++YYCURSOR;
switch ((yych = *YYCURSOR)) {
case '*':
case '-':
case '.':
+ case '/':
case '0':
case '1':
case '2':
@@ -1818,36 +2225,36 @@ int scan(scanner_state *s, scanner_token *token) {
case 'w':
case 'x':
case 'y':
- case 'z': goto yy20;
- default: goto yy94;
+ case 'z': goto yy22;
+ default: goto yy123;
}
-yy94:
+yy123:
#line 104 "/home/weyrick/workspace/efind/src/scanner.re"
{
token->tokType = TOKEN_OWNEDBY;
return 0;
}
-#line 1831 "/home/weyrick/workspace/efind/src/scanner.c"
-yy95:
+#line 2238 "/home/weyrick/workspace/efind/src/scanner.c"
+yy124:
yych = *++YYCURSOR;
switch (yych) {
case 'B':
- case 'b': goto yy96;
- default: goto yy37;
+ case 'b': goto yy125;
+ default: goto yy66;
}
-yy96:
+yy125:
yych = *++YYCURSOR;
switch (yych) {
case 'Y':
- case 'y': goto yy97;
- default: goto yy37;
+ case 'y': goto yy126;
+ default: goto yy66;
}
-yy97:
+yy126:
++YYCURSOR;
yych = *YYCURSOR;
- goto yy94;
+ goto yy123;
}
-#line 140 "/home/weyrick/workspace/efind/src/scanner.re"
+#line 159 "/home/weyrick/workspace/efind/src/scanner.re"
}
View
21 src/scanner.re
@@ -53,7 +53,7 @@ int scan(scanner_state *s, scanner_token *token) {
re2c:yyfill:enable = 0;
SPACE = [\r\n\t ]+;
- WORD = [-a-zA-Z0-9_*?.]+;
+ WORD = [-a-zA-Z0-9_*?./]+;
INT = [0-9]+;
ANY = [^];
@@ -113,6 +113,25 @@ int scan(scanner_state *s, scanner_token *token) {
'name''d'* {
token->tokType = TOKEN_NAMED;
+ token->opt = 0; // name
+ return 0;
+ }
+
+ 'iname''d'* {
+ token->tokType = TOKEN_NAMED;
+ token->opt = 1; // iname
+ return 0;
+ }
+
+ 'wholename''d'* {
+ token->tokType = TOKEN_NAMED;
+ token->opt = 2; // wholename
+ return 0;
+ }
+
+ 'iwholename''d'* {
+ token->tokType = TOKEN_NAMED;
+ token->opt = 3; // iwholename
return 0;
}
View
6 test/test1.c
@@ -58,6 +58,12 @@ test testList[] = {
{"named *bar*", "-name *bar*"},
{"named bar??foo", "-name bar??foo"},
{"name foo*", "-name foo*"},
+ {"inamed bar??foo", "-iname bar??foo"},
+ {"iname foo*", "-iname foo*"},
+ {"wholenamed bar??foo", "-wholename bar??foo"},
+ {"wholename foo/bar*", "-wholename foo/bar*"},
+ {"iwholenamed bar??foo", "-iwholename bar??foo"},
+ {"iwholename foo*", "-iwholename foo*"},
//
{0,0}
};

0 comments on commit d28a260

Please sign in to comment.
Something went wrong with that request. Please try again.