]>
Commit | Line | Data |
---|---|---|
878ddf1f | 1 | // FILE: BufFileInput.h\r |
2 | // AUTHOR: Alexey Demakov (AVD) demakov@kazbek.ispras.ru\r | |
3 | // CREATION: 26-JAN-1998\r | |
4 | // DESCRIPTION: File Input Stream with lookahead for Scanner\r | |
5 | // Tested under Win32 with ANTLR 1.33 MR10 and MSVC 5.0\r | |
6 | \r | |
7 | // Change History:\r | |
8 | //\r | |
9 | // 28-May-1998 Add virtual destructor to release buffer\r | |
10 | // Manfred Kogler (km@cast.uni-linz.ac.at)\r | |
11 | // (1.33MR14)\r | |
12 | \r | |
13 | #ifndef BufFileInput_h\r | |
14 | #define BufFileInput_h\r | |
15 | \r | |
16 | #include "pcctscfg.h"\r | |
17 | \r | |
18 | #include "pccts_stdio.h"\r | |
19 | \r | |
20 | PCCTS_NAMESPACE_STD\r | |
21 | \r | |
22 | #include "DLexerBase.h"\r | |
23 | \r | |
24 | class DllExportPCCTS BufFileInput : public DLGInputStream\r | |
25 | {\r | |
26 | public:\r | |
27 | // constructor\r | |
28 | // f - input stream\r | |
29 | // buf_size - size of buffer (maximal length for string in is_in)\r | |
30 | \r | |
31 | BufFileInput(FILE *f, int buf_size = 8 );\r | |
32 | \r | |
33 | virtual ~BufFileInput();\r | |
34 | \r | |
35 | // gets next char from stream\r | |
36 | \r | |
37 | virtual int nextChar( void );\r | |
38 | \r | |
39 | // looks in stream and compares next l characters with s\r | |
40 | // returns the result of comparision\r | |
41 | \r | |
42 | int lookahead( char* s );\r | |
43 | \r | |
44 | private:\r | |
45 | FILE *input; // input stream;\r | |
46 | int* buf; // buffer\r | |
47 | int size; // size of buffer\r | |
48 | int start; // position of the first symbol in buffer\r | |
49 | int len; // count of characters in buffers\r | |
50 | };\r | |
51 | \r | |
52 | #endif\r | |
53 | // end of file BufFileInput.h\r |