Vcsn  2.8
Be Rational
driver.hh
Go to the documentation of this file.
1 #pragma once
2 
3 #include <lib/vcsn/rat/fwd.hh>
4 #include <lib/vcsn/rat/parse.hh>
5 #include <vcsn/core/rat/fwd.hh>
7 #include <vcsn/dyn/context.hh>
8 #include <vcsn/dyn/value.hh>
9 #include <vcsn/misc/export.hh>
10 #include <vcsn/misc/location.hh>
11 
12 namespace vcsn
13 {
14  namespace rat
15  {
18  {
19  public:
21  ~driver();
22 
24  void context(const dyn::context& ctx);
25 
27  void context(const std::string& ctx);
28 
31  dyn::context context() const;
32 
35 
37  void tape_push();
38 
40  void tape_pop();
41 
43  void tape_inc(const location& l);
44 
46  dyn::expression parse(std::istream& is, const location& l = location{});
47 
49  void error(const location& l, const std::string& m);
51  ATTRIBUTE_NORETURN
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 
68  const class_t& c, bool accept);
69 
71  dyn::weight make_weight(const location& loc, const std::string& s);
72 
75  static int debug_level();
76 
77  private:
78  friend class parser;
79 
94  std::vector<unsigned> tapes_ = {0};
96  std::vector<dyn::context> tape_ctx_ = {};
97  };
98  }
99 }
expression make_expression(const context &ctx, const std::string &s, identities ids={}, const std::string &format="default")
Read an expression from a stream.
Definition: algos.hxx:71
#define LIBVCSN_API
Definition: export.hh:8
dyn::expression result_
The parsed expression.
Definition: driver.hh:87
location location_
The inital location.
Definition: driver.hh:81
dyn::context ctx_
The context used to read the expression.
Definition: driver.hh:83
std::string errors
The error messages.
Definition: driver.hh:55
Abstract a location.
Definition: location.hh:47
An expressionset can implement several different sets of identities on expressions.
Definition: identities.hh:20
label make_label(const context &ctx, const std::string &s, const std::string &format="default")
Build a label from a string.
Definition: algos.hxx:90
State and public interface for rational expression parsing.
Definition: driver.hh:17
A dyn Value/ValueSet.
Definition: fwd.hh:29
Template-less root for contexts.
Definition: context.hh:16
Definition: a-star.hh:8
weight make_weight(const context &ctx, const std::string &s)
Build a weight from a string.
Definition: algos.hxx:125
static dyn::context ctx(const driver &d)
Get the context of the driver.
Definition: parse.cc:84
std::unique_ptr< yyFlexLexer > scanner_
The scanner.
Definition: driver.hh:57
value_impl< detail::expression_tag > expression
Definition: fwd.hh:31
Define the vcsn::rat::parser class.
A Bison parser.
Definition: parse.hh:299
static identities ids(const driver &d)
Get the identities of the driver.
Definition: parse.cc:91
::vcsn::rat::identities identities
Sets of identities on expressions.
Definition: fwd.hh:17
static int debug_level()
Debug level set in the user&#39;s environment.
Definition: debug-level.hh:11
rat::identities ids_
The identities to apply.
Definition: driver.hh:85
std::set< std::pair< std::string, std::string > > class_t
A set of label ranges.
Definition: fwd.hh:12