MacroDefinition() {}
MacroDefinition(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.
+ // The scope is the last position at which the macro is in force.
+ // This will be the end of the file (or of the master Buffer) unless
+ // the macro 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;
};
};
MacroTable macro_table;
- /// Each child Buffer is listed in this map, together with where
- /// it is first included in this Buffer.
+ /// Each child Buffer is listed in this map, together with a
+ /// DocIterator that points at the inset where 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
- /// to those Buffers and their scope (whose point RKH does not yet
- /// understand).
- // FIXME Surely one of these is enough? The difference is that
- // children_positions has one entry for each child Buffer, whereas
- // position_to_children has one entry for each InsetInclude (and the
- // same Buffer could be included twice).
+ /// to those Buffers and their 'scope', which is the last point
+ /// at which macro definitions in the included file apply. (See
+ /// the comment above in MacroDefinition.)
+ /// Note that children_positions has one entry for each child Buffer,
+ /// whereas position_to_children has one entry for each InsetInclude
+ /// (and the same Buffer could be included twice).
struct ScopeBuffer {
ScopeBuffer() = default;
ScopeBuffer(DocIterator const & s, Buffer const * b)
// look where the child buffer is included first
Impl::BufferPositionMap::iterator it = d->children_positions.find(&child);
if (it == d->children_positions.end()) {
- LYXERR0("Querying parent for macro when we are not a child!");
+ if (d->file_fully_loaded)
+ LYXERR0("Querying parent for macro when we are not a child!");
return nullptr;
}