|
coan
6.0.1
A C/C++ Configuration Analyzer
|
struct explained_expansion encapsulates macro-expansion of a reference when the --explain option is operative
More...
#include <explained_expansion.h>
Public Member Functions | |
| explained_expansion (reference const &ref, explained_expansion *parent=nullptr) | |
| Explicitly construct from a reference and optional parent. More... | |
| unsigned | expand () override |
| Perform the explained expansion of the reference, returning the numbe of edits applied. | |
| void | throw_self () const override |
| Throw *this. | |
Public Member Functions inherited from expansion_base | |
| expansion_base (reference const &ref) | |
| Construct from a reference. | |
| std::string const & | value () const |
| Get the current expanded value of the reference. | |
| std::string const & | invocation () const override |
| Get a string representing the invocation of the reference with the current expansions of its arguments. | |
Public Member Functions inherited from reference | |
| reference (symbol::locator loc, reference const *invoker=nullptr) | |
| Construct given a symbol locator. More... | |
| reference (symbol::locator loc, argument_list const &args, reference const *invoker=nullptr) | |
Construct given a symbol locator argument_list and optional parent reference. | |
| template<class CharSeq > | |
| reference (symbol::locator loc, chewer< CharSeq > &chew, reference const *invoker=nullptr) | |
Construct given a symbol locator, a chewer<CharSeq>, and optional parent reference. More... | |
| bool | operator== (reference const &other) const |
| Equality. More... | |
| bool | operator!= (reference const &other) const |
| Inequality. | |
| std::string const & | id () const |
| Get the name of the symbol referenced. | |
| std::string const & | expansion () |
| Get the expansion of the reference. | |
| evaluation const & | eval () |
| Get the evaluation of the expansion. | |
| bool | reported () |
| Say whether this reference has been reported. | |
| bool | complete () |
| Say whether this reference has been fully expanded. | |
| void | report () |
| Report this reference appropriately. | |
| symbol::locator const & | callee () const |
| Get a [const] the state of the referenced symbol. | |
| symbol::locator | callee () |
| argument_list const & | args () const |
Get a [const] reference to the argument_list of the reference. | |
| argument_list & | args () |
Protected Member Functions | |
| unsigned | expand (std::string &str) override |
| Expand a string, returning the number of edits applied. | |
| unsigned | bubble_edit (explained_expansion const &e, bool do_self=true) |
Recursively replace remaining occurrences of a reference in the parents of this explained_expansion and optionally this explained_expansion itself. More... | |
| void | report_intermediate_value () |
| Report the latest value of the expansion. | |
Protected Member Functions inherited from expansion_base | |
| 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. | |
| bool | substitute () |
| Substitute the fully expanded arguments into the definition of the reference, returning true if the current value of the expansion is changed. | |
Protected Member Functions inherited from reference | |
| 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... | |
Protected Attributes | |
| explained_expansion * | _parent = nullptr |
Pointer to the explained_expansion, if any, of which this one is a sub-expansion. | |
| unsigned | _step = 0 |
| Sequential number of the explained expansion step. | |
Protected Attributes inherited from expansion_base | |
| std::string | _value |
| The current expanded value. | |
| size_t | _cur_arg = 0 |
| Index of the first argument not yet fully expanded. | |
Protected Attributes inherited from reference | |
| symbol::locator | _referee |
The symbol_state of the referenced symbol. | |
| argument_list | _args |
The argument_list of the reference. | |
| reference const * | _invoker |
| Pointer to the reference that invokes this one, if any, else null. | |
| std::string | _key |
| Key to this reference in the reference cache. | |
Additional Inherited Members | |
Public Types inherited from reference | |
| using | insert_result = reference_cache::insert_result |
| Type of result from cache insertion. | |
Static Public Member Functions inherited from expansion_base | |
| static std::unique_ptr < expansion_base > | factory (bool explain, reference const &ref) |
Global factory of subclasses of expansion_base More... | |
| static constexpr unsigned | max_expansion_size () |
| Cut-off size for macro-expansions. | |
struct explained_expansion encapsulates macro-expansion of a reference when the --explain option is operative
Definition at line 48 of file explained_expansion.h.
|
inlineexplicit |
Explicitly construct from a reference and optional parent.
| ref | The reference to be expanded |
| parent | If not null, then a pointer to the expansion_base from whose expansion this one accrues. |
Definition at line 55 of file explained_expansion.h.
|
protected |
Recursively replace remaining occurrences of a reference in the parents of this explained_expansion and optionally this explained_expansion itself.
| e | An explained_expansion. |
| do_self | If true, this explained_expansion itself is edited and then recursive parents. If false, the parent of the explained_expansion, if any, is edited and then recursive parents. |
In each `explained_expansion` reached, if
`args_expansion_done()` is false then occurrences of the reference of
e are replaced with the value of e throughout the expanded argument at its cur_arg_index() and subsquent arguments. Otherwise the reference of e` is replaced with its value throughout the current value of the explained_expansion.The effect of this member function in explained macro expansion is to propagate immediately each edit performed in this expansion to the expansions, if any, from which it is descended.