struct CLTK::Lexer::Rule

Overview

The Rule class is used simply for data encapsulation.

Defined in:

cltk/lexer/rule.cr

Constructors

Instance Method Summary

Instance methods inherited from class Object

in?(collection : Array | Set) in?

Constructor Detail

def self.new(pattern : Regex, state : Symbol, flags : Array(Symbol), &action : Proc(Regex::MatchData, String, CLTK::Lexer::Environment, BlockReturn)) #

[View source]

Instance Method Detail

def action : Regex::MatchData, String, CLTK::Lexer::Environment -> {String | Symbol | Nil, Array(String) | Float64 | Int32 | String | Nil} #

@return [Proc] Token producting action to be taken when this rule is matched.


[View source]
def flags : Array(Symbol) #

@return [Array] Flags currently set in this lexing environment.


[View source]
def pattern : Regex #

@return [Regexp] Regular expression for matching this rule.


[View source]