module MethodSource::CodeHelpers::IncompleteExpression

An exception matcher that matches only subsets of SyntaxErrors that can be fixed by adding more input to the buffer.

Public Class Methods

===(ex) click to toggle source
# File lib/method_source/code_helpers.rb, line 125
def self.===(ex)
  return false unless SyntaxError === ex
  case ex.message
  when /unexpected (\$end|end-of-file|end-of-input|END_OF_FILE)/, # mri, jruby, ruby-2.0, ironruby
    /embedded document meets end of file/, # =begin
    /unterminated (quoted string|string|regexp) meets end of file/, # "quoted string" is ironruby
    /missing 'end' for/, /: expecting '[})\]]'$/, /can't find string ".*" anywhere before EOF/, /: expecting keyword_end/, /expecting kWHEN/ # rbx
    true
  else
    false
  end
end