ScopeMacro() {}
ScopeMacro(DocIterator const & s, MacroData const & m)
: scope(s), macro(m) {}
+ // The SCOPE is really just the last position at which the macro
+ // is in force. This will be the end of the file (if there are no
+ // children) unless it is in (say) a note, or an inactive branch,
+ // in which case it will be the end of that construct.
DocIterator scope;
MacroData macro;
};
typedef map<DocIterator, ScopeMacro> PositionScopeMacroMap;
- typedef map<docstring, PositionScopeMacroMap> NamePositionScopeMacroMap;
+ typedef map<docstring, PositionScopeMacroMap> MacroMap;
/// map from the macro name to the position map,
/// which maps the macro definition position to the scope and the MacroData.
- NamePositionScopeMacroMap macros;
+ MacroMap macros;
/// Each child Buffer is listed in this map, together with where
- /// it is included in this Buffer.
+ /// it is first included in this Buffer.
typedef map<Buffer const * const, DocIterator> BufferPositionMap;
BufferPositionMap children_positions;
/// We also have a map from the positions where Buffers are included
MacroData const * bestData = nullptr;
// find macro definitions for name
- NamePositionScopeMacroMap::const_iterator nameIt = macros.find(name);
+ MacroMap::const_iterator nameIt = macros.find(name);
if (nameIt != macros.end()) {
- // find last definition in front of pos or at pos itself
+ // find last definition in front of pos
PositionScopeMacroMap::const_iterator it
= greatest_below(nameIt->second, pos);
if (it != nameIt->second.end()) {
{
if (d->macro_lock)
return;
-
+#if 0
+ LYXERR0("Starting macro dump");
+ for (auto const & m : d->macros) {
+ LYXERR0(m.first);
+ for (auto const & m1 : m.second) {
+ LYXERR0(m1.first);
+ LYXERR0("Scope: " << m1.second.scope);
+ LYXERR0("Def: " << m1.second.macro.definition());
+ LYXERR0("");
+ }
+ }
+ LYXERR0("Ending macro dump");
+ LYXERR0("");
LYXERR(Debug::MACROS, "updateMacro of " << d->filename.onlyFileName());
-
+#endif
+
// start with empty table
d->macros.clear();
d->children_positions.clear();