diff options
Diffstat (limited to 'lpvm.h')
-rw-r--r-- | lpvm.h | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -8,14 +8,14 @@ | |||
8 | /* Virtual Machine's instructions */ | 8 | /* Virtual Machine's instructions */ |
9 | typedef enum Opcode { | 9 | typedef enum Opcode { |
10 | IAny, /* if no char, fail */ | 10 | IAny, /* if no char, fail */ |
11 | IChar, /* if char != aux, fail */ | 11 | IChar, /* if char != aux1, fail */ |
12 | ISet, /* if char not in buff, fail */ | 12 | ISet, /* if char not in buff, fail */ |
13 | ITestAny, /* in no char, jump to 'offset' */ | 13 | ITestAny, /* in no char, jump to 'offset' */ |
14 | ITestChar, /* if char != aux, jump to 'offset' */ | 14 | ITestChar, /* if char != aux1, jump to 'offset' */ |
15 | ITestSet, /* if char not in buff, jump to 'offset' */ | 15 | ITestSet, /* if char not in buff, jump to 'offset' */ |
16 | ISpan, /* read a span of chars in buff */ | 16 | ISpan, /* read a span of chars in buff */ |
17 | IUTFR, /* if codepoint not in range [offset, utf_to], fail */ | 17 | IUTFR, /* if codepoint not in range [offset, utf_to], fail */ |
18 | IBehind, /* walk back 'aux' characters (fail if not possible) */ | 18 | IBehind, /* walk back 'aux1' characters (fail if not possible) */ |
19 | IRet, /* return from a rule */ | 19 | IRet, /* return from a rule */ |
20 | IEnd, /* end of pattern */ | 20 | IEnd, /* end of pattern */ |
21 | IChoice, /* stack a choice; next fail will jump to 'offset' */ | 21 | IChoice, /* stack a choice; next fail will jump to 'offset' */ |
@@ -40,8 +40,10 @@ typedef enum Opcode { | |||
40 | typedef union Instruction { | 40 | typedef union Instruction { |
41 | struct Inst { | 41 | struct Inst { |
42 | byte code; | 42 | byte code; |
43 | byte aux; | 43 | byte aux1; |
44 | short key; | 44 | union { |
45 | short key; | ||
46 | } aux2; | ||
45 | } i; | 47 | } i; |
46 | int offset; | 48 | int offset; |
47 | byte buff[1]; | 49 | byte buff[1]; |
@@ -49,7 +51,7 @@ typedef union Instruction { | |||
49 | 51 | ||
50 | 52 | ||
51 | /* extract 24-bit value from an instruction */ | 53 | /* extract 24-bit value from an instruction */ |
52 | #define utf_to(inst) (((inst)->i.key << 8) | (inst)->i.aux) | 54 | #define utf_to(inst) (((inst)->i.aux2.key << 8) | (inst)->i.aux1) |
53 | 55 | ||
54 | 56 | ||
55 | void printpatt (Instruction *p, int n); | 57 | void printpatt (Instruction *p, int n); |