Initial Commit
[packages] / xemacs-packages / semantic / bovine / semantic-skel.el
1 ;;; semantic-skel.el --- Semantic details for skel
2
3 ;;; Copyright (C) 2001, 2003, 2004 Eric M. Ludlam
4
5 ;; Author: Eric M. Ludlam <zappo@gnu.org>
6 ;; X-RCS: $Id: semantic-skel.el,v 1.1 2007-11-26 15:11:59 michaels Exp $
7
8 ;; This file is not part of GNU Emacs.
9
10 ;; This 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 2, or (at your option)
13 ;; any later version.
14
15 ;; This software 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; see the file COPYING.  If not, write to the
22 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 ;; Boston, MA 02110-1301, USA.
24
25 ;;; Commentary:
26 ;;
27
28 ;;; History:
29 ;; 
30
31 (require 'semantic)
32 (require 'semantic-skeleton-by)
33 (require 'backquote)
34
35 ;; Depending on what elements you include specialized support for
36 (eval-when-compile
37   (require 'semantic-ctxt)
38   (require 'semantic-imenu)
39   (require 'document)
40   (require 'senator))
41
42 ;;; Code:
43
44 ;; Create a lexical analyzer for your language.  You can use
45 ;; both the provided analyzers, and your own custom analyzers
46 ;; that let you take short-cuts in your language.
47
48 ;; One analyzer
49 (define-lex-regex-analyzer semantic-lex-skel-if-0
50   "Block out code matched in an #if 0 condition."
51   "^\\s-*#if\\s-*0$"
52   (beginning-of-line)
53   (c-forward-conditional 1)
54   (setq semantic-lex-end-point (point))
55   nil)
56
57 ;; Define the lexial analyzer
58 (define-lex semantic-skeleton-lexer
59   "Lexical Analyzer for SKELETON code."
60   semantic-lex-ignore-whitespace
61   semantic-lex-ignore-newline
62   semantic-lex-skel-if-0
63   semantic-lex-number
64   semantic-lex-symbol-or-keyword
65   semantic-lex-charquote
66   semantic-lex-paren-or-list
67   semantic-lex-close-paren
68   semantic-lex-ignore-comments
69   semantic-lex-punctuation
70   semantic-lex-default-action)
71
72 ;; You do not need to use this function unless you have compound
73 ;; definitions.  For example, in C, the following is expanded:
74 ;;  int x, y;
75 (defun semantic-skeleton-expand-tag (nonterm)
76   "Expand NONTERM into a list of equivalent nonterminals, or nil."
77   nil)
78 \f
79 ;;; Override methods & Variables
80 ;;
81
82 ;; Add methods to the override table here.  See
83 ;; `semantic-install-function-overrides' for more details.
84
85
86 ;;; Setup function
87 ;;
88 ;;;###autoload
89 (defun semantic-default-skel-setup ()
90   "Set up a buffer for semantic parsing of the skeleton language."
91   (semantic-skeleton-by--install-parser)
92   ;; Commented out lines below are generally considered optional
93   ;; See the Emacs Doc for the symbols used below
94   (setq semantic-symbol->name-assoc-list '( (variable . "Variables")
95                                             (type     . "Types")
96                                             (function . "Functions")
97                                             (include  . "Includes")
98                                             (package  . "Exports"))
99         ;;semantic-tag-expand-function 'semantic-skeleton-expand-tag
100         ;;semantic-lex-extensions semantic-lex-skeleton-extensions
101         ;;semantic-dependency-include-path semantic-default-skeleton-path
102         imenu-create-index-function 'semantic-create-imenu-index
103         semantic-type-relation-separator-character '(".")
104         semantic-command-separation-character ";"
105         document-comment-start "/*"
106         document-comment-line-prefix " *"
107         document-comment-end " */"
108         ;; Semantic navigation inside 'type children
109         senator-step-at-tag-classes '(function variable)
110         )
111   )
112
113 ;; Loading this file will install the parser.  Add this line
114 ;; to a .emacs file, or other setup file along with an autoload
115 ;; for the setup function to dynamically install the parser
116 ;; when a file of that type is read into Emacs.
117 (add-hook 'skeleton-mode-hook 'semantic-default-skeleton-setup)
118
119 (provide 'semantic-skel)
120
121 ;;; semantic-skel.el ends here