Class: XcodeIDE::IOScanner
- Inherits:
-
Object
- Object
- XcodeIDE::IOScanner
- Defined in:
- lib/xcodeide/io_scanner.rb
Constant Summary collapse
- TOKENS =
[ ?}, ?=, ?;, ?{, ?( ].freeze
- DELIMS =
[ ?), ?, ].freeze
Instance Attribute Summary collapse
-
#term ⇒ Object
readonly
Returns the value of attribute term.
Instance Method Summary collapse
- #delimit ⇒ Object
-
#initialize(io) ⇒ IOScanner
constructor
A new instance of IOScanner.
- #tokenize ⇒ Object
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
#term ⇒ Object (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
#delimit ⇒ Object
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 |
#tokenize ⇒ Object
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 |