Initial Commit
[packages] / xemacs-packages / semantic / bovine / semantic-erlang.el
1 ;;; semantic-erlang.el --- Semantic details for Erlang
2
3 ;; Copyright (C) 2001, 2002, 2003 Vladimir G. Sekissov
4 ;; Copyright (C) 2003 David Ponce
5
6 ;; Author: Vladimir G. Sekissov <svg@surnet.ru>
7 ;;         David Ponce <david@dponce.com>
8 ;; Keywords: syntax
9 ;; X-RCS: $Id: semantic-erlang.el,v 1.1 2007-11-26 15:11:56 michaels Exp $
10
11 ;; This file is not part of GNU Emacs.
12
13 ;; This file is free software; you can redistribute it and/or modify
14 ;; it under the terms of the GNU General Public License as published by
15 ;; the Free Software Foundation; either version 2, or (at your option)
16 ;; any later version.
17
18 ;; This file is distributed in the hope that it will be useful,
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 ;; GNU General Public License for more details.
22
23 ;; You should have received a copy of the GNU General Public License
24 ;; along with GNU Emacs; see the file COPYING.  If not, write to
25 ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
26 ;; Boston, MA 02110-1301, USA.
27
28 ;;; Commentary:
29 ;;
30
31 ;;; History:
32 ;;
33
34 ;;; Code:
35
36 (require 'semantic)
37 (require 'backquote)
38 (require 'semantic-erlang-by)
39 (require 'erlang-edoc)
40
41 ;; Depending on what elements you include specialized support for
42 (eval-when-compile
43   (require 'semantic-ctxt)
44   (require 'semantic-imenu)
45   (require 'document)
46   (require 'senator))
47
48 (define-lex-simple-regex-analyzer semantic-erlang-lex-char
49   "Detect and create Erlang CHAR tokens."
50   "\\s/\\(\\(\\\\[0-9]\\{3\\}\\)\\|[^\\]\\|\\\\\\\\\\)"
51   'CHAR)
52
53 (define-lex semantic-erlang-lexer
54   "Lexical Analyzer for Erlang code."
55   semantic-lex-ignore-whitespace
56   semantic-lex-ignore-newline
57   ;;semantic-lex-number
58   semantic-lex-symbol-or-keyword
59   semantic-erlang-lex-char
60   ;;semantic-lex-charquote
61   semantic-lex-paren-or-list
62   semantic-lex-close-paren
63   semantic-lex-ignore-comments
64   semantic-lex-punctuation
65   semantic-lex-default-action)
66
67 (defun semantic-erlang-default-setup ()
68   "Set up a buffer for semantic parsing of the Erlang language."
69   (semantic-erlang-by--install-parser)
70   (setq
71    ;; Lexical analysis
72    semantic-lex-number-expression nil
73    semantic-lex-syntax-modifications '((?' "_")
74                                        (?$ "/")
75                                        )
76    semantic-lex-analyzer 'semantic-erlang-lexer
77    ;; Parsing
78    ;; Environment
79    imenu-create-index-function 'semantic-create-imenu-index
80    semantic-type-relation-separator-character '(".")
81    semantic-command-separation-character ","
82    document-comment-start "%%**"
83    document-comment-line-prefix "%%"
84    document-comment-end "%%*"
85    ;; speedbar and imenu buckets name
86    semantic-symbol->name-assoc-list-for-type-parts
87    ;; in type parts
88    '((variable . "Definitions")
89      (type     . "Records")
90      (function . "Functions"))
91    semantic-symbol->name-assoc-list
92    ;; everywhere
93    '((variable . "Definitions")
94      (type     . "Records")
95      (function . "Functions")
96      (include  . "Includes")
97      (package  . "Module"))
98    ))
99
100 (add-hook 'erlang-mode-hook 'semantic-erlang-default-setup)
101
102 (provide 'semantic-erlang)
103
104 ;;; semantic-erlang.el ends here