Class: RLTK::Lexer::Rule
Overview
The Rule class is used simply for data encapsulation.
Instance Attribute Summary collapse
-
#action ⇒ Proc
readonly
Token producting action to be taken when this rule is matched.
-
#flags ⇒ Array<Symbol>
readonly
Flags currently set in this lexing environment.
-
#pattern ⇒ Regexp
readonly
Regular expression for matching this rule.
Instance Method Summary collapse
-
#initialize(pattern, action, state, flags) ⇒ Rule
constructor
Instantiates a new Rule object.
Constructor Details
#initialize(pattern, action, state, flags) ⇒ Rule
Instantiates a new Rule object.
354 355 356 357 358 359 |
# File 'lib/rltk/lexer.rb', line 354 def initialize(pattern, action, state, flags) @pattern = pattern @action = action @state = state @flags = flags end |
Instance Attribute Details
#action ⇒ Proc (readonly)
Returns Token producting action to be taken when this rule is matched.
340 341 342 |
# File 'lib/rltk/lexer.rb', line 340 def action @action end |
#flags ⇒ Array<Symbol> (readonly)
Returns Flags currently set in this lexing environment.
346 347 348 |
# File 'lib/rltk/lexer.rb', line 346 def flags @flags end |
#pattern ⇒ Regexp (readonly)
Returns Regular expression for matching this rule.
343 344 345 |
# File 'lib/rltk/lexer.rb', line 343 def pattern @pattern end |