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