diff options
Diffstat (limited to 'lptree.h')
-rw-r--r-- | lptree.h | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -18,6 +18,9 @@ typedef enum TTag { | |||
18 | TAny, | 18 | TAny, |
19 | TTrue, | 19 | TTrue, |
20 | TFalse, | 20 | TFalse, |
21 | TUTFR, /* range of UTF-8 codepoints; 'n' has initial codepoint; | ||
22 | 'cap' has length; 'key' has first byte; | ||
23 | extra info is similar for end codepoint */ | ||
21 | TRep, /* 'sib1'* */ | 24 | TRep, /* 'sib1'* */ |
22 | TSeq, /* 'sib1' 'sib2' */ | 25 | TSeq, /* 'sib1' 'sib2' */ |
23 | TChoice, /* 'sib1' / 'sib2' */ | 26 | TChoice, /* 'sib1' / 'sib2' */ |
@@ -26,8 +29,9 @@ typedef enum TTag { | |||
26 | TCall, /* ktable[key] is rule's key; 'sib2' is rule being called */ | 29 | TCall, /* ktable[key] is rule's key; 'sib2' is rule being called */ |
27 | TOpenCall, /* ktable[key] is rule's key */ | 30 | TOpenCall, /* ktable[key] is rule's key */ |
28 | TRule, /* ktable[key] is rule's key (but key == 0 for unused rules); | 31 | TRule, /* ktable[key] is rule's key (but key == 0 for unused rules); |
29 | 'sib1' is rule's pattern; | 32 | 'sib1' is rule's pattern pre-rule; 'sib2' is next rule; |
30 | 'sib2' is next rule; 'cap' is rule's sequential number */ | 33 | extra info 'n' is rule's sequential number */ |
34 | TXInfo, /* extra info */ | ||
31 | TGrammar, /* 'sib1' is initial (and first) rule */ | 35 | TGrammar, /* 'sib1' is initial (and first) rule */ |
32 | TBehind, /* 'sib1' is pattern, 'n' is how much to go back */ | 36 | TBehind, /* 'sib1' is pattern, 'n' is how much to go back */ |
33 | TCapture, /* captures: 'cap' is kind of capture (enum 'CapKind'); | 37 | TCapture, /* captures: 'cap' is kind of capture (enum 'CapKind'); |
@@ -36,6 +40,7 @@ typedef enum TTag { | |||
36 | TRunTime, /* run-time capture: 'key' is Lua function; | 40 | TRunTime, /* run-time capture: 'key' is Lua function; |
37 | 'sib1' is capture body */ | 41 | 'sib1' is capture body */ |
38 | TThrow, /* labeled failure: ktable[key] is label's name */ | 42 | TThrow, /* labeled failure: ktable[key] is label's name */ |
43 | |||
39 | } TTag; | 44 | } TTag; |
40 | 45 | ||
41 | 46 | ||
@@ -50,8 +55,8 @@ typedef struct TTree { | |||
50 | byte cap; /* kind of capture (if it is a capture) */ | 55 | byte cap; /* kind of capture (if it is a capture) */ |
51 | unsigned short key; /* key in ktable for Lua data (0 if no key) */ | 56 | unsigned short key; /* key in ktable for Lua data (0 if no key) */ |
52 | union { | 57 | union { |
53 | int n; /* occasional counter */ | ||
54 | int ps; /* occasional second child */ | 58 | int ps; /* occasional second child */ |
59 | int n; /* occasional counter */ | ||
55 | } u; | 60 | } u; |
56 | } TTree; | 61 | } TTree; |
57 | 62 | ||