Mercurial > hg > aboriginal
annotate sources/patches/musl-regex.patch @ 1711:60043af4120e draft
Make binutils install the extra things elf2flt needs in a less silly place.
author | Rob Landley <rob@landley.net> |
---|---|
date | Mon, 24 Nov 2014 14:45:21 -0600 |
parents | 5a7071eb01bb |
children | 9b4251fda364 |
rev | line source |
---|---|
1692
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
1 Make \| work in normal regexes. (Toybox grep uses this.) |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
2 |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
3 diff --git a/src/regex/regcomp.c b/src/regex/regcomp.c |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
4 index d907627..3a89305 100644 |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
5 --- a/src/regex/regcomp.c |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
6 +++ b/src/regex/regcomp.c |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
7 @@ -1008,9 +1008,11 @@ tre_parse(tre_parse_ctx_t *ctx) |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
8 tre_char_t c; |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
9 if (!*ctx->re) |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
10 break; |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
11 - c = *ctx->re; |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
12 + c = *ctx->re; |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
13 if (ctx->cflags & REG_EXTENDED && c == CHAR_PIPE) |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
14 break; |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
15 + else if (c == CHAR_BACKSLASH && ctx->re[1] == CHAR_PIPE) |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
16 + break; |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
17 if ((ctx->cflags & REG_EXTENDED |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
18 && c == CHAR_RPAREN && depth > 0) |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
19 || (!(ctx->cflags & REG_EXTENDED) |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
20 @@ -1047,23 +1049,16 @@ tre_parse(tre_parse_ctx_t *ctx) |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
21 } |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
22 |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
23 case PARSE_UNION: |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
24 - switch (*ctx->re) |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
25 - { |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
26 - case CHAR_PIPE: |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
27 + if (*ctx->re == CHAR_RPAREN) ctx->re++; |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
28 + else if (*ctx->re == CHAR_PIPE || |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
29 + (*ctx->re == CHAR_BACKSLASH && ctx->re[1] == CHAR_PIPE)) |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
30 + { |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
31 STACK_PUSHX(stack, int, PARSE_UNION); |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
32 STACK_PUSHX(stack, voidptr, result); |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
33 STACK_PUSHX(stack, int, PARSE_POST_UNION); |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
34 STACK_PUSHX(stack, int, PARSE_BRANCH); |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
35 - ctx->re++; |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
36 - break; |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
37 - |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
38 - case CHAR_RPAREN: |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
39 - ctx->re++; |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
40 - break; |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
41 - |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
42 - default: |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
43 - break; |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
44 - } |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
45 + ctx->re += 1+(*ctx->re == CHAR_BACKSLASH); |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
46 + } |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
47 break; |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
48 |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
49 case PARSE_POST_UNION: |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
50 @@ -1181,6 +1176,8 @@ tre_parse(tre_parse_ctx_t *ctx) |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
51 { |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
52 goto empty_atom; |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
53 } |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
54 + if (!(ctx->cflags & REG_EXTENDED) && ctx->re[1] == CHAR_PIPE) |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
55 + goto empty_atom; |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
56 |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
57 /* If a macro is used, parse the expanded macro recursively. */ |
5a7071eb01bb
Musl regex patch for \| support needed by toybox grep when more than one pattern specified.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
58 { |