Smart indentation management for code parsing. More...
#include <smartDedent.hpp>
Public Member Functions | |
| me & | countDown () |
| Decrements the internal count, typically indicating a pending dedent. | |
| me & | countUp () |
| Increments the internal count, typically indicating a pending dedent. | |
| me & | useLater () |
| Enables dedent tracking for future parsing, deferring any pending dedents. | |
| nint | dedent () |
| Generates and returns a dedent token based on the internal count. | |
| void | rel () |
| nbool | canDedent () const |
| nbool | isOn () const |
Smart indentation management for code parsing.
A class that parser uses to count and manage in an array how many leading spaces there are each time it creates a scope with indentation. For example, when parsing the following byeol code:
If the parser is parsing at position 1, smartDedent's internal array value is [0, 4, 6]. That is, the number of spaces for the outermost scope is smartDedent[0] = 0, and the number of spaces proving it's the scope of the innermost device scope is smartDedent[smartDedent.len() - 1] = 6, meaning there should be 6 leading spaces.
| me & by::smartDedent::countDown | ( | ) |
Decrements the internal count, typically indicating a pending dedent.
| me & by::smartDedent::countUp | ( | ) |
Increments the internal count, typically indicating a pending dedent.
| nint by::smartDedent::dedent | ( | ) |
Generates and returns a dedent token based on the internal count.
| me & by::smartDedent::useLater | ( | ) |
Enables dedent tracking for future parsing, deferring any pending dedents.