Personal emacs config
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
2.3 KiB

  1. ;; Copyright (C) 2011, 2014, 2016, 2019 Free Software Foundation, Inc
  2. ;; Author: Rocky Bernstein <rocky@gnu.org>
  3. ;; This program is free software; you can redistribute it and/or modify
  4. ;; it under the terms of the GNU General Public License as published by
  5. ;; the Free Software Foundation, either version 3 of the License, or
  6. ;; (at your option) any later version.
  7. ;;; Common Perl constants and regular expressions.
  8. (require 'load-relative)
  9. (require-relative-list '("../common/regexp" "../common/loc" "../common/track")
  10. "realgud-")
  11. (declare-function realgud-goto-line-for-pt 'realgud-track)
  12. (declare-function make-realgud-loc-pat 'realgud-regexp)
  13. ;; Regular expression that describes a Perl Carp backtrace line.
  14. ;; at /tmp/foo.pl line 7
  15. ;; main::__ANON__('Illegal division by zero at /tmp/foo.pl line 4.\x{a}') called at /tmp/foo.pl line 4
  16. ;; main::foo(3) called at /tmp/foo.pl line 8
  17. (defconst realgud-perl-carp-loc-pat
  18. (make-realgud-loc-pat
  19. :regexp (concat
  20. "\\(?:^\\|
  21. \\)"
  22. "\\(?:[ \t]+\\(?:\\|.* called \\)at \\(.*\\) line \\([0-9]+\\)\\)")
  23. :file-group 1
  24. :line-group 2)
  25. "A realgud-loc-pat struct that describes a line used in a Carp message" )
  26. (defconst realgud-perl-errmsg-loc-pat
  27. (make-realgud-loc-pat
  28. :regexp (concat
  29. " at \\(.+\\) line \\([0-9]+\\).$")
  30. :file-group 1
  31. :line-group 2)
  32. "A realgud-loc-pat struct that describes a line used in an error message" )
  33. ;; Regular expression that pseudo-files in caller. For example:
  34. ;; (eval 1006)[../example/eval.pl:5]
  35. (defconst realgud-perl-ignore-file-re "(eval [0-9]+)\\(\\[.+\\]\\)?"
  36. "Regular expression that pseudo-files of caller()")
  37. ;; FIXME: there is probably a less redundant way to do the following
  38. ;; FNS.
  39. (defun realgud:perl-goto-errmsg-line (pt)
  40. "Display the location mentioned by the Perl error message described by PT."
  41. (interactive "d")
  42. (realgud-goto-line-for-pt pt "perl-errmsg"))
  43. (defun realgud-perl-populate-command-keys (&optional map)
  44. "Bind the debugger function key layout used by many debuggers.
  45. \\{realgud-example-map-standard}"
  46. (define-key map (kbd "C-c !b") 'realgud:goto-debugger-backtrace-line)
  47. (define-key map (kbd "C-c !!") 'realgud:goto-lang-backtrace-line)
  48. (define-key map (kbd "C-c !e") 'realgud:perl-goto-errmsg-line)
  49. )
  50. (provide-me "realgud-lang-")