processor/command/info_subcmd/source.rb in trepanning-0.1.3 vs processor/command/info_subcmd/source.rb in trepanning-0.1.4

- old
+ new

@@ -4,10 +4,11 @@ require 'linecache' require 'columnize' require_relative '../base/subcmd' require_relative '../../../app/file' require_relative '../../../app/complete' +require_relative '../../../app/run' class Trepan::Subcommand::InfoSource < Trepan::Subcommand unless defined?(HELP) Trepanning::Subcommand.set_name_prefix(__FILE__, self) DEFAULT_FILE_ARGS = %w(size mtime sha1) @@ -46,13 +47,18 @@ msg(m) end max_line = LineCache::size(canonic_name) msg 'File has %d lines.' % max_line if max_line msg('SHA1 is %s.' % LineCache::sha1(canonic_name)) - msg('Possible breakpoint line numbers:') - lines = LineCache.trace_line_numbers(canonic_name) - fmt_lines = columnize_numbers(lines) - msg(fmt_lines) + syntax_errors = Trepan::ruby_syntax_errors(canonic_name) + if syntax_errors + msg('Not a syntactically-correct Ruby program.') + else + msg('Possible breakpoint line numbers:') + lines = LineCache.trace_line_numbers(canonic_name) + fmt_lines = columnize_numbers(lines) + msg(fmt_lines) + end if SCRIPT_ISEQS__.member?(canonic_name) msg("File contains instruction sequences:") SCRIPT_ISEQS__[canonic_name].each do |iseq| msg("\t%s %s" % [iseq, iseq.name.inspect]) end