1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*
** $Id: lptree.h,v 1.2 2013/03/24 13:51:12 roberto Exp $
*/
/* number of siblings for each tree */
static const byte numsiblings = ;
/*
** Types of trees (stored in tree->tag)
*/
typedef enum TTag TTag;
/*
* Trees
* The first sibling of a tree (if there is one) is immediately after
* the tree. A reference to a second sibling (ps) is its position
* relative to the position of the tree itself.
*
* The original lpeg implementation stated: "A key in ktable uses the
* (unique) address of the original tree that created that entry. NULL
* means no data." Now, a ktable key is merely a positive integer.
* But perhaps the original comment will help explain some odd bit of
* code that remains from lpeg.
*
*/
typedef struct TTree_type TTree;
/*
* A pattern constructed by the compiler has a tree and a ktable. (The
* ktable is a symbol table, and a tree node that references a string
* holds an index into the ktable.)
*
* When a pattern is compiled, the code array is created. A compiled
* pattern consists of its code and ktable. These are written when a
* compiled pattern is saved to a file, and restored when loaded.
*
* A compiled pattern restored from a file has no tree.
*/
typedef struct Pattern_type Pattern;
/* number of siblings for each tree */
/* extern const byte numsiblings[]; */
/* access to siblings */