Vcsn  2.0
Be Rational
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
context-parser.hh
Go to the documentation of this file.
1 #ifndef VCSN_DYN_CONTEXT_PARSER_HH
2 # define VCSN_DYN_CONTEXT_PARSER_HH
3 
4 # include <sstream>
5 # include <string>
6 
8 # include <vcsn/dyn/type-ast.hh>
9 # include <vcsn/misc/set.hh>
10 # include <vcsn/misc/stream.hh>
11 
12 namespace vcsn
13 {
14  namespace ast
15  {
17  {
18  public:
19  context_parser(std::istringstream& is)
20  : is_(is)
21  {}
22 
24  std::shared_ptr<ast_node> parse();
25 
27  std::shared_ptr<ast_node> parse_context();
28 
29  private:
31  std::shared_ptr<ast_node> any_();
32 
35  std::string word_();
36 
38  std::shared_ptr<const genset> genset_();
39  std::shared_ptr<const genset> genset_(const std::string& letter_type);
40 
42  std::shared_ptr<context> context_();
43  std::shared_ptr<context> context_(const std::string& word);
45  std::shared_ptr<context> context_(const std::shared_ptr<ast_node>& ls);
46 
48  std::shared_ptr<ast_node> labelset_();
49  std::shared_ptr<ast_node> labelset_(const std::string& kind);
50 
52  std::shared_ptr<ast_node> weightset_();
53  std::shared_ptr<ast_node> weightset_(const std::string& ws);
54 
56  std::shared_ptr<automaton> automaton_(std::string prefix);
57  std::shared_ptr<tupleset> tupleset_();
58 
60  std::shared_ptr<ratexpset> ratexpset_();
61  std::shared_ptr<ratexpset> ratexpset_series_(); // No optional parameter
62 
64  std::shared_ptr<polynomialset> polynomialset_();
65 
67  std::shared_ptr<ast_node> labelset_or_weightset_();
68  std::shared_ptr<ast_node> labelset_or_weightset_(const std::string& kind);
70  std::istringstream& is_;
71 
73  std::set<std::string> weightsets_
74  =
75  {
76  "b",
77  "f2",
78  "q",
79  "qmp",
80  "r",
81  "rmin",
82  "z",
83  "zmin",
84  };
85 
87  std::set<std::string> labelsets_
88  =
89  {
90  "lal_char",
91  "lan",
92  "lan_char",
93  "lao",
94  "law_char",
95  "letterset",
96  "wordset",
97  };
98  };
99  }
100 }
101 
102 #endif // !VCSN_DYN_CONTEXT_PARSER_HH
context_parser(std::istringstream &is)
std::shared_ptr< const genset > genset_()
A generator set (e.g., "char(abc)" or "char").
std::string word_()
Return the next word in the stream.
std::shared_ptr< tupleset > tupleset_()
std::shared_ptr< automaton > automaton_(std::string prefix)
"\<" "\>".
std::shared_ptr< ast_node > any_()
Accept anything.
std::shared_ptr< ast_node > weightset_()
.
std::shared_ptr< ratexpset > ratexpset_series_()
std::set< std::string > weightsets_
The set of terminal weightset names.
std::shared_ptr< ast_node > labelset_or_weightset_()
|
std::shared_ptr< ast_node > parse()
Accept anything.
std::set< std::string > labelsets_
The set of weightset names.
std::shared_ptr< context > context_()
, .
std::istringstream is
The input stream: the specification to translate.
Definition: translate.cc:329
std::shared_ptr< ratexpset > ratexpset_()
"ratexpset" "\<" "\>".
std::istringstream & is_
The stream we are parsing.
std::shared_ptr< polynomialset > polynomialset_()
"polynomialset" "\<" "\>".
std::shared_ptr< ast_node > parse_context()
Accept only a valid context.
std::shared_ptr< ast_node > labelset_()
.
auto prefix(const Aut &aut) -> decltype(::vcsn::copy(aut))
Definition: prefix.hh:72