SciLex
A header-only C++20 lexer built on REAL
Loading...
Searching...
No Matches
Public Types | Public Attributes | List of all members
scilex::mode_action Struct Reference

A mode transition, fired when its rule wins, acting on the scan's mode stack: enter a nested mode, leave the current one, or replace it. More...

#include <lexer.hpp>

Public Types

enum class  op { push , pop , set }
 The kind of transition. More...
 

Public Attributes

op operation
 Which transition to perform.
 
std::string target {}
 The mode push/set enters; ignored (and omittable) for pop.
 
std::size_t target_id {0}
 The interned id of target, resolved once when the lexer is built (see scilex::lexer::build_dispatch) so the per-token transition is a field read, not a name→id map lookup. Internal cache: a caller leaves it at 0 and sets only target; pop leaves it unused.
 

Detailed Description

A mode transition, fired when its rule wins, acting on the scan's mode stack: enter a nested mode, leave the current one, or replace it.

Definition at line 63 of file lexer.hpp.

Member Enumeration Documentation

◆ op

enum class scilex::mode_action::op
strong

The kind of transition.

Enumerator
push 

Enter target, remembering the mode below it (a nested context).

pop 

Leave the current mode, returning to the one beneath it.

set 

Replace the current mode with target (stack depth unchanged).

Definition at line 66 of file lexer.hpp.

Member Data Documentation

◆ operation

op scilex::mode_action::operation

Which transition to perform.

Definition at line 73 of file lexer.hpp.

◆ target

std::string scilex::mode_action::target {}

The mode push/set enters; ignored (and omittable) for pop.

Definition at line 74 of file lexer.hpp.

◆ target_id

std::size_t scilex::mode_action::target_id {0}

The interned id of target, resolved once when the lexer is built (see scilex::lexer::build_dispatch) so the per-token transition is a field read, not a name→id map lookup. Internal cache: a caller leaves it at 0 and sets only target; pop leaves it unused.

Definition at line 80 of file lexer.hpp.


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