diff options
author | Christopher L. Conway <christopherleeconway@gmail.com> | 2010-03-31 19:53:41 +0000 |
---|---|---|
committer | Christopher L. Conway <christopherleeconway@gmail.com> | 2010-03-31 19:53:41 +0000 |
commit | 57bb8dbac522bef0061cc5209dd5d6b66fa86b6a (patch) | |
tree | 76a684b2b2af7ff4ac0d7fdac82b102e3b9e6f19 /src/parser/cvc/cvc_input.h | |
parent | 0feb76aa01664745642035262b5fe27fb520fbcf (diff) |
Code cleanup in parser
Diffstat (limited to 'src/parser/cvc/cvc_input.h')
-rw-r--r-- | src/parser/cvc/cvc_input.h | 47 |
1 files changed, 41 insertions, 6 deletions
diff --git a/src/parser/cvc/cvc_input.h b/src/parser/cvc/cvc_input.h index 659123401..a6117b4a9 100644 --- a/src/parser/cvc/cvc_input.h +++ b/src/parser/cvc/cvc_input.h @@ -23,22 +23,57 @@ class ExprManager; namespace parser { class CvcInput : public AntlrInput { + /** The ANTLR3 CVC lexer for the input. */ + pCvcLexer d_pCvcLexer; + + /** The ANTLR3 CVC parser for the input. */ + pCvcParser d_pCvcParser; + public: + + /** Create a file input. + * + * @param exprManager the manager to use when building expressions from the input + * @param filename the path of the file to read + * @param useMmap <code>true</code> if the input should use memory-mapped + * I/O; otherwise, the input will use the standard ANTLR3 I/O implementation. + */ CvcInput(ExprManager* exprManager, const std::string& filename, bool useMmap); - CvcInput(ExprManager* exprManager, const std::string& input, const std::string& name); + + /** Create a string input. + * + * @param exprManager the manager to use when building expressions from the input + * @param input the string to read + * @param name the "filename" to use when reporting errors + */ + CvcInput(ExprManager* exprManager, const std::string& input, + const std::string& name); + + /* Destructor. Frees the lexer and the parser. */ ~CvcInput(); protected: + + /** Parse a command from the input. Returns <code>NULL</code> if there is + * no command there to parse. + * + * @throws ParserException if an error is encountered during parsing. + */ Command* doParseCommand() throw(ParserException); + + /** Parse an expression from the input. Returns a null <code>Expr</code> + * if there is no expression there to parse. + * + * @throws ParserException if an error is encountered during parsing. + */ Expr doParseExpr() throw(ParserException); - pANTLR3_LEXER getLexer(); - pANTLR3_LEXER createLexer(pANTLR3_INPUT_STREAM input); - pANTLR3_PARSER createParser(pANTLR3_COMMON_TOKEN_STREAM tokenStream); private: + + /** Initialize the class. Called from the constructors once the input stream + * is initialized. */ void init(); - pCvcLexer d_pCvcLexer; - pCvcParser d_pCvcParser; + }; // class CvcInput } // namespace parser |