src/Control/CommonGrammar.hpp file

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

Contents

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_bool
Rule used to trigger action.
template<typename tag, typename... tags>
struct tk::grm::action<Store_back_bool<tag, tags...>>
Convert and push back a bool to vector of ints in state at position given by 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 sel, typename vec, typename Tag, typename... Tags>
struct tk::grm::insert_seed
Rule used to trigger action.
template<typename sel, typename vec, typename Tag, typename... Tags>
struct tk::grm::action<insert_seed<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, class... xparam>
struct tk::grm::check_vector
Rule used to trigger action.
template<class eq, class param, class... xparam>
struct tk::grm::action<check_vector<eq, param, xparam...>>
Check parameter vector.
struct tk::grm::noop
Rule used to trigger action.
template<>
struct tk::grm::action<noop>
Action that does nothing.
template<class eq, class param, class... xparam>
struct tk::grm::check_spikes
Rule used to trigger action.
template<class eq, class param, class... xparam>
struct tk::grm::action<check_spikes<eq, param, xparam...>>
template<class eq, class param, class... xparam>
struct tk::grm::check_betapdfs
Rule used to trigger action.
template<class eq, class param, class... xparam>
struct tk::grm::action<check_betapdfs<eq, param, xparam...>>
template<class eq, class param, class... xparam>
struct tk::grm::check_gammapdfs
Rule used to trigger action.
template<class eq, class param, class... xparam>
struct tk::grm::action<check_gammapdfs<eq, param, xparam...>>
template<class eq, class param, class... xparam>
struct tk::grm::check_dirichletpdf
Rule used to trigger action.
template<class eq, class param, class... xparam>
struct tk::grm::action<check_dirichletpdf<eq, param, xparam...>>
template<class eq, class param, class... xparam>
struct tk::grm::check_gaussians
Rule used to trigger action.
template<class eq, class param, class... xparam>
struct tk::grm::action<check_gaussians<eq, param, xparam...>>
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<typename Tag, typename... Tags>
struct tk::grm::store_lua
Rule used to trigger action.
template<typename Tag, typename... Tags>
struct tk::grm::action<store_lua<Tag, Tags...>>
Append character parsed in a lua ... end block to a string.
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 'keyword', 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'.
template<class keyword, class... actions>
struct tk::grm::exact_scan
Scan input padded by blank at left and space at right and if it exactly matches 'keyword', apply 'actions'.
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 = noop, 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<template<class> class use, class tag, class... tags>
struct tk::grm::filename
Read and store a filename between quotes.
template<class keyword, class insert, class kw_type = pegtl::digit>
struct tk::grm::process
Process 'keyword' and if matches, parse following token (expecting 'kw_type' and call 'insert' action on it.
template<class keyword, class... actions>
struct tk::grm::process_alpha
Process 'keyword' and if matches, parse following token (expecting pegtl::alpha and call zero or more actions on it.
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.
struct tk::grm::bins
Match bin(sizes): real numbers as many sample space dimensions were given.
struct tk::grm::parse_expectations
Plow through expectations between characters '<' and '>'.
struct tk::grm::sample_space
Match list of sample space variables with error checking.
struct tk::grm::extents
Match extents: optional user-specified extents of PDF sample space.
struct tk::grm::bins_exts
Match binsizes followed by optional extents with error checking.
struct tk::grm::parse_pdf
Match pdf description: name + sample space specification.
template<template<class> class use, class prec>
struct tk::grm::precision
Match precision of floating-point numbers in digits (for text output)
template<typename keyword, class kw_type, typename... tags>
struct tk::grm::control
Match control parameter, enforce bounds if defined.
template<template<class> class use, typename keyword, typename Tag>
struct tk::grm::discrparam
Match discretization control parameter.
template<typename keyword, typename Tag>
struct tk::grm::component
Match component control parameter.
template<typename keyword, typename Tag>
struct tk::grm::interval
Match interval control parameter.
template<template<class> class use, template<class... Ts> class store>
struct tk::grm::statistics
Parse statistics ... end block.
template<template<class> class use, template<class... Ts> class store>
struct tk::grm::diagnostics
Parse diagnostics ... end block.
template<template<class> class use, typename Tag, typename... Tags>
struct tk::grm::lua
Parse lua ... end block and store it behind Tag, Tags..., tag::lua.
template<typename keyword, typename kw_type, typename model, typename Tag>
struct tk::grm::parameter
Match model parameter.
template<template<class> class use, typename keyword, typename option, typename model, typename... tags>
struct tk::grm::rng
Match rng parameter.
template<template<class> class use, class rngs>
struct tk::grm::rngblock
Match rngs ... end block.
template<template<class> class use, typename keyword, template<class, class...> class store, template<class, class...> class start, template<class, class, class...> class check, typename eq, typename param, typename... xparams>
struct tk::grm::parameter_vector
template<template<class> class use, typename keyword, class option, template<class, class...> class store, template<class, class...> class start, template<class, class> class check, typename eq, typename param>
struct tk::grm::option_vector
template<template<class> class use, typename model, typename Tag>
struct tk::grm::depvar
Match model parameter dependent variable.
template<template<class> class use>
struct tk::grm::title
Match and set keyword 'title'.
template<template<class> class use, typename keyword, typename option, typename p, typename... tags>
struct tk::grm::policy
Match and set policy parameter.
template<class keyword, class store>
struct tk::grm::pdf_option
Match and set a PDF option.
template<template<class> class use, template<class... Ts> class store>
struct tk::grm::pdfs
Match pdfs ... end block.
template<typename keyword, typename pool>
struct tk::grm::use
Ensure that a grammar only uses keywords from a pool of pre-defined keywords.