summaryrefslogtreecommitdiff
path: root/src/parser/bounded_token_factory.h
blob: c447700daaa85d04e3a8fa9828026116c43b7335 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*********************                                                        */
/*! \file bounded_token_factory.h
 ** \verbatim
 ** Original author: Christopher L. Conway
 ** Major contributors: Morgan Deters
 ** Minor contributors (to current version): none
 ** This file is part of the CVC4 project.
 ** Copyright (c) 2009-2013  New York University and The University of Iowa
 ** See the file COPYING in the top-level source directory for licensing
 ** information.\endverbatim
 **
 ** \brief An ANTLR3 bounded token factory.
 **
 ** An ANTLR3 bounded token factory. The factory has a fixed number of
 ** tokens that are re-used as parsing proceeds. Only use this factory
 ** if you *know* that the number of active tokens will be bounded
 ** (e.g., if you're using a bounded token stream).
 **/

#include "cvc4parser_private.h"

#ifndef __CVC4__PARSER__BOUNDED_TOKEN_FACTORY_H
#define __CVC4__PARSER__BOUNDED_TOKEN_FACTORY_H

namespace CVC4 {
namespace parser {

#ifdef __cplusplus
extern "C" {
#endif

/** Create a token factory with a pool of exactly <code>size</code> tokens,
 * attached to the input stream <code>input</code>. <code>size</code> must be
 * greater than the maximum lookahead in the parser, or tokens will be prematurely re-used.
 *
 * We abuse <code>pANTLR3_TOKEN_FACTORY</code> fields for our own purposes:
 * <code>pANTLR3_COMMON_TOKEN    *pools</code>: a pointer to a single-element array, a single pool of tokens
 * <code>ANTLR3_INT32       thisPool</code>: the size of the pool
 * <code>ANTLR3_UINT32      nextToken</code>: the index of the next token to be returned
 * */
pANTLR3_TOKEN_FACTORY
BoundedTokenFactoryNew(pANTLR3_INPUT_STREAM input,ANTLR3_UINT32 size);

#ifdef __cplusplus
}/* extern "C" */
#endif

}/* CVC4::parser namespace */
}/* CVC4 namespace */

#endif /* __CVC4__PARSER__BOUNDED_TOKEN_FACTORY_H */
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback