This commit is contained in:
Alexander Munch-Hansen 2019-10-23 16:07:47 +02:00
parent 7b55cf4eb9
commit 684a712de6
8 changed files with 14 additions and 11 deletions

BIN
chapter.pdf Normal file

Binary file not shown.

BIN
cheese.pdf Normal file

Binary file not shown.

BIN
drink.pdf Normal file

Binary file not shown.

BIN
flower.pdf Normal file

Binary file not shown.

BIN
food.pdf Normal file

Binary file not shown.

3
lol.rb
View File

@ -61,7 +61,8 @@ container_params = container_params|[]
driver_params = container_params driver_params = container_params
driver_methods = container_methods.slice(1, container_methods.length-1).map do |x| 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 end

View File

@ -7,21 +7,18 @@ def parse(exam_text)
text = reader.pages[0].text.split "\n" 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} 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] prim_class = content[0][0]
if content[0].length == 1 if content[0].length == 1
container = content[1][0] container = content[1][0].strip
else else
container = content[0][1] container = content[0][1].strip
end end
container_params = content.slice(2, content.length-1).filter { |x|
unless x[0].include? "(" # Fuck mig
if x[0].split(" ").length > 1 container_params = content[2].length > 1 ? [content[2][0].strip] : [content[3][0].strip]
x[0]
end
end
}.map {|x| x[0].strip}
container_methods = content.slice(2, content.length-1).filter { |x| container_methods = content.slice(2, content.length-1).filter { |x|
if x[0].include? "(" if x[0].include? "("
@ -47,8 +44,13 @@ def parse(exam_text)
Method_desc.new(*matches.captures) Method_desc.new(*matches.captures)
end 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 return prim_class, container, class_fields, container_params, container_methods
end end
parse("ferry.pdf") parse("flower.pdf")

BIN
pearl.pdf Normal file

Binary file not shown.