Module: JSCompiler::Parser
- Defined in:
- lib/jsc/parser.rb
Class Method Summary collapse
- .default_parser(result) ⇒ Object
-
.flymake_parser(result) ⇒ Object
window_message_handlers.js:73: strict warning: trailing comma is not legal in ECMA-262 object initializers:.
-
.parse(result) ⇒ Object
this methos calls the right parser for result.
- .print_under_character(pos) ⇒ Object
Class Method Details
.default_parser(result) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/jsc/parser.rb', line 37 def default_parser(result) out = "" if $debug puts "#DEBUG default parser \n" end op = JSCompiler.op unless result.nil? num = result.size out << "You've got #{result.size} #{op}\n" i = 0 result.each do || i += 1 out << "\n#{op.singularize.capitalize} n.#{i}\n" out << "\t#{['type']}: " + [op.singularize] + " at line #{['lineno']} character #{['charno']}\n" out << "\t" + ['line'] + "\n" unless ['line'].nil? out << "\t" + print_under_character(['charno']) end out else "No #{op}" end end |
.flymake_parser(result) ⇒ Object
window_message_handlers.js:73: strict warning: trailing comma is not legal in ECMA-262 object initializers:
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/jsc/parser.rb', line 13 def flymake_parser(result) if $debug puts "#DEBUG flymake parser \n" end #TODO out = "" op = JSCompiler.op unless result.nil? file = JSCompiler.file format_type = JSCompiler.format_type num = result.size result.each do || out << "#{file}:#{['lineno']}: #{op.singularize}: #{['type']}: " + [op.singularize] +"\n" out << "#{file}:#{['lineno']}: #{op.singularize}: #{['line']} \n" unless ['line'].nil? out << "#{file}:#{['lineno']}: #{op.singularize}: " + print_under_character(['charno']) end else out = "No #{op}" end return out end |
.parse(result) ⇒ Object
this methos calls the right parser for result
7 8 9 10 |
# File 'lib/jsc/parser.rb', line 7 def parse(result) return flymake_parser(result) if JSCompiler.format_type == "flymake" default_parser(result) end |
.print_under_character(pos) ⇒ Object
62 63 64 65 66 67 68 69 70 71 |
# File 'lib/jsc/parser.rb', line 62 def print_under_character(pos) i = 0 auto_fill = "" while i < pos -1 auto_fill << "." i = i+1 end auto_fill << " ^ \n" end |