Class: ApiDiff::KotlinBCVParser

Inherits:
Parser
  • Object
show all
Defined in:
lib/api_diff/kotlin_bcv_parser.rb

Overview

Biggest Drawback: Does not support optionals :-/

Instance Attribute Summary

Attributes inherited from Parser

#api

Instance Method Summary collapse

Methods inherited from Parser

#initialize

Constructor Details

This class inherits a constructor from ApiDiff::Parser

Instance Method Details

#parse(content) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/api_diff/kotlin_bcv_parser.rb', line 4

def parse(content)
  Property.readonly_keyword = "val" unless @options[:normalize]

  sections = content.scan(/^.+?{$.*?^}$/m)
  sections.each do |section|
    section.strip!
    first_line = section.split("\n")[0]
    if first_line.include?(" : java/lang/Enum")
      parse_enum(section)
    elsif first_line.include?("interface class")
      parse_interface(section)
    elsif first_line.match?(/public.+class/)
      parse_class(section)
    end
  end

  normalize!(api) if @options[:normalize]
end