class RLTK::Lexer::Rule

The Rule class is used simply for data encapsulation.

Attributes

action[R]

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

flags[R]

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

pattern[R]

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

Public Class Methods

new(pattern, action, state, flags) click to toggle source

Instantiates a new Rule object.

@param [Regexp] pattern Regular expression used to match to this rule. @param [Proc] action Token producing action associated with this rule. @param [Symbol] state State in which this rule is active. @param [Array<Symbol>] flags Flags that must be enabled for this rule to match.

# File lib/rltk/lexer.rb, line 364
def initialize(pattern, action, state, flags)
        @pattern    = pattern
        @action     = action
        @state      = state
        @flags      = flags
end