1 /********************* */
2 /*! \file bounded_token_factory.h
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
12 ** \brief An ANTLR3 bounded token factory.
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).
20 #include "cvc4parser_private.h"
22 #ifndef CVC4__PARSER__BOUNDED_TOKEN_FACTORY_H
23 #define CVC4__PARSER__BOUNDED_TOKEN_FACTORY_H
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.
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
42 BoundedTokenFactoryNew(pANTLR3_INPUT_STREAM input
,ANTLR3_UINT32 size
);
48 }/* CVC4::parser namespace */
51 #endif /* CVC4__PARSER__BOUNDED_TOKEN_FACTORY_H */