Vcsn  2.2
Be Rational
vcsn::rat::driver Class Reference

State and public interface for rational expression parsing. More...

#include <driver.hh>

Collaboration diagram for vcsn::rat::driver:

Public Member Functions

 driver (const dyn::context &ctx, rat::identities ids)
 
 ~driver ()
 
void context (const dyn::context &ctx)
 Set the expressionset to use from this context. More...
 
void context (const std::string &ctx)
 Set the expressionset to use from its context name. More...
 
dyn::context context () const
 Get the current context. More...
 
rat::identities identities () const
 Get the identities. More...
 
void tape_push ()
 Push a new tape number on the stack. More...
 
void tape_pop ()
 Pop the tape stack. More...
 
void tape_inc (const location &l)
 Increment the top most tape. More...
 
dyn::expression parse (std::istream &is, const location &l=location{})
 Parse this stream. More...
 
void error (const location &l, const std::string &m)
 Report an error m at l. More...
 
void invalid (const location &l, const std::string &s)
 The string s is invalid at l. More...
 
dyn::label make_label (const location &loc, const std::string &s, const dyn::context &ctx)
 From a string, generate a label. More...
 
dyn::expression make_atom (const location &loc, const std::string &s)
 From a string, generate an expression. More...
 
dyn::expression make_expression (const location &loc, const class_t &c, bool accept)
 From a label class, generate an expression. More...
 
dyn::weight make_weight (const location &loc, const std::string &s)
 From a string, generate a weight. More...
 

Public Attributes

std::string errors
 The error messages. More...
 
std::unique_ptr< yyFlexLexerscanner_
 The scanner. More...
 

Private Attributes

location location_
 The inital location. More...
 
dyn::context ctx_
 The context used to read the expression. More...
 
rat::identities ids_
 The identities to apply. More...
 
dyn::expression result_
 The parsed expression. More...
 
std::vector< unsigned > tapes_ = {0}
 The stack of tape numbers. More...
 
std::vector< dyn::contexttape_ctx_ = {}
 The context for each tape. If single-tape, [0] is ctx_. More...
 

Friends

class parser
 

Detailed Description

State and public interface for rational expression parsing.

Definition at line 17 of file driver.hh.

Constructor & Destructor Documentation

vcsn::rat::driver::driver ( const dyn::context ctx,
rat::identities  ids 
)

Definition at line 16 of file driver.cc.

References context().

Here is the call graph for this function:

vcsn::rat::driver::~driver ( )

Definition at line 23 of file driver.cc.

Member Function Documentation

void vcsn::rat::driver::context ( const dyn::context ctx)

Set the expressionset to use from this context.

Definition at line 31 of file driver.cc.

References vcsn::rat::ctx(), ctx_, vcsn::dyn::num_tapes(), vcsn::dyn::project(), and tape_ctx_.

Referenced by vcsn::rat::ctx().

Here is the call graph for this function:

void vcsn::rat::driver::context ( const std::string &  ctx)

Set the expressionset to use from its context name.

Definition at line 43 of file driver.cc.

References context(), and vcsn::dyn::make_context().

Here is the call graph for this function:

dyn::context vcsn::rat::driver::context ( ) const

Get the current context.

Depends on the current tape.

Definition at line 26 of file driver.cc.

References tape_ctx_, and tapes_.

Referenced by context(), driver(), make_atom(), and make_expression().

void vcsn::rat::driver::error ( const location l,
const std::string &  m 
)

Report an error m at l.

Definition at line 71 of file driver.cc.

References errors.

Referenced by invalid().

rat::identities vcsn::rat::driver::identities ( ) const

Get the identities.

Definition at line 48 of file driver.cc.

References ids_.

Referenced by vcsn::rat::ids().

void vcsn::rat::driver::invalid ( const location l,
const std::string &  s 
)

The string s is invalid at l.

Definition at line 80 of file driver.cc.

References error().

Here is the call graph for this function:

dyn::expression vcsn::rat::driver::make_atom ( const location loc,
const std::string &  s 
)

From a string, generate an expression.

Definition at line 142 of file driver.cc.

References context(), ctx_, ids_, make_label(), and vcsn::dyn::to_expression().

Referenced by vcsn::rat::parser::parse().

Here is the call graph for this function:

dyn::expression vcsn::rat::driver::make_expression ( const location loc,
const class_t c,
bool  accept = true 
)

From a label class, generate an expression.

Definition at line 159 of file driver.cc.

References context(), ctx_, vcsn::detail::front(), ids_, and vcsn::dyn::to_expression().

Referenced by vcsn::rat::parser::parse().

Here is the call graph for this function:

dyn::label vcsn::rat::driver::make_label ( const location loc,
const std::string &  s,
const dyn::context ctx 
)

From a string, generate a label.

Definition at line 124 of file driver.cc.

References is, vcsn::dyn::read_label(), and vcsn::require().

Referenced by make_atom().

Here is the call graph for this function:

dyn::weight vcsn::rat::driver::make_weight ( const location loc,
const std::string &  s 
)

From a string, generate a weight.

Definition at line 181 of file driver.cc.

References ctx_, is, vcsn::dyn::read_weight(), and vcsn::require().

Referenced by vcsn::rat::parser::parse().

Here is the call graph for this function:

auto vcsn::rat::driver::parse ( std::istream &  is,
const location l = location{} 
)

Parse this stream.

Definition at line 101 of file driver.cc.

References vcsn::detail::debug_level(), vcsn::rat::debug_level_(), is, vcsn::rat::parser::parse(), and vcsn::rat::parser::set_debug_level().

Here is the call graph for this function:

void vcsn::rat::driver::tape_inc ( const location l)

Increment the top most tape.

Definition at line 63 of file driver.cc.

References tape_ctx_, and tapes_.

Referenced by vcsn::rat::parser::parse().

void vcsn::rat::driver::tape_pop ( )

Pop the tape stack.

Definition at line 58 of file driver.cc.

References tapes_.

Referenced by vcsn::rat::parser::parse().

void vcsn::rat::driver::tape_push ( )

Push a new tape number on the stack.

Definition at line 53 of file driver.cc.

References tapes_.

Referenced by vcsn::rat::parser::parse().

Friends And Related Function Documentation

friend class parser
friend

Definition at line 73 of file driver.hh.

Member Data Documentation

dyn::context vcsn::rat::driver::ctx_
private

The context used to read the expression.

Definition at line 78 of file driver.hh.

Referenced by context(), make_atom(), make_expression(), make_weight(), and vcsn::rat::parser::parse().

std::string vcsn::rat::driver::errors

The error messages.

Definition at line 54 of file driver.hh.

Referenced by error().

rat::identities vcsn::rat::driver::ids_
private

The identities to apply.

Definition at line 80 of file driver.hh.

Referenced by identities(), make_atom(), and make_expression().

location vcsn::rat::driver::location_
private

The inital location.

Definition at line 76 of file driver.hh.

Referenced by vcsn::rat::parser::parse().

dyn::expression vcsn::rat::driver::result_
private

The parsed expression.

Definition at line 82 of file driver.hh.

Referenced by vcsn::rat::parser::parse().

std::unique_ptr<yyFlexLexer> vcsn::rat::driver::scanner_

The scanner.

Definition at line 56 of file driver.hh.

Referenced by vcsn::rat::parser::parse(), and vcsn::rat::yylex().

std::vector<dyn::context> vcsn::rat::driver::tape_ctx_ = {}
private

The context for each tape. If single-tape, [0] is ctx_.

Definition at line 91 of file driver.hh.

Referenced by context(), vcsn::rat::parser::parse(), and tape_inc().

std::vector<unsigned> vcsn::rat::driver::tapes_ = {0}
private

The stack of tape numbers.

The concept of tape number does not suffice. For instance, it cannot deal with (a|b)|(x|y) which is a lat<lat<lan, lan>, lat<lan, lan>>. Not that it really matters as of today...

Definition at line 89 of file driver.hh.

Referenced by context(), tape_inc(), tape_pop(), and tape_push().


The documentation for this class was generated from the following files: