Class: XcodeIDE::IOScanner

Inherits:
Object
  • Object
show all
Defined in:
lib/xcodeide/io_scanner.rb

Constant Summary collapse

TOKENS =
[ ?}, ?=, ?;, ?{, ?( ].freeze
DELIMS =
[ ?), ?, ].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(io) ⇒ IOScanner

Returns a new instance of IOScanner.



9
10
11
# File 'lib/xcodeide/io_scanner.rb', line 9

def initialize(io)
  @io = io
end

Instance Attribute Details

#termObject (readonly)

Returns the value of attribute term.



7
8
9
# File 'lib/xcodeide/io_scanner.rb', line 7

def term
  @term
end

Instance Method Details

#delimitObject



24
25
26
27
28
29
30
31
32
33
# File 'lib/xcodeide/io_scanner.rb', line 24

def delimit
  @term = ""
  
  while c = @io.getc
    return c if DELIMS.include? c
    term << c
  end
  
  return nil
end

#tokenizeObject



13
14
15
16
17
18
19
20
21
22
# File 'lib/xcodeide/io_scanner.rb', line 13

def tokenize
  @term = ""
  
  while c = @io.getc
    return c if TOKENS.include? c
    term << c
  end
  
  return nil
end