module

Obelisk::ContextRuleHelpers

Helper module for creating common context-aware rules

Class methods

bracket_tracking_rule(open_pattern : Regex, close_pattern : Regex, open_type : TokenType, close_type : TokenType, state_to_push : String | Nil = nil) : Array(ContextAwareRule)

Create rule for balanced bracket tracking

Source
contextual_comment_rule(pattern : Regex, context_conditions : Hash(String, TokenType)) : ContextAwareRule

Create rule for comment that varies by language context

Source
history_dependent_rule(pattern : Regex, required_recent_type : TokenType, success_type : TokenType, failure_type : TokenType, max_lookback = 5) : ContextAwareRule

Create rule that depends on recent token history

Source
string_interpolation_rule(start_pattern : Regex, state_to_push : String, token_type : TokenType = TokenType::LiteralStringInterpol) : ContextAwareRule

Create rule for string interpolation

Source
template_expression_rule(start_delim : String, end_delim : String, template_state : String, expr_state : String) : Array(ContextAwareRule)

Create rule for template language expressions

Source