blob: be2420cad6d054ad81e4acb9b8b5a0543c2b036d (
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
/********************* */
/*! \file smt1_input.cpp
** \verbatim
** Original author: Morgan Deters
** Major contributors: Christopher L. Conway
** 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 [[ Add file-specific comments here ]].
**
** [[ Add file-specific comments here ]]
**/
#include <antlr3.h>
#include "parser/smt1/smt1_input.h"
#include "expr/expr_manager.h"
#include "parser/input.h"
#include "parser/parser.h"
#include "parser/parser_exception.h"
#include "parser/smt1/generated/Smt1Lexer.h"
#include "parser/smt1/generated/Smt1Parser.h"
namespace CVC4 {
namespace parser {
/* Use lookahead=2 */
Smt1Input::Smt1Input(AntlrInputStream& inputStream) :
AntlrInput(inputStream, 2) {
pANTLR3_INPUT_STREAM input = inputStream.getAntlr3InputStream();
assert( input != NULL );
d_pSmt1Lexer = Smt1LexerNew(input);
if( d_pSmt1Lexer == NULL ) {
throw ParserException("Failed to create SMT lexer.");
}
setAntlr3Lexer( d_pSmt1Lexer->pLexer );
pANTLR3_COMMON_TOKEN_STREAM tokenStream = getTokenStream();
assert( tokenStream != NULL );
d_pSmt1Parser = Smt1ParserNew(tokenStream);
if( d_pSmt1Parser == NULL ) {
throw ParserException("Failed to create SMT parser.");
}
setAntlr3Parser(d_pSmt1Parser->pParser);
}
Smt1Input::~Smt1Input() {
d_pSmt1Lexer->free(d_pSmt1Lexer);
d_pSmt1Parser->free(d_pSmt1Parser);
}
Command* Smt1Input::parseCommand() {
return d_pSmt1Parser->parseCommand(d_pSmt1Parser);
}
Expr Smt1Input::parseExpr() {
return d_pSmt1Parser->parseExpr(d_pSmt1Parser);
}
}/* CVC4::parser namespace */
}/* CVC4 namespace */
|