2
This software may only be used by you under license from AT&T Corp.
3
("AT&T"). A copy of AT&T's Source Code Agreement is available at
4
AT&T's Internet website having the URL:
5
<http://www.research.att.com/sw/tools/graphviz/license/source.html>
6
If you received this software without first entering into a license
7
with AT&T, you have an infringing copy of this software and cannot use
8
it without violating AT&T's intellectual property rights.
12
/* File - TrieFA.ins.c
14
* This file contains code to be included in the scanner file using a
15
* generated trie-based FA.
21
static long CharMask[28] = {
22
0x0000001, 0x0000000, 0x0000004, 0x0000008,
23
0x0000010, 0x0000020, 0x0000040, 0x0000080,
24
0x0000100, 0x0000200, 0x0000400, 0x0000800,
25
0x0001000, 0x0002000, 0x0004000, 0x0008000,
26
0x0010000, 0x0020000, 0x0040000, 0x0080000,
27
0x0100000, 0x0200000, 0x0400000, 0x0800000,
28
0x1000000, 0x2000000, 0x4000000, 0x8000000,
31
#define IN_MASK_RANGE(C) (islower(C) || ((C) == '_'))
32
#define MASK_INDEX(C) ((C) - '_')
35
static long CharMask[26] = {
36
0x0000001, 0x0000002, 0x0000004, 0x0000008,
37
0x0000010, 0x0000020, 0x0000040, 0x0000080,
38
0x0000100, 0x0000200, 0x0000400, 0x0000800,
39
0x0001000, 0x0002000, 0x0004000, 0x0008000,
40
0x0010000, 0x0020000, 0x0040000, 0x0080000,
41
0x0100000, 0x0200000, 0x0400000, 0x0800000,
45
#define IN_MASK_RANGE(C) islower(C)
46
#define MASK_INDEX(C) ((C) - 'a')
50
static short TFA_State;
54
* Initialize the trie FA.
56
#define TFA_Init() TFA_State = 0
60
* Advance to the next state (or -1) on the lowercase letter c. This should be an
61
* inline routine, but the C++ implementation isn't advanced enough so we use a macro.
63
#define TFA_Advance(C) { \
65
if (TFA_State >= 0) { \
68
else if (! IN_MASK_RANGE(c)) { \
72
if (TrieStateTbl[TFA_State].mask & CharMask[MASK_INDEX(c)]) { \
73
short i = TrieStateTbl[TFA_State].trans_base; \
74
while (TrieTransTbl[i].c != c) \
76
TFA_State = TrieTransTbl[i].next_state; \
82
} /* end of TFA_Advance. */
86
* Return the definition (if any) associated with the current state.
88
#define TFA_Definition() \
89
((TFA_State < 0) ? -1 : TrieStateTbl[TFA_State].def)