59 (_referee->in_progress() || _referee->invoked()) &&
60 !_referee->deselected() &&
61 !_referee->self_referential();
63 return _invoker->explaining();
71 if (!_referee->self_referential()) {
72 _referee->make_clean();
76 if (_referee->dirty()) {
77 loc->second = digest().second;
78 if (!_referee->self_referential()) {
79 _referee->make_clean();
91 cout <<
"Expanding \"" << invocation();
95 cout <<
" in options\n";
100 string & s =
const_cast<string &
>(resolved.
expansion());
103 if (
size_t(chew) == 0) {
106 if (
size_t(chew) == 0) {
131 pe->reference::invocation(),eval,
false,
false);
140 !_referee->deselected() &&
141 (!_invoker || _referee->configured()));
147 bool clean = result.second;
154 char const * adverb = (clean || lineno == 0) ?
"afresh " :
"unchanged ";
155 cout << invocation();
156 switch(_referee->origin()) {
158 cout <<
": unconfigured";
164 cout <<
": transient";
171 if (_referee->defn()) {
173 if (_referee->parameters()) {
174 cout << _referee->signature() <<
'=';
176 cout << *_referee->defn() <<
"<<";
181 if(_referee->configured()) {
182 if (_referee->parameters().variadic()) {
183 cout <<
": insoluble, because variadic macro parameters "
186 if (_referee->self_referential()) {
187 cout <<
": insoluble, because of infinite regress";
189 cout <<
": expands " << adverb
192 cout <<
": evaluates to "
196 cout <<
": insoluble, because macro expansion too large";
200 cout <<
": insoluble";
204 cout <<
": in options";
215 if (!_args.well_formed()) {
217 "Malformed argument list for \""
218 << invocation() <<
"\"" <<
emit();
220 }
else if (_referee->self_referential()) {
222 << invocation() <<
'\"' <<
emit();
224 }
else if (_referee->parameters().variadic()) {
226 "Sorry, variadic macro expansion is unsupported. "
227 <<
"\"" << invocation() <<
"\"" <<
228 " will not be resolved" <<
emit();
230 }
else if (_args.size() != _referee->parameters().size()) {
231 if (_referee->configured()) {
233 <<
'\"' << _referee->signature()
234 <<
"\" takes " << _referee->parameters().size()
235 <<
" arguments; " << _args.size() <<
" provided" <<
emit();
236 }
else if (_referee->invoked()){
238 <<
"Unconfigured symbol \"" << _referee->id()
239 <<
"\" has already taken " << _referee->parameters().size()
240 <<
" arguments; " << _args.size() <<
" provided" <<
emit();
243 }
else if (!_referee->configured()) {
247 <<
"Function-like invocation of undefined symbol: \""
248 << invocation() <<
"\" (option --implicit)" <<
emit();
254 }
else if (_referee->defn() && _referee->defn()->empty()) {
static parsed_line & cur_line()
Get a reference to the current output line.
static iterator insert(value_type const &v, iterator hint)
Insert a value_type into the cache.
static bool implicit()
Do we implicitly --undef all unconfigured symbols?
error_msg< 18 > error_mismatched_macro_args
Report wrong number of macro arguments for symbol.
error_msg< 17 > error_malformed_macro
Report a malformed macro parameter list.
void do_report()
Do reporting of the reference if reportable.
static bool at_end(Iter i)
Say whether an iterator points to the end of the cache.
void set_reported(bool value=true)
Mark the entry as reported, or not.
The symbol is globally configured by a commandline option.
integer const & value() const
Get the integral value of the expression.
warning_msg< 34 > warning_inconsistent_calls
Report inconsistent argument lists for unconfigured symbol references.
warning_msg< 12 > warning_infinite_regress
Report a symbol has a circular definition.
static command_code get_command()
Get the operative coan command code.
Encapsulates parsing of preprocessor expressions.
map::iterator iterator
Iterator type on map
map::value_type value_type
Value-type of map
The symbol is not configured.
chew_mode::string_literal const string_literal
An exemplar chew_mode::string_literal
void set_insoluble()
Classify the expression as insoluble.
bool reportable() const
Say whether this reference is eligible for reporting.
reference_cache::insert_result lookup()
Lookup the reference in the cache.
error_msg< 19 > error_macro_call_on_undefined
Report attempting macro-ref on undefined symbol.
static bool explain_references()
Do we report the progressive expansion of symbol references?
reference_cache::insert_result insert_result
Type of result from cache insertion.
static std::string in_file_name()
Get the name of the current source file.
std::string citable(chewer< std::string > &chew, size_t len=std::string::npos)
Make a citable version of length-delimited text.
void set_empty()
Classify the expression as empty.
unsigned num() const
Get the greatest source line number spanned by this line.
reference_cache::value_type digest()
Return a cache entry for this reference.
reference_cache::entry expand(bool explain)
Expand the reference.
evaluation const & eval() const
Get a [const] reference to the evaluation of the cached reference.
static bool list_at_most_once_per_file()
Say whether items are reportable at most once per file.
std::string const & expansion() const
Get the expansion of the cached reference.
static bool expand_references()
Do we report the expansions reported symbols?
The tag class is inserted in a diagnostic_base to tell it to emit itself.
static std::unique_ptr< expansion_base > factory(bool explain, reference const &ref)
Global factory of subclasses of expansion_base
bool resolved() const
Say whether the expression has been resolved.
static bool list_location()
Do we report file and line numbers for listed items?
warning_msg< 26 > warning_variadic_macros_unsupported
Apologize that variadic macro expansion is unsupported.
chew_mode::header_name const header_name
An exemplar chew_mode::header_name
The symbol is transiently configured by an in-source directive.
bool reportable()
Is the line reportable for the operative command.
`template struct chewer<CharSeq> is a cursor-like type that is associated with a character-sequence t...
bool insoluble() const
Say whether the expression is insoluble.
evaluation validate() const
Diagnose a syntactically invalid reference.
struct expansion_base is an abstract base for classes that encapsulate a mode of macro-expansion of a...
Encapsulates an entry in the reference cache.
bool empty() const
Say whether the expression is empty.
bool complete() const
Is the cached reference fully expanded?
struct evaluation represents the result of evaluating a putative expression.
bool reported() const
Has the cached reference been reported.
bool explaining() const
Say whether this reference is to be explained or is descended from one being explained.