1 /********************* */
2 /*! \file smt1_input.cpp
4 ** Top contributors (to current version):
5 ** Christopher L. Conway, Morgan Deters, Tim King
6 ** This file is part of the CVC4 project.
7 ** Copyright (c) 2009-2017 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 [[ Add file-specific comments here ]].
14 ** [[ Add file-specific comments here ]]
17 // These headers must be the first two included.
18 // See the documentation in "parser/antlr_undefines.h" for more details.
20 #include "parser/antlr_undefines.h"
22 #include "parser/smt1/smt1_input.h"
24 #include "expr/expr_manager.h"
25 #include "parser/input.h"
26 #include "parser/parser.h"
27 #include "parser/parser_exception.h"
28 #include "parser/smt1/Smt1Lexer.h"
29 #include "parser/smt1/Smt1Parser.h"
35 Smt1Input::Smt1Input(AntlrInputStream
& inputStream
) :
36 AntlrInput(inputStream
, 2) {
37 pANTLR3_INPUT_STREAM input
= inputStream
.getAntlr3InputStream();
38 assert( input
!= NULL
);
40 d_pSmt1Lexer
= Smt1LexerNew(input
);
41 if( d_pSmt1Lexer
== NULL
) {
42 throw ParserException("Failed to create SMT lexer.");
45 setAntlr3Lexer( d_pSmt1Lexer
->pLexer
);
47 pANTLR3_COMMON_TOKEN_STREAM tokenStream
= getTokenStream();
48 assert( tokenStream
!= NULL
);
50 d_pSmt1Parser
= Smt1ParserNew(tokenStream
);
51 if( d_pSmt1Parser
== NULL
) {
52 throw ParserException("Failed to create SMT parser.");
55 setAntlr3Parser(d_pSmt1Parser
->pParser
);
59 Smt1Input::~Smt1Input() {
60 d_pSmt1Lexer
->free(d_pSmt1Lexer
);
61 d_pSmt1Parser
->free(d_pSmt1Parser
);
64 Command
* Smt1Input::parseCommand() {
65 return d_pSmt1Parser
->parseCommand(d_pSmt1Parser
);
68 Expr
Smt1Input::parseExpr() {
69 return d_pSmt1Parser
->parseExpr(d_pSmt1Parser
);
72 }/* CVC4::parser namespace */