Commit | Line | Data |
---|---|---|
a964f5e5 | 1 | ;;; semantic/wisent/java-tags.el --- Java LALR parser for Emacs |
bb051423 | 2 | |
5df4f04c | 3 | ;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010, 2011 |
f3628edd | 4 | ;; Free Software Foundation, Inc. |
bb051423 CY |
5 | |
6 | ;; Author: David Ponce <david@dponce.com> | |
7 | ;; Maintainer: David Ponce <david@dponce.com> | |
a964f5e5 | 8 | ;; Created: 15 Dec 2001 |
bb051423 CY |
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) | |
a964f5e5 | 35 | (require 'semantic/wisent/javat-wy) |
bb051423 CY |
36 | (require 'semantic/java) |
37 | ||
a964f5e5 CY |
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 | ) | |
bb051423 | 51 | |
a964f5e5 CY |
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 | ||
f3628edd GM |
81 | ;; In semantic-imenu.el, not part of Emacs. |
82 | (defvar semantic-imenu-summary-function) | |
83 | ||
a964f5e5 | 84 | ;;;###autoload |
bb051423 | 85 | (defun wisent-java-default-setup () |
a964f5e5 CY |
86 | "Hook run to setup Semantic in `java-mode'. |
87 | Use the alternate LALR(1) parser." | |
88 | (wisent-java-tags-wy--install-parser) | |
bb051423 CY |
89 | (setq |
90 | ;; Lexical analysis | |
91 | semantic-lex-number-expression semantic-java-number-regexp | |
a964f5e5 | 92 | semantic-lex-analyzer 'wisent-java-tags-lexer |
bb051423 CY |
93 | ;; Parsing |
94 | semantic-tag-expand-function 'semantic-java-expand-tag | |
95 | ;; Environment | |
96 | semantic-imenu-summary-function 'semantic-format-tag-prototype | |
bb051423 CY |
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 | ||
a964f5e5 | 117 | (provide 'semantic/wisent/java-tags) |
bb051423 | 118 | |
a964f5e5 CY |
119 | ;; Local variables: |
120 | ;; generated-autoload-file: "../loaddefs.el" | |
a964f5e5 CY |
121 | ;; generated-autoload-load-name: "semantic/wisent/java-tags" |
122 | ;; End: | |
123 | ||
3999968a | 124 | ;; arch-tag: 4125e018-58db-4456-b878-e58c602f4add |
a964f5e5 | 125 | ;;; semantic/wisent/java-tags.el ends here |