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<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::Store
Rule used to trigger action.
template<typename tag, typename... tags>
struct tk::grm::action<Store<tag, tags...>>
template<typename... tags>
struct tk::grm::Invert_switch
Rule used to trigger action.
template<typename... tags>
struct tk::grm::action<Invert_switch<tags...>>
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<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<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'.
struct tk::grm::number
Parse a number: an optional sign followed by digits.
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
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<typename keyword, typename pool>
struct tk::grm::use
Ensure that a grammar only uses keywords from a pool of pre-defined keywords.