]> code.delx.au - gnu-emacs-elpa/blob - packages/realgud/realgud/debugger/remake/init.el
d2888c18389a9ad3327c9b3be39e3e47da0ea62a
[gnu-emacs-elpa] / packages / realgud / realgud / debugger / remake / init.el
1 ;;; Copyright (C) 2011, 2014 Rocky Bernstein <rocky@gnu.org>
2 ;;; Regular expressions for GNU Make debugger: remake
3
4 (eval-when-compile (require 'cl))
5
6 (require 'load-relative)
7 (require-relative-list '("../../common/regexp"
8 "../../common/loc"
9 "../../common/init")
10 "realgud-")
11
12 (defvar realgud-pat-hash)
13 (declare-function make-realgud-loc-pat (realgud-loc))
14
15 (defvar realgud:remake-pat-hash (make-hash-table :test 'equal)
16 "Hash key is the what kind of pattern we want to match:
17 backtrace, prompt, etc. The values of a hash entry is a
18 realgud-loc-pat struct")
19
20 ;; Regular expression that describes a remake location generally shown
21 ;; before a command prompt.
22 ;; For example:
23 ;; -- (emacs-dbgr/realgud/debugger/Makefile:168)
24 (setf (gethash "loc" realgud:remake-pat-hash)
25 (make-realgud-loc-pat
26 :regexp "\\(?:^\\|\n\\)\\(?:.. \\)?(\\(\\(?:[a-zA-Z]:\\)?[-a-zA-Z0-9_/.\\\\ ]+\\):\\([0-9]+\\))\\(?:\n\\(.*?\\)\n\\)?"
27 :file-group 1
28 :line-group 2
29 :text-group 3))
30
31 ;; For example:
32 ;; remake<10>
33 ;; remake<<1>>
34 (setf (gethash "prompt" realgud:remake-pat-hash)
35 (make-realgud-loc-pat
36 :regexp "^remake[<]+\\([0-9]+\\)[>]+ "
37 :num 1
38 ))
39
40 ;; Regular expression that describes a "breakpoint set" line
41 (setf (gethash "brkpt-set" realgud:remake-pat-hash)
42 (make-realgud-loc-pat
43 :regexp "^Breakpoint \\([0-9]+\\) on target \\([^:]*\\): file \\(.+\\), line \\([0-9]+\\).\n"
44 :num 1
45 :file-group 3
46 :line-group 4))
47
48 ;; Regular expression that describes a debugger "delete" (breakpoint) response.
49 ;; For example:
50 ;; Removed 1 breakpoint(s).
51 (setf (gethash "brkpt-del" realgud:remake-pat-hash)
52 (make-realgud-loc-pat
53 :regexp "^Breakpoint \\([0-9]+\\) on target .* cleared\n"
54 :num 1))
55
56 (defconst realgud:remake-selected-frame-arrow "=>"
57 "String that describes which frame is selected in a debugger
58 backtrace listing.")
59 (defconst realgud:remake-frame-arrow (format "\\(%s\\| \\)"
60 realgud:remake-selected-frame-arrow))
61 (defconst realgud:remake-frame-num-regexp
62 "#\\([0-9]+\\) ")
63
64 (defconst realgud:remake-frame-file-regexp " at \\(.*\\):\\([0-9]+\\)")
65
66 ;; Regular expression that describes a remake "backtrace" command line.
67 ;; For example:
68 ;; #0 Makefile.in at /tmp/Makefile:216
69 ;; #1 Makefile at /tmp/Makefile:230
70 (setf (gethash "lang-backtrace" realgud:remake-pat-hash)
71 (make-realgud-loc-pat
72 :regexp (concat "^"
73 realgud:remake-frame-num-regexp
74 "\\(.*\\)"
75 realgud:remake-frame-file-regexp
76 )
77 :num 1
78 :file-group 3
79 :line-group 4)
80 )
81
82 ;; Regular expression that describes a debugger "backtrace" command line.
83 ;; For example:
84 ;; =>#0 Makefile.in at /tmp/Makefile:216
85 ;; #1 Makefile at /tmp/Makefile:230
86 (setf (gethash "debugger-backtrace" realgud:remake-pat-hash)
87 (make-realgud-loc-pat
88 :regexp (concat "^"
89 realgud:remake-frame-arrow
90 realgud:remake-frame-num-regexp
91 "\\(.*\\)"
92 realgud:remake-frame-file-regexp
93 )
94 :num 2
95 :file-group 4
96 :line-group 5)
97 )
98
99 ;; Regular expression that describes which frame is selected in
100 ;; a debugger backtrace listing.
101 (setf (gethash "selected-frame-indicator" realgud:remake-pat-hash)
102 realgud:remake-selected-frame-arrow)
103
104 ;; Regular expression for a termination message.
105 (setf (gethash "termination" realgud:remake-pat-hash)
106 "^remake: That's all, folks...\n")
107
108 (setf (gethash "font-lock-keywords" realgud:remake-pat-hash)
109 '(
110 ;; ;; File name and line number
111 ;; ;; E.g. =>#0 Makefile.in at /tmp/Makefile:216
112 ;; ;; ----^^^^^^^^^^^^^^^^^
113 (" at \\(.*\\):\\([0-9]+\\)"
114 (1 realgud-file-name-face)
115 (2 realgud-line-number-face))
116
117 ;; The frame number and first type name, if present.
118 ;; E.g. =>#0 Makefile.in at /tmp/Makefile:216
119 ;; ---^
120 ("#\\([0-9]+\\) "
121 (1 realgud-backtrace-number-face))
122 ))
123
124 (setf (gethash "remake" realgud-pat-hash) realgud:remake-pat-hash)
125
126 (defvar realgud:remake-command-hash (make-hash-table :test 'equal)
127 "Hash key is command name like 'quit' and the value is
128 the remake command to use, like 'q'")
129
130 (setf (gethash "break" realgud:remake-command-hash) "break %l")
131 (setf (gethash "eval" realgud:remake-command-hash) "expand %s")
132 (setf (gethash "remake" realgud-command-hash) realgud:remake-command-hash)
133
134
135 (provide-me "realgud:remake-")