struct expansion_base
is an abstract base for classes that encapsulate a mode of macro-expansion of a reference.
More...
#include <expansion_base.h>
|
void | set_expansion_flags () |
| Assign the expand-flags of the reference's arguments, if any, in accordance with the definition, if any, of the referenced symbol. More...
|
|
size_t | seek_expandable_arg () |
| Seek to the next argument of the reference, if any, that is eligible for expansion, returning its index if found, else args.size()
|
|
void | edit (std::string &str, size_t at, size_t len, std::string const &replacement) |
|
unsigned | edit_buf (std::string &str, expansion_base const &e, size_t off=0) |
| Replace all remaining occurrences of a reference throughout a string. More...
|
|
unsigned | edit_trailing_args (expansion_base const &e, size_t start=0) |
| Replace all occurrences of a reference throughout a terminal segment of this expansions's arguments. More...
|
|
bool | args_expansion_done () const |
| Say whether all arguments are fully expanded.
|
|
virtual unsigned | expand (std::string &str)=0 |
| Expand a string, returning the number of edits applied.
|
|
bool | substitute () |
| Substitute the fully expanded arguments into the definition of the reference, returning true if the current value of the expansion is changed.
|
|
bool | explain () const |
| Say whether we are to explain this reference.
|
|
bool | explaining () const |
| Say whether this reference is to be explained or is descended from one being explained.
|
|
bool | reportable () const |
| Say whether this reference is eligible for reporting.
|
|
void | do_report () |
| Do reporting of the reference if reportable.
|
|
reference_cache::iterator | lower_bound () const |
| Get a lower bound to this reference in the reference cache.
|
|
reference_cache::insert_result | lookup () |
| Lookup the reference in the cache. More...
|
|
reference_cache::value_type | digest () |
| Return a cache entry for this reference.
|
|
reference_cache::entry | expand (bool explain) |
| Expand the reference. More...
|
|
evaluation | validate () const |
| Diagnose a syntactically invalid reference. More...
|
|
struct expansion_base
is an abstract base for classes that encapsulate a mode of macro-expansion of a reference.
Definition at line 50 of file expansion_base.h.
void expansion_base::edit |
( |
std::string & |
str, |
|
|
size_t |
at, |
|
|
size_t |
len, |
|
|
std::string const & |
replacement |
|
) |
| |
|
inlineprotected |
Edit a string
- Parameters
-
str | The string to edit |
at | Offset in str where replacement starts |
len | Length to be replaced. |
replacement | String to replace the len characters at at |
Definition at line 122 of file expansion_base.h.
unsigned expansion_base::edit_buf |
( |
std::string & |
str, |
|
|
expansion_base const & |
e, |
|
|
size_t |
off = 0 |
|
) |
| |
|
protected |
Replace all remaining occurrences of a reference throughout a string.
- Parameters
-
str | The string to edit. |
e | An expansion, s.t. that each ocurrence of that expansion's reference in str is to be replaced with its expanded value. |
off | Offset into str at which to start replacement. |
- Returns
- The number of replacements made.
Definition at line 116 of file expansion_base.cpp.
unsigned expansion_base::edit_trailing_args |
( |
expansion_base const & |
e, |
|
|
size_t |
start = 0 |
|
) |
| |
|
protected |
Replace all occurrences of a reference throughout a terminal segment of this expansions's arguments.
- Parameters
-
e | An expansion. |
start | Index into the arguments of this expansion. |
- Returns
- The number of replacements made.
In each expandable argument of the reference of this expansion, starting at index start
, all occurrences of the reference of e
are replaced with the value of e
Definition at line 137 of file expansion_base.cpp.
void expansion_base::set_expansion_flags |
( |
| ) |
|
|
protected |
Assign the expand-flags of the reference's arguments, if any, in accordance with the definition, if any, of the referenced symbol.
The definition of the referenced symbol determines whether an argument of the reference is to be expanded, quoted, or retained literally.
Definition at line 85 of file expansion_base.cpp.
The documentation for this struct was generated from the following files: