Very minor tidy to pcre2grep, plus fix typos in comments.

This commit is contained in:
Philip.Hazel 2016-12-29 16:29:05 +00:00
parent 664cc446bb
commit 25dbe146bd
3 changed files with 43 additions and 40 deletions

View File

@ -269,6 +269,9 @@ characters to match (for example, /[\s[:^ascii:]]/).
40. The callout_error modifier has been added to pcre2test to make it possible 40. The callout_error modifier has been added to pcre2test to make it possible
to return PCRE2_ERROR_CALLOUT from a callout. to return PCRE2_ERROR_CALLOUT from a callout.
41. A minor change to pcre2grep: colour reset is now "<esc>[0m" instead of
"<esc>[00m".
Version 10.22 29-July-2016 Version 10.22 29-July-2016
-------------------------- --------------------------

View File

@ -693,7 +693,7 @@ print_match(const char* buf, int length)
{ {
if (do_colour) fprintf(stdout, "%c[%sm", 0x1b, colour_string); if (do_colour) fprintf(stdout, "%c[%sm", 0x1b, colour_string);
FWRITE(buf, 1, length, stdout); FWRITE(buf, 1, length, stdout);
if (do_colour) fprintf(stdout, "%c[00m", 0x1b); if (do_colour) fprintf(stdout, "%c[0m", 0x1b);
} }
/* End of Unix-style or native z/OS environment functions. */ /* End of Unix-style or native z/OS environment functions. */
@ -1686,7 +1686,7 @@ while (length > 0)
} }
else if (*string == '{') else if (*string == '{')
{ {
/* Must be a decimal number in parenthesis, e.g: (5) or (38) */ /* Must be a decimal number in braces, e.g: {5} or {38} */
string++; string++;
length--; length--;
@ -1708,7 +1708,7 @@ while (length > 0)
} }
while (*string >= '0' && *string <= '9'); while (*string >= '0' && *string <= '9');
/* Syntax error: close paren is missing. */ /* Syntax error: closing brace is missing. */
if (*string != '}') return 0; if (*string != '}') return 0;
} }

74
testdata/grepoutput vendored
View File

@ -456,8 +456,8 @@ over the lazy dog.
This time it jumps and jumps and jumps. This time it jumps and jumps and jumps.
RC=0 RC=0
---------------------------- Test 52 ------------------------------ ---------------------------- Test 52 ------------------------------
fox jumps fox jumps
This time it jumps and jumps and jumps. This time it jumps and jumps and jumps.
RC=0 RC=0
---------------------------- Test 53 ------------------------------ ---------------------------- Test 53 ------------------------------
36972,6 36972,6
@ -474,9 +474,9 @@ RC=0
597:32,4 597:32,4
RC=0 RC=0
---------------------------- Test 55 ----------------------------- ---------------------------- Test 55 -----------------------------
Here is the pattern again. Here is the pattern again.
That time it was on a line by itself. That time it was on a line by itself.
This line contains pattern not on a line by itself. This line contains pattern not on a line by itself.
RC=0 RC=0
---------------------------- Test 56 ----------------------------- ---------------------------- Test 56 -----------------------------
./testdata/grepinput:456 ./testdata/grepinput:456
@ -588,52 +588,52 @@ RC=0
---------------------------- Test 70 ----------------------------- ---------------------------- Test 70 -----------------------------
triple: t1_txt s1_tag s_txt p_tag p_txt o_tag o_txt triple: t1_txt s1_tag s_txt p_tag p_txt o_tag o_txt
triple: t3_txt s2_tag s_txt p_tag p_txt o_tag o_txt triple: t3_txt s2_tag s_txt p_tag p_txt o_tag o_txt
triple: t4_txt s1_tag s_txt p_tag p_txt o_tag o_txt triple: t4_txt s1_tag s_txt p_tag p_txt o_tag o_txt
triple: t6_txt s2_tag s_txt p_tag p_txt o_tag o_txt triple: t6_txt s2_tag s_txt p_tag p_txt o_tag o_txt
RC=0 RC=0
---------------------------- Test 71 ----------------------------- ---------------------------- Test 71 -----------------------------
01 01
RC=0 RC=0
---------------------------- Test 72 ----------------------------- ---------------------------- Test 72 -----------------------------
010203040506 010203040506
RC=0 RC=0
---------------------------- Test 73 ----------------------------- ---------------------------- Test 73 -----------------------------
01 01
RC=0 RC=0
---------------------------- Test 74 ----------------------------- ---------------------------- Test 74 -----------------------------
01 01
02 02
RC=0 RC=0
---------------------------- Test 75 ----------------------------- ---------------------------- Test 75 -----------------------------
010203040506 010203040506
RC=0 RC=0
---------------------------- Test 76 ----------------------------- ---------------------------- Test 76 -----------------------------
01 01
02 02
RC=0 RC=0
---------------------------- Test 77 ----------------------------- ---------------------------- Test 77 -----------------------------
01 01
03 03
RC=0 RC=0
---------------------------- Test 78 ----------------------------- ---------------------------- Test 78 -----------------------------
010203040506 010203040506
RC=0 RC=0
---------------------------- Test 79 ----------------------------- ---------------------------- Test 79 -----------------------------
01 01
03 03
RC=0 RC=0
---------------------------- Test 80 ----------------------------- ---------------------------- Test 80 -----------------------------
01 01
RC=0 RC=0
---------------------------- Test 81 ----------------------------- ---------------------------- Test 81 -----------------------------
010203040506 010203040506
RC=0 RC=0
---------------------------- Test 82 ----------------------------- ---------------------------- Test 82 -----------------------------
01 01
RC=0 RC=0
---------------------------- Test 83 ----------------------------- ---------------------------- Test 83 -----------------------------
pcre2grep: line 4 of file ./testdata/grepinput3 is too long for the internal buffer pcre2grep: line 4 of file ./testdata/grepinput3 is too long for the internal buffer
@ -702,9 +702,9 @@ RC=0
./testdata/grepinput:zerothe. ./testdata/grepinput:zerothe.
RC=0 RC=0
---------------------------- Test 101 ------------------------------ ---------------------------- Test 101 ------------------------------
./testdata/grepinput:.|zero|the|. ./testdata/grepinput:.|zero|the|.
./testdata/grepinput:zero|a ./testdata/grepinput:zero|a
./testdata/grepinput:.|zero|the|. ./testdata/grepinput:.|zero|the|.
RC=0 RC=0
---------------------------- Test 102 ----------------------------- ---------------------------- Test 102 -----------------------------
2: 2:
@ -725,21 +725,21 @@ RC=0
14: 14:
RC=0 RC=0
---------------------------- Test 105 ----------------------------- ---------------------------- Test 105 -----------------------------
triple: t1_txt s1_tag s_txt p_tag p_txt o_tag o_txt triple: t1_txt s1_tag s_txt p_tag p_txt o_tag o_txt
 
triple: t2_txt s1_tag s_txt p_tag p_txt o_tag triple: t2_txt s1_tag s_txt p_tag p_txt o_tag
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
 
triple: t3_txt s2_tag s_txt p_tag p_txt o_tag o_txt triple: t3_txt s2_tag s_txt p_tag p_txt o_tag o_txt
 
triple: t4_txt s1_tag s_txt p_tag p_txt o_tag o_txt triple: t4_txt s1_tag s_txt p_tag p_txt o_tag o_txt
 
triple: t5_txt s1_tag s_txt p_tag p_txt o_tag triple: t5_txt s1_tag s_txt p_tag p_txt o_tag
o_txt o_txt
 
triple: t6_txt s2_tag s_txt p_tag p_txt o_tag o_txt triple: t6_txt s2_tag s_txt p_tag p_txt o_tag o_txt
 
triple: t7_txt s1_tag s_txt p_tag p_txt o_tag o_txt triple: t7_txt s1_tag s_txt p_tag p_txt o_tag o_txt
RC=0 RC=0
---------------------------- Test 106 ----------------------------- ---------------------------- Test 106 -----------------------------
a a