Class: Furnace::AVM2::Tokens::ElseToken
- Inherits:
-
Code::NonterminalToken
- Object
- Code::NonterminalToken
- Furnace::AVM2::Tokens::ElseToken
- Defined in:
- lib/furnace-avm2/source/implementation_tokens/else_token.rb
Instance Method Summary collapse
-
#initialize(origin, body, options = {}) ⇒ ElseToken
constructor
A new instance of ElseToken.
- #to_structure(options = {}) ⇒ Object
- #to_text ⇒ Object
Constructor Details
#initialize(origin, body, options = {}) ⇒ ElseToken
Returns a new instance of ElseToken.
4 5 6 7 |
# File 'lib/furnace-avm2/source/implementation_tokens/else_token.rb', line 4 def initialize(origin, body, ={}) super(origin, [body], ) @body = body end |
Instance Method Details
#to_structure(options = {}) ⇒ Object
20 21 22 |
# File 'lib/furnace-avm2/source/implementation_tokens/else_token.rb', line 20 def to_structure(={}) structurize "else ...", end |
#to_text ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/furnace-avm2/source/implementation_tokens/else_token.rb', line 9 def to_text header = "else" if @body.is_a? ScopeToken "#{header} #{@body.to_text}" elsif @body "#{header}\n#{indent @body.to_text}" else "#{header} " end end |