Class: Foxtail::Syntax::Parser::AST::Span

Inherits:
BaseNode
  • Object
show all
Defined in:
lib/foxtail/syntax/parser/ast/span.rb

Overview

Represents a source code span with start and end positions Used to track the location of AST nodes in the original source text

Instance Attribute Summary collapse

Attributes inherited from BaseNode

#type

Instance Method Summary collapse

Methods inherited from BaseNode

#==, #accept, #children, #to_h

Constructor Details

#initialize(start_pos, end_pos) ⇒ Span

Returns a new instance of Span.



13
14
15
16
17
# File 'lib/foxtail/syntax/parser/ast/span.rb', line 13

def initialize(start_pos, end_pos)
  super()
  @start = start_pos
  @end = end_pos
end

Instance Attribute Details

#endObject

Returns the value of attribute end.



11
12
13
# File 'lib/foxtail/syntax/parser/ast/span.rb', line 11

def end
  @end
end

#startObject

Returns the value of attribute start.



10
11
12
# File 'lib/foxtail/syntax/parser/ast/span.rb', line 10

def start
  @start
end