diff options
author | Conrad Irwin <conrad.irwin@gmail.com> | 2012-07-02 00:31:32 -0700 |
---|---|---|
committer | Conrad Irwin <conrad.irwin@gmail.com> | 2012-07-02 00:33:45 -0700 |
commit | 0dbc9344dfa5e94d52ebb3d79d3d43b35434a74e (patch) | |
tree | b8e12136c55e71dc44ac5a3f5a1fc422934fd8d9 /lib/method_source/code_helpers.rb | |
parent | d2b25cdbbed2f8539fe5f11e5dcf180fc1f3fce8 (diff) | |
download | method_source-0dbc9344dfa5e94d52ebb3d79d3d43b35434a74e.tar.gz |
Allow embedded documents in incomplete expressions [Fixes pry#622]
Also import complete_expression? tests from Pry.
Diffstat (limited to 'lib/method_source/code_helpers.rb')
-rw-r--r-- | lib/method_source/code_helpers.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/method_source/code_helpers.rb b/lib/method_source/code_helpers.rb index a3d2a71..b3c33de 100644 --- a/lib/method_source/code_helpers.rb +++ b/lib/method_source/code_helpers.rb @@ -123,8 +123,10 @@ module MethodSource # fixed by adding more input to the buffer. module IncompleteExpression def self.===(ex) + return false unless SyntaxError === ex case ex.message when /unexpected (\$end|end-of-file|END_OF_FILE)/, # mri, jruby, 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 |