Class: RLTK::Lexer::Rule
- Inherits:
-
Object
- Object
- RLTK::Lexer::Rule
- Defined in:
- lib/rltk/lexer.rb
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.
364 365 366 367 368 369 |
# File 'lib/rltk/lexer.rb', line 364 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.
350 351 352 |
# File 'lib/rltk/lexer.rb', line 350 def action @action end |
#flags ⇒ Array<Symbol> (readonly)
Returns Flags currently set in this lexing environment.
356 357 358 |
# File 'lib/rltk/lexer.rb', line 356 def flags @flags end |
#pattern ⇒ Regexp (readonly)
Returns Regular expression for matching this rule.
353 354 355 |
# File 'lib/rltk/lexer.rb', line 353 def pattern @pattern end |