3 #include <boost/algorithm/string/predicate.hpp> 39 for (
size_t t = 0; t < n; ++t)
75 std::ostringstream er;
78 if (!!getenv(
"YYDEBUG"))
79 std::cerr <<
"ERROR: " << er.str() << std::endl;
92 if (
const char* cp = getenv(
"YYDEBUG"))
95 auto s = std::istringstream{cp};
113 static int nesting = 0;
114 p.set_debug_level(level && nesting < level);
131 std::istringstream is{s};
134 "unexpected trailing characters in: ", s,
": ", is);
137 catch (
const std::exception& e)
152 if (boost::algorithm::contains(s,
","))
162 const class_t& c,
bool accept =
true)
176 catch (
const std::exception& e)
187 std::istringstream is{s};
190 "unexpected trailing characters in: ", s,
": ", is);
193 catch (
const std::exception& e)
std::vector< dyn::context > tape_ctx_
The context for each tape. If single-tape, [0] is ctx_.
label read_label(const context &ctx, std::istream &is, const std::string &format="default")
Read a label from a stream.
automaton project(const automaton &aut, unsigned tape)
Keep a single tape from a multiple-tape automaton.
ATTRIBUTE_NORETURN void invalid(const location &l, const std::string &s)
The string s is invalid at l.
dyn::context context() const
Get the current context.
expression to_expression(const automaton &aut, identities ids={}, const std::string &algo="auto")
An expression denoting the language of aut.
context make_context(const std::string &name)
Build a context from its name.
std::vector< unsigned > tapes_
The stack of tape numbers.
void tape_inc(const location &l)
Increment the top most tape.
void error(const location &l, const std::string &m)
Report an error m at l.
dyn::expression result_
The parsed expression.
void tape_pop()
Pop the tape stack.
location location_
The inital location.
dyn::context ctx_
The context used to read the expression.
dyn::weight make_weight(const location &loc, const std::string &s)
From a string, generate a weight.
std::string errors
The error messages.
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.
dyn::label make_label(const location &loc, const std::string &s, const dyn::context &ctx)
From a string, generate a label.
An expressionset can implement several different sets of identities on expressions.
dyn::expression parse(std::istream &is, const location &l=location{})
Parse this stream.
dyn::expression make_atom(const location &loc, const std::string &s)
From a string, generate an expression.
Template-less root for contexts.
void print_caret(std::istream &is, std::ostream &os, const rat::location &loc)
Repeat a line with an error, underlining the error with carets.
void tape_push()
Push a new tape number on the stack.
Container::value_type front(const Container &container)
The first member of this Container.
static dyn::context ctx(const driver &d)
Get the context of the driver.
static int debug_level()
The nesting limit for parser traces, as specified per $YYDEBUG.
rat::identities identities() const
Get the identities.
std::unique_ptr< yyFlexLexer > scanner_
The scanner.
value_impl< detail::expression_tag > expression
Define the vcsn::rat::parser class.
static identities ids(const driver &d)
Get the identities of the driver.
driver(const dyn::context &ctx, rat::identities ids)
void require(Bool b, Args &&... args)
If b is not verified, raise an error with args as message.
rat::identities ids_
The identities to apply.
Syntax errors thrown from user actions.
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.