** Don't fear the files-changed list, almost all changes are in the **
[cvc5.git] / src / parser / bounded_token_buffer.h
1 /********************* */
2 /*! \file bounded_token_buffer.h
3 ** \verbatim
4 ** Original author: cconway
5 ** Major contributors: none
6 ** Minor contributors (to current version): none
7 ** This file is part of the CVC4 prototype.
8 ** Copyright (c) 2009, 2010 The Analysis of Computer Systems Group (ACSys)
9 ** Courant Institute of Mathematical Sciences
10 ** New York University
11 ** See the file COPYING in the top-level source directory for licensing
12 ** information.\endverbatim
13 **
14 ** \brief An ANTLR3 bounded token stream.
15 **
16 ** An ANTLR3 bounded token stream. The stream has a bounded
17 ** lookahead/behind k. Calling LT(i) with i > k or i < -k will raise
18 ** an exception. Only use this factory if you *know* that the grammar
19 ** has bounded lookahead (e.g., if you've set the k parameter in the
20 ** parser.
21 **/
22
23 #ifndef __CVC4__PARSER__BOUNDED_TOKEN_BUFFER_H
24 #define __CVC4__PARSER__BOUNDED_TOKEN_BUFFER_H
25
26 #include <antlr3defs.h>
27
28 namespace CVC4 {
29 namespace parser {
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35
36 /** A "super" structure for COMMON_TOKEN_STREAM. */
37 typedef struct BOUNDED_TOKEN_BUFFER_struct
38 {
39 pANTLR3_COMMON_TOKEN_STREAM commonTstream;
40 pANTLR3_COMMON_TOKEN* tokenBuffer;
41 // tokenNeg1, token1, token2;
42 ANTLR3_UINT32 currentIndex, maxIndex, k, bufferSize;
43 ANTLR3_BOOLEAN empty, done;
44 } BOUNDED_TOKEN_BUFFER, *pBOUNDED_TOKEN_BUFFER;
45
46 pBOUNDED_TOKEN_BUFFER
47 BoundedTokenBufferSourceNew(ANTLR3_UINT32 k, pANTLR3_TOKEN_SOURCE source);
48
49 void
50 BoundedTokenBufferFree(pBOUNDED_TOKEN_BUFFER buffer);
51
52 #ifdef __cplusplus
53 }
54 #endif
55
56 }
57 }
58
59
60 #endif /* __CVC4__PARSER__BOUNDED_TOKEN_BUFFER_H */
61