Class: ZergXcode::Lexer

Inherits:
Object
  • Object
show all
Defined in:
lib/zerg_xcode/file_format/lexer.rb

Overview

Lexer for flattened object graphs stored in .xcodeproj files.

Constant Summary collapse

SIMPLE_TOKENS =
[ '(', ')', '{', '}', '=', ';', ',' ]

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(string) ⇒ Lexer

Returns a new instance of Lexer.



16
17
18
# File 'lib/zerg_xcode/file_format/lexer.rb', line 16

def initialize(string)
  @scan_buffer = ScanBuffer.new(string)
end

Class Method Details

.tokenize(string) ⇒ Object



124
125
126
# File 'lib/zerg_xcode/file_format/lexer.rb', line 124

def self.tokenize(string)
  Lexer.new(string).tokenize
end

Instance Method Details

#tokenizeObject



20
21
22
23
24
# File 'lib/zerg_xcode/file_format/lexer.rb', line 20

def tokenize
  tokens, token = [], nil
  tokens << token until (token = scan_token).nil?
  tokens
end