]> code.delx.au - gnu-emacs-elpa/blob - packages/realgud/realgud/lang/perl.el
Add 'packages/realgud/' from commit 'd811316e6a0f4eeee8a1347f504c196c86baa2cb'
[gnu-emacs-elpa] / packages / realgud / realgud / lang / perl.el
1 ;;; Copyright (C) 2011, 2014 Rocky Bernstein <rocky@gnu.org>
2 ;;; Common Perl constants and regular expressions.
3 (eval-when-compile (require 'cl))
4
5 (require 'load-relative)
6 (require-relative-list '("../common/regexp" "../common/loc" "../common/track")
7 "realgud-")
8
9 (declare-function realgud-goto-line-for-pt 'realgud-track)
10
11 ;; Regular expression that describes a Perl Carp backtrace line.
12 ;; at /tmp/foo.pl line 7
13 ;; main::__ANON__('Illegal division by zero at /tmp/foo.pl line 4.\x{a}') called at /tmp/foo.pl line 4
14 ;; main::foo(3) called at /tmp/foo.pl line 8
15 (defconst realgud-perl-carp-loc-pat
16 (make-realgud-loc-pat
17 :regexp (concat
18 "\\(?:^\\|
19 \\)"
20 "\\(?:[ \t]+\\(?:\\|.* called \\)at \\(.*\\) line \\([0-9]+\\)\\)")
21 :file-group 1
22 :line-group 2)
23 "A realgud-loc-pat struct that describes a line used in a Carp message" )
24
25 (defconst realgud-perl-errmsg-loc-pat
26 (make-realgud-loc-pat
27 :regexp (concat
28 " at \\(.+\\) line \\([0-9]+\\).$")
29 :file-group 1
30 :line-group 2)
31 "A realgud-loc-pat struct that describes a line used in an error message" )
32
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
38 ;; FIXME: there is probably a less redundant way to do the following
39 ;; FNS.
40 (defun realgud:perl-goto-errmsg-line (pt)
41 "Display the location mentioned by the Perl error message described by PT."
42 (interactive "d")
43 (realgud-goto-line-for-pt pt "perl-errmsg"))
44
45 (defun realgud-perl-populate-command-keys (&optional map)
46 "Bind the debugger function key layout used by many debuggers.
47
48 \\{realgud-example-map-standard}"
49 (define-key map (kbd "C-c !b") 'realgud:goto-debugger-backtrace-line)
50 (define-key map (kbd "C-c !!") 'realgud:goto-lang-backtrace-line)
51 (define-key map (kbd "C-c !e") 'realgud:perl-goto-errmsg-line)
52 )
53
54 (provide-me "realgud-lang-")