16 #define TK_NameSep 197
18 #define TK_PlusPlus 212
19 #define TK_MinusMinus 213
20 #define TK_ArrowStar 214
21 #define TK_DotStar 215
22 #define TK_ShiftLeft 216
23 #define TK_ShiftRight 217
24 #define TK_IntegerDecimal 218
25 #define TK_IntegerOctal 219
26 #define TK_IntegerHex 220
27 #define TK_EqualsEquals 223
28 #define TK_NotEquals 224
31 #define TK_MultAssign 227
32 #define TK_DivAssign 228
33 #define TK_PercentAssign 229
34 #define TK_PlusAssign 230
35 #define TK_MinusAssign 231
36 #define TK_AmpAssign 232
37 #define TK_CaretAssign 233
38 #define TK_BarAssign 234
39 #define TK_DotDotDot 240
41 /* A growable buffer for collecting headers. */
44 Buffer() : data(0), allocated(0), length(0) { }
45 Buffer( const Buffer
&other
) {
46 data
= (char*)malloc( other
.allocated
);
47 memcpy( data
, other
.data
, other
.length
);
48 allocated
= other
.allocated
;
49 length
= other
.length
;
51 ~Buffer() { empty(); }
53 void append( char p
) {
54 if ( ++length
> allocated
)
55 upAllocate( length
*2 );
58 void append( char *str
, int len
) {
59 if ( (length
+= len
) > allocated
)
60 upAllocate( length
*2 );
61 memcpy( data
+length
-len
, str
, len
);
64 void clear() { length
= 0; }
65 void upAllocate( int len
);
76 Scanner( std::ostream
&out
)
88 void pass(char c
) { nonTokBuf
.append(c
); }
89 void buf(char c
) { tokBuf
.append(c
); }
94 // Initialize the machine. Invokes any init statement blocks. Returns 0
95 // if the machine begins in a non-accepting state and 1 if the machine
96 // begins in an accepting state.
99 // Execute the machine on a block of data. Returns -1 if after processing
100 // the data, the machine is in the error state and can never accept, 0 if
101 // the machine is in a non-accepting state and 1 if the machine is in an
103 int execute( const char *data
, int len
);
105 // Indicate that there is no more data. Returns -1 if the machine finishes
106 // in the error state and does not accept, 0 if the machine finishes
107 // in any other non-accepting state and 1 if the machine finishes in an