class Lex::Lexeme
Represents token definition
Attributes
action[R]
name[R]
pattern[R]
Public Class Methods
new(name, pattern, &action)
click to toggle source
# File lib/lex/lexeme.rb, line 8 def initialize(name, pattern, &action) @name = name @pattern = pattern @action = action end
Public Instance Methods
==(other)
click to toggle source
@api public
# File lib/lex/lexeme.rb, line 23 def ==(other) @name == other.name end
match(scanner)
click to toggle source
# File lib/lex/lexeme.rb, line 14 def match(scanner) match = scanner.check(pattern) if match return Token.new(name, match.to_s, &action) end match end