Class: Kalculator::Parser::Environment

Inherits:
Environment
  • Object
show all
Defined in:
lib/kalculator/parser.rb

Overview

code taken from spiff-rb

Instance Method Summary collapse

Instance Method Details

#metadata(first_token = nil, last_token = nil) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/kalculator/parser.rb', line 6

def (first_token = nil, last_token = nil)
  first_token ||= @positions.first
  last_token  ||= @positions.last
  begins_at = first_token.stream_offset
  ends_at   = last_token.stream_offset + last_token.length - 1
  {
    offset: begins_at..ends_at,
  }
end