3 #include <boost/algorithm/string/predicate.hpp>
38 for (
size_t t = 0; t < n; ++t)
74 std::ostringstream er;
76 if (!!getenv(
"YYDEBUG"))
77 std::cerr << er.str() << std::endl;
83 error(l,
"invalid input: " + s);
92 if (
const char* cp = getenv(
"YYDEBUG"))
95 std::istringstream s{cp};
105 scanner_->scan_open_(is);
113 static int nesting = 0;
118 scanner_->scan_close_();
121 return std::move(result_);
130 std::istringstream is{s};
133 "unexpected trailing characters in: ", s,
": ", is);
136 catch (
const std::exception& e)
151 if (boost::algorithm::contains(s,
","))
161 const class_t& c,
bool accept =
true)
175 catch (
const std::exception& e)
186 std::istringstream is{s};
189 "unexpected trailing characters in: ", s,
": ", is);
192 catch (
const std::exception& e)
context make_context(const std::string &name)
Build a context from its name.
std::size_t num_tapes(const context &ctx)
The number of input tapes.
dyn::label make_label(const location &loc, const std::string &s, const dyn::context &ctx)
From a string, generate a label.
dyn::context context() const
Get the current context.
driver(const dyn::context &ctx, rat::identities ids)
static int debug_level_()
The nesting limit for parser traces, as specified per $YYDEBUG.
void tape_push()
Push a new tape number on the stack.
void set_debug_level(debug_level_type l)
Set the current debugging level.
void require(Bool b, Args &&...args)
If b is not verified, raise an error with args as message.
virtual int parse()
Parse.
static int debug_level()
Debug level set in the user's environment.
rat::identities ids_
The identities to apply.
std::vector< dyn::context > tape_ctx_
The context for each tape. If single-tape, [0] is ctx_.
expression to_expression(const automaton &aut, identities ids={}, const std::string &algo="auto")
An expression denoting the language of aut.
Template-less root for contexts.
Syntax errors thrown from user actions.
std::string errors
The error messages.
std::vector< unsigned > tapes_
The stack of tape numbers.
void error(const location &l, const std::string &m)
Report an error m at l.
void invalid(const location &l, const std::string &s)
The string s is invalid at l.
dyn::expression parse(std::istream &is, const location &l=location{})
Parse this stream.
An expressionset can implement several different sets of identities on expressions.
std::set< std::pair< std::string, std::string >> class_t
A set of label ranges.
dyn::expression make_expression(const location &loc, const class_t &c, bool accept)
From a label class, generate an expression.
automaton project(const automaton &aut, unsigned tape)
Keep a single tape from a multiple-tape automaton.
void tape_pop()
Pop the tape stack.
dyn::context ctx_
The context used to read the expression.
void tape_inc(const location &l)
Increment the top most tape.
weight read_weight(const context &ctx, std::istream &is)
Read a weight from a stream.
static identities ids(const driver &d)
Get the identities of the driver.
label read_label(const context &ctx, std::istream &is, const std::string &format="default")
Read a label from a stream.
dyn::expression make_atom(const location &loc, const std::string &s)
From a string, generate an expression.
value_impl< detail::expression_tag > expression
Container::value_type front(const Container &container)
The first member of this Container.
Define the vcsn::rat::parser class.
rat::identities identities() const
Get the identities.
dyn::weight make_weight(const location &loc, const std::string &s)
From a string, generate a weight.
static dyn::context ctx(const driver &d)
Get the context of the driver.