Module: IOSParser

Defined in:
lib/ios_parser.rb,
lib/ios_parser.rb,
lib/ios_parser/ios.rb,
lib/ios_parser/lexer.rb,
lib/ios_parser/token.rb,
lib/ios_parser/version.rb,
lib/ios_parser/ios/command.rb,
lib/ios_parser/ios/document.rb,
lib/ios_parser/ios/queryable.rb,
ext/ios_parser/c_lexer/lexer.c

Defined Under Namespace

Classes: CLexer, IOS, LexError, PureLexer, Token

Constant Summary collapse

Lexer =
lexer

Class Method Summary collapse

Class Method Details

.c_lexerObject



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/ios_parser.rb', line 17

def self.c_lexer
  if RUBY_VERSION < '2.1'
    warn 'The C Lexer requires Ruby 2.1 or later. The pure Ruby lexer will '\
         'be used instead. You can eliminate this warning by upgrading ruby '\
         'or explicitly using the pure-Ruby lexer '\
         "(require 'ios_parser/pure')"
    pure_lexer
  else
    require_relative 'ios_parser/c_lexer'
    CLexer
  end
end

.hash_to_ios(hash) ⇒ Object



46
47
48
# File 'lib/ios_parser.rb', line 46

def hash_to_ios(hash)
  IOSParser::IOS::Document.from_hash(hash)
end

.json_to_ios(text) ⇒ Object



50
51
52
# File 'lib/ios_parser.rb', line 50

def json_to_ios(text)
  hash_to_ios JSON.parse(text)
end

.lexerObject



7
8
9
10
11
12
13
14
15
# File 'lib/ios_parser.rb', line 7

def self.lexer
  if const_defined?(:PureLexer)
    PureLexer
  else
    c_lexer
  end
rescue LoadError
  pure_lexer
end

.parse(input) ⇒ Object



42
43
44
# File 'lib/ios_parser.rb', line 42

def parse(input)
  IOSParser::IOS.new.call(input)
end

.pure_lexerObject



30
31
32
33
# File 'lib/ios_parser.rb', line 30

def self.pure_lexer
  require 'ios_parser/lexer'
  PureLexer
end

.versionObject



3
4
5
# File 'lib/ios_parser/version.rb', line 3

def version
  '0.9.0'
end