1 /********************* */
2 /*! \file bounded_token_buffer.h
4 ** Original author: cconway
5 ** Major contributors: none
6 ** Minor contributors (to current version): mdeters
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
14 ** \brief An ANTLR3 bounded token stream.
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
23 #ifndef __CVC4__PARSER__BOUNDED_TOKEN_BUFFER_H
24 #define __CVC4__PARSER__BOUNDED_TOKEN_BUFFER_H
26 #include <antlr3defs.h>
36 /** A "super" structure for COMMON_TOKEN_STREAM. */
37 typedef struct BOUNDED_TOKEN_BUFFER_struct
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
;
47 BoundedTokenBufferSourceNew(ANTLR3_UINT32 k
, pANTLR3_TOKEN_SOURCE source
);
50 BoundedTokenBufferFree(pBOUNDED_TOKEN_BUFFER buffer
);
56 }/* CVC4::parser namespace */
59 #endif /* __CVC4__PARSER__BOUNDED_TOKEN_BUFFER_H */