Class: Lrama::Grammar::Destructor

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ident_or_tags:, token_code:, lineno:) ⇒ Destructor

Returns a new instance of Destructor.



12
13
14
15
16
# File 'lib/lrama/grammar/destructor.rb', line 12

def initialize(ident_or_tags:, token_code:, lineno:)
  @ident_or_tags = ident_or_tags
  @token_code = token_code
  @lineno = lineno
end

Instance Attribute Details

#ident_or_tagsObject (readonly)

: Array



7
8
9
# File 'lib/lrama/grammar/destructor.rb', line 7

def ident_or_tags
  @ident_or_tags
end

#linenoObject (readonly)

: Integer



9
10
11
# File 'lib/lrama/grammar/destructor.rb', line 9

def lineno
  @lineno
end

#token_codeObject (readonly)

: Lexer::Token::UserCode



8
9
10
# File 'lib/lrama/grammar/destructor.rb', line 8

def token_code
  @token_code
end

Instance Method Details

#translated_code(tag) ⇒ Object



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

def translated_code(tag)
  Code::DestructorCode.new(type: :destructor, token_code: token_code, tag: tag).translated_code
end