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)
static dyn::context ctx(const driver &d)
Get the context of the driver.
void tape_push()
Push a new tape number on the stack.
static int debug_level()
Debug level set in the user's environment.
static int debug_level_()
The nesting limit for parser traces, as specified per $YYDEBUG.
Container::value_type front(const Container &container)
The first member of this Container.
static identities ids(const driver &d)
Get the identities of the driver.
expression to_expression(const automaton &aut, identities ids={}, const std::string &algo="auto")
An expression denoting the language of aut.
label read_label(const context &ctx, std::istream &is, const std::string &format="default")
Read a label from a stream.
std::set< std::pair< std::string, std::string >> class_t
A set of label ranges.
void tape_inc(const location &l)
Increment the top most tape.
virtual int parse()
Parse.
Syntax errors thrown from user actions.
void require(Bool b, Args &&...args)
If b is not verified, raise an error with args as message.
context make_context(const std::string &name)
Build a context from its name.
void invalid(const location &l, const std::string &s)
The string s is invalid at l.
dyn::weight make_weight(const location &loc, const std::string &s)
From a string, generate a weight.
std::string errors
The error messages.
dyn::expression make_atom(const location &loc, const std::string &s)
From a string, generate an expression.
automaton project(const automaton &aut, unsigned tape)
Keep a single tape from a multiple-tape automaton.
dyn::context context() const
Get the current context.
Template-less root for contexts.
rat::identities identities() const
Get the identities.
weight read_weight(const context &ctx, std::istream &is)
Read a weight from a stream.
std::size_t num_tapes(const context &ctx)
The number of input tapes.
rat::identities ids_
The identities to apply.
dyn::context ctx_
The context used to read the expression.
An expressionset can implement several different sets of identities on expressions.
dyn::label make_label(const location &loc, const std::string &s, const dyn::context &ctx)
From a string, generate a label.
void error(const location &l, const std::string &m)
Report an error m at l.
void set_debug_level(debug_level_type l)
Set the current debugging level.
driver(const dyn::context &ctx, rat::identities ids)
value_impl< detail::expression_tag > expression
std::vector< unsigned > tapes_
The stack of tape numbers.
std::vector< dyn::context > tape_ctx_
The context for each tape. If single-tape, [0] is ctx_.
dyn::expression make_expression(const location &loc, const class_t &c, bool accept)
From a label class, generate an expression.
void tape_pop()
Pop the tape stack.
dyn::expression parse(std::istream &is, const location &l=location{})
Parse this stream.
Define the vcsn::rat::parser class.