Mercurial > emacs
comparison lisp/cedet/semantic/symref/global.el @ 104422:36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
cedet/semantic/symref/global.el, cedet/semantic/symref/idutils.el,
cedet/semantic/symref/list.el: New files.
cedet/semantic/db-ebrowse.el: Use mapc instead of mapcar.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Sat, 29 Aug 2009 20:12:41 +0000 |
parents | |
children | 1ca7a97e0322 |
comparison
equal
deleted
inserted
replaced
104421:b66bb908c129 | 104422:36f56620b2ae |
---|---|
1 ;;; semantic/symref/global.el --- Use GNU Global for symbol references | |
2 | |
3 ;; Copyright (C) 2008, 2009 Free Software Foundation, Inc. | |
4 | |
5 ;; Author: Eric Ludlam <eludlam@mathworks.com> | |
6 | |
7 ;; Author: Eric M. Ludlam <eric@siege-engine.com> | |
8 | |
9 ;; This file is part of GNU Emacs. | |
10 | |
11 ;; GNU Emacs is free software: you can redistribute it and/or modify | |
12 ;; it under the terms of the GNU General Public License as published by | |
13 ;; the Free Software Foundation, either version 3 of the License, or | |
14 ;; (at your option) any later version. | |
15 | |
16 ;; GNU Emacs is distributed in the hope that it will be useful, | |
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 ;; GNU General Public License for more details. | |
20 | |
21 ;; You should have received a copy of the GNU General Public License | |
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | |
23 | |
24 ;;; Commentary: | |
25 ;; | |
26 ;; GNU Global use with the semantic-symref system. | |
27 | |
28 (require 'cedet-global) | |
29 (require 'semantic/symref) | |
30 | |
31 ;;; Code: | |
32 (defclass semantic-symref-tool-global (semantic-symref-tool-baseclass) | |
33 ( | |
34 ) | |
35 "A symref tool implementation using GNU Global. | |
36 The GNU Global command can be used to generate lists of tags in a way | |
37 similar to that of `grep'. This tool will parse the output to generate | |
38 the hit list. | |
39 | |
40 See the function `cedet-gnu-global-search' for more details.") | |
41 | |
42 (defmethod semantic-symref-perform-search ((tool semantic-symref-tool-global)) | |
43 "Perform a search with GNU Global." | |
44 (let ((b (cedet-gnu-global-search (oref tool :searchfor) | |
45 (oref tool :searchtype) | |
46 (oref tool :resulttype) | |
47 (oref tool :searchscope) | |
48 )) | |
49 ) | |
50 (semantic-symref-parse-tool-output tool b) | |
51 )) | |
52 | |
53 (defmethod semantic-symref-parse-tool-output-one-line ((tool semantic-symref-tool-global)) | |
54 "Parse one line of grep output, and return it as a match list. | |
55 Moves cursor to end of the match." | |
56 (cond ((or (eq (oref tool :resulttype) 'file) | |
57 (eq (oref tool :searchtype) 'tagcompletions)) | |
58 ;; Search for files | |
59 (when (re-search-forward "^\\([^\n]+\\)$" nil t) | |
60 (match-string 1))) | |
61 (t | |
62 (when (re-search-forward "^\\([^ ]+\\) +\\([0-9]+\\) \\([^ ]+\\) " nil t) | |
63 (cons (string-to-number (match-string 2)) | |
64 (match-string 3)) | |
65 )))) | |
66 | |
67 (provide 'semantic/symref/global) | |
68 | |
69 ;;; semantic/symref/global.el ends here |