aboutsummaryrefslogtreecommitdiff
path: root/lpcset.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2023-04-27 10:32:39 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2023-04-27 10:32:39 -0300
commit012cf9c86cf91cb8354e229bde335592d41b84b2 (patch)
tree353f17797b1952eaec231c8e4fd5c21e02daf875 /lpcset.h
parent3403b0c7256435560b63f828da92026c5d4c898b (diff)
downloadlpeg-012cf9c86cf91cb8354e229bde335592d41b84b2.tar.gz
lpeg-012cf9c86cf91cb8354e229bde335592d41b84b2.tar.bz2
lpeg-012cf9c86cf91cb8354e229bde335592d41b84b2.zip
Compact charsets used in trees, too.
Diffstat (limited to 'lpcset.h')
-rw-r--r--lpcset.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/lpcset.h b/lpcset.h
index e5152c4..b69fef9 100644
--- a/lpcset.h
+++ b/lpcset.h
@@ -4,22 +4,27 @@
4 4
5#include "lpcset.h" 5#include "lpcset.h"
6#include "lpcode.h" 6#include "lpcode.h"
7#include "lptree.h"
7 8
8 9
9/* 10/*
10** Extra information for the result of 'charsettype'. When result is 11** Extra information for the result of 'charsettype'. When result is
11** IChar, 'aux1' is the character. When result is ISet, 'aux1' is the 12** IChar, 'offset' is the character. When result is ISet, 'cs' is the
12** offset (in bytes), 'size' is the size (in bytes), and 13** supporting bit array (with offset included), 'offset' is the offset
13** 'delt' is the default value for bytes outside the set. 14** (in bytes), 'size' is the size (in bytes), and 'delt' is the default
15** value for bytes outside the set.
14*/ 16*/
15typedef struct { 17typedef struct {
16 int aux1; 18 const byte *cs;
19 int offset;
17 int size; 20 int size;
18 int deflt; 21 int deflt;
19} charsetinfo; 22} charsetinfo;
20 23
21 24
25int tocharset (TTree *tree, Charset *cs);
22Opcode charsettype (const byte *cs, charsetinfo *info); 26Opcode charsettype (const byte *cs, charsetinfo *info);
23byte getbytefromcharset (const byte *cs, const charsetinfo *info, int index); 27byte getbytefromcharset (const charsetinfo *info, int index);
28void tree2cset (TTree *tree, charsetinfo *info);
24 29
25#endif 30#endif