Add 2011 to FSF/AIST copyright years.
[bpt/emacs.git] / lisp / cedet / semantic / symref / idutils.el
CommitLineData
a4bdf715
CY
1;;; semantic/symref/idutils.el --- Symref implementation for idutils
2
5df4f04c 3;;; Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
a4bdf715
CY
4
5;; Author: Eric M. Ludlam <eric@siege-engine.com>
6
7;; This file is part of GNU Emacs.
8
d037e45a
GM
9;; GNU Emacs is free software: you can redistribute it and/or modify
10;; it under the terms of the GNU General Public License as published by
11;; the Free Software Foundation, either version 3 of the License, or
12;; (at your option) any later version.
a4bdf715 13
d037e45a
GM
14;; GNU Emacs is distributed in the hope that it will be useful,
15;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17;; GNU General Public License for more details.
a4bdf715
CY
18
19;; You should have received a copy of the GNU General Public License
d037e45a 20;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
a4bdf715
CY
21
22;;; Commentary:
23;;
24;; Support IDUtils use in the Semantic Symref tool.
25
26(require 'cedet-idutils)
7daf6b54 27(require 'semantic/symref)
a4bdf715
CY
28
29;;; Code:
2182c2cc 30;;;###autoload
a4bdf715
CY
31(defclass semantic-symref-tool-idutils (semantic-symref-tool-baseclass)
32 (
33 )
34 "A symref tool implementation using ID Utils.
35The udutils command set can be used to generate lists of tags in a way
36similar to that of `grep'. This tool will parse the output to generate
37the hit list.
38
39See the function `cedet-idutils-search' for more details.")
40
41(defmethod semantic-symref-perform-search ((tool semantic-symref-tool-idutils))
42 "Perform a search with IDUtils."
43 (let ((b (cedet-idutils-search (oref tool :searchfor)
44 (oref tool :searchtype)
45 (oref tool :resulttype)
46 (oref tool :searchscope)
47 ))
48 )
49 (semantic-symref-parse-tool-output tool b)
50 ))
51
52(defmethod semantic-symref-parse-tool-output-one-line ((tool semantic-symref-tool-idutils))
53 "Parse one line of grep output, and return it as a match list.
54Moves cursor to end of the match."
55 (cond ((eq (oref tool :resulttype) 'file)
56 ;; Search for files
57 (when (re-search-forward "^\\([^\n]+\\)$" nil t)
58 (match-string 1)))
59 ((eq (oref tool :searchtype) 'tagcompletions)
60 (when (re-search-forward "^\\([^ ]+\\) " nil t)
61 (match-string 1)))
62 (t
63 (when (re-search-forward "^\\([^ :]+\\):+\\([0-9]+\\):" nil t)
64 (cons (string-to-number (match-string 2))
65 (expand-file-name (match-string 1) default-directory))
66 ))))
67
68(provide 'semantic/symref/idutils)
69
2182c2cc
CY
70;; Local variables:
71;; generated-autoload-file: "../loaddefs.el"
2182c2cc
CY
72;; generated-autoload-load-name: "semantic/symref/idutils"
73;; End:
74
3999968a 75;; arch-tag: 7e872652-cbe2-4083-a4d3-2a7c88c4c65c
a4bdf715 76;;; semantic/symref/idutils.el ends here