src/Control/CommonGrammar.hpp file

Generic, low-level grammar, re-used by specific grammars.

Contents

Generic, low-level grammar. We use the Parsing Expression Grammar Template Library (PEGTL) to create the grammar and the associated parser.

Namespaces

namespace tk
Toolkit declarations and definitions for general purpose utilities.
namespace tk::grm
Toolkit general purpose grammar definition.

Classes

template<template<class> class use>
struct tk::grm::is_keyword
template<typename Rule>
struct tk::grm::action
template<typename... As>
struct tk::grm::call
Helper for calling action::apply for multiple actions.
template<class rule, class... actions>
struct tk::grm::act
Rule used to trigger action(s) for a rule.
template<class rule, class... actions>
struct tk::grm::action<act<rule, actions...>>
template<MsgType, MsgKey>
struct tk::grm::msg
Rule used to trigger action.
template<MsgType type, MsgKey key>
struct tk::grm::action<msg<type, key>>
template<typename tag, typename... tags>
struct tk::grm::Set
Rule used to trigger action.
template<typename tag, typename... tags>
struct tk::grm::action<Set<tag, tags...>>
template<typename tag, typename... tags>
struct tk::grm::Store
Rule used to trigger action.
template<typename tag, typename... tags>
struct tk::grm::action<Store<tag, tags...>>
template<typename tag, typename... tags>
struct tk::grm::Store_back
Rule used to trigger action.
template<typename tag, typename... tags>
struct tk::grm::action<Store_back<tag, tags...>>
template<typename tag, typename... tags>
struct tk::grm::Store_back_back
Rule used to trigger action.
template<typename tag, typename... tags>
struct tk::grm::action<Store_back_back<tag, tags...>>
Convert and push back value to vector of back of vector in state at position given by tags.
template<typename tag, typename... tags>
struct tk::grm::Store_back_back_back
Rule used to trigger action.
template<typename tag, typename... tags>
struct tk::grm::action<Store_back_back_back<tag, tags...>>
Convert and push back value to vector of back of vector of back of vector in state at position given by tags.
template<typename... tags>
struct tk::grm::Invert_switch
Rule used to trigger action.
template<typename... tags>
struct tk::grm::action<Invert_switch<tags...>>
template<template<class> class use, class Option, typename tag, typename... tags>
struct tk::grm::store_back_option
Rule used to trigger action.
template<template<class> class use, class Option, typename tag, typename... tags>
struct tk::grm::action<store_back_option<use, Option, tag, tags...>>
template<template<class> class use, class Option, typename tag, typename... tags>
struct tk::grm::store_back_back_option
Rule used to trigger action.
template<template<class> class use, class Option, typename tag, typename... tags>
struct tk::grm::action<store_back_back_option<use, Option, tag, tags...>>
Push back option to vector of back of vector in state at position given by tags.
template<typename field, typename sel, typename vec, typename tag, typename... tags>
struct tk::grm::Insert_field
Rule used to trigger action.
template<typename field, typename sel, typename vec, typename tag, typename... tags>
struct tk::grm::action<Insert_field<field, sel, vec, tag, tags...>>
Convert and insert value to map at position given by tags.
template<template<class> class use, class Option, typename field, typename sel, typename vec, typename tag, typename... tags>
struct tk::grm::insert_option
Rule used to trigger action.
template<template<class> class use, class Option, typename field, typename sel, typename vec, typename tag, typename... tags>
struct tk::grm::action<insert_option<use, Option, field, sel, vec, tag, tags...>>
Convert and insert option value to map at position given by tags.
template<typename prec>
struct tk::grm::store_precision
Rule used to trigger action.
template<class prec>
struct tk::grm::action<store_precision<prec>>
Set numeric precision for ASCII output of floating-point values.
struct tk::grm::helpkw
Rule used to trigger action.
template<>
struct tk::grm::action<helpkw>
Find keyword among all keywords and if found, store the keyword and its info on which help was requested behind tag::helpkw in Stack.
template<typename push>
struct tk::grm::match_depvar
Rule used to trigger action.
template<class push>
struct tk::grm::action<match_depvar<push>>
Match depvar (dependent variable) to one of the selected ones.
struct tk::grm::match_pdfname
Rule used to trigger action.
template<>
struct tk::grm::action<match_pdfname>
Match PDF name to the registered ones.
template<template<class> class use, class Option, typename sel, typename vec, typename... tags>
struct tk::grm::check_store_option
Rule used to trigger action.
template<template<class> class use, class Option, typename sel, typename vec, typename... tags>
struct tk::grm::action<check_store_option<use, Option, sel, vec, tags...>>
Put option in state at position given by tags if among the selected.
struct tk::grm::add_depvar
Rule used to trigger action.
template<>
struct tk::grm::action<add_depvar>
Add depvar (dependent variable) to the selected ones.
template<class keyword, typename tag, typename... tags>
struct tk::grm::check_lower_bound
Rule used to trigger action.
template<class keyword, typename tag, typename... tags>
struct tk::grm::action<check_lower_bound<keyword, tag, tags...>>
Check if value is larger than lower bound.
template<class keyword, typename tag, typename... tags>
struct tk::grm::check_upper_bound
Rule used to trigger action.
template<class keyword, typename tag, typename... tags>
struct tk::grm::action<check_upper_bound<keyword, tag, tags...>>
Check if value is lower than upper bound.
template<typename tag, typename... tags>
struct tk::grm::start_vector
Rule used to trigger action.
template<class tag, class... tags>
struct tk::grm::action<start_vector<tag, tags...>>
Start new vector in vector.
template<typename tag, typename... tags>
struct tk::grm::start_vector_back
Rule used to trigger action.
template<class tag, class... tags>
struct tk::grm::action<start_vector_back<tag, tags...>>
Start new vector in back of a vector.
template<typename tk::ctr::Moment, char var = '\0'>
struct tk::grm::push_term
Rule used to trigger action.
template<tk::ctr::Moment m, char var>
struct tk::grm::action<push_term<m, var>>
Add matched value as Term into vector of vector of statistics.
template<tk::ctr::Moment m>
struct tk::grm::push_sample
Rule used to trigger action.
template<tk::ctr::Moment m>
struct tk::grm::action<push_sample<m>>
Add matched value as Term into vector of vector of PDFs.
struct tk::grm::push_binsize
Rule used to trigger action.
template<>
struct tk::grm::action<push_binsize>
Push matched value into vector of vector binsizes.
struct tk::grm::push_extents
Rule used to trigger action.
template<>
struct tk::grm::action<push_extents>
Push matched value into vector of PDF extents.
template<class eq, class param>
struct tk::grm::check_vector
Rule used to trigger action.
template<class eq, class param>
struct tk::grm::action<check_vector<eq, param>>
Check parameter vector.
template<class eq, class param>
struct tk::grm::check_spikes
Rule used to trigger action.
template<class eq, class param>
struct tk::grm::action<check_spikes<eq, param>>
template<class eq, class param>
struct tk::grm::check_betapdfs
Rule used to trigger action.
template<class eq, class param>
struct tk::grm::action<check_betapdfs<eq, param>>
template<class eq, class param>
struct tk::grm::check_gammapdfs
Rule used to trigger action.
template<class eq, class param>
struct tk::grm::action<check_gammapdfs<eq, param>>
template<class eq, class param>
struct tk::grm::check_gaussians
Rule used to trigger action.
template<class eq, class param>
struct tk::grm::action<check_gaussians<eq, param>>
struct tk::grm::check_expectation
Rule used to trigger action.
template<>
struct tk::grm::action<check_expectation>
Check if there is at least one variable in expectation.
struct tk::grm::check_binsizes
Rule used to trigger action.
template<>
struct tk::grm::action<check_binsizes>
Check if the number of binsizes equal the PDF sample space variables.
struct tk::grm::check_extents
Rule used to trigger action.
template<>
struct tk::grm::action<check_extents>
Check if the number of extents equal 2 * the PDF sample space variables.
struct tk::grm::check_samples
Rule used to trigger action.
template<>
struct tk::grm::action<check_samples>
Check if there is at least one sample space variable in PDF.
struct tk::grm::save_field
Rule used to trigger action.
template<>
struct tk::grm::action<save_field>
Save field ID to parser's state so push_term can pick it up.
template<class token, class erased>
struct tk::grm::trim
Read 'token' until 'erased' trimming, i.e., not consuming, 'erased'.
template<MsgType type, MsgKey key>
struct tk::grm::unknown
Match unknown keyword and handle error.
template<class keyword>
struct tk::grm::alias
template<class keyword>
struct tk::grm::verbose
template<class token>
struct tk::grm::readkw
Read keyword 'token' padded by blank at left and space at right.
template<class keyword, typename = void>
struct tk::grm::readcmd
template<class keyword>
struct tk::grm::readcmd<keyword, typename if_<false, typename keyword::info::alias>::type>
template<class keyword, class... actions>
struct tk::grm::scan
Scan input padded by blank at left and space at right and if it matches 'keywords', apply 'actions'.
template<class keywords, class action, class end = pegtl::space>
struct tk::grm::scan_until
Scan input padded by blank at left and space at right and if it matches 'keywords', apply 'action'.
struct tk::grm::comment
Parse comment: start with '#' until eol.
struct tk::grm::ignore
Ignore comments and empty lines.
struct tk::grm::number
Parse a number: an optional sign followed by digits.
template<class endkeyword, typename... tokens>
struct tk::grm::block
Plow through 'tokens' until 'endkeyword'.
template<class key, class insert, class endkeyword, class starter, class value = number>
struct tk::grm::vector
template<class insert, char lbound = '"', char rbound = '"'>
struct tk::grm::quoted
Scan string between characters 'lbound' and 'rbound' and if matches apply action 'insert'.
template<class keyword, class insert, class kw_type = pegtl::digit>
struct tk::grm::process
Process 'keyword' and call its 'insert' action if matches 'kw_type'.
template<template<class> class use, class keyword, class insert, class kw_type, class tag, class... tags>
struct tk::grm::process_cmd
Process command line 'keyword' and call its 'insert' action if matches 'kw_type'.
template<template<class> class use, class keyword, typename tag, typename... tags>
struct tk::grm::process_cmd_switch
template<typename keywords, typename... ign>
struct tk::grm::read_file
Generic file parser entry point: parse 'keywords' and 'ignore' until end of file.
struct tk::grm::charmarg
Process but ignore Charm++'s charmrun arguments starting with '+'.
template<typename keywords>
struct tk::grm::read_string
Generic string parser entry point: parse 'keywords' until end of string.
template<template<class> class use, typename keyword, typename option, typename field, typename sel, typename vec, typename... tags>
struct tk::grm::rng_option
template<typename var>
struct tk::grm::fieldvar
Match fieldvar: a character, denoting a variable, optionally followed by a digit.
struct tk::grm::term
Match term: upper or lowercase fieldvar matched to selected depvars for stats.
template<class c, tk::ctr::Moment m>
struct tk::grm::sample_space_var
sample space variable: fieldvar matched to selected depvars
struct tk::grm::samples
Match samples: sample space variables optionally separated by fillers.