Vcsn  2.8
Be Rational
vcsn::ast::context_parser Class Reference

Parser of snames. More...

Collaboration diagram for vcsn::ast::context_parser:

Public Member Functions

 context_parser (std::istringstream &is)
 
std::shared_ptr< ast_nodeparse ()
 Accept anything. More...
 
std::shared_ptr< ast_nodeparse_context ()
 Accept only a valid context. More...
 

Private Member Functions

int peek_ ()
 The next character, possibly preceded by spaces. More...
 
char eat_ (char c)
 Accept this character, possibly preceded by spaces. More...
 
const std::string & eat_ (const std::string &s)
 Accept this string, possibly preceded by spaces. More...
 
void check_eof_ (std::shared_ptr< ast_node > res)
 We managed to read res in is, check that is_ is finished. More...
 
std::string word_ ()
 The next word in the stream. More...
 
std::string parameters_ ()
 The next parameters in the stream. More...
 
std::shared_ptr< ast_nodeany_ ()
 Accept anything. More...
 
std::shared_ptr< const gensetgenset_ ()
 An optional generator set in brackets (e.g., <char_letters(abc)> or <char>). More...
 
std::shared_ptr< const gensetgenset_ (std::string letter_type)
 A generator set (e.g., char_letters(abc) or char). More...
 
std::shared_ptr< contextcontext_ ()
 <LabelSet>, <WeightSet>. More...
 
std::shared_ptr< contextcontext_ (std::string w)
 <LabelSet>, <WeightSet>. More...
 
std::shared_ptr< ast_nodelabelset_ ()
 <LabelSet>. More...
 
std::shared_ptr< ast_nodelabelset_ (const std::string &ls)
 <LabelSet>. More...
 
std::shared_ptr< ast_nodeweightset_ ()
 <WeightSet>. More...
 
std::shared_ptr< ast_nodeweightset_ (const std::string &ws)
 <WeightSet>. More...
 
std::shared_ptr< automatonautomaton_ ()
 <Automaton> "<" <Context> ">". More...
 
std::shared_ptr< automatonautomaton_ (std::string prefix)
 <Automaton> "<" <Context> ">". More...
 
std::shared_ptr< tupletuple_ ()
 "<" (<Any> ",")* ">". More...
 
std::shared_ptr< tuplesettupleset_ ()
 "<" (<LabelSet> | <WeightSet> ",")+ ">". More...
 
std::shared_ptr< expressionsetexpressionset_ ()
 ("expressionset"|"seriesset") "<" <Context> ">", possibly followed by identities. More...
 
std::shared_ptr< expressionsetexpressionset_ (const std::string &w)
 "expressionset" "<" <Context> ">", possibly followed by identities. More...
 
std::shared_ptr< expansionsetexpansionset_ ()
 "expansionset" "<" <Expressionset> ">". More...
 
std::shared_ptr< polynomialsetpolynomialset_ ()
 "polynomialset" "<" <Context> ">". More...
 
std::shared_ptr< ast_nodelabelset_or_weightset_ ()
 <LabelSet> | <WeightSet> More...
 
std::shared_ptr< ast_nodelabelset_or_weightset_ (const std::string &w)
 <LabelSet> | <WeightSet> More...
 

Private Attributes

std::istringstream & is_
 The stream we are parsing. More...
 
std::set< std::string > weightsets_
 The set of terminal weightset names. More...
 
std::set< std::string > labelsets_
 The set of weightset names. More...
 

Detailed Description

Parser of snames.

Definition at line 17 of file context-parser.cc.

Constructor & Destructor Documentation

◆ context_parser()

vcsn::ast::context_parser::context_parser ( std::istringstream &  is)
inline

Definition at line 20 of file context-parser.cc.

Member Function Documentation

◆ any_()

std::shared_ptr<ast_node> vcsn::ast::context_parser::any_ ( )
inlineprivate

Accept anything.

Definition at line 120 of file context-parser.cc.

References automaton_(), context_(), expansionset_(), expressionset_(), vcsn::has(), labelset_(), labelsets_, parameters_(), peek_(), polynomialset_(), vcsn::res, tuple_(), tupleset_(), weightset_(), weightsets_, and word_().

Referenced by automaton_(), parse(), and tuple_().

Here is the call graph for this function:

◆ automaton_() [1/2]

std::shared_ptr<automaton> vcsn::ast::context_parser::automaton_ ( )
inlineprivate

<Automaton> "<" <Context> ">".

Definition at line 288 of file context-parser.cc.

References word_().

Referenced by any_(), and automaton_().

Here is the call graph for this function:

◆ automaton_() [2/2]

std::shared_ptr<automaton> vcsn::ast::context_parser::automaton_ ( std::string  prefix)
inlineprivate

<Automaton> "<" <Context> ">".

Definition at line 294 of file context-parser.cc.

References any_(), automaton_(), context_(), eat_(), expressionset_(), peek_(), vcsn::prefix(), vcsn::res, vcsn::str_quote(), and word_().

Here is the call graph for this function:

◆ check_eof_()

void vcsn::ast::context_parser::check_eof_ ( std::shared_ptr< ast_node res)
inlineprivate

We managed to read res in is, check that is_ is finished.

Definition at line 64 of file context-parser.cc.

References vcsn::fail_reading(), is_, and peek_().

Referenced by parse(), and parse_context().

Here is the call graph for this function:

◆ context_() [1/2]

std::shared_ptr<context> vcsn::ast::context_parser::context_ ( )
inlineprivate

<LabelSet>, <WeightSet>.

Definition at line 200 of file context-parser.cc.

References word_().

Referenced by any_(), automaton_(), expressionset_(), parse_context(), and polynomialset_().

Here is the call graph for this function:

◆ context_() [2/2]

std::shared_ptr<context> vcsn::ast::context_parser::context_ ( std::string  w)
inlineprivate

<LabelSet>, <WeightSet>.

Definition at line 206 of file context-parser.cc.

References eat_(), labelset_(), weightset_(), and word_().

Here is the call graph for this function:

◆ eat_() [1/2]

char vcsn::ast::context_parser::eat_ ( char  c)
inlineprivate

Accept this character, possibly preceded by spaces.

Definition at line 49 of file context-parser.cc.

References vcsn::eat(), is_, and vcsn::skip_space().

Referenced by automaton_(), context_(), expansionset_(), expressionset_(), genset_(), labelset_(), parameters_(), polynomialset_(), tuple_(), and tupleset_().

Here is the call graph for this function:

◆ eat_() [2/2]

const std::string& vcsn::ast::context_parser::eat_ ( const std::string &  s)
inlineprivate

Accept this string, possibly preceded by spaces.

Definition at line 56 of file context-parser.cc.

References vcsn::eat(), is_, and vcsn::skip_space().

Here is the call graph for this function:

◆ expansionset_()

std::shared_ptr<expansionset> vcsn::ast::context_parser::expansionset_ ( )
inlineprivate

"expansionset" "<" <Expressionset> ">".

Definition at line 440 of file context-parser.cc.

References eat_(), expressionset_(), and vcsn::res.

Referenced by any_().

Here is the call graph for this function:

◆ expressionset_() [1/2]

std::shared_ptr<expressionset> vcsn::ast::context_parser::expressionset_ ( )
inlineprivate

("expressionset"|"seriesset") "<" <Context> ">", possibly followed by identities.

Definition at line 413 of file context-parser.cc.

References word_().

Referenced by any_(), automaton_(), expansionset_(), labelset_(), labelset_or_weightset_(), and weightset_().

Here is the call graph for this function:

◆ expressionset_() [2/2]

std::shared_ptr<expressionset> vcsn::ast::context_parser::expressionset_ ( const std::string &  w)
inlineprivate

"expressionset" "<" <Context> ">", possibly followed by identities.

w is "expressionset" or "seriesset", already eaten.

Definition at line 420 of file context-parser.cc.

References context_(), vcsn::rat::identities::distributive, eat_(), vcsn::rat::ids(), is_, peek_(), and vcsn::require().

Here is the call graph for this function:

◆ genset_() [1/2]

std::shared_ptr<const genset> vcsn::ast::context_parser::genset_ ( )
inlineprivate

An optional generator set in brackets (e.g., <char_letters(abc)> or <char>).

Defaults to <char> if the stream does not start with <.

Definition at line 160 of file context-parser.cc.

References eat_(), peek_(), vcsn::res, and word_().

Referenced by labelset_().

Here is the call graph for this function:

◆ genset_() [2/2]

std::shared_ptr<const genset> vcsn::ast::context_parser::genset_ ( std::string  letter_type)
inlineprivate

A generator set (e.g., char_letters(abc) or char).

Parameters
letter_typeshould be char_letter, or char, etc.

Definition at line 175 of file context-parser.cc.

References is_, peek_(), and vcsn::require().

Here is the call graph for this function:

◆ labelset_() [1/2]

std::shared_ptr<ast_node> vcsn::ast::context_parser::labelset_ ( )
inlineprivate

<LabelSet>.

Definition at line 224 of file context-parser.cc.

References word_().

Referenced by any_(), context_(), labelset_(), and labelset_or_weightset_().

Here is the call graph for this function:

◆ labelset_() [2/2]

std::shared_ptr<ast_node> vcsn::ast::context_parser::labelset_ ( const std::string &  ls)
inlineprivate

<LabelSet>.

Definition at line 230 of file context-parser.cc.

References eat_(), expressionset_(), genset_(), labelset_(), vcsn::res, vcsn::str_quote(), and tupleset_().

Here is the call graph for this function:

◆ labelset_or_weightset_() [1/2]

std::shared_ptr<ast_node> vcsn::ast::context_parser::labelset_or_weightset_ ( )
inlineprivate

<LabelSet> | <WeightSet>

Definition at line 458 of file context-parser.cc.

References word_().

Referenced by tupleset_().

Here is the call graph for this function:

◆ labelset_or_weightset_() [2/2]

std::shared_ptr<ast_node> vcsn::ast::context_parser::labelset_or_weightset_ ( const std::string &  w)
inlineprivate

<LabelSet> | <WeightSet>

Definition at line 464 of file context-parser.cc.

References expressionset_(), vcsn::has(), labelset_(), labelsets_, vcsn::str_quote(), tupleset_(), weightset_(), and weightsets_.

Here is the call graph for this function:

◆ parameters_()

std::string vcsn::ast::context_parser::parameters_ ( )
inlineprivate

The next parameters in the stream.

Must be right before the opening <. Will return up to the matching >. Skips spaces.

Definition at line 100 of file context-parser.cc.

References eat_(), is_, peek_(), and vcsn::res.

Referenced by any_().

Here is the call graph for this function:

◆ parse()

std::shared_ptr<ast_node> vcsn::ast::context_parser::parse ( )
inline

Accept anything.

Definition at line 25 of file context-parser.cc.

References any_(), check_eof_(), and vcsn::res.

Referenced by vcsn::ast::parse_type().

Here is the call graph for this function:

◆ parse_context()

std::shared_ptr<ast_node> vcsn::ast::context_parser::parse_context ( )
inline

Accept only a valid context.

Definition at line 33 of file context-parser.cc.

References check_eof_(), context_(), and vcsn::res.

Referenced by vcsn::ast::parse_context().

Here is the call graph for this function:

◆ peek_()

int vcsn::ast::context_parser::peek_ ( )
inlineprivate

The next character, possibly preceded by spaces.

Definition at line 42 of file context-parser.cc.

References is_, and vcsn::skip_space().

Referenced by any_(), automaton_(), check_eof_(), expressionset_(), genset_(), parameters_(), tuple_(), and tupleset_().

Here is the call graph for this function:

◆ polynomialset_()

std::shared_ptr<polynomialset> vcsn::ast::context_parser::polynomialset_ ( )
inlineprivate

"polynomialset" "<" <Context> ">".

Definition at line 449 of file context-parser.cc.

References context_(), eat_(), and vcsn::res.

Referenced by any_(), and weightset_().

Here is the call graph for this function:

◆ tuple_()

std::shared_ptr<tuple> vcsn::ast::context_parser::tuple_ ( )
inlineprivate

"<" (<Any> ",")* ">".

Definition at line 382 of file context-parser.cc.

References any_(), eat_(), peek_(), and vcsn::res.

Referenced by any_().

Here is the call graph for this function:

◆ tupleset_()

std::shared_ptr<tupleset> vcsn::ast::context_parser::tupleset_ ( )
inlineprivate

"<" (<LabelSet> | <WeightSet> ",")+ ">".

Definition at line 397 of file context-parser.cc.

References eat_(), labelset_or_weightset_(), peek_(), and vcsn::res.

Referenced by any_(), labelset_(), labelset_or_weightset_(), and weightset_().

Here is the call graph for this function:

◆ weightset_() [1/2]

std::shared_ptr<ast_node> vcsn::ast::context_parser::weightset_ ( )
inlineprivate

<WeightSet>.

Definition at line 267 of file context-parser.cc.

References word_().

Referenced by any_(), context_(), and labelset_or_weightset_().

Here is the call graph for this function:

◆ weightset_() [2/2]

std::shared_ptr<ast_node> vcsn::ast::context_parser::weightset_ ( const std::string &  ws)
inlineprivate

<WeightSet>.

Definition at line 273 of file context-parser.cc.

References expressionset_(), vcsn::has(), polynomialset_(), vcsn::str_quote(), tupleset_(), and weightsets_.

Here is the call graph for this function:

◆ word_()

std::string vcsn::ast::context_parser::word_ ( )
inlineprivate

The next word in the stream.

Does not consider that underscore is word-constituent. Skips spaces.

Definition at line 79 of file context-parser.cc.

References is_, vcsn::res, and vcsn::skip_space().

Referenced by any_(), automaton_(), context_(), expressionset_(), genset_(), labelset_(), labelset_or_weightset_(), and weightset_().

Here is the call graph for this function:

Member Data Documentation

◆ is_

std::istringstream& vcsn::ast::context_parser::is_
private

The stream we are parsing.

Definition at line 479 of file context-parser.cc.

Referenced by check_eof_(), eat_(), expressionset_(), genset_(), parameters_(), peek_(), and word_().

◆ labelsets_

std::set<std::string> vcsn::ast::context_parser::labelsets_
private
Initial value:
=
{
"lal",
"lal_char",
"lan",
"lan_char",
"lao",
"law",
"law_char",
"letterset",
"nullableset",
"wordset",
}

The set of weightset names.

Definition at line 497 of file context-parser.cc.

Referenced by any_(), and labelset_or_weightset_().

◆ weightsets_

std::set<std::string> vcsn::ast::context_parser::weightsets_
private
Initial value:
=
{
"b",
"f2",
"log",
"nmin",
"q",
"qmp",
"r",
"rmin",
"z",
"zmin",
}

The set of terminal weightset names.

Definition at line 482 of file context-parser.cc.

Referenced by any_(), labelset_or_weightset_(), and weightset_().


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