Class: MxmlcOutputReader
- Inherits:
-
Object
- Object
- MxmlcOutputReader
- Defined in:
- lib/mxmlc_output/mxmlc_output_reader.rb
Overview
Formats the mxmlc to errors
Constant Summary collapse
- ERROR_LINE =
/^((\/([\w\.]+))+)(\((-?\d+)\))?:\s*(col: (\d+))?:?\s*(Error|Warning+): (.+)$/
Instance Attribute Summary collapse
-
#messages ⇒ Object
readonly
Returns the value of attribute messages.
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(output) ⇒ MxmlcOutputReader
constructor
A new instance of MxmlcOutputReader.
-
#parse! ⇒ Object
example: /Users/japetheape/Projects/tunedustry/editor/src/com/tunedustry/editor/view/Controls.as(43): col: 32 Warning: return value for function ‘setPositions’ has no type declaration.
- #warnings ⇒ Object
Constructor Details
#initialize(output) ⇒ MxmlcOutputReader
9 10 11 12 13 |
# File 'lib/mxmlc_output/mxmlc_output_reader.rb', line 9 def initialize(output) @output = output @messages = [] parse! end |
Instance Attribute Details
#messages ⇒ Object (readonly)
Returns the value of attribute messages.
6 7 8 |
# File 'lib/mxmlc_output/mxmlc_output_reader.rb', line 6 def @messages end |
Instance Method Details
#errors ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/mxmlc_output/mxmlc_output_reader.rb', line 24 def errors out = [] @messages.each do |e| out << e if e.level == "Error" end out end |
#parse! ⇒ Object
example: /Users/japetheape/Projects/tunedustry/editor/src/com/tunedustry/editor/view/Controls.as(43): col: 32 Warning: return value for function ‘setPositions’ has no type declaration.
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/mxmlc_output/mxmlc_output_reader.rb', line 33 def parse! @output.each_line do |l| matches = ERROR_LINE.match(l) if !matches.nil? @messages << MxmlcError.new(matches[1], matches[5], matches[7], matches[8], matches[9]) elsif !@messages.empty? @messages.last.content << l end end end |
#warnings ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/mxmlc_output/mxmlc_output_reader.rb', line 16 def warnings out = [] @messages.each do |e| out << e if e.level == "Warning" end out end |