Loading...
Searching...
No Matches
by::smartDedent Class Reference

Smart indentation management for code parsing. More...

#include <smartDedent.hpp>

Inheritance diagram for by::smartDedent:

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
 

Detailed Description

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:

name := "my device"
# 1)
Definition tnarr.hpp:9

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.

Member Function Documentation

◆ countDown()

me & by::smartDedent::countDown ( )

Decrements the internal count, typically indicating a pending dedent.

Returns
A reference to this smartDedent instance.

◆ countUp()

me & by::smartDedent::countUp ( )

Increments the internal count, typically indicating a pending dedent.

Returns
A reference to this smartDedent instance.

◆ dedent()

nint by::smartDedent::dedent ( )

Generates and returns a dedent token based on the internal count.

Returns
The token ID for DEDENT, or 0 if no dedent is pending.

◆ useLater()

me & by::smartDedent::useLater ( )

Enables dedent tracking for future parsing, deferring any pending dedents.

Returns
A reference to this smartDedent instance.

The documentation for this class was generated from the following file:
to Top