Class: CppFeedbackHook::CppExplainer

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

Instance Method Summary collapse

Instance Method Details

#errorObject



15
16
17
# File 'lib/feedback_hook.rb', line 15

def error()
  '[eE]rror:'
end

#explain_call_of_overloaded_is_ambiguous(_, result) ⇒ Object



73
74
75
76
77
# File 'lib/feedback_hook.rb', line 73

def explain_call_of_overloaded_is_ambiguous(_, result)
  (/#{error} call of overloaded '(.*)' is ambiguous#{near_regex}/.match result).try do |it|
    {target: it[1], near: it[2]}
  end
end

#explain_does_not_a_type(_, result) ⇒ Object



31
32
33
34
35
# File 'lib/feedback_hook.rb', line 31

def explain_does_not_a_type(_, result)
  (/#{error} '(.*)' does not name a type#{near_regex}/.match result).try do |it|
    {type: it[1], near: it[2]}
  end
end

#explain_expected_after_struct_definition(_, result) ⇒ Object



85
86
87
88
89
# File 'lib/feedback_hook.rb', line 85

def explain_expected_after_struct_definition(_, result)
  (/#{error} expected ';' after struct definition#{near_regex}/.match result).try do |it|
    {near: it[1]}
  end
end

#explain_expected_at_end_of_member(_, result) ⇒ Object



97
98
99
100
101
# File 'lib/feedback_hook.rb', line 97

def explain_expected_at_end_of_member(_, result)
  (/#{error} expected '(.*)' at end of member declaration#{near_regex}/.match result).try do |it|
    {token: it[1], near: it[2]}
  end
end

#explain_expected_comma_before_token(_, result) ⇒ Object



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

def explain_expected_comma_before_token(_, result)
  (/#{error} expected ',' or '.{3}' before '\.' token#{near_regex}/.match result).try do |it|
    {near: it[1]}
  end
end

#explain_expected_initializer_before(_, result) ⇒ Object



91
92
93
94
95
# File 'lib/feedback_hook.rb', line 91

def explain_expected_initializer_before(_, result)
  (/#{error} expected initializer before '(.*)'#{near_regex}/.match result).try do |it|
    {near: it[2]}
  end
end

#explain_expected_initializer_before_token(_, result) ⇒ Object



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

def explain_expected_initializer_before_token(_, result)
  (/#{error} expected initializer before '.' token#{near_regex}/.match result).try do |it|
    {near: it[1]}
  end
end

#explain_expected_unqualified_id(_, result) ⇒ Object



103
104
105
106
107
# File 'lib/feedback_hook.rb', line 103

def explain_expected_unqualified_id(_, result)
  (/#{error} expected unqualified-id before '(.*)' token#{near_regex}/.match result).try do |it|
    {token: it[1], near: it[2]}
  end
end

#explain_has_incomplete_type_and_cannot_be_defined(_, result) ⇒ Object



37
38
39
40
41
# File 'lib/feedback_hook.rb', line 37

def explain_has_incomplete_type_and_cannot_be_defined(_, result)
  (/#{error} aggregate '(.*)' has incomplete type and cannot be defined#{near_regex}/.match result).try do |it|
    {type: it[1], near: it[2]}
  end
end

#explain_has_no_member_named(_, result) ⇒ Object



19
20
21
22
23
# File 'lib/feedback_hook.rb', line 19

def explain_has_no_member_named(_, result)
  (/#{error} '(.*)' has no member named '(.*)'#{near_regex}/.match result).try do |it|
    {type: it[1], target: it[2], near: it[3]}
  end
end

#explain_invalid_conversion_from_to(_, result) ⇒ Object



79
80
81
82
83
# File 'lib/feedback_hook.rb', line 79

def explain_invalid_conversion_from_to(_, result)
  (/#{error} invalid conversion from '(.*)' to '(.*)'#{near_regex}/.match result).try do |it|
    {expected: it[1], actual: it[2], near: it[3]}
  end
end

#explain_invalid_suffix(_, result) ⇒ Object



43
44
45
46
47
# File 'lib/feedback_hook.rb', line 43

def explain_invalid_suffix(_, result)
  (/#{error} invalid suffix "(.*)" on integer constant#{near_regex}/.match result).try do |it|
    {suffix: it[1], near: it[2]}
  end
end

#explain_too_few_arguments_to_function(_, result) ⇒ Object



67
68
69
70
71
# File 'lib/feedback_hook.rb', line 67

def explain_too_few_arguments_to_function(_, result)
  (/#{error} too few arguments to function '(.*)'#{near_regex}/.match result).try do |it|
    {target: it[1], near: it[2]}
  end
end

#explain_too_many_arguments_to_function(_, result) ⇒ Object



61
62
63
64
65
# File 'lib/feedback_hook.rb', line 61

def explain_too_many_arguments_to_function(_, result)
  (/#{error} too many arguments to function '(.*)'#{near_regex}/.match result).try do |it|
    {target: it[1], near: it[2]}
  end
end

#explain_was_not_declared_in_this_scope(_, result) ⇒ Object



25
26
27
28
29
# File 'lib/feedback_hook.rb', line 25

def explain_was_not_declared_in_this_scope(_, result)
  (/#{error} '(.*)' was not declared in this scope#{near_regex}/.match result).try do |it|
    {target: it[1], near: it[2]}
  end
end

#near_regexObject



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

def near_regex()
  '.*[\t \n]* *(.*)\n[ \t]+\^'
end