Class: Lrama::Grammar::Type

Inherits:
Object
  • Object
show all
Defined in:
lib/lrama/grammar/type.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, tag:) ⇒ Type

Returns a new instance of Type.



19
20
21
22
# File 'lib/lrama/grammar/type.rb', line 19

def initialize(id:, tag:)
  @id = id
  @tag = tag
end

Instance Attribute Details

#idObject (readonly)

TODO: rbs-inline 0.11.0 doesn't support instance variables. Move these type declarations above instance variable definitions, once it's supported. see: https://github.com/soutaro/rbs-inline/pull/149

@rbs! @id: Lexer::Token::Base @tag: Lexer::Token::Tag



15
16
17
# File 'lib/lrama/grammar/type.rb', line 15

def id
  @id
end

#tagObject (readonly)

: Lexer::Token::Tag



16
17
18
# File 'lib/lrama/grammar/type.rb', line 16

def tag
  @tag
end

Instance Method Details

#==(other) ⇒ Object



25
26
27
28
29
# File 'lib/lrama/grammar/type.rb', line 25

def ==(other)
  self.class == other.class &&
  self.id == other.id &&
  self.tag == other.tag
end