LOOS  v2.3.2
Parser.hpp
1 /*
2  This file is part of LOOS.
3 
4  LOOS (Lightweight Object-Oriented Structure library)
5  Copyright (c) 2008, Tod D. Romo, Alan Grossfield
6  Department of Biochemistry and Biophysics
7  School of Medicine & Dentistry, University of Rochester
8 
9  This package (LOOS) is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation under version 3 of the License.
12 
13  This package is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
22 
23 
24 
25 #if !defined(LOOS_PARSER_HPP)
26 #define LOOS_PARSER_HPP
27 
28 #include <iostream>
29 #include <sstream>
30 #include <stdexcept>
31 
32 #include <AtomicGroup.hpp>
33 #include <Kernel.hpp>
34 #include <ParserDriver.hpp>
35 
36 
37 namespace loos {
38 
39 
41 
89  class Parser {
90  Kernel krnl;
91  ParserDriver driver;
92 
93  public:
94  explicit Parser(const std::string& s) : driver(s, krnl) { } // This auto-parses the string...
95  Parser() : driver(krnl) { }
96 
98  void parse(const std::string& s) {krnl.clearActions(); driver.parse(s); }
99 
101  Kernel& kernel(void) { return(krnl); }
102  };
103 
104 
105 
106 }
107 
108 #endif
109 
Kernel & kernel(void)
Return a ref to the compiled (hopefully) Kernel.
Definition: Parser.hpp:101
void parse(const std::string &s)
Parse the given command string after clearing the action stack.
Definition: Parser.hpp:98
void parse(const std::string &s)
Parse the passed string...
Front-end to the Bison/Flex parser.
Definition: Parser.hpp:89
Namespace for most things not already encapsulated within a class.
The Kernel (virtual machine) for compiling and executing user-defined atom selections.
Definition: Kernel.hpp:42