class CLTK::Lexer::Environment

Overview

All actions passed to LexerCore.rule are evaluated inside an instance of the Environment class or its subclass (which must have the same name). This class provides functions for manipulating lexer state and flags. see http://carc.in/#/r/1i9

Defined in:

cltk/lexer/environment.cr

Class Method Summary

Instance Method Summary

Instance methods inherited from class Object

in?(collection : Array | Set) in?

Class Method Detail

def self.new(start_state, match = nil) #

[View source]

Instance Method Detail

def clear_flags #

Unsets all flags in the current environment.

@return [void]


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

@return [Array<Symbol>] Flags currently set in this environment.


[View source]
def match #

[View source]
def match=(match) #

@return [Match] Match object generated by a rule's regular expression.


[View source]
def pop_state #

Pops a state from the state stack.

@return [void]


[View source]
def push_state(state) #

Pushes a new state onto the state stack.

@return [void]


[View source]
def set_flag(flag) #

Sets a flag in the current environment.

@param [Symbol] flag Flag to set as enabled.

@return [void]


[View source]
def set_state(state) #

Sets the value on the top of the state stack.

@param [Symbol] state New state for the lexing environment.

@return [void]


[View source]
def state #

@return [Symbol] Current state of the lexing environment.


[View source]
def unset_flag(flag) #

Unsets a flag in the current environment.

@param [Symbol] flag Flag to unset.

@return [void]


[View source]