diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-04-27 10:32:39 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-04-27 10:32:39 -0300 |
commit | 012cf9c86cf91cb8354e229bde335592d41b84b2 (patch) | |
tree | 353f17797b1952eaec231c8e4fd5c21e02daf875 /lpprint.c | |
parent | 3403b0c7256435560b63f828da92026c5d4c898b (diff) | |
download | lpeg-012cf9c86cf91cb8354e229bde335592d41b84b2.tar.gz lpeg-012cf9c86cf91cb8354e229bde335592d41b84b2.tar.bz2 lpeg-012cf9c86cf91cb8354e229bde335592d41b84b2.zip |
Compact charsets used in trees, too.
Diffstat (limited to 'lpprint.c')
-rw-r--r-- | lpprint.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -46,6 +46,17 @@ static void printIcharset (const Instruction *inst, const byte *buff) { | |||
46 | } | 46 | } |
47 | 47 | ||
48 | 48 | ||
49 | static void printTcharset (TTree *tree) { | ||
50 | byte cs[CHARSETSIZE]; | ||
51 | int i; | ||
52 | printf("(%02x-%d) ", tree->u.set.offset, tree->u.set.size); | ||
53 | loopset(j, cs[j] = tree->u.set.deflt); | ||
54 | for (i = 0; i < tree->u.set.size; i++) | ||
55 | cs[tree->u.set.offset + i] = treebuffer(tree)[i]; | ||
56 | printcharset(cs); | ||
57 | } | ||
58 | |||
59 | |||
49 | static const char *capkind (int kind) { | 60 | static const char *capkind (int kind) { |
50 | const char *const modes[] = { | 61 | const char *const modes[] = { |
51 | "close", "position", "constant", "backref", | 62 | "close", "position", "constant", "backref", |
@@ -186,7 +197,7 @@ void printtree (TTree *tree, int ident) { | |||
186 | break; | 197 | break; |
187 | } | 198 | } |
188 | case TSet: { | 199 | case TSet: { |
189 | printcharset(treebuffer(tree)); | 200 | printTcharset(tree); |
190 | printf("\n"); | 201 | printf("\n"); |
191 | break; | 202 | break; |
192 | } | 203 | } |