3 #include <boost/algorithm/string/predicate.hpp>
37 for (
size_t t = 0; t < n; ++t)
73 std::ostringstream er;
75 if (!!getenv(
"YYDEBUG"))
76 std::cerr << er.str() << std::endl;
82 error(l,
"invalid input: " + s);
91 if (
const char* cp = getenv(
"YYDEBUG"))
94 std::istringstream s{cp};
104 scanner_->scan_open_(
is);
112 static int nesting = 0;
117 scanner_->scan_close_();
120 return std::move(result_);
129 std::istringstream
is{s};
132 "unexpected trailing characters in: ", s,
": ",
is);
135 catch (
const std::exception& e)
150 if (boost::algorithm::contains(s,
","))
160 const class_t& c,
bool accept =
true)
174 catch (
const std::exception& e)
185 std::istringstream
is{s};
188 "unexpected trailing characters in: ", s,
": ",
is);
191 catch (
const std::exception& e)
weight read_weight(const context &ctx, std::istream &is)
Read a weight from a stream.
std::set< std::pair< std::string, std::string >> class_t
A set of label ranges.
void set_debug_level(debug_level_type l)
Set the current debugging level.
dyn::context ctx_
The context used to read the expression.
rat::identities ids_
The identities to apply.
std::shared_ptr< const detail::weight_base > weight
An expressionset can implement several different sets of identities on expressions.
std::size_t num_tapes(const context &ctx)
The number of input tapes.
dyn::expression make_atom(const location &loc, const std::string &s)
From a string, generate an expression.
void require(Bool b, Args &&...args)
If b is not verified, raise an error with args as message.
rat::identities identities() const
Get the identities.
virtual int parse()
Parse.
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.
dyn::expression parse(std::istream &is, const location &l=location{})
Parse this stream.
dyn::label make_label(const location &loc, const std::string &s, const dyn::context &ctx)
From a string, generate a label.
dyn::expression make_expression(const location &loc, const class_t &c, bool accept)
From a label class, generate an expression.
std::shared_ptr< const detail::label_base > label
driver(const dyn::context &ctx, rat::identities ids)
std::shared_ptr< const detail::context_base > context
A dyn::context.
void tape_pop()
Pop the tape stack.
automaton project(const automaton &aut, unsigned tape)
Keep a single tape from a multiple-tape automaton.
static int debug_level_()
The nesting limit for parser traces, as specified per $YYDEBUG.
void tape_inc(const location &l)
Increment the top most tape.
void tape_push()
Push a new tape number on the stack.
expression to_expression(const automaton &aut, rat::identities ids={}, const std::string &algo="auto")
An expression denoting the language of aut.
Define the vcsn::rat::parser class.
std::istringstream is
The input stream: the specification to translate.
context make_context(const std::string &name)
Build a context from its name.
dyn::weight make_weight(const location &loc, const std::string &s)
From a string, generate a weight.
std::vector< dyn::context > tape_ctx_
The context for each tape. If single-tape, [0] is ctx_.
static dyn::context ctx(const driver &d)
Get the context of the driver.
Container::value_type front(const Container &container)
The first member of this Container.
static int debug_level()
Debug level set in the user's environment.
std::shared_ptr< detail::expression_base > expression
void invalid(const location &l, const std::string &s)
The string s is invalid at l.
static identities ids(const driver &d)
Get the identities of the driver.
Syntax errors thrown from user actions.
dyn::context context() const
Get the current context.
label read_label(const context &ctx, std::istream &is, const std::string &format="default")
Read a label from a stream.