diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-04-25 15:57:30 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-04-25 15:57:30 -0300 |
commit | 37ff352e833ae3a543acb07b2bee56fee7bd1491 (patch) | |
tree | 8ca4cf55cd6c8ea0beab6b1bd5dc9ca1116efe34 /lpprint.c | |
parent | 0476d60007ec6693fd9643f6c92aa3adb9fde8d7 (diff) | |
download | lpeg-37ff352e833ae3a543acb07b2bee56fee7bd1491.tar.gz lpeg-37ff352e833ae3a543acb07b2bee56fee7bd1491.tar.bz2 lpeg-37ff352e833ae3a543acb07b2bee56fee7bd1491.zip |
Fixing several bugs left in previous commit
Diffstat (limited to 'lpprint.c')
-rw-r--r-- | lpprint.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -23,7 +23,7 @@ void printcharset (const byte *st) { | |||
23 | printf("["); | 23 | printf("["); |
24 | for (i = 0; i <= UCHAR_MAX; i++) { | 24 | for (i = 0; i <= UCHAR_MAX; i++) { |
25 | int first = i; | 25 | int first = i; |
26 | while (testchar(st, i) && i <= UCHAR_MAX) i++; | 26 | while (i <= UCHAR_MAX && testchar(st, i)) i++; |
27 | if (i - 1 == first) /* unary range? */ | 27 | if (i - 1 == first) /* unary range? */ |
28 | printf("(%02x)", first); | 28 | printf("(%02x)", first); |
29 | else if (i - 1 > first) /* non-empty range? */ | 29 | else if (i - 1 > first) /* non-empty range? */ |
@@ -36,8 +36,9 @@ void printcharset (const byte *st) { | |||
36 | static void printIcharset (const Instruction *inst, const byte *buff) { | 36 | static void printIcharset (const Instruction *inst, const byte *buff) { |
37 | byte cs[CHARSETSIZE]; | 37 | byte cs[CHARSETSIZE]; |
38 | int i; | 38 | int i; |
39 | printf("(%02x-%d) ", inst->i.aux2.set.offset, inst->i.aux2.set.size); | ||
39 | loopset(j, cs[j] = 0); | 40 | loopset(j, cs[j] = 0); |
40 | for (i = 0; i < CHARSETSIZE << 3; i++) { | 41 | for (i = 0; i < CHARSETSIZE * 8; i++) { |
41 | if (charinset(inst, buff, i)) | 42 | if (charinset(inst, buff, i)) |
42 | setchar(cs, i); | 43 | setchar(cs, i); |
43 | } | 44 | } |