unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
blob ebb899221ccf9ea78cb8a02921ec89612926d911 4779 bytes (raw)
name: lisp/cedet/semantic/wisent/java-tags.el 	 # note: path name is non-authoritative(*)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
 
;;; semantic/wisent/java-tags.el --- Java LALR parser for Emacs  -*- lexical-binding: t; -*-

;; Copyright (C) 2001-2006, 2009-2024 Free Software Foundation, Inc.

;; Author: David Ponce <david@dponce.com>
;; Created: 15 Dec 2001
;; Keywords: syntax

;; This file is part of GNU Emacs.

;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.

;;; Commentary:
;;

;;; Code:

(require 'semantic/wisent)
(require 'semantic/wisent/javat-wy)
(require 'semantic/java)

;;;;
;;;; Simple parser error reporting function
;;;;

(defun wisent-java-parse-error (msg)
  "Error reporting function called when a parse error occurs.
MSG is the message string to report."
;;   (let ((error-start (nth 2 wisent-input)))
;;     (if (number-or-marker-p error-start)
;;         (goto-char error-start)))
  (message msg)
  ;;(debug)
  )

;;;;
;;;; Local context
;;;;

(define-mode-local-override semantic-get-local-variables
  java-mode ()
  "Get local values from a specific context.
Parse the current context for `field_declaration' nonterminals to
collect tags, such as local variables or prototypes.
This function override `get-local-variables'."
  (let ((vars nil)
	(ct (semantic-current-tag))
        ;; We want nothing to do with funny syntaxing while doing this.
        (semantic-unmatched-syntax-hook nil))
    (while (not (semantic-up-context (point) 'function))
      (save-excursion
        (forward-char 1)
        (setq vars
              (append (semantic-parse-region
                       (point)
                       (save-excursion (semantic-end-of-context) (point))
                       'field_declaration
                       0 t)
                      vars))))
    ;; Add 'this' if in a fcn
    (when (semantic-tag-of-class-p ct 'function)
      ;; Append a new tag THIS into our space.
      (setq vars (cons (semantic-tag-new-variable
			"this" (semantic-tag-name (semantic-current-tag-parent))
			nil)
		       vars)))
    vars))

;;;
;;; Analyzer and type cache support
;;;
(define-mode-local-override semantic-analyze-split-name java-mode (name)
  "Split up tag names on colon . boundaries."
  (let ((ans (split-string name "\\.")))
    (if (= (length ans) 1)
	name
      (delete "" ans))))

(define-mode-local-override semantic-analyze-unsplit-name java-mode (namelist)
  "Assemble the list of names NAMELIST into a namespace name."
  (mapconcat #'identity namelist "."))



;;;;
;;;; Semantic integration of the Java LALR parser
;;;;

;; In semantic/imenu.el, not part of Emacs.
(defvar semantic-imenu-summary-function)

;;;###autoload
(defun wisent-java-default-setup ()
  "Hook run to setup Semantic in `java-mode'.
Use the alternate LALR(1) parser."
  (wisent-java-tags-wy--install-parser)
  (setq
   ;; Lexical analysis
   semantic-lex-number-expression semantic-java-number-regexp
   semantic-lex-analyzer #'wisent-java-tags-lexer
   ;; Parsing
   semantic-tag-expand-function #'semantic-java-expand-tag
   ;; Environment
   semantic-imenu-summary-function #'semantic-format-tag-prototype
   semantic--create-index-function-origin imenu-create-index-function
   imenu-create-index-function #'semantic-create-imenu-index
   semantic-type-relation-separator-character '(".")
   semantic-command-separation-character ";"
   ;; speedbar and imenu buckets name
   semantic-symbol->name-assoc-list-for-type-parts
   ;; in type parts
   '((type     . "Classes")
     (variable . "Variables")
     (function . "Methods"))
   semantic-symbol->name-assoc-list
   ;; everywhere
   (append semantic-symbol->name-assoc-list-for-type-parts
           '((include  . "Imports")
             (package  . "Package")))
   ;; navigation inside 'type children
   senator-step-at-tag-classes '(function variable)
   ;; Remove 'recursive from the default semanticdb find throttle
   ;; since java imports never recurse.
   semanticdb-find-default-throttle
   (remq 'recursive (default-value 'semanticdb-find-default-throttle))
   )
  ;; Setup javadoc stuff
  (semantic-java-doc-setup))

(provide 'semantic/wisent/java-tags)

;; Local variables:
;; generated-autoload-file: "../loaddefs.el"
;; generated-autoload-load-name: "semantic/wisent/java-tags"
;; End:

;;; semantic/wisent/java-tags.el ends here

debug log:

solving ebb899221cc ...
found ebb899221cc in https://yhetil.org/emacs-bugs/TYCPR01MB1000493E60747FE15AB458E9AFB3E2@TYCPR01MB10004.jpnprd01.prod.outlook.com/
found ed62d2c3a9c in https://git.savannah.gnu.org/cgit/emacs.git
preparing index
index prepared:
100644 ed62d2c3a9c9d4564b5e466d966308756934fcea	lisp/cedet/semantic/wisent/java-tags.el

applying [1/1] https://yhetil.org/emacs-bugs/TYCPR01MB1000493E60747FE15AB458E9AFB3E2@TYCPR01MB10004.jpnprd01.prod.outlook.com/
diff --git a/lisp/cedet/semantic/wisent/java-tags.el b/lisp/cedet/semantic/wisent/java-tags.el
index ed62d2c3a9c..ebb899221cc 100644

Checking patch lisp/cedet/semantic/wisent/java-tags.el...
Applied patch lisp/cedet/semantic/wisent/java-tags.el cleanly.

index at:
100644 ebb899221ccf9ea78cb8a02921ec89612926d911	lisp/cedet/semantic/wisent/java-tags.el

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).