]> code.delx.au - gnu-emacs/blob - lisp/cedet/semantic/wisent/java-tags.el
Refill some long/short copyright headers.
[gnu-emacs] / lisp / cedet / semantic / wisent / java-tags.el
1 ;;; semantic/wisent/java-tags.el --- Java LALR parser for Emacs
2
3 ;; Copyright (C) 2001-2006, 2009-2011 Free Software Foundation, Inc.
4
5 ;; Author: David Ponce <david@dponce.com>
6 ;; Maintainer: David Ponce <david@dponce.com>
7 ;; Created: 15 Dec 2001
8 ;; Keywords: syntax
9
10 ;; This file is part of GNU Emacs.
11
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation, either version 3 of the License, or
15 ;; (at your option) any later version.
16
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
21
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
24
25 ;;; Commentary:
26 ;;
27
28 ;;; History:
29 ;;
30
31 ;;; Code:
32
33 (require 'semantic/wisent)
34 (require 'semantic/wisent/javat-wy)
35 (require 'semantic/java)
36
37 ;;;;
38 ;;;; Simple parser error reporting function
39 ;;;;
40
41 (defun wisent-java-parse-error (msg)
42 "Error reporting function called when a parse error occurs.
43 MSG is the message string to report."
44 ;; (let ((error-start (nth 2 wisent-input)))
45 ;; (if (number-or-marker-p error-start)
46 ;; (goto-char error-start)))
47 (message msg)
48 ;;(debug)
49 )
50
51 ;;;;
52 ;;;; Local context
53 ;;;;
54
55 (define-mode-local-override semantic-get-local-variables
56 java-mode ()
57 "Get local values from a specific context.
58 Parse the current context for `field_declaration' nonterminals to
59 collect tags, such as local variables or prototypes.
60 This function override `get-local-variables'."
61 (let ((vars nil)
62 ;; We want nothing to do with funny syntaxing while doing this.
63 (semantic-unmatched-syntax-hook nil))
64 (while (not (semantic-up-context (point) 'function))
65 (save-excursion
66 (forward-char 1)
67 (setq vars
68 (append (semantic-parse-region
69 (point)
70 (save-excursion (semantic-end-of-context) (point))
71 'field_declaration
72 0 t)
73 vars))))
74 vars))
75
76 ;;;;
77 ;;;; Semantic integration of the Java LALR parser
78 ;;;;
79
80 ;; In semantic-imenu.el, not part of Emacs.
81 (defvar semantic-imenu-summary-function)
82
83 ;;;###autoload
84 (defun wisent-java-default-setup ()
85 "Hook run to setup Semantic in `java-mode'.
86 Use the alternate LALR(1) parser."
87 (wisent-java-tags-wy--install-parser)
88 (setq
89 ;; Lexical analysis
90 semantic-lex-number-expression semantic-java-number-regexp
91 semantic-lex-analyzer 'wisent-java-tags-lexer
92 ;; Parsing
93 semantic-tag-expand-function 'semantic-java-expand-tag
94 ;; Environment
95 semantic-imenu-summary-function 'semantic-format-tag-prototype
96 imenu-create-index-function 'semantic-create-imenu-index
97 semantic-type-relation-separator-character '(".")
98 semantic-command-separation-character ";"
99 ;; speedbar and imenu buckets name
100 semantic-symbol->name-assoc-list-for-type-parts
101 ;; in type parts
102 '((type . "Classes")
103 (variable . "Variables")
104 (function . "Methods"))
105 semantic-symbol->name-assoc-list
106 ;; everywhere
107 (append semantic-symbol->name-assoc-list-for-type-parts
108 '((include . "Imports")
109 (package . "Package")))
110 ;; navigation inside 'type children
111 senator-step-at-tag-classes '(function variable)
112 )
113 ;; Setup javadoc stuff
114 (semantic-java-doc-setup))
115
116 (provide 'semantic/wisent/java-tags)
117
118 ;; Local variables:
119 ;; generated-autoload-file: "../loaddefs.el"
120 ;; generated-autoload-load-name: "semantic/wisent/java-tags"
121 ;; End:
122
123 ;;; semantic/wisent/java-tags.el ends here