class ABNF::Parser::Compiler::Token

Attributes

abnf[R]
type[R]

Public Class Methods

new(type, abnf=nil) click to toggle source
# File lib/abnf/parser/compiler/token.rb, line 8
def initialize type, abnf=nil
  @abnf = abnf
  @type = type
end

Public Instance Methods

==(other_token) click to toggle source
# File lib/abnf/parser/compiler/token.rb, line 13
def == other_token
  return false unless other_token.respond_to? :abnf
  return false unless other_token.respond_to? :type

  self.abnf == other_token.abnf and self.type == other_token.type
end
inspect() click to toggle source
# File lib/abnf/parser/compiler/token.rb, line 24
def inspect
  "(#{type} #{abnf.inspect})"
end
lexeme() click to toggle source
# File lib/abnf/parser/compiler/token.rb, line 20
def lexeme
  abnf
end
underscore_type() click to toggle source
# File lib/abnf/parser/compiler/token.rb, line 28
def underscore_type
  @underscore_type ||= type.downcase.gsub('-', '_')
end