Smart dedent handler for indentation-based parsing. More...
#include <stelaSmartDedent.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 dedent handler for indentation-based parsing.
A class that counts and manages in an array how many leading spaces exist whenever stelaParser creates a scope based on indentation.
For example, when parsing this stela code:
If the parser is parsing at position 1, smartDedent's internal array is [0, 4, 6]. This means the outermost scope's whitespace count is smartDedent[0] = 0, and the innermost device scope's whitespace count is smartDedent[smartDedent.len() - 1] = 6, meaning 6 leading spaces are required.
| me & by::stelaSmartDedent::countDown | ( | ) |
Decrements the internal count, typically indicating a pending dedent.
| me & by::stelaSmartDedent::countUp | ( | ) |
Increments the internal count, typically indicating a pending dedent.
| nint by::stelaSmartDedent::dedent | ( | ) |
Generates and returns a dedent token based on the internal count.
| me & by::stelaSmartDedent::useLater | ( | ) |
Enables dedent tracking for future parsing, deferring any pending dedents.