class CLTK::Lexer::Environment
- CLTK::Lexer::Environment
- Reference
- Object
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.crConstructors
Instance Method Summary
-
#clear_flags
Unsets all flags in the current environment.
-
#flags : Array(Symbol)
@return [Array
] Flags currently set in this environment. -
#match
@return [Match] Match object generated by a rule's regular expression.
-
#match=(match : Regex::MatchData | Nil)
@return [Match] Match object generated by a rule's regular expression.
-
#pop_state
Pops a state from the state stack.
-
#push_state(state)
Pushes a new state onto the state stack.
-
#set_flag(flag)
Sets a flag in the current environment.
-
#set_state(state)
Sets the value on the top of the state stack.
-
#state
@return [Symbol] Current state of the lexing environment.
-
#unset_flag(flag)
Unsets a flag in the current environment.
Instance methods inherited from class Object
in?(collection : Array | Set)
in?
Constructor Detail
Instance Method Detail
@return [Match] Match object generated by a rule's regular expression.
Sets a flag in the current environment.
@param [Symbol] flag Flag to set as enabled.
@return [void]
Sets the value on the top of the state stack.
@param [Symbol] state New state for the lexing environment.
@return [void]
Unsets a flag in the current environment.
@param [Symbol] flag Flag to unset.
@return [void]