cedet/cedet.el (cedet-packages): Bump srecode version.
cedet/data-debug.el: Require `ring' for use of ring-length.
cedet/semantic.el (semantic-repeat-parse-whole-stream): Check
semantic-working-type before updating progress reporter.
cedet/semantic/adebug.el: Fix file header.
cedet/semantic/analyze.el: eval-when-compile semantic/find, for
semantic-find-tags-by-name. Declare semanticdb-strip-find-results and
semanticdb-find-tags-by-name.
cedet/semantic/chart.el: Require semantic/find, semantic/db-mode,
semantic/db-typecache, and semantic/scope.
cedet/semantic/complete.el: Declare
semantic-displayor-focus-abstract-child-p function (needed as the
semantic-displayor-focus-abstract class is defined only after used).
Move semantic-complete-inline-custom-type and
semantic-complete-inline-analyzer-displayor-class variable definitions
up, before they are used, to avoid compiler warning.
Require semantic/decorate, semantic/tag-file, eieio-opt, and
semantic/analyze/complete.
cedet/semantic/ctxt.el: Require semantic/find. Don't
eval-when-compile semantic/db
(semantic-get-local-variables): Use Emacs' built-in progress reporter
instead of working-status-forms.
cedet/semantic/db-debug.el: Require data-debug, semantic/db-mode, and
semantic/format.
cedet/semantic/db-ebrowse.el: Require semantic/db-mode, semantic/find,
semantic/sort, data-debug
(semanticdb-create-database): Require semantic/dep for
semantic-add-system-include.
(semanticdb-table-ebrowse, semanticdb-project-database-ebrowse): Move
class definitions near top of file, before they are used, to avoid
compiler warnings.
(semanticdb-ebrowse-add-tree-to-table): Use split-string.
2009-08-30 21:16:39 +00:00
|
|
|
|
;;; semantic/analyze.el --- Analyze semantic tags against local context
|
2009-08-29 19:00:35 +00:00
|
|
|
|
|
2012-01-05 01:46:05 -08:00
|
|
|
|
;; Copyright (C) 2000-2005, 2007-2012 Free Software Foundation, Inc.
|
2009-08-29 19:00:35 +00:00
|
|
|
|
|
|
|
|
|
;; Author: Eric M. Ludlam <zappo@gnu.org>
|
|
|
|
|
|
|
|
|
|
;; 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 <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
;;
|
|
|
|
|
;; Semantic, as a tool, provides a nice list of searchable tags.
|
|
|
|
|
;; That information can provide some very accurate answers if the current
|
|
|
|
|
;; context of a position is known.
|
|
|
|
|
;;
|
|
|
|
|
;; Semantic-ctxt provides ways of analyzing, and manipulating the
|
|
|
|
|
;; semantic context of a language in code.
|
|
|
|
|
;;
|
|
|
|
|
;; This library provides routines for finding intelligent answers to
|
|
|
|
|
;; tough problems, such as if an argument to a function has the correct
|
|
|
|
|
;; return type, or all possible tags that fit in a given local context.
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
;;; Vocabulary:
|
|
|
|
|
;;
|
|
|
|
|
;; Here are some words used to describe different things in the analyzer:
|
|
|
|
|
;;
|
|
|
|
|
;; tag - A single entity
|
|
|
|
|
;; prefix - The beginning of a symbol, usually used to look up something
|
|
|
|
|
;; incomplete.
|
Fix typos in CEDET docstrings.
* cedet/semantic/analyze.el (semantic-analyze-push-error)
(semantic-analyze-context, semantic-analyze-context-assignment)
(semantic-analyze-find-tag-sequence, semantic-analyze-find-tag):
* cedet/semantic/java.el (java-mode, semantic-tag-include-filename)
(semantic-java-doc-keywords-map):
* cedet/semantic/bovine/c.el (c-mode, semantic-c-member-of-autocast)
(semantic-lex-c-nested-namespace-ignore-second, semantic-parse-region)
(semantic-c-parse-lexical-token, semantic-c-debug-mode-init-pch)
(semantic-c-classname, semantic-format-tag-uml-prototype)
(semantic-c-dereference-namespace, semantic-analyze-type-constants):
* cedet/semantic/bovine/el.el (semantic-elisp-form-to-doc-string)
(semantic-emacs-lisp-obsoleted-doc, semantic-up-context)
(semantic-get-local-variables, semantic-end-of-command)
(semantic-beginning-of-command, semantic-ctxt-current-class-list)
(lisp-mode):
* cedet/semantic/bovine/make.el (makefile-mode):
* cedet/semantic/wisent/python.el (wisent-python-string-re)
(wisent-python-implicit-line-joining-p, wisent-python-forward-string)
(wisent-python-lex-beginning-of-line, wisent-python-lex-end-of-line)
(semantic-lex, semantic-get-local-variables, python-mode):
* cedet/semantic/wisent/python-wy.el (wisent-python-wy--keyword-table):
* cedet/srecode/extract.el (srecode-extract-state-set)
(srecode-extract-method): Fix typos in docstrings.
2010-01-12 05:51:26 +01:00
|
|
|
|
;; type - The name of a datatype in the language.
|
2009-08-29 19:00:35 +00:00
|
|
|
|
;; metatype - If a type is named in a declaration like:
|
|
|
|
|
;; struct moose somevariable;
|
|
|
|
|
;; that name "moose" can be turned into a concrete type.
|
|
|
|
|
;; tag sequence - In C code, a list of dereferences, such as:
|
|
|
|
|
;; this.that.theother();
|
|
|
|
|
;; parent - For a datatype in an OO language, another datatype
|
|
|
|
|
;; inherited from. This excludes interfaces.
|
|
|
|
|
;; scope - A list of tags that can be dereferenced that cannot
|
|
|
|
|
;; be found from the global namespace.
|
|
|
|
|
;; scopetypes - A list of tags which are datatype that contain
|
|
|
|
|
;; the scope. The scopetypes need to have the scope extracted
|
|
|
|
|
;; in a way that honors the type of inheritance.
|
|
|
|
|
;; nest/nested - When one tag is contained entirely in another.
|
|
|
|
|
;;
|
|
|
|
|
;; context - A semantic datatype representing a point in a buffer.
|
|
|
|
|
;;
|
2011-11-26 20:43:11 -08:00
|
|
|
|
;; constraint - If a context specifies a specific datatype is needed,
|
2009-08-29 19:00:35 +00:00
|
|
|
|
;; that is a constraint.
|
|
|
|
|
;; constants - Some datatypes define elements of themselves as a
|
|
|
|
|
;; constant. These need to be returned as there would be no
|
|
|
|
|
;; other possible completions.
|
2009-09-28 15:15:00 +00:00
|
|
|
|
|
2009-10-17 04:18:31 +00:00
|
|
|
|
(eval-when-compile (require 'cl))
|
2009-08-29 19:00:35 +00:00
|
|
|
|
(require 'semantic)
|
|
|
|
|
(require 'semantic/format)
|
|
|
|
|
(require 'semantic/ctxt)
|
|
|
|
|
(require 'semantic/scope)
|
2009-09-28 15:15:00 +00:00
|
|
|
|
(require 'semantic/sort)
|
2009-08-29 19:00:35 +00:00
|
|
|
|
(require 'semantic/analyze/fcn)
|
|
|
|
|
|
2009-09-28 15:15:00 +00:00
|
|
|
|
(eval-when-compile (require 'semantic/find))
|
|
|
|
|
|
2009-09-13 16:12:23 +00:00
|
|
|
|
(declare-function data-debug-new-buffer "data-debug")
|
|
|
|
|
(declare-function data-debug-insert-object-slots "eieio-datadebug")
|
|
|
|
|
|
2009-08-29 19:00:35 +00:00
|
|
|
|
;;; Code:
|
|
|
|
|
(defvar semantic-analyze-error-stack nil
|
|
|
|
|
"Collection of any errors thrown during analysis.")
|
|
|
|
|
|
|
|
|
|
(defun semantic-analyze-push-error (err)
|
|
|
|
|
"Push the error in ERR-DATA onto the error stack.
|
Fix typos in CEDET docstrings.
* cedet/semantic/analyze.el (semantic-analyze-push-error)
(semantic-analyze-context, semantic-analyze-context-assignment)
(semantic-analyze-find-tag-sequence, semantic-analyze-find-tag):
* cedet/semantic/java.el (java-mode, semantic-tag-include-filename)
(semantic-java-doc-keywords-map):
* cedet/semantic/bovine/c.el (c-mode, semantic-c-member-of-autocast)
(semantic-lex-c-nested-namespace-ignore-second, semantic-parse-region)
(semantic-c-parse-lexical-token, semantic-c-debug-mode-init-pch)
(semantic-c-classname, semantic-format-tag-uml-prototype)
(semantic-c-dereference-namespace, semantic-analyze-type-constants):
* cedet/semantic/bovine/el.el (semantic-elisp-form-to-doc-string)
(semantic-emacs-lisp-obsoleted-doc, semantic-up-context)
(semantic-get-local-variables, semantic-end-of-command)
(semantic-beginning-of-command, semantic-ctxt-current-class-list)
(lisp-mode):
* cedet/semantic/bovine/make.el (makefile-mode):
* cedet/semantic/wisent/python.el (wisent-python-string-re)
(wisent-python-implicit-line-joining-p, wisent-python-forward-string)
(wisent-python-lex-beginning-of-line, wisent-python-lex-end-of-line)
(semantic-lex, semantic-get-local-variables, python-mode):
* cedet/semantic/wisent/python-wy.el (wisent-python-wy--keyword-table):
* cedet/srecode/extract.el (srecode-extract-state-set)
(srecode-extract-method): Fix typos in docstrings.
2010-01-12 05:51:26 +01:00
|
|
|
|
Argument ERR."
|
2009-08-29 19:00:35 +00:00
|
|
|
|
(push err semantic-analyze-error-stack))
|
|
|
|
|
|
|
|
|
|
;;; Analysis Classes
|
|
|
|
|
;;
|
|
|
|
|
;; These classes represent what a context is. Different types
|
|
|
|
|
;; of contexts provide differing amounts of information to help
|
|
|
|
|
;; provide completions.
|
|
|
|
|
;;
|
|
|
|
|
(defclass semantic-analyze-context ()
|
|
|
|
|
((bounds :initarg :bounds
|
|
|
|
|
:type list
|
|
|
|
|
:documentation "The bounds of this context.
|
|
|
|
|
Usually bound to the dimension of a single symbol or command.")
|
|
|
|
|
(prefix :initarg :prefix
|
|
|
|
|
:type list
|
|
|
|
|
:documentation "List of tags defining local text.
|
|
|
|
|
This can be nil, or a list where the last element can be a string
|
2011-02-22 23:08:12 -08:00
|
|
|
|
representing text that may be incomplete. Preceding elements
|
2009-08-29 19:00:35 +00:00
|
|
|
|
must be semantic tags representing variables or functions
|
|
|
|
|
called in a dereference sequence.")
|
|
|
|
|
(prefixclass :initarg :prefixclass
|
|
|
|
|
:type list
|
|
|
|
|
:documentation "Tag classes expected at this context.
|
2011-11-14 23:55:13 -08:00
|
|
|
|
These are classes for tags, such as 'function, or 'variable.")
|
2009-08-29 19:00:35 +00:00
|
|
|
|
(prefixtypes :initarg :prefixtypes
|
|
|
|
|
:type list
|
|
|
|
|
:documentation "List of tags defining types for :prefix.
|
|
|
|
|
This list is one shorter than :prefix. Each element is a semantic
|
|
|
|
|
tag representing a type matching the semantic tag in the same
|
|
|
|
|
position in PREFIX.")
|
|
|
|
|
(scope :initarg :scope
|
|
|
|
|
:type (or null semantic-scope-cache)
|
|
|
|
|
:documentation "List of tags available in scopetype.
|
|
|
|
|
See `semantic-analyze-scoped-tags' for details.")
|
|
|
|
|
(buffer :initarg :buffer
|
|
|
|
|
:type buffer
|
|
|
|
|
:documentation "The buffer this context is derived from.")
|
|
|
|
|
(errors :initarg :errors
|
|
|
|
|
:documentation "Any errors thrown an caught during analysis.")
|
|
|
|
|
)
|
Fix typos in CEDET docstrings.
* cedet/semantic/analyze.el (semantic-analyze-push-error)
(semantic-analyze-context, semantic-analyze-context-assignment)
(semantic-analyze-find-tag-sequence, semantic-analyze-find-tag):
* cedet/semantic/java.el (java-mode, semantic-tag-include-filename)
(semantic-java-doc-keywords-map):
* cedet/semantic/bovine/c.el (c-mode, semantic-c-member-of-autocast)
(semantic-lex-c-nested-namespace-ignore-second, semantic-parse-region)
(semantic-c-parse-lexical-token, semantic-c-debug-mode-init-pch)
(semantic-c-classname, semantic-format-tag-uml-prototype)
(semantic-c-dereference-namespace, semantic-analyze-type-constants):
* cedet/semantic/bovine/el.el (semantic-elisp-form-to-doc-string)
(semantic-emacs-lisp-obsoleted-doc, semantic-up-context)
(semantic-get-local-variables, semantic-end-of-command)
(semantic-beginning-of-command, semantic-ctxt-current-class-list)
(lisp-mode):
* cedet/semantic/bovine/make.el (makefile-mode):
* cedet/semantic/wisent/python.el (wisent-python-string-re)
(wisent-python-implicit-line-joining-p, wisent-python-forward-string)
(wisent-python-lex-beginning-of-line, wisent-python-lex-end-of-line)
(semantic-lex, semantic-get-local-variables, python-mode):
* cedet/semantic/wisent/python-wy.el (wisent-python-wy--keyword-table):
* cedet/srecode/extract.el (srecode-extract-state-set)
(srecode-extract-method): Fix typos in docstrings.
2010-01-12 05:51:26 +01:00
|
|
|
|
"Base analysis data for any context.")
|
2009-08-29 19:00:35 +00:00
|
|
|
|
|
|
|
|
|
(defclass semantic-analyze-context-assignment (semantic-analyze-context)
|
|
|
|
|
((assignee :initarg :assignee
|
|
|
|
|
:type list
|
|
|
|
|
:documentation "A sequence of tags for an assignee.
|
|
|
|
|
This is a variable into which some value is being placed. The last
|
|
|
|
|
item in the list is the variable accepting the value. Earlier
|
Fix typos in CEDET docstrings.
* cedet/semantic/analyze.el (semantic-analyze-push-error)
(semantic-analyze-context, semantic-analyze-context-assignment)
(semantic-analyze-find-tag-sequence, semantic-analyze-find-tag):
* cedet/semantic/java.el (java-mode, semantic-tag-include-filename)
(semantic-java-doc-keywords-map):
* cedet/semantic/bovine/c.el (c-mode, semantic-c-member-of-autocast)
(semantic-lex-c-nested-namespace-ignore-second, semantic-parse-region)
(semantic-c-parse-lexical-token, semantic-c-debug-mode-init-pch)
(semantic-c-classname, semantic-format-tag-uml-prototype)
(semantic-c-dereference-namespace, semantic-analyze-type-constants):
* cedet/semantic/bovine/el.el (semantic-elisp-form-to-doc-string)
(semantic-emacs-lisp-obsoleted-doc, semantic-up-context)
(semantic-get-local-variables, semantic-end-of-command)
(semantic-beginning-of-command, semantic-ctxt-current-class-list)
(lisp-mode):
* cedet/semantic/bovine/make.el (makefile-mode):
* cedet/semantic/wisent/python.el (wisent-python-string-re)
(wisent-python-implicit-line-joining-p, wisent-python-forward-string)
(wisent-python-lex-beginning-of-line, wisent-python-lex-end-of-line)
(semantic-lex, semantic-get-local-variables, python-mode):
* cedet/semantic/wisent/python-wy.el (wisent-python-wy--keyword-table):
* cedet/srecode/extract.el (srecode-extract-state-set)
(srecode-extract-method): Fix typos in docstrings.
2010-01-12 05:51:26 +01:00
|
|
|
|
tags represent the variables being dereferenced to get to the
|
2009-08-29 19:00:35 +00:00
|
|
|
|
assignee."))
|
|
|
|
|
"Analysis class for a value in an assignment.")
|
|
|
|
|
|
|
|
|
|
(defclass semantic-analyze-context-functionarg (semantic-analyze-context)
|
|
|
|
|
((function :initarg :function
|
|
|
|
|
:type list
|
|
|
|
|
:documentation "A sequence of tags for a function.
|
|
|
|
|
This is a function being called. The cursor will be in the position
|
|
|
|
|
of an argument.
|
|
|
|
|
The last tag in :function is the function being called. Earlier
|
|
|
|
|
tags represent the variables being dereferenced to get to the
|
|
|
|
|
function.")
|
|
|
|
|
(index :initarg :index
|
|
|
|
|
:type integer
|
|
|
|
|
:documentation "The index of the argument for this context.
|
|
|
|
|
If a function takes 4 arguments, this value should be bound to
|
|
|
|
|
the values 1 through 4.")
|
|
|
|
|
(argument :initarg :argument
|
|
|
|
|
:type list
|
|
|
|
|
:documentation "A sequence of tags for the :index argument.
|
|
|
|
|
The argument can accept a value of some type, and this contains the
|
|
|
|
|
tag for that definition. It should be a tag, but might
|
|
|
|
|
be just a string in some circumstances.")
|
|
|
|
|
)
|
|
|
|
|
"Analysis class for a value as a function argument.")
|
|
|
|
|
|
|
|
|
|
(defclass semantic-analyze-context-return (semantic-analyze-context)
|
|
|
|
|
() ; No extra data.
|
|
|
|
|
"Analysis class for return data.
|
2011-11-19 23:30:16 -08:00
|
|
|
|
Return data methods identify the required type by the return value
|
2009-08-29 19:00:35 +00:00
|
|
|
|
of the parent function.")
|
|
|
|
|
|
|
|
|
|
;;; METHODS
|
|
|
|
|
;;
|
|
|
|
|
;; Simple methods against the context classes.
|
|
|
|
|
;;
|
|
|
|
|
(defmethod semantic-analyze-type-constraint
|
|
|
|
|
((context semantic-analyze-context) &optional desired-type)
|
|
|
|
|
"Return a type constraint for completing :prefix in CONTEXT.
|
|
|
|
|
Optional argument DESIRED-TYPE may be a non-type tag to analyze."
|
|
|
|
|
(when (semantic-tag-p desired-type)
|
|
|
|
|
;; Convert the desired type if needed.
|
|
|
|
|
(if (not (eq (semantic-tag-class desired-type) 'type))
|
|
|
|
|
(setq desired-type (semantic-tag-type desired-type)))
|
|
|
|
|
;; Protect against plain strings
|
|
|
|
|
(cond ((stringp desired-type)
|
|
|
|
|
(setq desired-type (list desired-type 'type)))
|
|
|
|
|
((and (stringp (car desired-type))
|
|
|
|
|
(not (semantic-tag-p desired-type)))
|
|
|
|
|
(setq desired-type (list (car desired-type) 'type)))
|
|
|
|
|
((semantic-tag-p desired-type)
|
|
|
|
|
;; We have a tag of some sort. Yay!
|
|
|
|
|
nil)
|
|
|
|
|
(t (setq desired-type nil))
|
|
|
|
|
)
|
|
|
|
|
desired-type))
|
|
|
|
|
|
|
|
|
|
(defmethod semantic-analyze-type-constraint
|
|
|
|
|
((context semantic-analyze-context-functionarg))
|
|
|
|
|
"Return a type constraint for completing :prefix in CONTEXT."
|
|
|
|
|
(call-next-method context (car (oref context argument))))
|
|
|
|
|
|
|
|
|
|
(defmethod semantic-analyze-type-constraint
|
|
|
|
|
((context semantic-analyze-context-assignment))
|
|
|
|
|
"Return a type constraint for completing :prefix in CONTEXT."
|
|
|
|
|
(call-next-method context (car (reverse (oref context assignee)))))
|
|
|
|
|
|
|
|
|
|
(defmethod semantic-analyze-interesting-tag
|
|
|
|
|
((context semantic-analyze-context))
|
|
|
|
|
"Return a tag from CONTEXT that would be most interesting to a user."
|
|
|
|
|
(let ((prefix (reverse (oref context :prefix))))
|
|
|
|
|
;; Go back through the prefix until we find a tag we can return.
|
|
|
|
|
(while (and prefix (not (semantic-tag-p (car prefix))))
|
|
|
|
|
(setq prefix (cdr prefix)))
|
|
|
|
|
;; Return the found tag, or nil.
|
|
|
|
|
(car prefix)))
|
|
|
|
|
|
|
|
|
|
(defmethod semantic-analyze-interesting-tag
|
|
|
|
|
((context semantic-analyze-context-functionarg))
|
|
|
|
|
"Try the base, and if that fails, return what we are assigning into."
|
|
|
|
|
(or (call-next-method) (car-safe (oref context :function))))
|
|
|
|
|
|
|
|
|
|
(defmethod semantic-analyze-interesting-tag
|
|
|
|
|
((context semantic-analyze-context-assignment))
|
|
|
|
|
"Try the base, and if that fails, return what we are assigning into."
|
|
|
|
|
(or (call-next-method) (car-safe (oref context :assignee))))
|
|
|
|
|
|
|
|
|
|
;;; ANALYSIS
|
|
|
|
|
;;
|
|
|
|
|
;; Start out with routines that will calculate useful parts of
|
|
|
|
|
;; the general analyzer function. These could be used directly
|
|
|
|
|
;; by an application that doesn't need to calculate the full
|
|
|
|
|
;; context.
|
|
|
|
|
|
|
|
|
|
(define-overloadable-function semantic-analyze-find-tag-sequence (sequence &optional
|
|
|
|
|
scope typereturn throwsym)
|
|
|
|
|
"Attempt to find all tags in SEQUENCE.
|
|
|
|
|
Optional argument LOCALVAR is the list of local variables to use when
|
|
|
|
|
finding the details on the first element of SEQUENCE in case
|
|
|
|
|
it is not found in the global set of tables.
|
|
|
|
|
Optional argument SCOPE are additional terminals to search which are currently
|
|
|
|
|
scoped. These are not local variables, but symbols available in a structure
|
Fix typos in CEDET docstrings.
* cedet/semantic/analyze.el (semantic-analyze-push-error)
(semantic-analyze-context, semantic-analyze-context-assignment)
(semantic-analyze-find-tag-sequence, semantic-analyze-find-tag):
* cedet/semantic/java.el (java-mode, semantic-tag-include-filename)
(semantic-java-doc-keywords-map):
* cedet/semantic/bovine/c.el (c-mode, semantic-c-member-of-autocast)
(semantic-lex-c-nested-namespace-ignore-second, semantic-parse-region)
(semantic-c-parse-lexical-token, semantic-c-debug-mode-init-pch)
(semantic-c-classname, semantic-format-tag-uml-prototype)
(semantic-c-dereference-namespace, semantic-analyze-type-constants):
* cedet/semantic/bovine/el.el (semantic-elisp-form-to-doc-string)
(semantic-emacs-lisp-obsoleted-doc, semantic-up-context)
(semantic-get-local-variables, semantic-end-of-command)
(semantic-beginning-of-command, semantic-ctxt-current-class-list)
(lisp-mode):
* cedet/semantic/bovine/make.el (makefile-mode):
* cedet/semantic/wisent/python.el (wisent-python-string-re)
(wisent-python-implicit-line-joining-p, wisent-python-forward-string)
(wisent-python-lex-beginning-of-line, wisent-python-lex-end-of-line)
(semantic-lex, semantic-get-local-variables, python-mode):
* cedet/semantic/wisent/python-wy.el (wisent-python-wy--keyword-table):
* cedet/srecode/extract.el (srecode-extract-state-set)
(srecode-extract-method): Fix typos in docstrings.
2010-01-12 05:51:26 +01:00
|
|
|
|
which doesn't need to be dereferenced.
|
2009-08-29 19:00:35 +00:00
|
|
|
|
Optional argument TYPERETURN is a symbol in which the types of all found
|
|
|
|
|
will be stored. If nil, that data is thrown away.
|
|
|
|
|
Optional argument THROWSYM specifies a symbol the throw on non-recoverable error.")
|
|
|
|
|
|
|
|
|
|
(defun semantic-analyze-find-tag-sequence-default (sequence &optional
|
|
|
|
|
scope typereturn
|
|
|
|
|
throwsym)
|
|
|
|
|
"Attempt to find all tags in SEQUENCE.
|
|
|
|
|
SCOPE are extra tags which are in scope.
|
|
|
|
|
TYPERETURN is a symbol in which to place a list of tag classes that
|
|
|
|
|
are found in SEQUENCE.
|
|
|
|
|
Optional argument THROWSYM specifies a symbol the throw on non-recoverable error."
|
|
|
|
|
(let ((s sequence) ; copy of the sequence
|
|
|
|
|
(tmp nil) ; tmp find variable
|
|
|
|
|
(tag nil) ; tag return list
|
|
|
|
|
(tagtype nil) ; tag types return list
|
|
|
|
|
(fname nil)
|
Synch Semantic to CEDET 1.0.
Move CEDET ChangeLog entries to new file lisp/cedet/ChangeLog.
* semantic.el (semantic-version): Update to 2.0.
(semantic-mode-map): Add "," and "m" bindings.
(navigate-menu): Update.
* semantic/symref.el (semantic-symref-calculate-rootdir):
New function.
(semantic-symref-detect-symref-tool): Use it.
* semantic/symref/grep.el (semantic-symref-grep-shell): New var.
(semantic-symref-perform-search): Use it. Calculate root dir with
semantic-symref-calculate-rootdir.
(semantic-symref-derive-find-filepatterns): Improve error message.
* semantic/symref/list.el
(semantic-symref-results-mode-map): New bindings.
(semantic-symref-auto-expand-results): New option.
(semantic-symref-results-dump): Obey auto-expand.
(semantic-symref-list-expand-all, semantic-symref-regexp)
(semantic-symref-list-contract-all)
(semantic-symref-list-map-open-hits)
(semantic-symref-list-update-open-hits)
(semantic-symref-list-create-macro-on-open-hit)
(semantic-symref-list-call-macro-on-open-hits): New functions.
(semantic-symref-list-menu-entries)
(semantic-symref-list-menu): New vars.
(semantic-symref-list-map-open-hits): Move cursor to beginning of
match before calling the mapped function.
* semantic/doc.el
(semantic-documentation-comment-preceeding-tag): Do nothing if the
mode doesn't provide comment-start-skip.
* semantic/scope.el
(semantic-analyze-scope-nested-tags-default): Strip duplicates.
(semantic-analyze-scoped-inherited-tag-map): Take the tag we are
looking for as part of the scoped tags list.
* semantic/html.el (semantic-default-html-setup): Add
senator-step-at-tag-classes.
* semantic/decorate/include.el
(semantic-decoration-on-unknown-includes): Change light bgcolor.
(semantic-decoration-on-includes-highlight-default): Check that
the include tag has a postion.
* semantic/complete.el (semantic-collector-local-members):
(semantic-complete-read-tag-local-members)
(semantic-complete-jump-local-members): New class and functions.
(semantic-complete-self-insert): Save excursion before completing.
* semantic/analyze/complete.el
(semantic-analyze-possible-completions-default): If no completions
are found, return the raw by-name-only completion list. Add FLAGS
arguments. Add support for 'no-tc (type constraint) and
'no-unique, or no stripping duplicates.
(semantic-analyze-possible-completions-default): Add FLAGS arg.
* semantic/util-modes.el
(semantic-stickyfunc-show-only-functions-p): New option.
(semantic-stickyfunc-fetch-stickyline): Don't show stickytext for
the very first line in a buffer.
* semantic/util.el (semantic-hack-search)
(semantic-recursive-find-nonterminal-by-name)
(semantic-current-tag-interactive): Deleted.
(semantic-describe-buffer): Fix expand-nonterminal. Add
lex-syntax-mods, type relation separator char, and command
separation char.
(semantic-sanity-check): Only message if called interactively.
* semantic/tag.el (semantic-tag-deep-copy-one-tag): Copy the
:filename property and the tag position.
* semantic/lex-spp.el (semantic-lex-spp-lex-text-string):
Add recursion limit.
* semantic/imenu.el (semantic-imenu-bucketize-type-members):
Make this buffer local, not the obsoleted variable.
* semantic/idle.el: Add breadcrumbs support.
(semantic-idle-summary-current-symbol-info-default)
(semantic-idle-tag-highlight)
(semantic-idle-completion-list-default): Use
semanticdb-without-unloaded-file-searches for speed, and to
conform to the controls that specify if the idle timer is supposed
to be parsing unparsed includes.
(semantic-idle-symbol-highlight-face)
(semantic-idle-symbol-maybe-highlight): Rename from *-summary-*.
Callers changed.
(semantic-idle-work-parse-neighboring-files-flag): Default to nil.
(semantic-idle-work-update-headers-flag): New var.
(semantic-idle-work-for-one-buffer): Use it.
(semantic-idle-local-symbol-highlight): Rename from
semantic-idle-tag-highlight.
(semantic-idle-truncate-long-summaries): New option.
* semantic/ia.el (semantic-ia-cache)
(semantic-ia-get-completions): Deleted. Callers changed.
(semantic-ia-show-variants): New command.
(semantic-ia-show-doc): If doc is empty, don't make a temp buffer.
(semantic-ia-show-summary): If there isn't anything to show, say so.
* semantic/grammar.el (semantic-grammar-create-package):
Save the buffer even in batch mode.
* semantic/fw.el
(semanticdb-without-unloaded-file-searches): New macro.
* semantic/dep.el (semantic-dependency-find-file-on-path):
Fix case dereferencing ede-object when it is a list.
* semantic/db-typecache.el (semanticdb-expand-nested-tag)
(semanticdb-typecache-faux-namespace): New functions.
(semanticdb-typecache-file-tags)
(semanticdb-typecache-merge-streams): Use them.
(semanticdb-typecache-file-tags): When deriving tags from a file,
give the mode a chance to monkey with the tag copy.
(semanticdb-typecache-find-default): Wrap find in save-excursion.
(semanticdb-typecache-find-by-name-helper): Merge found names down.
* semantic/db-global.el
(semanticdb-enable-gnu-global-in-buffer): Don't show messages if
GNU Global is not available and we don't want to throw an error.
* semantic/db-find.el (semanticdb-find-result-nth-in-buffer):
When trying to normalize the tag to a buffer, don't error if
set-buffer method doesn't exist.
* semantic/db-file.el (semanticdb-save-db): Simplify msg.
* semantic/db.el (semanticdb-refresh-table): If forcing a
refresh on a file not in a buffer, use semantic-find-file-noselect
and delete the buffer after use.
(semanticdb-current-database-list): When calculating root via
hooks, force it through true-filename and skip the list of
possible roots.
* semantic/ctxt.el (semantic-ctxt-imported-packages): New.
* semantic/analyze/debug.el
(semantic-analyzer-debug-insert-tag): Reset standard output to
current buffer.
(semantic-analyzer-debug-global-symbol)
(semantic-analyzer-debug-missing-innertype): Change "prefix" to
"symbol" in messages.
* semantic/analyze/refs.el: (semantic-analyze-refs-impl)
(semantic-analyze-refs-proto): When calculating value, make sure
the found tag is 'similar' to the originating tag.
(semantic--analyze-refs-find-tags-with-parent): Attempt to
identify matches via imported symbols of parents.
(semantic--analyze-refs-full-lookup-with-parents): Do a deep
search during the brute search.
* semantic/analyze.el
(semantic-analyze-find-tag-sequence-default): Be robust to
calculated scopes being nil.
* semantic/bovine/c.el (semantic-c-describe-environment): Add
project macro symbol array.
(semantic-c-parse-lexical-token): Add recursion limit.
(semantic-ctxt-imported-packages, semanticdb-expand-nested-tag):
New overrides.
(semantic-expand-c-tag-namelist): Split a full type from a typedef
out to its own tag.
(semantic-expand-c-tag-namelist): Do not split out a typedef'd
inline type if it is an anonymous type.
(semantic-c-reconstitute-token): Use the optional initializers as
a clue that some function is probably a constructor. When
defining the type of these constructors, split the parent name,
and use only the class part, if applicable.
* semantic/bovine/c-by.el:
* semantic/wisent/python-wy.el: Regenerate.
2010-09-18 22:49:54 -04:00
|
|
|
|
(miniscope (when scope (clone scope)))
|
2009-08-29 19:00:35 +00:00
|
|
|
|
)
|
2011-11-22 23:03:56 -08:00
|
|
|
|
;; First order check. Is this wholly contained in the typecache?
|
2009-08-29 19:00:35 +00:00
|
|
|
|
(setq tmp (semanticdb-typecache-find sequence))
|
|
|
|
|
|
|
|
|
|
(if tmp
|
|
|
|
|
(progn
|
|
|
|
|
;; We are effectively done...
|
|
|
|
|
(setq s nil)
|
|
|
|
|
(setq tag (list tmp)))
|
|
|
|
|
|
|
|
|
|
;; For the first entry, it better be a variable, but it might
|
|
|
|
|
;; be in the local context too.
|
|
|
|
|
;; NOTE: Don't forget c++ namespace foo::bar.
|
|
|
|
|
(setq tmp (or
|
|
|
|
|
;; Is this tag within our scope. Scopes can sometimes
|
|
|
|
|
;; shadow other things, so it goes first.
|
|
|
|
|
(and scope (semantic-scope-find (car s) nil scope))
|
|
|
|
|
;; Find the tag out there... somewhere, but not in scope
|
|
|
|
|
(semantic-analyze-find-tag (car s))
|
|
|
|
|
))
|
|
|
|
|
|
|
|
|
|
(if (and (listp tmp) (semantic-tag-p (car tmp)))
|
|
|
|
|
(setq tmp (semantic-analyze-select-best-tag tmp)))
|
|
|
|
|
(if (not (semantic-tag-p tmp))
|
|
|
|
|
(if throwsym
|
|
|
|
|
(throw throwsym "Cannot find definition")
|
|
|
|
|
(error "Cannot find definition for \"%s\"" (car s))))
|
|
|
|
|
(setq s (cdr s))
|
|
|
|
|
(setq tag (cons tmp tag)) ; tag is nil here...
|
|
|
|
|
(setq fname (semantic-tag-file-name tmp))
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
;; For the middle entries
|
|
|
|
|
(while s
|
2011-11-15 18:37:37 +01:00
|
|
|
|
;; Using the tag found in TMP, let's find the tag
|
2009-08-29 19:00:35 +00:00
|
|
|
|
;; representing the full typeographic information of its
|
|
|
|
|
;; type, and use that to determine the search context for
|
|
|
|
|
;; (car s)
|
|
|
|
|
(let* ((tmptype
|
|
|
|
|
;; In some cases the found TMP is a type,
|
|
|
|
|
;; and we can use it directly.
|
|
|
|
|
(cond ((semantic-tag-of-class-p tmp 'type)
|
|
|
|
|
;; update the miniscope when we need to analyze types directly.
|
Synch Semantic to CEDET 1.0.
Move CEDET ChangeLog entries to new file lisp/cedet/ChangeLog.
* semantic.el (semantic-version): Update to 2.0.
(semantic-mode-map): Add "," and "m" bindings.
(navigate-menu): Update.
* semantic/symref.el (semantic-symref-calculate-rootdir):
New function.
(semantic-symref-detect-symref-tool): Use it.
* semantic/symref/grep.el (semantic-symref-grep-shell): New var.
(semantic-symref-perform-search): Use it. Calculate root dir with
semantic-symref-calculate-rootdir.
(semantic-symref-derive-find-filepatterns): Improve error message.
* semantic/symref/list.el
(semantic-symref-results-mode-map): New bindings.
(semantic-symref-auto-expand-results): New option.
(semantic-symref-results-dump): Obey auto-expand.
(semantic-symref-list-expand-all, semantic-symref-regexp)
(semantic-symref-list-contract-all)
(semantic-symref-list-map-open-hits)
(semantic-symref-list-update-open-hits)
(semantic-symref-list-create-macro-on-open-hit)
(semantic-symref-list-call-macro-on-open-hits): New functions.
(semantic-symref-list-menu-entries)
(semantic-symref-list-menu): New vars.
(semantic-symref-list-map-open-hits): Move cursor to beginning of
match before calling the mapped function.
* semantic/doc.el
(semantic-documentation-comment-preceeding-tag): Do nothing if the
mode doesn't provide comment-start-skip.
* semantic/scope.el
(semantic-analyze-scope-nested-tags-default): Strip duplicates.
(semantic-analyze-scoped-inherited-tag-map): Take the tag we are
looking for as part of the scoped tags list.
* semantic/html.el (semantic-default-html-setup): Add
senator-step-at-tag-classes.
* semantic/decorate/include.el
(semantic-decoration-on-unknown-includes): Change light bgcolor.
(semantic-decoration-on-includes-highlight-default): Check that
the include tag has a postion.
* semantic/complete.el (semantic-collector-local-members):
(semantic-complete-read-tag-local-members)
(semantic-complete-jump-local-members): New class and functions.
(semantic-complete-self-insert): Save excursion before completing.
* semantic/analyze/complete.el
(semantic-analyze-possible-completions-default): If no completions
are found, return the raw by-name-only completion list. Add FLAGS
arguments. Add support for 'no-tc (type constraint) and
'no-unique, or no stripping duplicates.
(semantic-analyze-possible-completions-default): Add FLAGS arg.
* semantic/util-modes.el
(semantic-stickyfunc-show-only-functions-p): New option.
(semantic-stickyfunc-fetch-stickyline): Don't show stickytext for
the very first line in a buffer.
* semantic/util.el (semantic-hack-search)
(semantic-recursive-find-nonterminal-by-name)
(semantic-current-tag-interactive): Deleted.
(semantic-describe-buffer): Fix expand-nonterminal. Add
lex-syntax-mods, type relation separator char, and command
separation char.
(semantic-sanity-check): Only message if called interactively.
* semantic/tag.el (semantic-tag-deep-copy-one-tag): Copy the
:filename property and the tag position.
* semantic/lex-spp.el (semantic-lex-spp-lex-text-string):
Add recursion limit.
* semantic/imenu.el (semantic-imenu-bucketize-type-members):
Make this buffer local, not the obsoleted variable.
* semantic/idle.el: Add breadcrumbs support.
(semantic-idle-summary-current-symbol-info-default)
(semantic-idle-tag-highlight)
(semantic-idle-completion-list-default): Use
semanticdb-without-unloaded-file-searches for speed, and to
conform to the controls that specify if the idle timer is supposed
to be parsing unparsed includes.
(semantic-idle-symbol-highlight-face)
(semantic-idle-symbol-maybe-highlight): Rename from *-summary-*.
Callers changed.
(semantic-idle-work-parse-neighboring-files-flag): Default to nil.
(semantic-idle-work-update-headers-flag): New var.
(semantic-idle-work-for-one-buffer): Use it.
(semantic-idle-local-symbol-highlight): Rename from
semantic-idle-tag-highlight.
(semantic-idle-truncate-long-summaries): New option.
* semantic/ia.el (semantic-ia-cache)
(semantic-ia-get-completions): Deleted. Callers changed.
(semantic-ia-show-variants): New command.
(semantic-ia-show-doc): If doc is empty, don't make a temp buffer.
(semantic-ia-show-summary): If there isn't anything to show, say so.
* semantic/grammar.el (semantic-grammar-create-package):
Save the buffer even in batch mode.
* semantic/fw.el
(semanticdb-without-unloaded-file-searches): New macro.
* semantic/dep.el (semantic-dependency-find-file-on-path):
Fix case dereferencing ede-object when it is a list.
* semantic/db-typecache.el (semanticdb-expand-nested-tag)
(semanticdb-typecache-faux-namespace): New functions.
(semanticdb-typecache-file-tags)
(semanticdb-typecache-merge-streams): Use them.
(semanticdb-typecache-file-tags): When deriving tags from a file,
give the mode a chance to monkey with the tag copy.
(semanticdb-typecache-find-default): Wrap find in save-excursion.
(semanticdb-typecache-find-by-name-helper): Merge found names down.
* semantic/db-global.el
(semanticdb-enable-gnu-global-in-buffer): Don't show messages if
GNU Global is not available and we don't want to throw an error.
* semantic/db-find.el (semanticdb-find-result-nth-in-buffer):
When trying to normalize the tag to a buffer, don't error if
set-buffer method doesn't exist.
* semantic/db-file.el (semanticdb-save-db): Simplify msg.
* semantic/db.el (semanticdb-refresh-table): If forcing a
refresh on a file not in a buffer, use semantic-find-file-noselect
and delete the buffer after use.
(semanticdb-current-database-list): When calculating root via
hooks, force it through true-filename and skip the list of
possible roots.
* semantic/ctxt.el (semantic-ctxt-imported-packages): New.
* semantic/analyze/debug.el
(semantic-analyzer-debug-insert-tag): Reset standard output to
current buffer.
(semantic-analyzer-debug-global-symbol)
(semantic-analyzer-debug-missing-innertype): Change "prefix" to
"symbol" in messages.
* semantic/analyze/refs.el: (semantic-analyze-refs-impl)
(semantic-analyze-refs-proto): When calculating value, make sure
the found tag is 'similar' to the originating tag.
(semantic--analyze-refs-find-tags-with-parent): Attempt to
identify matches via imported symbols of parents.
(semantic--analyze-refs-full-lookup-with-parents): Do a deep
search during the brute search.
* semantic/analyze.el
(semantic-analyze-find-tag-sequence-default): Be robust to
calculated scopes being nil.
* semantic/bovine/c.el (semantic-c-describe-environment): Add
project macro symbol array.
(semantic-c-parse-lexical-token): Add recursion limit.
(semantic-ctxt-imported-packages, semanticdb-expand-nested-tag):
New overrides.
(semantic-expand-c-tag-namelist): Split a full type from a typedef
out to its own tag.
(semantic-expand-c-tag-namelist): Do not split out a typedef'd
inline type if it is an anonymous type.
(semantic-c-reconstitute-token): Use the optional initializers as
a clue that some function is probably a constructor. When
defining the type of these constructors, split the parent name,
and use only the class part, if applicable.
* semantic/bovine/c-by.el:
* semantic/wisent/python-wy.el: Regenerate.
2010-09-18 22:49:54 -04:00
|
|
|
|
(when miniscope
|
|
|
|
|
(let ((rawscope
|
|
|
|
|
(apply 'append
|
|
|
|
|
(mapcar 'semantic-tag-type-members
|
|
|
|
|
tagtype))))
|
|
|
|
|
(oset miniscope fullscope rawscope)))
|
2011-11-14 15:59:56 -08:00
|
|
|
|
;; Now analyze the type to remove metatypes.
|
2009-08-29 19:00:35 +00:00
|
|
|
|
(or (semantic-analyze-type tmp miniscope)
|
|
|
|
|
tmp))
|
|
|
|
|
(t
|
|
|
|
|
(semantic-analyze-tag-type tmp scope))))
|
|
|
|
|
(typefile
|
|
|
|
|
(when tmptype
|
|
|
|
|
(semantic-tag-file-name tmptype)))
|
|
|
|
|
(slots nil))
|
|
|
|
|
|
|
|
|
|
;; Get the children
|
|
|
|
|
(setq slots (semantic-analyze-scoped-type-parts tmptype scope))
|
|
|
|
|
|
|
|
|
|
;; find (car s) in the list o slots
|
|
|
|
|
(setq tmp (semantic-find-tags-by-name (car s) slots))
|
|
|
|
|
|
|
|
|
|
;; If we have lots
|
|
|
|
|
(if (and (listp tmp) (semantic-tag-p (car tmp)))
|
|
|
|
|
(setq tmp (semantic-analyze-select-best-tag tmp)))
|
|
|
|
|
|
|
|
|
|
;; Make sure we have a tag.
|
|
|
|
|
(if (not (semantic-tag-p tmp))
|
|
|
|
|
(if (cdr s)
|
|
|
|
|
;; In the middle, we need to keep seeking our types out.
|
|
|
|
|
(error "Cannot find definition for \"%s\"" (car s))
|
|
|
|
|
;; Else, it's ok to end with a non-tag
|
|
|
|
|
(setq tmp (car s))))
|
|
|
|
|
|
|
|
|
|
(setq fname (or typefile fname))
|
|
|
|
|
(when (and fname (semantic-tag-p tmp)
|
|
|
|
|
(not (semantic-tag-in-buffer-p tmp)))
|
|
|
|
|
(semantic--tag-put-property tmp :filename fname))
|
|
|
|
|
(setq tag (cons tmp tag))
|
|
|
|
|
(setq tagtype (cons tmptype tagtype))
|
|
|
|
|
)
|
|
|
|
|
(setq s (cdr s)))
|
|
|
|
|
|
|
|
|
|
(if typereturn (set typereturn (nreverse tagtype)))
|
|
|
|
|
;; Return the mess
|
|
|
|
|
(nreverse tag)))
|
|
|
|
|
|
|
|
|
|
(defun semantic-analyze-find-tag (name &optional tagclass scope)
|
|
|
|
|
"Return the first tag found with NAME or nil if not found.
|
Fix typos in CEDET docstrings.
* cedet/semantic/analyze.el (semantic-analyze-push-error)
(semantic-analyze-context, semantic-analyze-context-assignment)
(semantic-analyze-find-tag-sequence, semantic-analyze-find-tag):
* cedet/semantic/java.el (java-mode, semantic-tag-include-filename)
(semantic-java-doc-keywords-map):
* cedet/semantic/bovine/c.el (c-mode, semantic-c-member-of-autocast)
(semantic-lex-c-nested-namespace-ignore-second, semantic-parse-region)
(semantic-c-parse-lexical-token, semantic-c-debug-mode-init-pch)
(semantic-c-classname, semantic-format-tag-uml-prototype)
(semantic-c-dereference-namespace, semantic-analyze-type-constants):
* cedet/semantic/bovine/el.el (semantic-elisp-form-to-doc-string)
(semantic-emacs-lisp-obsoleted-doc, semantic-up-context)
(semantic-get-local-variables, semantic-end-of-command)
(semantic-beginning-of-command, semantic-ctxt-current-class-list)
(lisp-mode):
* cedet/semantic/bovine/make.el (makefile-mode):
* cedet/semantic/wisent/python.el (wisent-python-string-re)
(wisent-python-implicit-line-joining-p, wisent-python-forward-string)
(wisent-python-lex-beginning-of-line, wisent-python-lex-end-of-line)
(semantic-lex, semantic-get-local-variables, python-mode):
* cedet/semantic/wisent/python-wy.el (wisent-python-wy--keyword-table):
* cedet/srecode/extract.el (srecode-extract-state-set)
(srecode-extract-method): Fix typos in docstrings.
2010-01-12 05:51:26 +01:00
|
|
|
|
Optional argument TAGCLASS specifies the class of tag to return,
|
|
|
|
|
such as 'function or 'variable.
|
2009-08-29 19:00:35 +00:00
|
|
|
|
Optional argument SCOPE specifies a scope object which has
|
|
|
|
|
additional tags which are in SCOPE and do not need prefixing to
|
|
|
|
|
find.
|
|
|
|
|
|
Synch Semantic to CEDET 1.0.
Move CEDET ChangeLog entries to new file lisp/cedet/ChangeLog.
* semantic.el (semantic-version): Update to 2.0.
(semantic-mode-map): Add "," and "m" bindings.
(navigate-menu): Update.
* semantic/symref.el (semantic-symref-calculate-rootdir):
New function.
(semantic-symref-detect-symref-tool): Use it.
* semantic/symref/grep.el (semantic-symref-grep-shell): New var.
(semantic-symref-perform-search): Use it. Calculate root dir with
semantic-symref-calculate-rootdir.
(semantic-symref-derive-find-filepatterns): Improve error message.
* semantic/symref/list.el
(semantic-symref-results-mode-map): New bindings.
(semantic-symref-auto-expand-results): New option.
(semantic-symref-results-dump): Obey auto-expand.
(semantic-symref-list-expand-all, semantic-symref-regexp)
(semantic-symref-list-contract-all)
(semantic-symref-list-map-open-hits)
(semantic-symref-list-update-open-hits)
(semantic-symref-list-create-macro-on-open-hit)
(semantic-symref-list-call-macro-on-open-hits): New functions.
(semantic-symref-list-menu-entries)
(semantic-symref-list-menu): New vars.
(semantic-symref-list-map-open-hits): Move cursor to beginning of
match before calling the mapped function.
* semantic/doc.el
(semantic-documentation-comment-preceeding-tag): Do nothing if the
mode doesn't provide comment-start-skip.
* semantic/scope.el
(semantic-analyze-scope-nested-tags-default): Strip duplicates.
(semantic-analyze-scoped-inherited-tag-map): Take the tag we are
looking for as part of the scoped tags list.
* semantic/html.el (semantic-default-html-setup): Add
senator-step-at-tag-classes.
* semantic/decorate/include.el
(semantic-decoration-on-unknown-includes): Change light bgcolor.
(semantic-decoration-on-includes-highlight-default): Check that
the include tag has a postion.
* semantic/complete.el (semantic-collector-local-members):
(semantic-complete-read-tag-local-members)
(semantic-complete-jump-local-members): New class and functions.
(semantic-complete-self-insert): Save excursion before completing.
* semantic/analyze/complete.el
(semantic-analyze-possible-completions-default): If no completions
are found, return the raw by-name-only completion list. Add FLAGS
arguments. Add support for 'no-tc (type constraint) and
'no-unique, or no stripping duplicates.
(semantic-analyze-possible-completions-default): Add FLAGS arg.
* semantic/util-modes.el
(semantic-stickyfunc-show-only-functions-p): New option.
(semantic-stickyfunc-fetch-stickyline): Don't show stickytext for
the very first line in a buffer.
* semantic/util.el (semantic-hack-search)
(semantic-recursive-find-nonterminal-by-name)
(semantic-current-tag-interactive): Deleted.
(semantic-describe-buffer): Fix expand-nonterminal. Add
lex-syntax-mods, type relation separator char, and command
separation char.
(semantic-sanity-check): Only message if called interactively.
* semantic/tag.el (semantic-tag-deep-copy-one-tag): Copy the
:filename property and the tag position.
* semantic/lex-spp.el (semantic-lex-spp-lex-text-string):
Add recursion limit.
* semantic/imenu.el (semantic-imenu-bucketize-type-members):
Make this buffer local, not the obsoleted variable.
* semantic/idle.el: Add breadcrumbs support.
(semantic-idle-summary-current-symbol-info-default)
(semantic-idle-tag-highlight)
(semantic-idle-completion-list-default): Use
semanticdb-without-unloaded-file-searches for speed, and to
conform to the controls that specify if the idle timer is supposed
to be parsing unparsed includes.
(semantic-idle-symbol-highlight-face)
(semantic-idle-symbol-maybe-highlight): Rename from *-summary-*.
Callers changed.
(semantic-idle-work-parse-neighboring-files-flag): Default to nil.
(semantic-idle-work-update-headers-flag): New var.
(semantic-idle-work-for-one-buffer): Use it.
(semantic-idle-local-symbol-highlight): Rename from
semantic-idle-tag-highlight.
(semantic-idle-truncate-long-summaries): New option.
* semantic/ia.el (semantic-ia-cache)
(semantic-ia-get-completions): Deleted. Callers changed.
(semantic-ia-show-variants): New command.
(semantic-ia-show-doc): If doc is empty, don't make a temp buffer.
(semantic-ia-show-summary): If there isn't anything to show, say so.
* semantic/grammar.el (semantic-grammar-create-package):
Save the buffer even in batch mode.
* semantic/fw.el
(semanticdb-without-unloaded-file-searches): New macro.
* semantic/dep.el (semantic-dependency-find-file-on-path):
Fix case dereferencing ede-object when it is a list.
* semantic/db-typecache.el (semanticdb-expand-nested-tag)
(semanticdb-typecache-faux-namespace): New functions.
(semanticdb-typecache-file-tags)
(semanticdb-typecache-merge-streams): Use them.
(semanticdb-typecache-file-tags): When deriving tags from a file,
give the mode a chance to monkey with the tag copy.
(semanticdb-typecache-find-default): Wrap find in save-excursion.
(semanticdb-typecache-find-by-name-helper): Merge found names down.
* semantic/db-global.el
(semanticdb-enable-gnu-global-in-buffer): Don't show messages if
GNU Global is not available and we don't want to throw an error.
* semantic/db-find.el (semanticdb-find-result-nth-in-buffer):
When trying to normalize the tag to a buffer, don't error if
set-buffer method doesn't exist.
* semantic/db-file.el (semanticdb-save-db): Simplify msg.
* semantic/db.el (semanticdb-refresh-table): If forcing a
refresh on a file not in a buffer, use semantic-find-file-noselect
and delete the buffer after use.
(semanticdb-current-database-list): When calculating root via
hooks, force it through true-filename and skip the list of
possible roots.
* semantic/ctxt.el (semantic-ctxt-imported-packages): New.
* semantic/analyze/debug.el
(semantic-analyzer-debug-insert-tag): Reset standard output to
current buffer.
(semantic-analyzer-debug-global-symbol)
(semantic-analyzer-debug-missing-innertype): Change "prefix" to
"symbol" in messages.
* semantic/analyze/refs.el: (semantic-analyze-refs-impl)
(semantic-analyze-refs-proto): When calculating value, make sure
the found tag is 'similar' to the originating tag.
(semantic--analyze-refs-find-tags-with-parent): Attempt to
identify matches via imported symbols of parents.
(semantic--analyze-refs-full-lookup-with-parents): Do a deep
search during the brute search.
* semantic/analyze.el
(semantic-analyze-find-tag-sequence-default): Be robust to
calculated scopes being nil.
* semantic/bovine/c.el (semantic-c-describe-environment): Add
project macro symbol array.
(semantic-c-parse-lexical-token): Add recursion limit.
(semantic-ctxt-imported-packages, semanticdb-expand-nested-tag):
New overrides.
(semantic-expand-c-tag-namelist): Split a full type from a typedef
out to its own tag.
(semantic-expand-c-tag-namelist): Do not split out a typedef'd
inline type if it is an anonymous type.
(semantic-c-reconstitute-token): Use the optional initializers as
a clue that some function is probably a constructor. When
defining the type of these constructors, split the parent name,
and use only the class part, if applicable.
* semantic/bovine/c-by.el:
* semantic/wisent/python-wy.el: Regenerate.
2010-09-18 22:49:54 -04:00
|
|
|
|
This is a wrapper on top of semanticdb, semanticdb typecache,
|
2009-08-29 19:00:35 +00:00
|
|
|
|
semantic-scope, and semantic search functions. Almost all
|
|
|
|
|
searches use the same arguments."
|
|
|
|
|
(let ((namelst (if (consp name) name ;; test if pre-split.
|
|
|
|
|
(semantic-analyze-split-name name))))
|
|
|
|
|
(cond
|
|
|
|
|
;; If the splitter gives us a list, use the sequence finder
|
|
|
|
|
;; to get the list. Since this routine is expected to return
|
|
|
|
|
;; only one tag, return the LAST tag found from the sequence
|
|
|
|
|
;; which is supposedly the nested reference.
|
|
|
|
|
;;
|
|
|
|
|
;; Of note, the SEQUENCE function below calls this function
|
|
|
|
|
;; (recursively now) so the names that we get from the above
|
|
|
|
|
;; fcn better not, in turn, be splittable.
|
|
|
|
|
((listp namelst)
|
|
|
|
|
;; If we had a split, then this is likely a c++ style namespace::name sequence,
|
|
|
|
|
;; so take a short-cut through the typecache.
|
|
|
|
|
(or (semanticdb-typecache-find namelst)
|
|
|
|
|
;; Ok, not there, try the usual...
|
|
|
|
|
(let ((seq (semantic-analyze-find-tag-sequence
|
|
|
|
|
namelst scope nil)))
|
|
|
|
|
(semantic-analyze-select-best-tag seq tagclass)
|
|
|
|
|
)))
|
|
|
|
|
;; If NAME is solo, then do our searches for it here.
|
|
|
|
|
((stringp namelst)
|
|
|
|
|
(let ((retlist (and scope (semantic-scope-find name tagclass scope))))
|
|
|
|
|
(if retlist
|
|
|
|
|
(semantic-analyze-select-best-tag
|
|
|
|
|
retlist tagclass)
|
|
|
|
|
(if (eq tagclass 'type)
|
|
|
|
|
(semanticdb-typecache-find name)
|
|
|
|
|
;; Search in the typecache. First entries in a sequence are
|
|
|
|
|
;; often there.
|
|
|
|
|
(setq retlist (semanticdb-typecache-find name))
|
|
|
|
|
(if retlist
|
|
|
|
|
retlist
|
|
|
|
|
(semantic-analyze-select-best-tag
|
|
|
|
|
(semanticdb-strip-find-results
|
|
|
|
|
(semanticdb-find-tags-by-name name)
|
|
|
|
|
'name)
|
|
|
|
|
tagclass)
|
|
|
|
|
)))))
|
|
|
|
|
)))
|
|
|
|
|
|
|
|
|
|
;;; SHORT ANALYSIS
|
|
|
|
|
;;
|
|
|
|
|
;; Create a mini-analysis of just the symbol under point.
|
|
|
|
|
;;
|
|
|
|
|
(define-overloadable-function semantic-analyze-current-symbol
|
|
|
|
|
(analyzehookfcn &optional position)
|
|
|
|
|
"Call ANALYZEHOOKFCN after analyzing the symbol under POSITION.
|
|
|
|
|
The ANALYZEHOOKFCN is called with the current symbol bounds, and the
|
|
|
|
|
analyzed prefix. It should take the arguments (START END PREFIX).
|
|
|
|
|
The ANALYZEHOOKFCN is only called if some sort of prefix with bounds was
|
|
|
|
|
found under POSITION.
|
|
|
|
|
|
|
|
|
|
The results of ANALYZEHOOKFCN is returned, or nil if there was nothing to
|
|
|
|
|
call it with.
|
|
|
|
|
|
|
|
|
|
For regular analysis, you should call `semantic-analyze-current-context'
|
|
|
|
|
to calculate the context information. The purpose for this function is
|
|
|
|
|
to provide a large number of non-cached analysis for filtering symbols."
|
|
|
|
|
;; Only do this in a Semantic enabled buffer.
|
|
|
|
|
(when (not (semantic-active-p))
|
2009-10-01 04:54:05 +00:00
|
|
|
|
(error "Cannot analyze buffers not supported by Semantic"))
|
2009-08-29 19:00:35 +00:00
|
|
|
|
;; Always refresh out tags in a safe way before doing the
|
|
|
|
|
;; context.
|
|
|
|
|
(semantic-refresh-tags-safe)
|
|
|
|
|
;; Do the rest of the analysis.
|
|
|
|
|
(save-match-data
|
|
|
|
|
(save-excursion
|
|
|
|
|
(:override)))
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(defun semantic-analyze-current-symbol-default (analyzehookfcn position)
|
|
|
|
|
"Call ANALYZEHOOKFCN on the analyzed symbol at POSITION."
|
|
|
|
|
(let* ((semantic-analyze-error-stack nil)
|
|
|
|
|
(LLstart (current-time))
|
|
|
|
|
(prefixandbounds (semantic-ctxt-current-symbol-and-bounds (or position (point))))
|
|
|
|
|
(prefix (car prefixandbounds))
|
|
|
|
|
(bounds (nth 2 prefixandbounds))
|
|
|
|
|
(scope (semantic-calculate-scope position))
|
|
|
|
|
(end nil)
|
|
|
|
|
)
|
|
|
|
|
;; Only do work if we have bounds (meaning a prefix to complete)
|
|
|
|
|
(when bounds
|
|
|
|
|
|
|
|
|
|
(if debug-on-error
|
|
|
|
|
(catch 'unfindable
|
|
|
|
|
;; If debug on error is on, allow debugging in this fcn.
|
|
|
|
|
(setq prefix (semantic-analyze-find-tag-sequence
|
|
|
|
|
prefix scope 'prefixtypes 'unfindable)))
|
|
|
|
|
;; Debug on error is off. Capture errors and move on
|
|
|
|
|
(condition-case err
|
|
|
|
|
;; NOTE: This line is duplicated in
|
|
|
|
|
;; semantic-analyzer-debug-global-symbol
|
|
|
|
|
;; You will need to update both places.
|
|
|
|
|
(setq prefix (semantic-analyze-find-tag-sequence
|
|
|
|
|
prefix scope 'prefixtypes))
|
|
|
|
|
(error (semantic-analyze-push-error err))))
|
|
|
|
|
|
|
|
|
|
(setq end (current-time))
|
|
|
|
|
;;(message "Analysis took %.2f sec" (semantic-elapsed-time LLstart end))
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
(when prefix
|
|
|
|
|
(prog1
|
|
|
|
|
(funcall analyzehookfcn (car bounds) (cdr bounds) prefix)
|
|
|
|
|
;;(setq end (current-time))
|
|
|
|
|
;;(message "hookfcn took %.5f sec" (semantic-elapsed-time LLstart end))
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
)))
|
|
|
|
|
|
|
|
|
|
;;; MAIN ANALYSIS
|
|
|
|
|
;;
|
|
|
|
|
;; Create a full-up context analysis.
|
|
|
|
|
;;
|
2009-09-03 03:58:13 +00:00
|
|
|
|
;;;###autoload
|
2009-08-29 19:00:35 +00:00
|
|
|
|
(define-overloadable-function semantic-analyze-current-context (&optional position)
|
|
|
|
|
"Analyze the current context at optional POSITION.
|
|
|
|
|
If called interactively, display interesting information about POSITION
|
|
|
|
|
in a separate buffer.
|
|
|
|
|
Returns an object based on symbol `semantic-analyze-context'.
|
|
|
|
|
|
2011-11-14 22:00:24 +01:00
|
|
|
|
This function can be overridden with the symbol `analyze-context'.
|
2009-08-29 19:00:35 +00:00
|
|
|
|
When overriding this function, your override will be called while
|
|
|
|
|
cursor is at POSITION. In addition, your function will not be called
|
|
|
|
|
if a cached copy of the return object is found."
|
|
|
|
|
(interactive "d")
|
|
|
|
|
;; Only do this in a Semantic enabled buffer.
|
|
|
|
|
(when (not (semantic-active-p))
|
2009-10-01 04:54:05 +00:00
|
|
|
|
(error "Cannot analyze buffers not supported by Semantic"))
|
2009-08-29 19:00:35 +00:00
|
|
|
|
;; Always refresh out tags in a safe way before doing the
|
|
|
|
|
;; context.
|
|
|
|
|
(semantic-refresh-tags-safe)
|
|
|
|
|
;; Do the rest of the analysis.
|
|
|
|
|
(if (not position) (setq position (point)))
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char position)
|
|
|
|
|
(let* ((answer (semantic-get-cache-data 'current-context)))
|
|
|
|
|
(with-syntax-table semantic-lex-syntax-table
|
|
|
|
|
(when (not answer)
|
|
|
|
|
(setq answer (:override))
|
|
|
|
|
(when (and answer (oref answer bounds))
|
|
|
|
|
(with-slots (bounds) answer
|
|
|
|
|
(semantic-cache-data-to-buffer (current-buffer)
|
|
|
|
|
(car bounds)
|
|
|
|
|
(cdr bounds)
|
|
|
|
|
answer
|
|
|
|
|
'current-context
|
|
|
|
|
'exit-cache-zone)))
|
|
|
|
|
;; Check for interactivity
|
2009-11-22 23:49:13 +00:00
|
|
|
|
(when (called-interactively-p 'any)
|
2009-08-29 19:00:35 +00:00
|
|
|
|
(if answer
|
|
|
|
|
(semantic-analyze-pop-to-context answer)
|
|
|
|
|
(message "No Context."))
|
|
|
|
|
))
|
|
|
|
|
|
|
|
|
|
answer))))
|
|
|
|
|
|
|
|
|
|
(defun semantic-analyze-current-context-default (position)
|
|
|
|
|
"Analyze the current context at POSITION.
|
|
|
|
|
Returns an object based on symbol `semantic-analyze-context'."
|
|
|
|
|
(let* ((semantic-analyze-error-stack nil)
|
|
|
|
|
(context-return nil)
|
|
|
|
|
(prefixandbounds (semantic-ctxt-current-symbol-and-bounds (or position (point))))
|
|
|
|
|
(prefix (car prefixandbounds))
|
|
|
|
|
(bounds (nth 2 prefixandbounds))
|
|
|
|
|
;; @todo - vv too early to really know this answer! vv
|
|
|
|
|
(prefixclass (semantic-ctxt-current-class-list))
|
|
|
|
|
(prefixtypes nil)
|
|
|
|
|
(scope (semantic-calculate-scope position))
|
|
|
|
|
(function nil)
|
|
|
|
|
(fntag nil)
|
|
|
|
|
arg fntagend argtag
|
|
|
|
|
assign asstag
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
;; Pattern for Analysis:
|
|
|
|
|
;;
|
|
|
|
|
;; Step 1: Calculate DataTypes in Scope:
|
|
|
|
|
;;
|
|
|
|
|
;; a) Calculate the scope (above)
|
|
|
|
|
;;
|
|
|
|
|
;; Step 2: Parse context
|
|
|
|
|
;;
|
|
|
|
|
;; a) Identify function being called, or variable assignment,
|
|
|
|
|
;; and find source tags for those references
|
|
|
|
|
;; b) Identify the prefix (text cursor is on) and find the source
|
|
|
|
|
;; tags for those references.
|
|
|
|
|
;;
|
|
|
|
|
;; Step 3: Assemble an object
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
;; Step 2 a:
|
|
|
|
|
|
|
|
|
|
(setq function (semantic-ctxt-current-function))
|
|
|
|
|
|
|
|
|
|
(when function
|
|
|
|
|
;; Calculate the argument for the function if there is one.
|
|
|
|
|
(setq arg (semantic-ctxt-current-argument))
|
|
|
|
|
|
|
|
|
|
;; Find a tag related to the function name.
|
|
|
|
|
(condition-case err
|
|
|
|
|
(setq fntag
|
|
|
|
|
(semantic-analyze-find-tag-sequence function scope))
|
|
|
|
|
(error (semantic-analyze-push-error err)))
|
|
|
|
|
|
|
|
|
|
;; fntag can have the last entry as just a string, meaning we
|
|
|
|
|
;; could not find the core datatype. In this case, the searches
|
|
|
|
|
;; below will not work.
|
|
|
|
|
(when (stringp (car (last fntag)))
|
|
|
|
|
;; Take a wild guess!
|
|
|
|
|
(setcar (last fntag) (semantic-tag (car (last fntag)) 'function))
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(when fntag
|
|
|
|
|
(let ((fcn (semantic-find-tags-by-class 'function fntag)))
|
|
|
|
|
(when (not fcn)
|
|
|
|
|
(let ((ty (semantic-find-tags-by-class 'type fntag)))
|
|
|
|
|
(when ty
|
|
|
|
|
;; We might have a constructor with the same name as
|
|
|
|
|
;; the found datatype.
|
|
|
|
|
(setq fcn (semantic-find-tags-by-name
|
|
|
|
|
(semantic-tag-name (car ty))
|
|
|
|
|
(semantic-tag-type-members (car ty))))
|
|
|
|
|
(if fcn
|
|
|
|
|
(let ((lp fcn))
|
|
|
|
|
(while lp
|
|
|
|
|
(when (semantic-tag-get-attribute (car lp)
|
|
|
|
|
:constructor)
|
|
|
|
|
(setq fcn (cons (car lp) fcn)))
|
|
|
|
|
(setq lp (cdr lp))))
|
|
|
|
|
;; Give up, go old school
|
|
|
|
|
(setq fcn fntag))
|
|
|
|
|
)))
|
|
|
|
|
(setq fntagend (car (reverse fcn))
|
|
|
|
|
argtag
|
|
|
|
|
(when (semantic-tag-p fntagend)
|
|
|
|
|
(nth (1- arg) (semantic-tag-function-arguments fntagend)))
|
|
|
|
|
fntag fcn))))
|
|
|
|
|
|
|
|
|
|
;; Step 2 b:
|
|
|
|
|
|
|
|
|
|
;; Only do work if we have bounds (meaning a prefix to complete)
|
|
|
|
|
(when bounds
|
|
|
|
|
|
|
|
|
|
(if debug-on-error
|
|
|
|
|
(catch 'unfindable
|
|
|
|
|
;; If debug on error is on, allow debugging in this fcn.
|
|
|
|
|
(setq prefix (semantic-analyze-find-tag-sequence
|
|
|
|
|
prefix scope 'prefixtypes 'unfindable)))
|
|
|
|
|
;; Debug on error is off. Capture errors and move on
|
|
|
|
|
(condition-case err
|
|
|
|
|
;; NOTE: This line is duplicated in
|
|
|
|
|
;; semantic-analyzer-debug-global-symbol
|
|
|
|
|
;; You will need to update both places.
|
|
|
|
|
(setq prefix (semantic-analyze-find-tag-sequence
|
|
|
|
|
prefix scope 'prefixtypes))
|
|
|
|
|
(error (semantic-analyze-push-error err))))
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
;; Step 3:
|
|
|
|
|
|
|
|
|
|
(cond
|
|
|
|
|
(fntag
|
|
|
|
|
;; If we found a tag for our function, we can go into
|
|
|
|
|
;; functional context analysis mode, meaning we have a type
|
|
|
|
|
;; for the argument.
|
|
|
|
|
(setq context-return
|
|
|
|
|
(semantic-analyze-context-functionarg
|
|
|
|
|
"functionargument"
|
|
|
|
|
:buffer (current-buffer)
|
|
|
|
|
:function fntag
|
|
|
|
|
:index arg
|
|
|
|
|
:argument (list argtag)
|
|
|
|
|
:scope scope
|
|
|
|
|
:prefix prefix
|
|
|
|
|
:prefixclass prefixclass
|
|
|
|
|
:bounds bounds
|
|
|
|
|
:prefixtypes prefixtypes
|
|
|
|
|
:errors semantic-analyze-error-stack)))
|
|
|
|
|
|
|
|
|
|
;; No function, try assignment
|
|
|
|
|
((and (setq assign (semantic-ctxt-current-assignment))
|
|
|
|
|
;; We have some sort of an assignment
|
|
|
|
|
(condition-case err
|
|
|
|
|
(setq asstag (semantic-analyze-find-tag-sequence
|
|
|
|
|
assign scope))
|
|
|
|
|
(error (semantic-analyze-push-error err)
|
|
|
|
|
nil)))
|
|
|
|
|
|
|
|
|
|
(setq context-return
|
|
|
|
|
(semantic-analyze-context-assignment
|
|
|
|
|
"assignment"
|
|
|
|
|
:buffer (current-buffer)
|
|
|
|
|
:assignee asstag
|
|
|
|
|
:scope scope
|
|
|
|
|
:bounds bounds
|
|
|
|
|
:prefix prefix
|
|
|
|
|
:prefixclass prefixclass
|
|
|
|
|
:prefixtypes prefixtypes
|
|
|
|
|
:errors semantic-analyze-error-stack)))
|
|
|
|
|
|
|
|
|
|
;; TODO: Identify return value condition.
|
|
|
|
|
;;((setq return .... what to do?)
|
|
|
|
|
;; ...)
|
|
|
|
|
|
|
|
|
|
(bounds
|
|
|
|
|
;; Nothing in particular
|
|
|
|
|
(setq context-return
|
|
|
|
|
(semantic-analyze-context
|
|
|
|
|
"context"
|
|
|
|
|
:buffer (current-buffer)
|
|
|
|
|
:scope scope
|
|
|
|
|
:bounds bounds
|
|
|
|
|
:prefix prefix
|
|
|
|
|
:prefixclass prefixclass
|
|
|
|
|
:prefixtypes prefixtypes
|
|
|
|
|
:errors semantic-analyze-error-stack)))
|
|
|
|
|
|
|
|
|
|
(t (setq context-return nil))
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
;; Return our context.
|
|
|
|
|
context-return))
|
|
|
|
|
|
2009-09-13 15:58:30 +00:00
|
|
|
|
|
|
|
|
|
(defun semantic-adebug-analyze (&optional ctxt)
|
|
|
|
|
"Perform `semantic-analyze-current-context'.
|
|
|
|
|
Display the results as a debug list.
|
|
|
|
|
Optional argument CTXT is the context to show."
|
|
|
|
|
(interactive)
|
2009-09-13 16:12:23 +00:00
|
|
|
|
(require 'data-debug)
|
2009-09-13 15:58:30 +00:00
|
|
|
|
(let ((start (current-time))
|
|
|
|
|
(ctxt (or ctxt (semantic-analyze-current-context)))
|
|
|
|
|
(end (current-time)))
|
|
|
|
|
(if (not ctxt)
|
|
|
|
|
(message "No Analyzer Results")
|
|
|
|
|
(message "Analysis took %.2f seconds."
|
|
|
|
|
(semantic-elapsed-time start end))
|
|
|
|
|
(semantic-analyze-pulse ctxt)
|
|
|
|
|
(if ctxt
|
|
|
|
|
(progn
|
|
|
|
|
(data-debug-new-buffer "*Analyzer ADEBUG*")
|
|
|
|
|
(data-debug-insert-object-slots ctxt "]"))
|
|
|
|
|
(message "No Context to analyze here.")))))
|
|
|
|
|
|
2009-08-29 19:00:35 +00:00
|
|
|
|
|
|
|
|
|
;;; DEBUG OUTPUT
|
|
|
|
|
;;
|
|
|
|
|
;; Friendly output of a context analysis.
|
|
|
|
|
;;
|
cedet/cedet.el (cedet-packages): Bump srecode version.
cedet/data-debug.el: Require `ring' for use of ring-length.
cedet/semantic.el (semantic-repeat-parse-whole-stream): Check
semantic-working-type before updating progress reporter.
cedet/semantic/adebug.el: Fix file header.
cedet/semantic/analyze.el: eval-when-compile semantic/find, for
semantic-find-tags-by-name. Declare semanticdb-strip-find-results and
semanticdb-find-tags-by-name.
cedet/semantic/chart.el: Require semantic/find, semantic/db-mode,
semantic/db-typecache, and semantic/scope.
cedet/semantic/complete.el: Declare
semantic-displayor-focus-abstract-child-p function (needed as the
semantic-displayor-focus-abstract class is defined only after used).
Move semantic-complete-inline-custom-type and
semantic-complete-inline-analyzer-displayor-class variable definitions
up, before they are used, to avoid compiler warning.
Require semantic/decorate, semantic/tag-file, eieio-opt, and
semantic/analyze/complete.
cedet/semantic/ctxt.el: Require semantic/find. Don't
eval-when-compile semantic/db
(semantic-get-local-variables): Use Emacs' built-in progress reporter
instead of working-status-forms.
cedet/semantic/db-debug.el: Require data-debug, semantic/db-mode, and
semantic/format.
cedet/semantic/db-ebrowse.el: Require semantic/db-mode, semantic/find,
semantic/sort, data-debug
(semanticdb-create-database): Require semantic/dep for
semantic-add-system-include.
(semanticdb-table-ebrowse, semanticdb-project-database-ebrowse): Move
class definitions near top of file, before they are used, to avoid
compiler warnings.
(semanticdb-ebrowse-add-tree-to-table): Use split-string.
2009-08-30 21:16:39 +00:00
|
|
|
|
(declare-function pulse-momentary-highlight-region "pulse")
|
|
|
|
|
|
2009-08-29 19:00:35 +00:00
|
|
|
|
(defmethod semantic-analyze-pulse ((context semantic-analyze-context))
|
|
|
|
|
"Pulse the region that CONTEXT affects."
|
cedet/cedet.el (cedet-packages): Bump srecode version.
cedet/data-debug.el: Require `ring' for use of ring-length.
cedet/semantic.el (semantic-repeat-parse-whole-stream): Check
semantic-working-type before updating progress reporter.
cedet/semantic/adebug.el: Fix file header.
cedet/semantic/analyze.el: eval-when-compile semantic/find, for
semantic-find-tags-by-name. Declare semanticdb-strip-find-results and
semanticdb-find-tags-by-name.
cedet/semantic/chart.el: Require semantic/find, semantic/db-mode,
semantic/db-typecache, and semantic/scope.
cedet/semantic/complete.el: Declare
semantic-displayor-focus-abstract-child-p function (needed as the
semantic-displayor-focus-abstract class is defined only after used).
Move semantic-complete-inline-custom-type and
semantic-complete-inline-analyzer-displayor-class variable definitions
up, before they are used, to avoid compiler warning.
Require semantic/decorate, semantic/tag-file, eieio-opt, and
semantic/analyze/complete.
cedet/semantic/ctxt.el: Require semantic/find. Don't
eval-when-compile semantic/db
(semantic-get-local-variables): Use Emacs' built-in progress reporter
instead of working-status-forms.
cedet/semantic/db-debug.el: Require data-debug, semantic/db-mode, and
semantic/format.
cedet/semantic/db-ebrowse.el: Require semantic/db-mode, semantic/find,
semantic/sort, data-debug
(semanticdb-create-database): Require semantic/dep for
semantic-add-system-include.
(semanticdb-table-ebrowse, semanticdb-project-database-ebrowse): Move
class definitions near top of file, before they are used, to avoid
compiler warnings.
(semanticdb-ebrowse-add-tree-to-table): Use split-string.
2009-08-30 21:16:39 +00:00
|
|
|
|
(require 'pulse)
|
* cedet/srecode/srt-mode.el (semantic-analyze-possible-completions):
* cedet/semantic/symref/list.el (semantic-symref-rb-toggle-expand-tag):
* cedet/semantic/symref/grep.el (semantic-symref-perform-search):
* cedet/semantic/bovine/gcc.el (semantic-gcc-query):
* cedet/semantic/bovine/c.el (semantic-c-parse-lexical-token):
* cedet/semantic/analyze/debug.el (semantic-analyzer-debug-add-buttons)
(semantic-analyzer-debug-global-symbol)
(semantic-analyzer-debug-missing-innertype)
(semantic-analyzer-debug-insert-include-summary):
* cedet/semantic/util.el (semantic-file-tag-table):
(semantic-describe-buffer-var-helper, semantic-something-to-tag-table)
(semantic-recursive-find-nonterminal-by-name):
* cedet/semantic/tag-ls.el (semantic-tag-calculate-parent-default):
* cedet/semantic/tag-file.el (semantic-prototype-file):
* cedet/semantic/symref.el (semantic-symref-parse-tool-output):
* cedet/semantic/sb.el (semantic-sb-fetch-tag-table):
* cedet/semantic/lex-spp.el (semantic-lex-spp-lex-text-string):
* cedet/semantic/idle.el (semantic-idle-work-for-one-buffer):
(semantic-idle-summary-maybe-highlight):
* cedet/semantic/ia-sb.el (semantic-ia-speedbar)
(semantic-ia-sb-tag-info):
* cedet/semantic/grammar.el (semantic-analyze-possible-completions):
* cedet/semantic/find.el (semantic-brute-find-tag-by-position):
* cedet/semantic/ede-grammar.el (project-compile-target):
(ede-proj-makefile-insert-variables):
* cedet/semantic/debug.el (semantic-debug-set-parser-location):
(semantic-debug-set-source-location, semantic-debug-interface-layout)
(semantic-debug-mode, semantic-debug):
* cedet/semantic/db.el (semanticdb-needs-refresh-p):
* cedet/semantic/db-typecache.el (semanticdb-typecache-refresh-for-buffer):
* cedet/semantic/db-javascript.el (semanticdb-equivalent-mode):
* cedet/semantic/db-find.el (semanticdb-find-log-new-search)
(semanticdb-find-translate-path-includes--internal)
(semanticdb-reset-log, semanticdb-find-log-activity):
* cedet/semantic/db-file.el (object-write):
* cedet/semantic/db-el.el (semanticdb-equivalent-mode):
* cedet/semantic/db-ebrowse.el (semanticdb-ebrowse-C-file-p)
(semanticdb-create-ebrowse-database):
* cedet/semantic/db-debug.el (semanticdb-table-sanity-check):
* cedet/semantic/complete.el (semantic-displayor-focus-request)
(semantic-collector-calculate-completions-raw)
(semantic-complete-read-tag-analyzer):
* cedet/semantic/analyze.el (semantic-analyze-pulse):
* cedet/ede/util.el (ede-update-version-in-source):
* cedet/ede/proj.el (project-delete-target):
* cedet/ede/proj-elisp.el (ede-update-version-in-source)
(ede-proj-flush-autoconf):
* cedet/ede/pconf.el (ede-proj-configure-synchronize)
(ede-proj-configure-synchronize):
* cedet/ede/locate.el (ede-locate-file-in-project-impl):
* cedet/ede/linux.el (ede-linux-version):
* cedet/ede/emacs.el (ede-emacs-version):
* cedet/ede/dired.el (ede-dired-add-to-target):
* cedet/ede.el (ede-buffer-header-file, ede-find-target)
(ede-buffer-documentation-files, ede-project-buffers, ede-set)
(ede-target-buffers, ede-buffers, ede-make-project-local-variable):
* cedet/cedet-idutils.el (cedet-idutils-fnid-call):
(cedet-idutils-lid-call, cedet-idutils-expand-filename)
(cedet-idutils-version-check):
* cedet/cedet-global.el (cedet-gnu-global-call):
(cedet-gnu-global-expand-filename, cedet-gnu-global-root)
(cedet-gnu-global-version-check, cedet-gnu-global-scan-hits):
* cedet/cedet-cscope.el (cedet-cscope-call)
(cedet-cscope-expand-filename, cedet-cscope-version-check):
Use with-current-buffer.
* cedet/ede.el (ede-make-project-local-variable)
(ede-set-project-variables, ede-set): Use dolist.
2009-10-30 02:16:41 +00:00
|
|
|
|
(with-current-buffer (oref context :buffer)
|
2009-08-29 19:00:35 +00:00
|
|
|
|
(let ((bounds (oref context :bounds)))
|
|
|
|
|
(when bounds
|
|
|
|
|
(pulse-momentary-highlight-region (car bounds) (cdr bounds))))))
|
|
|
|
|
|
|
|
|
|
(defcustom semantic-analyze-summary-function 'semantic-format-tag-prototype
|
2009-09-28 15:15:00 +00:00
|
|
|
|
"Function to use when creating items in Imenu.
|
2009-08-29 19:00:35 +00:00
|
|
|
|
Some useful functions are found in `semantic-format-tag-functions'."
|
|
|
|
|
:group 'semantic
|
|
|
|
|
:type semantic-format-tag-custom-list)
|
|
|
|
|
|
|
|
|
|
(defun semantic-analyze-princ-sequence (sequence &optional prefix buff)
|
|
|
|
|
"Send the tag SEQUENCE to standard out.
|
|
|
|
|
Use PREFIX as a label.
|
|
|
|
|
Use BUFF as a source of override methods."
|
|
|
|
|
(while sequence
|
|
|
|
|
(princ prefix)
|
|
|
|
|
(cond
|
|
|
|
|
((semantic-tag-p (car sequence))
|
|
|
|
|
(princ (funcall semantic-analyze-summary-function
|
|
|
|
|
(car sequence))))
|
|
|
|
|
((stringp (car sequence))
|
|
|
|
|
(princ "\"")
|
|
|
|
|
(princ (semantic--format-colorize-text (car sequence) 'variable))
|
|
|
|
|
(princ "\""))
|
|
|
|
|
(t
|
|
|
|
|
(princ (format "'%S" (car sequence)))))
|
|
|
|
|
(princ "\n")
|
|
|
|
|
(setq sequence (cdr sequence))
|
|
|
|
|
(setq prefix (make-string (length prefix) ? ))
|
|
|
|
|
))
|
|
|
|
|
|
|
|
|
|
(defmethod semantic-analyze-show ((context semantic-analyze-context))
|
|
|
|
|
"Insert CONTEXT into the current buffer in a nice way."
|
|
|
|
|
(semantic-analyze-princ-sequence (oref context prefix) "Prefix: " )
|
|
|
|
|
(semantic-analyze-princ-sequence (oref context prefixclass) "Prefix Classes: ")
|
|
|
|
|
(semantic-analyze-princ-sequence (oref context prefixtypes) "Prefix Types: ")
|
|
|
|
|
(semantic-analyze-princ-sequence (oref context errors) "Encountered Errors: ")
|
|
|
|
|
(princ "--------\n")
|
|
|
|
|
;(semantic-analyze-princ-sequence (oref context scopetypes) "Scope Types: ")
|
|
|
|
|
;(semantic-analyze-princ-sequence (oref context scope) "Scope: ")
|
|
|
|
|
;(semantic-analyze-princ-sequence (oref context localvariables) "LocalVars: ")
|
|
|
|
|
(when (oref context scope)
|
|
|
|
|
(semantic-analyze-show (oref context scope)))
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(defmethod semantic-analyze-show ((context semantic-analyze-context-assignment))
|
|
|
|
|
"Insert CONTEXT into the current buffer in a nice way."
|
|
|
|
|
(semantic-analyze-princ-sequence (oref context assignee) "Assignee: ")
|
|
|
|
|
(call-next-method))
|
|
|
|
|
|
|
|
|
|
(defmethod semantic-analyze-show ((context semantic-analyze-context-functionarg))
|
|
|
|
|
"Insert CONTEXT into the current buffer in a nice way."
|
|
|
|
|
(semantic-analyze-princ-sequence (oref context function) "Function: ")
|
|
|
|
|
(princ "Argument Index: ")
|
|
|
|
|
(princ (oref context index))
|
|
|
|
|
(princ "\n")
|
|
|
|
|
(semantic-analyze-princ-sequence (oref context argument) "Argument: ")
|
|
|
|
|
(call-next-method))
|
|
|
|
|
|
|
|
|
|
(defun semantic-analyze-pop-to-context (context)
|
|
|
|
|
"Display CONTEXT in a temporary buffer.
|
|
|
|
|
CONTEXT's content is described in `semantic-analyze-current-context'."
|
|
|
|
|
(semantic-analyze-pulse context)
|
|
|
|
|
(with-output-to-temp-buffer "*Semantic Context Analysis*"
|
|
|
|
|
(princ "Context Type: ")
|
|
|
|
|
(princ (object-name context))
|
|
|
|
|
(princ "\n")
|
|
|
|
|
(princ "Bounds: ")
|
|
|
|
|
(princ (oref context bounds))
|
|
|
|
|
(princ "\n")
|
|
|
|
|
(semantic-analyze-show context)
|
|
|
|
|
)
|
|
|
|
|
(shrink-window-if-larger-than-buffer
|
|
|
|
|
(get-buffer-window "*Semantic Context Analysis*"))
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(provide 'semantic/analyze)
|
|
|
|
|
|
2009-09-03 03:58:13 +00:00
|
|
|
|
;; Local variables:
|
|
|
|
|
;; generated-autoload-file: "loaddefs.el"
|
2009-09-05 01:00:36 +00:00
|
|
|
|
;; generated-autoload-load-name: "semantic/analyze"
|
2009-09-03 03:58:13 +00:00
|
|
|
|
;; End:
|
|
|
|
|
|
cedet/cedet.el (cedet-packages): Bump srecode version.
cedet/data-debug.el: Require `ring' for use of ring-length.
cedet/semantic.el (semantic-repeat-parse-whole-stream): Check
semantic-working-type before updating progress reporter.
cedet/semantic/adebug.el: Fix file header.
cedet/semantic/analyze.el: eval-when-compile semantic/find, for
semantic-find-tags-by-name. Declare semanticdb-strip-find-results and
semanticdb-find-tags-by-name.
cedet/semantic/chart.el: Require semantic/find, semantic/db-mode,
semantic/db-typecache, and semantic/scope.
cedet/semantic/complete.el: Declare
semantic-displayor-focus-abstract-child-p function (needed as the
semantic-displayor-focus-abstract class is defined only after used).
Move semantic-complete-inline-custom-type and
semantic-complete-inline-analyzer-displayor-class variable definitions
up, before they are used, to avoid compiler warning.
Require semantic/decorate, semantic/tag-file, eieio-opt, and
semantic/analyze/complete.
cedet/semantic/ctxt.el: Require semantic/find. Don't
eval-when-compile semantic/db
(semantic-get-local-variables): Use Emacs' built-in progress reporter
instead of working-status-forms.
cedet/semantic/db-debug.el: Require data-debug, semantic/db-mode, and
semantic/format.
cedet/semantic/db-ebrowse.el: Require semantic/db-mode, semantic/find,
semantic/sort, data-debug
(semanticdb-create-database): Require semantic/dep for
semantic-add-system-include.
(semanticdb-table-ebrowse, semanticdb-project-database-ebrowse): Move
class definitions near top of file, before they are used, to avoid
compiler warnings.
(semanticdb-ebrowse-add-tree-to-table): Use split-string.
2009-08-30 21:16:39 +00:00
|
|
|
|
;;; semantic/analyze.el ends here
|