Bertini 2 d882924 (2026-10-06 19:56 UTC)
Numerical algebraic geometry library (C++ core)
Loading...
Searching...
No Matches
bertini::parsing::classic Namespace Reference

Classes

class  SplitInputFile
 Storage class for input file that splits up the config portion from the input portion. More...
struct  SplitInputFileParser
 Qi Parser object for parsing text into the SplitInputfile class. More...
struct  CommentStripper
 Qi Parser object for removing comments from a line of text and then returns the uncommented line. More...
struct  FunctionParser
 A Qi grammar parser for parsing text into function trees. More...
struct  MpfrFloatParser
 A Qi grammar parsing a real multiprecision number, at a precision matching the input's digits. More...
struct  MpfrComplexParser
 A Qi grammar parsing a complex multiprecision number (real then imaginary part). More...
struct  ConfigParser
 Base variadic parser for parsing many config structs at once. More...
struct  ConfigParser< ConfigT >
 Specialization of ConfigParser for a single config struct. More...
struct  ConfigParser< detail::TypeList< Ts... > >
 Specialization of ConfigParser for a typelist, returning a thing passed down from the base variadic case. More...
struct  ConfigSettingParser< Iterator, algorithm::TolerancesConfig, Skipper >
 Parser for the TolerancesConfig settings block of classic Bertini input. More...
struct  ConfigSettingParser< Iterator, algorithm::ZeroDimConfig, Skipper >
 Parser for the ZeroDimConfig settings block of classic Bertini input. More...
struct  ConfigSettingParser< Iterator, algorithm::MidPathConfig, Skipper >
 Parser for the MidPathConfig settings block of classic Bertini input. More...
struct  ConfigSettingParser< Iterator, algorithm::RecordsConfig, Skipper >
 Parser for RecordsConfig: the classic input format has no keyword for it, so this consumes the config text and leaves the defaults. More...
struct  ConfigSettingParser< Iterator, algorithm::AutoRetrackConfig, Skipper >
 Parser for the AutoRetrackConfig settings block of classic Bertini input. More...
struct  ConfigSettingParser< Iterator, algorithm::SharpeningConfig, Skipper >
 Parser for the SharpeningConfig settings block of classic Bertini input. More...
struct  ConfigSettingParser< Iterator, algorithm::RegenerationConfig, Skipper >
 Parser for the RegenerationConfig settings block of classic Bertini input. More...
struct  ConfigSettingParser< Iterator, algorithm::PostProcessingConfig, Skipper >
 Parser for the PostProcessingConfig settings block of classic Bertini input. More...
struct  ConfigSettingParser< Iterator, algorithm::classic::AlgoChoice, Skipper >
 Parser for the AlgoChoice settings block of classic Bertini input. More...
struct  ConfigSettingParser< Iterator, algorithm::classic::EndgameChoiceConfig, Skipper >
 Parser for the EndgameChoiceConfig settings block of classic Bertini input. More...
struct  ConfigSettingParser
 Qi Parser object for parsing config settings This ensures we can provide backwards compatibility with Bertini Classic input files. More...
struct  ConfigSettingParser< Iterator, bertini::endgame::SecurityConfig, Skipper >
 Parser for the SecurityConfig settings block of classic Bertini input. More...
struct  ConfigSettingParser< Iterator, bertini::endgame::EndgameConfig, Skipper >
 Parser for the EndgameConfig settings block of classic Bertini input. More...
struct  ConfigSettingParser< Iterator, bertini::endgame::PowerSeriesConfig, Skipper >
 Parser for the PowerSeriesConfig settings block of classic Bertini input. More...
struct  ConfigSettingParser< Iterator, bertini::endgame::CauchyConfig, Skipper >
 Parser for the CauchyConfig settings block of classic Bertini input. More...
struct  ConfigSettingParser< Iterator, bertini::endgame::TrackBackConfig, Skipper >
 Parser for the TrackBackConfig settings block of classic Bertini input. More...
struct  ConfigSettingParser< Iterator, algorithm::RandomConfig, Skipper >
 Parser for the RandomConfig settings block of classic Bertini input. More...
struct  ConfigSettingParser< Iterator, PrecisionType, Skipper >
 Qi Parser object for parsing config settings This ensures we can provide backwards compatibility with Bertini Classic input files. More...
struct  ConfigSettingParser< Iterator, Predictor, Skipper >
 Parser for the Predictor settings block of classic Bertini input. More...
struct  ConfigSettingParser< Iterator, TrackerConfig, Skipper >
 The tracker's own settings, from a classic input file. More...
struct  ConfigSettingParser< Iterator, SteppingConfig, Skipper >
 Parser for the SteppingConfig settings block of classic Bertini input. More...
struct  ConfigSettingParser< Iterator, NewtonConfig, Skipper >
 Parser for the NewtonConfig settings block of classic Bertini input. More...
struct  ConfigSettingParser< Iterator, FixedPrecisionConfig, Skipper >
 As of this writing, there are no meaningful settings in FixedPrecisionConfig, so this parser is ... empty. More...
struct  ConfigSettingParser< Iterator, AdaptiveMultiplePrecisionConfig, Skipper >
 Parser for the AdaptiveMultiplePrecisionConfig settings block of classic Bertini input. More...
struct  SystemParser
 Qi Parser object for parsing text into the System class. More...

Typedefs

using AdaptiveMultiplePrecisionConfig = AdaptiveMultiplePrecisionConfig
 Alias bringing the AMP config type into this scope for the parser specialization below.
using Variable = node::Variable
 The variable node type.
using Node = node::Node
 The generic expression-tree node type.
using Var = std::shared_ptr<Variable>
 Shorthand for a shared pointer to a variable node.
using Nd = std::shared_ptr<Node>
 Shorthand for a shared pointer to a generic node.

Functions

SplitInputFile ParseInputFile (std::string str_input_file)
 Split a classic Bertini input file's contents into its config and input portions.
std::tuple< std::string, std::string > SplitIntoConfigAndInput (Path const &input_file)
 Function for splitting a Bertini Classic style input file into config and input.
void SplitIntoConfigAndInput (std::string &config_section, std::string &input_section, Path const &input_file)
 Function for splitting a Bertini Classic style input file into config and input.
template<typename Iterator>
bool parse (Iterator first, Iterator last, std::shared_ptr< bertini::node::Node > &func)
 Parse a function expression from the iterator range into a node tree.
template<typename Iterator>
static bool parse (Iterator first, Iterator last, double &c)
 Parse a double from the iterator range.
template<typename Iterator>
static bool parse (Iterator first, Iterator last, std::complex< double > &c)
 Parse a double-precision complex number from the iterator range.
template<typename Iterator>
static bool parse (Iterator first, Iterator last, real_mp &c)
 Parse a multiprecision real from the iterator range.
template<typename Iterator>
static bool parse (Iterator first, Iterator last, complex_mp &c)
 Parse a multiprecision complex number from the iterator range.
void StripUTF8BOM (std::string &s)
 Strip a leading UTF-8 byte-order mark (EF BB BF) from s in place, if present.
void StripClassicComments (std::string &s)
 Remove Bertini 1 comments from s in place: everything from a % to the end of its line.
void StripClassicFileWrappers (std::string &s)
 Unwrap a Bertini 1 classic input FILE down to the declarations the grammar reads.
std::string FormatParseError (std::string::const_iterator begin, std::string::const_iterator end, std::string::const_iterator err_pos, boost::spirit::info const &what, std::string const &parser_name)
 Format a human-readable parse-error message (line, column, expected, and found text).
void ReportParseError (std::string::const_iterator begin, std::string::const_iterator end, std::string::const_iterator err_pos, boost::spirit::info const &what, std::string const &parser_name)
 Report a parse error (via FormatParseError) to the log, for use in a Spirit on_error handler.
template<typename ConfigT>
ConfigT FillConfigStruct (std::string const &config_str)
 Helper function to fill a single configuration struct by parsing a config input file.
template<typename Iterator>
static bool parse (Iterator first, Iterator last, System &sys)
 Parse a polynomial system from the iterator range into a System.

Typedef Documentation

◆ AdaptiveMultiplePrecisionConfig

Alias bringing the AMP config type into this scope for the parser specialization below.

◆ Nd

using bertini::parsing::classic::Nd = std::shared_ptr<Node>

Shorthand for a shared pointer to a generic node.

◆ Node

The generic expression-tree node type.

◆ Var

using bertini::parsing::classic::Var = std::shared_ptr<Variable>

Shorthand for a shared pointer to a variable node.

◆ Variable

The variable node type.

Function Documentation

◆ FillConfigStruct()

template<typename ConfigT>
ConfigT bertini::parsing::classic::FillConfigStruct ( std::string const & config_str)

Helper function to fill a single configuration struct by parsing a config input file.

Parameters
config_strThe comment-stripped configuration string from a Bertini classic input file.
Template Parameters
ConfigTThe config ConfigT type
RealTReal number type
Returns
The config struct filled with data from the input file.

◆ FormatParseError()

std::string bertini::parsing::classic::FormatParseError ( std::string::const_iterator begin,
std::string::const_iterator end,
std::string::const_iterator err_pos,
boost::spirit::info const & what,
std::string const & parser_name )
inline

Format a human-readable parse-error message (line, column, expected, and found text).

◆ parse() [1/6]

template<typename Iterator>
bool bertini::parsing::classic::parse ( Iterator first,
Iterator last,
complex_mp & c )
static

Parse a multiprecision complex number from the iterator range.

◆ parse() [2/6]

template<typename Iterator>
bool bertini::parsing::classic::parse ( Iterator first,
Iterator last,
double & c )
static

Parse a double from the iterator range.

◆ parse() [3/6]

template<typename Iterator>
bool bertini::parsing::classic::parse ( Iterator first,
Iterator last,
real_mp & c )
static

Parse a multiprecision real from the iterator range.

◆ parse() [4/6]

template<typename Iterator>
bool bertini::parsing::classic::parse ( Iterator first,
Iterator last,
std::complex< double > & c )
static

Parse a double-precision complex number from the iterator range.

◆ parse() [5/6]

template<typename Iterator>
bool bertini::parsing::classic::parse ( Iterator first,
Iterator last,
std::shared_ptr< bertini::node::Node > & func )

Parse a function expression from the iterator range into a node tree.

◆ parse() [6/6]

template<typename Iterator>
bool bertini::parsing::classic::parse ( Iterator first,
Iterator last,
System & sys )
static

Parse a polynomial system from the iterator range into a System.

◆ ParseInputFile()

SplitInputFile bertini::parsing::classic::ParseInputFile ( std::string str_input_file)

Split a classic Bertini input file's contents into its config and input portions.

◆ ReportParseError()

void bertini::parsing::classic::ReportParseError ( std::string::const_iterator begin,
std::string::const_iterator end,
std::string::const_iterator err_pos,
boost::spirit::info const & what,
std::string const & parser_name )
inline

Report a parse error (via FormatParseError) to the log, for use in a Spirit on_error handler.

◆ SplitIntoConfigAndInput() [1/2]

std::tuple< std::string, std::string > bertini::parsing::classic::SplitIntoConfigAndInput ( Path const & input_file)

Function for splitting a Bertini Classic style input file into config and input.

◆ SplitIntoConfigAndInput() [2/2]

void bertini::parsing::classic::SplitIntoConfigAndInput ( std::string & config_section,
std::string & input_section,
Path const & input_file )

Function for splitting a Bertini Classic style input file into config and input.

◆ StripClassicComments()

void bertini::parsing::classic::StripClassicComments ( std::string & s)
inline

Remove Bertini 1 comments from s in place: everything from a % to the end of its line.

A classic input file may carry comments anywhere – whole lines, or the tail of a declaration – and the grammars have no skip rule for them, so an uncommented text is what every parse entry point must start from. Bertini 1 has no string literals, so a % is always a comment marker. Line breaks are kept, so error positions still name the right line. See #407.

◆ StripClassicFileWrappers()

void bertini::parsing::classic::StripClassicFileWrappers ( std::string & s)
inline

Unwrap a Bertini 1 classic input FILE down to the declarations the grammar reads.

System::to_classic_input() emits a complete Bertini 1 file – CONFIG ... END; then INPUT ... END; – because its purpose is running the same problem in Bertini 1. The grammar reads only the INPUT-section BODY. The two therefore were not inverses, and the mismatch did not announce itself: the wrapped text matched nothing and the caller received an empty System. See #396.

Comply rather than refuse: handing a system parser a classic input file means one thing. The CONFIG section holds tracking settings a System does not carry, so it is dropped. Text that is already a bare body is returned untouched, so this is a no-op for every caller that was working before.

◆ StripUTF8BOM()

void bertini::parsing::classic::StripUTF8BOM ( std::string & s)
inline

Strip a leading UTF-8 byte-order mark (EF BB BF) from s in place, if present.

Editors (notably on Windows) may prepend a BOM; the Qi grammar treats input as raw UTF-8, so the BOM must be removed at the read boundary or it would appear as a stray leading "character".