1 |
tim |
770 |
#ifndef INC_CharBuffer_hpp__ |
2 |
|
|
#define INC_CharBuffer_hpp__ |
3 |
|
|
|
4 |
|
|
/* ANTLR Translator Generator |
5 |
|
|
* Project led by Terence Parr at http://www.jGuru.com |
6 |
|
|
* Software rights: http://www.antlr.org/license.html |
7 |
|
|
* |
8 |
gezelter |
1442 |
* $Id$ |
9 |
tim |
770 |
*/ |
10 |
|
|
|
11 |
|
|
#include <istream> |
12 |
|
|
|
13 |
|
|
#include <antlr/config.hpp> |
14 |
|
|
#include <antlr/InputBuffer.hpp> |
15 |
|
|
|
16 |
|
|
#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE |
17 |
|
|
namespace antlr { |
18 |
|
|
#endif |
19 |
|
|
|
20 |
|
|
/**A Stream of characters fed to the lexer from a InputStream that can |
21 |
|
|
* be rewound via mark()/rewind() methods. |
22 |
|
|
* <p> |
23 |
|
|
* A dynamic array is used to buffer up all the input characters. Normally, |
24 |
|
|
* "k" characters are stored in the buffer. More characters may be stored |
25 |
|
|
* during guess mode (testing syntactic predicate), or when LT(i>k) is |
26 |
|
|
* referenced. |
27 |
|
|
* Consumption of characters is deferred. In other words, reading the next |
28 |
|
|
* character is not done by consume(), but deferred until needed by LA or LT. |
29 |
|
|
* <p> |
30 |
|
|
* |
31 |
|
|
* @see antlr.CharQueue |
32 |
|
|
*/ |
33 |
|
|
|
34 |
|
|
class ANTLR_API CharBuffer : public InputBuffer { |
35 |
|
|
public: |
36 |
|
|
/// Create a character buffer |
37 |
|
|
CharBuffer( ANTLR_USE_NAMESPACE(std)istream& input ); |
38 |
|
|
/// Get the next character from the stream |
39 |
|
|
int getChar(); |
40 |
|
|
|
41 |
|
|
protected: |
42 |
|
|
// character source |
43 |
|
|
ANTLR_USE_NAMESPACE(std)istream& input; |
44 |
|
|
|
45 |
|
|
private: |
46 |
|
|
// NOTE: Unimplemented |
47 |
|
|
CharBuffer(const CharBuffer& other); |
48 |
|
|
CharBuffer& operator=(const CharBuffer& other); |
49 |
|
|
}; |
50 |
|
|
|
51 |
|
|
#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE |
52 |
|
|
} |
53 |
|
|
#endif |
54 |
|
|
|
55 |
|
|
#endif //INC_CharBuffer_hpp__ |