1 ;;; semantic/wisent/java-tags.el --- Java LALR parser for Emacs
3 ;; Copyright (C) 2001-2006, 2009-2015 Free Software Foundation, Inc.
5 ;; Author: David Ponce <david@dponce.com>
6 ;; Maintainer: David Ponce <david@dponce.com>
7 ;; Created: 15 Dec 2001
10 ;; This file is part of GNU Emacs.
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.
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.
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/>.
33 (require 'semantic
/wisent
)
34 (require 'semantic
/wisent
/javat-wy
)
35 (require 'semantic
/java
)
38 ;;;; Simple parser error reporting function
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)))
55 (define-mode-local-override semantic-get-local-variables
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'."
62 (ct (semantic-current-tag))
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
))
69 (append (semantic-parse-region
71 (save-excursion (semantic-end-of-context) (point))
75 ;; Add 'this' if in a fcn
76 (when (semantic-tag-of-class-p ct
'function
)
77 ;; Append a new tag THIS into our space.
78 (setq vars
(cons (semantic-tag-new-variable
79 "this" (semantic-tag-name (semantic-current-tag-parent))
85 ;;; Analyzer and type cache support
87 (define-mode-local-override semantic-analyze-split-name java-mode
(name)
88 "Split up tag names on colon . boundaries."
89 (let ((ans (split-string name
"\\.")))
90 (if (= (length ans
) 1)
94 (define-mode-local-override semantic-analyze-unsplit-name java-mode
(namelist)
95 "Assemble the list of names NAMELIST into a namespace name."
96 (mapconcat 'identity namelist
"."))
101 ;;;; Semantic integration of the Java LALR parser
104 ;; In semantic/imenu.el, not part of Emacs.
105 (defvar semantic-imenu-summary-function
)
108 (defun wisent-java-default-setup ()
109 "Hook run to setup Semantic in `java-mode'.
110 Use the alternate LALR(1) parser."
111 (wisent-java-tags-wy--install-parser)
114 semantic-lex-number-expression semantic-java-number-regexp
115 semantic-lex-analyzer
'wisent-java-tags-lexer
117 semantic-tag-expand-function
'semantic-java-expand-tag
119 semantic-imenu-summary-function
'semantic-format-tag-prototype
120 imenu-create-index-function
'semantic-create-imenu-index
121 semantic-type-relation-separator-character
'(".")
122 semantic-command-separation-character
";"
123 ;; speedbar and imenu buckets name
124 semantic-symbol-
>name-assoc-list-for-type-parts
127 (variable .
"Variables")
128 (function .
"Methods"))
129 semantic-symbol-
>name-assoc-list
131 (append semantic-symbol-
>name-assoc-list-for-type-parts
132 '((include .
"Imports")
133 (package .
"Package")))
134 ;; navigation inside 'type children
135 senator-step-at-tag-classes
'(function variable
)
136 ;; Remove 'recursive from the default semanticdb find throttle
137 ;; since java imports never recurse.
138 semanticdb-find-default-throttle
139 (remq 'recursive
(default-value 'semanticdb-find-default-throttle
))
141 ;; Setup javadoc stuff
142 (semantic-java-doc-setup))
144 (provide 'semantic
/wisent
/java-tags
)
147 ;; generated-autoload-file: "../loaddefs.el"
148 ;; generated-autoload-load-name: "semantic/wisent/java-tags"
151 ;;; semantic/wisent/java-tags.el ends here