Vcsn  2.3
Be Rational
driver.hh
Go to the documentation of this file.
1 #pragma once
2 
3 #include <vcsn/core/rat/fwd.hh>
4 #include <vcsn/dyn/context.hh>
5 #include <vcsn/dyn/value.hh>
7 #include <vcsn/misc/export.hh>
8 
9 #include <lib/vcsn/rat/fwd.hh>
10 #include <lib/vcsn/rat/parse.hh>
11 
12 namespace vcsn
13 {
14  namespace rat
15  {
16 
19  {
20  public:
22  ~driver();
23 
25  void context(const dyn::context& ctx);
26 
28  void context(const std::string& ctx);
29 
32  dyn::context context() const;
33 
36 
38  void tape_push();
39 
41  void tape_pop();
42 
44  void tape_inc(const location& l);
45 
47  dyn::expression parse(std::istream& is, const location& l = location{});
48 
50  void error(const location& l, const std::string& m);
52  void invalid(const location& l, const std::string& s);
53 
55  std::string errors;
57  std::unique_ptr<yyFlexLexer> scanner_;
58 
60  dyn::label make_label(const location& loc, const std::string& s,
61  const dyn::context& ctx);
62 
64  dyn::expression make_atom(const location& loc, const std::string& s);
65 
67  dyn::expression make_expression(const location& loc,
68  const class_t& c, bool accept);
69 
71  dyn::weight make_weight(const location& loc, const std::string& s);
72 
73  private:
74  friend class parser;
75 
90  std::vector<unsigned> tapes_ = {0};
92  std::vector<dyn::context> tape_ctx_ = {};
93  };
94  }
95 }
A Bison parser.
Definition: parse.hh:299
Abstract a location.
Definition: location.hh:47
Define the vcsn::rat::location class.
std::unique_ptr< yyFlexLexer > scanner_
The scanner.
Definition: driver.hh:57
A dyn Value/ValueSet.
Definition: fwd.hh:23
rat::identities ids_
The identities to apply.
Definition: driver.hh:81
Template-less root for contexts.
Definition: context.hh:16
std::string errors
The error messages.
Definition: driver.hh:55
Definition: a-star.hh:8
#define LIBVCSN_API
Definition: export.hh:8
An expressionset can implement several different sets of identities on expressions.
Definition: identities.hh:21
dyn::expression result_
The parsed expression.
Definition: driver.hh:83
std::set< std::pair< std::string, std::string >> class_t
A set of label ranges.
Definition: fwd.hh:12
State and public interface for rational expression parsing.
Definition: driver.hh:18
dyn::context ctx_
The context used to read the expression.
Definition: driver.hh:79
static identities ids(const driver &d)
Get the identities of the driver.
Definition: parse.cc:89
location location_
The inital location.
Definition: driver.hh:77
value_impl< detail::expression_tag > expression
Definition: fwd.hh:25
Define the vcsn::rat::parser class.
static dyn::context ctx(const driver &d)
Get the context of the driver.
Definition: parse.cc:82