class RKelly::Lexeme
Attributes
name[R]
pattern[R]
Public Class Methods
new(name, pattern, &block)
click to toggle source
# File lib/rkelly/lexeme.rb, line 6 def initialize(name, pattern, &block) @name = name @pattern = pattern @block = block end
Public Instance Methods
match(string)
click to toggle source
# File lib/rkelly/lexeme.rb, line 12 def match(string) match = pattern.match(string) return Token.new(name, match.to_s, &@block) if match match end