TextMateLib 1.0
Modern C++ implementation of the TextMate syntax highlighting engine
Loading...
Searching...
No Matches
tml::StateStack Class Referenceabstract

Abstract interface representing the parsing state at the end of a line. More...

#include </home/runner/work/TextMateLib/TextMateLib/packages/tml-cpp/src/types.h>

Inherited by tml::StateStackImpl.

Public Member Functions

virtual int getDepth () const =0
 Get the nesting depth (number of active rules)
 
virtual StateStack * clone ()=0
 Create an independent copy of this state.
 
virtual bool equals (StateStack *other)=0
 Check if this state equals another (for incremental tokenization)
 

Detailed Description

Abstract interface representing the parsing state at the end of a line.

StateStack is immutable and encodes the hierarchy of active grammar rules after parsing a line. Two StateStacks are equal() if and only if parsing can resume from the exact same position (all scopes and nesting are identical). This enables incremental tokenization optimization: if prevState equals previousLine's ruleStack, the line's tokens may not have changed (early stopping).

Definition at line 55 of file types.h.

Member Function Documentation

◆ clone()

virtual StateStack * tml::StateStack::clone ( )
pure virtual

Create an independent copy of this state.

Returns
Dynamically allocated copy (caller must delete)

◆ equals()

virtual bool tml::StateStack::equals ( StateStack *  other)
pure virtual

Check if this state equals another (for incremental tokenization)

Parameters
otherStateStack to compare with
Returns
True if states represent identical parsing positions
Note
Critical for incremental tokenization performance

◆ getDepth()

virtual int tml::StateStack::getDepth ( ) const
pure virtual

Get the nesting depth (number of active rules)

Returns
Stack depth (0 for initial state)

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