Class: L43Peg::Input

Inherits:
Object
  • Object
show all
Extended by:
L43::OpenObject
Defined in:
lib/l43_peg/input.rb

Instance Method Summary collapse

Instance Method Details

#debugObject



9
10
11
12
13
# File 'lib/l43_peg/input.rb', line 9

def debug
  "Input<" +
  ["col:#{col}", "input:#{input.inspect}", "lnb:#{lnb}", "context:#{context.inspect}"].join(" ") +
  ">"
end

#drop(by = nil) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/l43_peg/input.rb', line 15

def drop(by=nil)
  case by
  when nil
    _drop_by_n(1)
  when String
    _drop_by_n(by.length)
  else
    _drop_by_n(by)
  end
end

#empty?Boolean

Returns:

  • (Boolean)


26
# File 'lib/l43_peg/input.rb', line 26

def empty? = input.empty?

#head_hr(n, position: false) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/l43_peg/input.rb', line 28

def head_hr(n, position: false)
  if position
    "Input<#{input[0...n].inspect}@#{position_hr}>"
  else
    "Input<#{input[0...n].inspect}>"
  end
end

#positionObject



36
# File 'lib/l43_peg/input.rb', line 36

def position = [@col, @lnb]

#position_hrObject



38
# File 'lib/l43_peg/input.rb', line 38

def position_hr = [@col, @lnb].join(":")