Class: PrologFeedbackHook::PrologExplainer

Inherits:
Mumukit::Explainer
  • Object
show all
Defined in:
lib/feedback_hook.rb

Instance Method Summary collapse

Instance Method Details

#explain_clauses_not_together(_, test_results) ⇒ Object



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

def explain_clauses_not_together(_, test_results)
  (/Clauses of .*:(.*) are not together in the source-file/.match test_results).try do |it|
    {target: it[1]}
  end
end

#explain_missing_dot_error(_, test_results) ⇒ Object



55
56
57
# File 'lib/feedback_hook.rb', line 55

def explain_missing_dot_error(_, test_results)
  /ERROR: (.*): Syntax error: Operator priority clash/ =~ test_results
end

#explain_missing_predicate(_, test_results) ⇒ Object



64
65
66
67
68
69
# File 'lib/feedback_hook.rb', line 64

def explain_missing_predicate(_, test_results)
  (/.*:(.*): Undefined procedure: .*:(.*)/.match test_results).try do |it|
    {target: it[1],
     missing: it[2]} unless it[1].include? 'unit body'
  end
end

#explain_not_sufficiently_instantiated(_, test_results) ⇒ Object



45
46
47
48
49
# File 'lib/feedback_hook.rb', line 45

def explain_not_sufficiently_instantiated(_, test_results)
  (/received error: (.*): Arguments are not sufficiently instantiated/.match test_results).try do |it|
    {target: it[1]}
  end
end

#explain_operator_error(_, test_results) ⇒ Object



51
52
53
# File 'lib/feedback_hook.rb', line 51

def explain_operator_error(_, test_results)
  /ERROR: (.*): Syntax error: Operator expected/ =~ test_results
end

#explain_singleton_variables(_, test_results) ⇒ Object



35
36
37
38
39
# File 'lib/feedback_hook.rb', line 35

def explain_singleton_variables(_, test_results)
  (/Singleton variables: \[(.*)\]/.match test_results).try do |it|
    {target: it[1]}
  end
end

#explain_test_failed(_, test_results) ⇒ Object



41
42
43
# File 'lib/feedback_hook.rb', line 41

def explain_test_failed(_, test_results)
  /test (.*): failed/ =~ test_results
end

#explain_wrong_comma(_, test_results) ⇒ Object



60
61
62
# File 'lib/feedback_hook.rb', line 60

def explain_wrong_comma(_, test_results)
  /ERROR: (.*): Full stop in clause-body\? Cannot redefine ,\/2/ =~ test_results
end

#explain_wrong_distinct_operator(content, _) ⇒ Object



10
11
12
13
14
# File 'lib/feedback_hook.rb', line 10

def explain_wrong_distinct_operator(content, _)
  (/.{0,9}(\/=|<>|!=).{0,9}/.match content).try do |it|
    {near: it[0]}
  end
end

#explain_wrong_gte_operator(content, _) ⇒ Object



16
17
18
19
20
# File 'lib/feedback_hook.rb', line 16

def explain_wrong_gte_operator(content, _)
  (/.{0,9}(=>).{0,9}/.match content).try do |it|
    {near: it[0]}
  end
end

#explain_wrong_lte_operator(content, _) ⇒ Object



22
23
24
25
26
# File 'lib/feedback_hook.rb', line 22

def explain_wrong_lte_operator(content, _)
  (/.{0,9}(<=).{0,9}/.match content).try do |it|
    {near: it[0]}
  end
end