Bertini 2 d882924 (2026-10-06 19:56 UTC)
Numerical algebraic geometry library (C++ core)
Loading...
Searching...
No Matches
bertini::parsing::classic::SystemParser< Iterator, Skipper > Struct Template Reference

Qi Parser object for parsing text into the System class. More...

#include <system_rules.hpp>

Inheritance diagram for bertini::parsing::classic::SystemParser< Iterator, Skipper >:
[legend]
Collaboration diagram for bertini::parsing::classic::SystemParser< Iterator, Skipper >:
[legend]

Public Member Functions

 SystemParser ()
void CollectFunctionNames (std::vector< std::string > const &names)
 Record the declared function names (in declaration order).
void CollectConstantNames (std::vector< std::string > const &names)
 Record the declared constant names.
void CollectParameterNames (std::vector< std::string > const &names)
 Record the declared parameter names.
void DefineNamed (std::string const &name, Nd const &expr)
 Bind a declared name to its (immutable) NamedExpression definition.
void AddPathVariableChecked (System &s, Var const &v)
 Add the path variable, refusing a second declaration.
void EmitDeclaredFunctions (System &s) const
 Emit the collected declared functions/constants/parameters to the System.

Detailed Description

template<typename Iterator, typename Skipper = ascii::space_type>
struct bertini::parsing::classic::SystemParser< Iterator, Skipper >

Qi Parser object for parsing text into the System class.

This ensures we can provide backwards compatibility with Bertini Classic input files.

To use this parser, construct an object of its type, then use it to parse.

System sys;
std::string str = "variable_group x, y, z; \nfunction f1, f2;\n f1 = x*y*z;\n f2 = x+y+z;\n";
std::string::const_iterator iter = str.begin();
std::string::const_iterator end = str.end();
bertini::SystemParser<std::string::const_iterator> S;
bool s = phrase_parse(iter, end, S,boost::spirit::ascii::space, sys);
The fundamental polynomial system class for Bertini2.
Definition system.hpp:106

Qi Parser object for parsing text into the System class.

This parser could not have been written without the help of SO user sehe.

Constructor & Destructor Documentation

◆ SystemParser()

template<typename Iterator, typename Skipper = ascii::space_type>
bertini::parsing::classic::SystemParser< Iterator, Skipper >::SystemParser ( )
inline

Member Function Documentation

◆ AddPathVariableChecked()

template<typename Iterator, typename Skipper = ascii::space_type>
void bertini::parsing::classic::SystemParser< Iterator, Skipper >::AddPathVariableChecked ( System & s,
Var const & v )
inline

Add the path variable, refusing a second declaration.

A system has exactly one path variable, so a second pathvariable line is a mistake in the input rather than a re-assignment. Enforced here, at the declaration, rather than in System::AddPathVariable, which stays permissive so that a caller building a system programmatically may still change its mind.

Parameters
sThe system being built.
vThe declared path variable.

◆ CollectConstantNames()

template<typename Iterator, typename Skipper = ascii::space_type>
void bertini::parsing::classic::SystemParser< Iterator, Skipper >::CollectConstantNames ( std::vector< std::string > const & names)
inline

Record the declared constant names.

◆ CollectFunctionNames()

template<typename Iterator, typename Skipper = ascii::space_type>
void bertini::parsing::classic::SystemParser< Iterator, Skipper >::CollectFunctionNames ( std::vector< std::string > const & names)
inline

Record the declared function names (in declaration order).

◆ CollectParameterNames()

template<typename Iterator, typename Skipper = ascii::space_type>
void bertini::parsing::classic::SystemParser< Iterator, Skipper >::CollectParameterNames ( std::vector< std::string > const & names)
inline

Record the declared parameter names.

◆ DefineNamed()

template<typename Iterator, typename Skipper = ascii::space_type>
void bertini::parsing::classic::SystemParser< Iterator, Skipper >::DefineNamed ( std::string const & name,
Nd const & expr )
inline

Bind a declared name to its (immutable) NamedExpression definition.

◆ EmitDeclaredFunctions()

template<typename Iterator, typename Skipper = ascii::space_type>
void bertini::parsing::classic::SystemParser< Iterator, Skipper >::EmitDeclaredFunctions ( System & s) const
inline

Emit the collected declared functions/constants/parameters to the System.

Every declared name must have been defined. A name that was declared and never defined is reported here, by name and kind: before this the missing definition reached std::map::at and surfaced as the meaningless map::at, which told the user nothing about which name they had forgotten (b2#441).

Parameters
sThe system to emit into.