Mercurial > emacs
comparison lisp/cedet/semantic/bovine/scm.el @ 104452:688cf3b99678
lisp/cedet/semantic/bovine/c-by.el
lisp/cedet/semantic/bovine/c.el
lisp/cedet/semantic/bovine/debug.el
lisp/cedet/semantic/bovine/el.el
lisp/cedet/semantic/bovine/gcc.el
lisp/cedet/semantic/bovine/java.el
lisp/cedet/semantic/bovine/make-by.el
lisp/cedet/semantic/bovine/make.el
lisp/cedet/semantic/bovine/scm-by.el
lisp/cedet/semantic/bovine/scm.el: New files.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Sat, 05 Sep 2009 20:47:41 +0000 |
parents | |
children | 6ccad1511df1 |
comparison
equal
deleted
inserted
replaced
104451:2858c6bcc446 | 104452:688cf3b99678 |
---|---|
1 ;;; semantic/bovine/scm.el --- Semantic details for Scheme (guile) | |
2 | |
3 ;;; Copyright (C) 2001, 2002, 2003, 2004, 2008, 2009 | |
4 ;;; Free Software Foundation, Inc. | |
5 | |
6 ;; Author: Eric M. Ludlam <zappo@gnu.org> | |
7 | |
8 ;; This file is part of GNU Emacs. | |
9 | |
10 ;; GNU Emacs is free software: you can redistribute it and/or modify | |
11 ;; it under the terms of the GNU General Public License as published by | |
12 ;; the Free Software Foundation, either version 3 of the License, or | |
13 ;; (at your option) any later version. | |
14 | |
15 ;; GNU Emacs is distributed in the hope that it will be useful, | |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;; GNU General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | |
22 | |
23 ;;; Commentary: | |
24 ;; | |
25 ;; Use the Semantic Bovinator for Scheme (guile) | |
26 | |
27 (require 'semantic) | |
28 (require 'semantic/bovine/scm-by) | |
29 (require 'semantic/format) | |
30 | |
31 (eval-when-compile | |
32 (require 'semantic/dep)) | |
33 | |
34 ;;; Code: | |
35 | |
36 (defcustom-mode-local-semantic-dependency-system-include-path | |
37 scheme-mode semantic-default-scheme-path | |
38 '("/usr/share/guile/") | |
39 "Default set of include paths for scheme (guile) code. | |
40 This should probably do some sort of search to see what is | |
41 actually on the local machine.") | |
42 | |
43 (define-mode-local-override semantic-format-tag-prototype scheme-mode (tag) | |
44 "Return a prototype for the Emacs Lisp nonterminal TAG." | |
45 (let* ((tok (semantic-tag-class tag)) | |
46 (args (semantic-tag-components tag)) | |
47 ) | |
48 (if (eq tok 'function) | |
49 (concat (semantic-tag-name tag) " (" | |
50 (mapconcat (lambda (a) a) args " ") | |
51 ")") | |
52 (semantic-format-tag-prototype-default tag)))) | |
53 | |
54 (define-mode-local-override semantic-documentation-for-tag scheme-mode (tag &optional nosnarf) | |
55 "Return the documentation string for TAG. | |
56 Optional argument NOSNARF is ignored." | |
57 (let ((d (semantic-tag-docstring tag))) | |
58 (if (and d (> (length d) 0) (= (aref d 0) ?*)) | |
59 (substring d 1) | |
60 d))) | |
61 | |
62 (define-mode-local-override semantic-insert-foreign-tag scheme-mode (tag tagfile) | |
63 "Insert TAG from TAGFILE at point. | |
64 Attempts a simple prototype for calling or using TAG." | |
65 (cond ((eq (semantic-tag-class tag) 'function) | |
66 (insert "(" (semantic-tag-name tag) " )") | |
67 (forward-char -1)) | |
68 (t | |
69 (insert (semantic-tag-name tag))))) | |
70 | |
71 ;; Note: Analyzer from Henry S. Thompson | |
72 (define-lex-regex-analyzer semantic-lex-scheme-symbol | |
73 "Detect and create symbol and keyword tokens." | |
74 "\\(\\sw\\([:]\\|\\sw\\|\\s_\\)+\\)" | |
75 ;; (message (format "symbol: %s" (match-string 0))) | |
76 (semantic-lex-push-token | |
77 (semantic-lex-token | |
78 (or (semantic-lex-keyword-p (match-string 0)) 'symbol) | |
79 (match-beginning 0) (match-end 0)))) | |
80 | |
81 | |
82 (define-lex semantic-scheme-lexer | |
83 "A simple lexical analyzer that handles simple buffers. | |
84 This lexer ignores comments and whitespace, and will return | |
85 syntax as specified by the syntax table." | |
86 semantic-lex-ignore-whitespace | |
87 semantic-lex-ignore-newline | |
88 semantic-lex-scheme-symbol | |
89 semantic-lex-charquote | |
90 semantic-lex-paren-or-list | |
91 semantic-lex-close-paren | |
92 semantic-lex-string | |
93 semantic-lex-ignore-comments | |
94 semantic-lex-punctuation | |
95 semantic-lex-number | |
96 semantic-lex-default-action) | |
97 | |
98 (defun semantic-default-scheme-setup () | |
99 "Setup hook function for Emacs Lisp files and Semantic." | |
100 (semantic-scm-by--install-parser) | |
101 (setq semantic-symbol->name-assoc-list '( (variable . "Variables") | |
102 ;;(type . "Types") | |
103 (function . "Functions") | |
104 (include . "Loads") | |
105 (package . "DefineModule")) | |
106 imenu-create-index-function 'semantic-create-imenu-index | |
107 imenu-create-index-function 'semantic-create-imenu-index | |
108 ) | |
109 (setq semantic-lex-analyzer #'semantic-scheme-lexer) | |
110 ) | |
111 | |
112 (add-hook 'scheme-mode-hook 'semantic-default-scheme-setup) | |
113 | |
114 (provide 'semantic/bovine/scm) | |
115 | |
116 ;;; semantic/bovine/scm.el ends here |