diff --git a/chapter.pdf b/chapter.pdf new file mode 100644 index 0000000..1bdca0c Binary files /dev/null and b/chapter.pdf differ diff --git a/cheese.pdf b/cheese.pdf new file mode 100644 index 0000000..1cf025b Binary files /dev/null and b/cheese.pdf differ diff --git a/drink.pdf b/drink.pdf new file mode 100644 index 0000000..4ce0346 Binary files /dev/null and b/drink.pdf differ diff --git a/flower.pdf b/flower.pdf new file mode 100644 index 0000000..cee97d8 Binary files /dev/null and b/flower.pdf differ diff --git a/food.pdf b/food.pdf new file mode 100644 index 0000000..8bc1cf5 Binary files /dev/null and b/food.pdf differ diff --git a/lol.rb b/lol.rb index 5306161..b5ae67d 100644 --- a/lol.rb +++ b/lol.rb @@ -61,7 +61,8 @@ container_params = container_params|[] driver_params = container_params driver_methods = container_methods.slice(1, container_methods.length-1).map do |x| - {:name => x[:name], :parameters => x[:params], :print => !x[:name].start_with?("print")} + name_maggie = (x[:name].start_with?("print") ? x[:name].slice(0, x[:name].length - 3) : x[:name]) + {:name => name_maggie, :parameters => x[:params], :print => !x[:name].start_with?("print")} end diff --git a/pdf-parser.rb b/pdf-parser.rb index 6e455d3..ee3ee93 100644 --- a/pdf-parser.rb +++ b/pdf-parser.rb @@ -7,21 +7,18 @@ def parse(exam_text) text = reader.pages[0].text.split "\n" content = text.slice(3, 15).map {|x| x.split " "}.map {|x| x.filter {|y| y.length > 1 and y.strip != "*"} }.filter {|x| x.length > 0} + prim_class = content[0][0] if content[0].length == 1 - container = content[1][0] + container = content[1][0].strip else - container = content[0][1] + container = content[0][1].strip end - container_params = content.slice(2, content.length-1).filter { |x| - unless x[0].include? "(" - if x[0].split(" ").length > 1 - x[0] - end - end - }.map {|x| x[0].strip} + # Fuck mig + container_params = content[2].length > 1 ? [content[2][0].strip] : [content[3][0].strip] + container_methods = content.slice(2, content.length-1).filter { |x| if x[0].include? "(" @@ -47,8 +44,13 @@ def parse(exam_text) Method_desc.new(*matches.captures) end + puts "prim #{prim_class}" + puts "container #{container}" + puts "class_f #{class_fields}" + puts "container_p #{container_params}" + puts "container_m #{container_methods}" return prim_class, container, class_fields, container_params, container_methods end -parse("ferry.pdf") +parse("flower.pdf") diff --git a/pearl.pdf b/pearl.pdf new file mode 100644 index 0000000..eb770c4 Binary files /dev/null and b/pearl.pdf differ