comparison lisp/cedet/semantic/analyze.el @ 107617:c5f9e4613394

Merge from mainline.
author Eli Zaretskii <eliz@gnu.org>
date Sat, 16 Jan 2010 06:57:09 -0500
parents 1d1d5d9bd884
children a5ad4f188e19
comparison
equal deleted inserted replaced
107616:fa5ad3eee9f5 107617:c5f9e4613394
1 ;;; semantic/analyze.el --- Analyze semantic tags against local context 1 ;;; semantic/analyze.el --- Analyze semantic tags against local context
2 2
3 ;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009 3 ;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
4 ;; Free Software Foundation, Inc. 4 ;; Free Software Foundation, Inc.
5 5
6 ;; Author: Eric M. Ludlam <zappo@gnu.org> 6 ;; Author: Eric M. Ludlam <zappo@gnu.org>
7 7
8 ;; This file is part of GNU Emacs. 8 ;; This file is part of GNU Emacs.
39 ;; Here are some words used to describe different things in the analyzer: 39 ;; Here are some words used to describe different things in the analyzer:
40 ;; 40 ;;
41 ;; tag - A single entity 41 ;; tag - A single entity
42 ;; prefix - The beginning of a symbol, usually used to look up something 42 ;; prefix - The beginning of a symbol, usually used to look up something
43 ;; incomplete. 43 ;; incomplete.
44 ;; type - The name of a datatype in the langauge. 44 ;; type - The name of a datatype in the language.
45 ;; metatype - If a type is named in a declaration like: 45 ;; metatype - If a type is named in a declaration like:
46 ;; struct moose somevariable; 46 ;; struct moose somevariable;
47 ;; that name "moose" can be turned into a concrete type. 47 ;; that name "moose" can be turned into a concrete type.
48 ;; tag sequence - In C code, a list of dereferences, such as: 48 ;; tag sequence - In C code, a list of dereferences, such as:
49 ;; this.that.theother(); 49 ;; this.that.theother();
81 (defvar semantic-analyze-error-stack nil 81 (defvar semantic-analyze-error-stack nil
82 "Collection of any errors thrown during analysis.") 82 "Collection of any errors thrown during analysis.")
83 83
84 (defun semantic-analyze-push-error (err) 84 (defun semantic-analyze-push-error (err)
85 "Push the error in ERR-DATA onto the error stack. 85 "Push the error in ERR-DATA onto the error stack.
86 Argument ERR" 86 Argument ERR."
87 (push err semantic-analyze-error-stack)) 87 (push err semantic-analyze-error-stack))
88 88
89 ;;; Analysis Classes 89 ;;; Analysis Classes
90 ;; 90 ;;
91 ;; These classes represent what a context is. Different types 91 ;; These classes represent what a context is. Different types
122 :type buffer 122 :type buffer
123 :documentation "The buffer this context is derived from.") 123 :documentation "The buffer this context is derived from.")
124 (errors :initarg :errors 124 (errors :initarg :errors
125 :documentation "Any errors thrown an caught during analysis.") 125 :documentation "Any errors thrown an caught during analysis.")
126 ) 126 )
127 "Base analysis data for a any context.") 127 "Base analysis data for any context.")
128 128
129 (defclass semantic-analyze-context-assignment (semantic-analyze-context) 129 (defclass semantic-analyze-context-assignment (semantic-analyze-context)
130 ((assignee :initarg :assignee 130 ((assignee :initarg :assignee
131 :type list 131 :type list
132 :documentation "A sequence of tags for an assignee. 132 :documentation "A sequence of tags for an assignee.
133 This is a variable into which some value is being placed. The last 133 This is a variable into which some value is being placed. The last
134 item in the list is the variable accepting the value. Earlier 134 item in the list is the variable accepting the value. Earlier
135 tags represent the variables being derefernece to get to the 135 tags represent the variables being dereferenced to get to the
136 assignee.")) 136 assignee."))
137 "Analysis class for a value in an assignment.") 137 "Analysis class for a value in an assignment.")
138 138
139 (defclass semantic-analyze-context-functionarg (semantic-analyze-context) 139 (defclass semantic-analyze-context-functionarg (semantic-analyze-context)
140 ((function :initarg :function 140 ((function :initarg :function
233 Optional argument LOCALVAR is the list of local variables to use when 233 Optional argument LOCALVAR is the list of local variables to use when
234 finding the details on the first element of SEQUENCE in case 234 finding the details on the first element of SEQUENCE in case
235 it is not found in the global set of tables. 235 it is not found in the global set of tables.
236 Optional argument SCOPE are additional terminals to search which are currently 236 Optional argument SCOPE are additional terminals to search which are currently
237 scoped. These are not local variables, but symbols available in a structure 237 scoped. These are not local variables, but symbols available in a structure
238 which doesn't need to be dereferneced. 238 which doesn't need to be dereferenced.
239 Optional argument TYPERETURN is a symbol in which the types of all found 239 Optional argument TYPERETURN is a symbol in which the types of all found
240 will be stored. If nil, that data is thrown away. 240 will be stored. If nil, that data is thrown away.
241 Optional argument THROWSYM specifies a symbol the throw on non-recoverable error.") 241 Optional argument THROWSYM specifies a symbol the throw on non-recoverable error.")
242 242
243 (defun semantic-analyze-find-tag-sequence-default (sequence &optional 243 (defun semantic-analyze-find-tag-sequence-default (sequence &optional
343 ;; Return the mess 343 ;; Return the mess
344 (nreverse tag))) 344 (nreverse tag)))
345 345
346 (defun semantic-analyze-find-tag (name &optional tagclass scope) 346 (defun semantic-analyze-find-tag (name &optional tagclass scope)
347 "Return the first tag found with NAME or nil if not found. 347 "Return the first tag found with NAME or nil if not found.
348 Optional argument TAGCLASS specifies the class of tag to return, such 348 Optional argument TAGCLASS specifies the class of tag to return,
349 as 'function or 'variable. 349 such as 'function or 'variable.
350 Optional argument SCOPE specifies a scope object which has 350 Optional argument SCOPE specifies a scope object which has
351 additional tags which are in SCOPE and do not need prefixing to 351 additional tags which are in SCOPE and do not need prefixing to
352 find. 352 find.
353 353
354 This is a wrapper on top of semanticdb, semanticdb-typecache, 354 This is a wrapper on top of semanticdb, semanticdb-typecache,