Add support for str.from_code (#3829)
[cvc5.git] / src / parser / bounded_token_factory.h
1 /********************* */
2 /*! \file bounded_token_factory.h
3 ** \verbatim
4 ** Top contributors (to current version):
5 ** Christopher L. Conway, Morgan Deters
6 ** This file is part of the CVC4 project.
7 ** Copyright (c) 2009-2019 by the authors listed in the file AUTHORS
8 ** in the top-level source directory) and their institutional affiliations.
9 ** All rights reserved. See the file COPYING in the top-level source
10 ** directory for licensing information.\endverbatim
11 **
12 ** \brief An ANTLR3 bounded token factory.
13 **
14 ** An ANTLR3 bounded token factory. The factory has a fixed number of
15 ** tokens that are re-used as parsing proceeds. Only use this factory
16 ** if you *know* that the number of active tokens will be bounded
17 ** (e.g., if you're using a bounded token stream).
18 **/
19
20 #include "cvc4parser_private.h"
21
22 #ifndef CVC4__PARSER__BOUNDED_TOKEN_FACTORY_H
23 #define CVC4__PARSER__BOUNDED_TOKEN_FACTORY_H
24
25 namespace CVC4 {
26 namespace parser {
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 /** Create a token factory with a pool of exactly <code>size</code> tokens,
33 * attached to the input stream <code>input</code>. <code>size</code> must be
34 * greater than the maximum lookahead in the parser, or tokens will be prematurely re-used.
35 *
36 * We abuse <code>pANTLR3_TOKEN_FACTORY</code> fields for our own purposes:
37 * <code>pANTLR3_COMMON_TOKEN *pools</code>: a pointer to a single-element array, a single pool of tokens
38 * <code>ANTLR3_INT32 thisPool</code>: the size of the pool
39 * <code>ANTLR3_UINT32 nextToken</code>: the index of the next token to be returned
40 * */
41 pANTLR3_TOKEN_FACTORY
42 BoundedTokenFactoryNew(pANTLR3_INPUT_STREAM input,ANTLR3_UINT32 size);
43
44 #ifdef __cplusplus
45 }/* extern "C" */
46 #endif
47
48 }/* CVC4::parser namespace */
49 }/* CVC4 namespace */
50
51 #endif /* CVC4__PARSER__BOUNDED_TOKEN_FACTORY_H */