Permalink
Browse files

Fix regexp for the eval command

I.e. now it can parse both eval XML commands like:
<eval expression="2 + 2" value="4"/>
and
<eval expression="2 + 2" value="4" />
(i.e. with trailing space)
  • Loading branch information...
1 parent 631a9eb commit 1e2f8def6eaf0164a80c3f1724f8685dc31a06fd @astashov committed Dec 30, 2012
Showing with 6 additions and 5 deletions.
  1. +1 −1 autoload/ruby_debugger.vim
  2. +4 −3 src/additionals/autoload/ruby_debugger.vim
  3. +1 −1 src/ruby_debugger/commands.vim
@@ -829,7 +829,7 @@ endfunction
function! RubyDebugger.commands.eval(cmd)
" rdebug-ide-gem doesn't escape attributes of tag properly, so we should not
" use usual attribute extractor here...
- let match = matchlist(a:cmd, "<eval expression=\"\\(.\\{-}\\)\" value=\"\\(.*\\)\" \\/>")
+ let match = matchlist(a:cmd, "<eval expression=\"\\(.\\{-}\\)\" value=\"\\(.*\\)\"\\s*\\/>")
echo "Evaluated expression:\n" . s:unescape_html(match[1]) ."\nResulted value is:\n" . match[2] . "\n"
endfunction
@@ -692,10 +692,11 @@ endfunction
" Debug current opened test
-function! RubyDebugger.run_test() dict
+function! RubyDebugger.run_test(...) dict
let file = s:get_filename()
if file =~ '_spec\.rb$'
- call g:RubyDebugger.start(g:ruby_debugger_spec_path . ' ' . file)
+ let line = a:0 && a:0 > 0 && !empty(a:1) ? a:1 : " "
+ call g:RubyDebugger.start(g:ruby_debugger_spec_path . ' ' . file . line)
elseif file =~ '\.feature$'
call g:RubyDebugger.start(g:ruby_debugger_cucumber_path . ' ' . file)
elseif file =~ '_test\.rb$'
@@ -828,7 +829,7 @@ endfunction
function! RubyDebugger.commands.eval(cmd)
" rdebug-ide-gem doesn't escape attributes of tag properly, so we should not
" use usual attribute extractor here...
- let match = matchlist(a:cmd, "<eval expression=\"\\(.\\{-}\\)\" value=\"\\(.*\\)\" \\/>")
+ let match = matchlist(a:cmd, "<eval expression=\"\\(.\\{-}\\)\" value=\"\\(.*\\)\"\\s*\\/>")
echo "Evaluated expression:\n" . s:unescape_html(match[1]) ."\nResulted value is:\n" . match[2] . "\n"
endfunction
@@ -117,7 +117,7 @@ endfunction
function! RubyDebugger.commands.eval(cmd)
" rdebug-ide-gem doesn't escape attributes of tag properly, so we should not
" use usual attribute extractor here...
- let match = matchlist(a:cmd, "<eval expression=\"\\(.\\{-}\\)\" value=\"\\(.*\\)\" \\/>")
+ let match = matchlist(a:cmd, "<eval expression=\"\\(.\\{-}\\)\" value=\"\\(.*\\)\"\\s*\\/>")
echo "Evaluated expression:\n" . s:unescape_html(match[1]) ."\nResulted value is:\n" . match[2] . "\n"
endfunction

0 comments on commit 1e2f8de

Please sign in to comment.