mirror of
https://github.com/gbdev/rgbds.git
synced 2026-05-08 10:59:36 +00:00
Some refactoring, renaming, and debug assertions for clarity and safety
- Add more `assume()` checks in the lexer - Replace double negative "`disable* = false`" with "`enable* = true`" - Naming convention of "`std::deque<> *Stack`" when relying on `.push_front()` and `.pop_back()`
This commit is contained in:
@@ -87,16 +87,16 @@ struct LexerState {
|
||||
int lastToken;
|
||||
int nextToken;
|
||||
|
||||
std::deque<IfStackEntry> ifStack;
|
||||
std::deque<IfStackEntry> ifStack; // Front is the innermost `IF` block
|
||||
|
||||
bool capturing; // Whether the text being lexed should be captured
|
||||
size_t captureSize; // Amount of text captured
|
||||
std::shared_ptr<std::vector<char>> captureBuf; // Buffer to send the captured text to if set
|
||||
|
||||
bool disableExpansions;
|
||||
size_t expansionScanDistance; // Max distance already scanned for expansions
|
||||
bool expandStrings;
|
||||
std::deque<Expansion> expansions; // Front is the innermost current expansion
|
||||
bool enableExpansions;
|
||||
bool enableStringExpansions;
|
||||
size_t expansionScanDistance; // Max distance already scanned for expansions
|
||||
std::deque<Expansion> expansionStack; // Front is the innermost current expansion
|
||||
|
||||
std::variant<std::monostate, ViewedContent, BufferedContent> content;
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ ReversedIterable<IterableT> reversed(IterableT &&_iterable) {
|
||||
// A map from `std::string` keys to `ItemT` items, iterable in the order the items were inserted.
|
||||
template<typename ItemT>
|
||||
class InsertionOrderedMap {
|
||||
std::deque<ItemT> list;
|
||||
std::deque<ItemT> list; // `deque` does not invalidate item references
|
||||
std::unordered_map<std::string, size_t> map; // Indexes into `list`
|
||||
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user