class

Obelisk::ConditionalLexer

Inherits Obelisk::RegexLexer < Obelisk::Lexer < Reference < Object

Conditional lexer that switches behavior based on context

Constructors

new(context_manager : Obelisk::ContextManager = ContextManager.new)
Source

Instance methods

add_context_rule(state : String, rule : ContextAwareRule) : Nil

Add context-aware rule to a state

Source
add_fallback_rule(state : String, rule : LexerRule) : Nil

Add traditional rule as fallback

Source
config
Source
context_manager

Get context manager for external access

Source
find_context_match(context : ParsingContext) : Tuple(ContextAwareRule, Regex::MatchData) | Nil

Find matching rule considering context

Source
rules

Get rules (implements abstract method from RegexLexer)

Source
tokenize(text : String) : TokenIterator

Enhanced tokenizer with context awareness

Source