1 ;;; Copyright (C) 2010 Rocky Bernstein <rocky@gnu.org>
2 ;;; Common Ruby regular expressions and things
3 (eval-when-compile (require 'cl))
5 (require 'load-relative)
6 (require-relative-list '("../common/regexp" "../common/loc" "../common/track")
10 (defconst dbgr-ruby-backtrace-loc-pat
12 :regexp "^[ \t]+from \\([^:]+\\):\\([0-9]+\\)\\(?: in `.*'\\)?"
15 "A dbgr-loc-pat struct that describes a Ruby backtrace (or
18 (defconst dbgr-rubinius-backtrace-loc-pat
20 :regexp "^\\(
\e\\[0;3[1-4]m\\)?[ \t]+.* at \\([^:]+\\):\\([0-9]+\\)"
23 "A dbgr-loc-pat struct that describes a Rubinius backtrace (or
26 (defconst dbgr-ruby-dollar-bang
28 :regexp "^[ \t]*[[]?\\(.+\\):\\([0-9]+\\):in `.*'"
31 "A dbgr-loc-pat that struct that describes a Ruby $! string."
34 ;; FIXME: there is probably a less redundant way to do the following
36 (defun dbgr-ruby-goto-backtrace-line (pt)
37 "Display the location mentioned by the Ruby backtrace line
40 (dbgr-goto-line-for-pt pt "backtrace"))
42 (defun dbgr-ruby-goto-dollarbang-backtrace-line (pt)
43 "Display the location mentioned by a Ruby $! backtrace line
46 (dbgr-goto-line-for-pt pt "dollar-bang"))
48 (defun dbgr-ruby-populate-command-keys (&optional map)
49 "Bind the debugger function key layout used by many debuggers.
51 \\{dbgr-example-map-standard}"
52 (define-key map (kbd "C-c !!") 'dbgr-ruby-goto-dollarbang-backtrace-line)
53 (define-key map (kbd "C-c !b") 'dbgr-ruby-goto-backtrace-line)
57 ;; Some things common to all trepan debuggers (Rubinius and Ruby 1.9.2)
58 (defconst dbgr-trepan-frame-start-regexp
59 "\\(?:^\\|\n\\)\\(-->\\| \\)")
61 (defconst dbgr-trepan-frame-num-regexp
64 (defconst dbgr-trepan-frame-line-regexp
65 "[ \t\n]+at line \\([0-9]+\\)\\(?:\n\\|$\\)")
68 (provide-me "dbgr-lang-")