My Project
Loading...
Searching...
No Matches
ActionParser.hpp
1
/*
2
Copyright 2019 Equinor ASA.
3
4
This file is part of the Open Porous Media project (OPM).
5
6
OPM is free software: you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation, either version 3 of the License, or
9
(at your option) any later version.
10
11
OPM is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
15
16
You should have received a copy of the GNU General Public License
17
along with OPM. If not, see <http://www.gnu.org/licenses/>.
18
*/
19
20
#ifndef ACTION_PARSER_HPP
21
#define ACTION_PARSER_HPP
22
23
#include <opm/input/eclipse/Schedule/Action/ASTNode.hpp>
24
#include <opm/input/eclipse/Schedule/Action/ActionValue.hpp>
25
26
#include <string>
27
#include <vector>
28
29
namespace
Opm
{
namespace
Action {
30
31
struct
ParseNode
32
{
33
ParseNode
(TokenType type_arg,
const
std::string& value_arg)
34
: type (type_arg)
35
, value(value_arg)
36
{}
37
38
// Implicit converting constructor.
39
explicit
ParseNode
(TokenType type_arg)
40
:
ParseNode
(type_arg,
""
)
41
{}
42
43
TokenType type;
44
std::string value;
45
};
46
47
48
49
class
Parser
50
{
51
public
:
52
static
Action::ASTNode
parse(
const
std::vector<std::string>& tokens);
53
static
TokenType get_type(
const
std::string& arg);
54
static
FuncType get_func(
const
std::string& arg);
55
56
private
:
57
explicit
Parser
(
const
std::vector<std::string>& tokens);
58
59
ParseNode
current()
const
;
60
ParseNode
next();
61
size_t
pos()
const
;
62
Action::ASTNode
parse_cmp();
63
Action::ASTNode
parse_op();
64
Action::ASTNode
parse_left();
65
Action::ASTNode
parse_right();
66
Action::ASTNode
parse_and();
67
Action::ASTNode
parse_or();
68
69
const
std::vector<std::string>& tokens;
70
ssize_t current_pos = -1;
71
};
72
73
}}
// namespace Opm::Action
74
75
#endif
// ACTION_PARSER_HPP
Opm::Action::ASTNode
Definition
ASTNode.hpp:38
Opm::Action::Parser
Definition
ActionParser.hpp:50
Opm
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition
Exceptions.hpp:30
Opm::Action::ParseNode
Definition
ActionParser.hpp:32
opm
input
eclipse
Schedule
Action
ActionParser.hpp
Generated by
1.9.8