tags.texi
- Provided by: xemacs21-basesupport (Version: 2009.02.17.dfsg.2-5)
- Source: xemacs21-packages
- Report a bug
The end result of a @semantic{} parser is a list of tags per each buffer. This chapter discusses the tag data structure and the API provided by @semantic{} to query, process, and modify tags.
The tags list for a buffer can be obtained by calling @code{semantic-fetch-tags} which returns a parse tree of tags that represent the program structure.
@ignore David said:
Tags are not sorted. Maybe would it be clearer to say that `semantic-fetch-tags returns a parse tree of tags that represent the program structure.
From a grammar's developer point of view it could be worth highlighting that the parse tree of tags should be consistent with buffer's location.
For example, for the following definition:
(defun foo (x y) ...)
The parse tree should look like:
("foo" function
(:arguments
("x" "y"))
...)
A bad parse tree is for example:
("foo" function
(:arguments
("y" "x")) <--- Arguments are in the reverse order
...) @end ignore
@menu * Tag Basics:: * Tag Query:: * Tag Hooks:: * Tag Overlay:: * Misc Tag Functions:: * Tag Internals:: @end menu
@node Tag Basics @section Tag Basics @cindex Tag Basics
Currently each tag is a list with up to five elements: @example (@var{name} @var{class} @var{attributes} @var{properties} @var{overlay}) @end example
Application developers should not rely on this list structure. Instead they should rely on the provided API documented in this chapter. The list structure is explained here primarily to help those reading the @semantic{} source code.
@itemize @bullet @c @item @var{name} is a required component for all tags, i.e., every tag must have this component. It is also guaranteed to be a string. This string represents the name of the tag, usually a named definition which the language will use elsewhere as a reference to the syntactic element found. @c @item @var{class} is the other required component for all tags. It is a symbol representing the class of the tag. @ignore David said: I think it would be better to say the category or class of tag [rather than ``type'']. Type of tag could be confusing. The notion of tag type represents program data type (see the function `semantic-tag-type'). @end ignore Valid @var{class}es can be anything, as long is it is an Emacs Lisp symbol. However following are some of the well-known symbols: @code{type}, @code{function}, @code{variable}, @code{include}, @code{package}, @code{code}. @c @item @var{attributes} is a property list that keep information related to the tag parsed from the buffer.
The symbol names in the property list can be anything, though there is a useful set of predefined attributes. It is best to use the API functions to access the well-known properties. @ref{Tag Query}.
@ignore
It could be worth enumerating the commonly used attribute names:
:type
:members
:superclasses
:interfaces
:default-value
:documentation
:arguments
:system-flag
:detail
We could recommend to use the above names when that makes sense, and more generally to use the Emacs keyword notation (symbol starting with @end ignore @c @item @var{properties} is generated by the semantic parser harness, and need not be provided by a language author.
Properties are used to store transient data on a tag unrelated to the source of the original tag, such as hook functions, dynamic overlays, or other data needed by programs.
The semantic incremental parser will attempt to maintain
properties when reparsing the source of a tag. @c @item @var{overlay}
represents positional information for this tag. It is automatically
generated by the semantic parser harness, and need not be provided by the
language author. @c Below is from old semantic manual: unless they provide a
@c nonterminal expansion function via @c
@code{semantic-tag-expand-function}. Depending on the overlay in a program
can be dangerous because sometimes the overlay is replaced with an integer
pair @example [ @var{start} @var{end} ] @end example when the buffer the tag
belongs to is not in memory. This happens when a using has activated the
Semantic Database
@inforef{semanticdb, , lang-support-guide}. @c @end itemize
@defun semantic-tag-name tag @anchor{semantic-tag-name} Return the name of @var{tag}. For functions, variables, classes, typedefs, etc., this is the identifier that is being defined. For tags without an obvious associated name, this may be the statement type, e.g., this may return @code{print} for python's print statement. @obsolete{semantic-token-name,semantic-tag-name} @end defun
@defun semantic-tag-class tag @anchor{semantic-tag-class} Return the class of @var{tag}. That is, the symbol @code{'variable}, @code{'function}, @code{'type}, or other. There is no limit to the symbols that may represent the class of a tag. Each parser generates tags with classes defined by it.
For functional languages, typical tag classes are:
@table @code @item type Data types, named map for a memory block. @item function A function or method, or named execution location. @item variable A variable, or named storage for data. @item include Statement that represents a file from which more tags can be found. @item package Statement that declairs this file's package name. @item code Code that has not name or binding to any other symbol, such as in a script. @end table
@obsolete{semantic-token-token,semantic-tag-class} @end defun
Several functions that deal with @var{attributes} component are given in @ref{Tag Attributes Internals,Tag Attributes Internals}. However functions listed in @ref{Tag Query,Tag Query} should provide most needs of the application developer.
Similarly functions that deal with @var{properties} component are given in @ref{Tag Properties Internals,Tag Properties Internals}. The application developer should not need to use any of these.
Finally @ref{Tag Overlay,Tag Overlay} lists functions dealing with the @var{overlay} component.
@node Tag Query @section Tag Query @cindex Tag Query
This section lists functions that answers simple questions regarding a given tag.
@subsection Tag Predicates
@defun semantic-tag-p tag @anchor{semantic-tag-p} Return non-@code{nil} if @var{tag} is most likely a semantic tag. @obsolete{semantic-token-p,semantic-tag-p} @end defun
@defun semantic-equivalent-tag-p tag1 tag2 @anchor{semantic-equivalent-tag-p} Compare @var{tag1} and @var{tag2} and return non-@code{nil} if they are equivalent. Use @dfn{eq} to test of two tags are the same. Use this function if tags are being copied and regrouped to test for if two tags represent the same thing, but may be constructed of different cons cells. @obsolete{semantic-equivalent-tokens-p,semantic-equivalent-tag-p} @end defun
@defun semantic-tag-of-class-p tag class @anchor{semantic-tag-of-class-p} Return non-@code{nil} if class of @var{tag} is @var{class}. @end defun
@defun semantic-tag-faux-p tag @anchor{semantic-tag-faux-p} Return non-@code{nil} if @var{tag} is a @var{faux} tag. @var{faux} tags are created to represent a construct that is not known to exist in the code. @end defun
@defun semantic-tag-type-compound-p tag @anchor{semantic-tag-type-compound-p} Return non-@code{nil} the type of @var{tag} is compound. Compound implies a structure or similar data type. Returns the list of tag members if it is compound. @end defun
@subsection Documentation
@defun semantic-tag-docstring tag &optional buffer @anchor{semantic-tag-docstring} Return the documentation of @var{tag}. That is the value defined by the `:documentation' attribute. Optional argument @var{buffer} indicates where to get the text from. If not provided, then only the @var{position} can be provided. @obsolete{semantic-token-docstring,semantic-tag-docstring} @end defun
@subsection Common Flags
@defun semantic-tag-variable-constant-p tag @anchor{semantic-tag-variable-constant-p} Return non-@code{nil} if the variable that @var{tag} describes is a constant. That is the value of the attribute `:constant-flag'. @obsolete{semantic-token-variable-const,semantic-tag-variable-constant-p} @end defun
@defun semantic-tag-function-destructor-p tag @anchor{semantic-tag-function-destructor-p} Return non-@code{nil} if @var{tag} describes a destructor function. That is the value of the `:destructor-flag' attribute. @obsolete{semantic-token-function-destructor,semantic-tag-function-destructor-p} @end defun
@defun semantic-tag-function-throws tag @anchor{semantic-tag-function-throws} Return the exceptions the function that @var{tag} describes can throw. That is the value of the `:throws' attribute. @obsolete{semantic-token-function-throws,semantic-tag-function-throws} @end defun
@defun semantic-tag-modifiers tag @anchor{semantic-tag-modifiers} Return the value of the `:typemodifiers' attribute of @var{tag}. @obsolete{semantic-token-type-modifiers,semantic-tag-modifiers} @obsolete{semantic-token-variable-modifiers,semantic-tag-modifiers} @obsolete{semantic-token-function-modifiers,semantic-tag-modifiers} @end defun
@subsection Functions
@defun semantic-tag-function-arguments tag @anchor{semantic-tag-function-arguments} Return the arguments of the function that @var{tag} describes. That is the value of the `:arguments' attribute. @obsolete{semantic-token-function-args,semantic-tag-function-arguments} @end defun
@subsection Variables
@defun semantic-tag-variable-default tag @anchor{semantic-tag-variable-default} Return the default value of the variable that @var{tag} describes. That is the value of the attribute `:default-value'. @obsolete{semantic-token-variable-default,semantic-tag-variable-default} @end defun
@subsection Data Types
@defun semantic-tag-type tag @anchor{semantic-tag-type} Return the value of the `:type' attribute of @var{tag}. @obsolete{semantic-token-type,semantic-tag-type} @end defun
@defun semantic-tag-of-type-p tag type @anchor{semantic-tag-of-type-p} Compare TAG's type against @var{type}. Non @code{nil} if equivalent. @var{type} can be a string, or a tag of class @code{'type}. @end defun
@subsection Inheritance and Hierarchy
@defun semantic-tag-named-parent tag @anchor{semantic-tag-named-parent} Return the parent of @var{tag}. That is the value of the `:parent' attribute. If a definition can occur outside an actual parent structure, but refers to that parent by name, then the @code{:parent} attribute should be used. @end defun
@defun semantic-tag-function-parent tag @anchor{semantic-tag-function-parent} Return the parent of the function that @var{tag} describes. That is the value of the `:parent' attribute. A function has a parent if it is a method of a class, and if the function does not appear in body of it's parent class. @obsolete{semantic-token-function-parent,semantic-tag-function-parent} @end defun
@defun semantic-tag-type-superclasses tag @anchor{semantic-tag-type-superclasses} Return the list of superclasses of the type that @var{tag} describes. @obsolete{semantic-token-type-parent-superclass,semantic-tag-type-superclasses} @obsolete{semantic-token-type-parent,semantic-tag-type-superclasses} @end defun
@defun semantic-tag-type-interfaces tag @anchor{semantic-tag-type-interfaces} Return the list of interfaces of the type that @var{tag} describes. @obsolete{semantic-token-type-parent-implement,semantic-tag-type-interfaces} @obsolete{semantic-token-type-parent,semantic-tag-type-interfaces} @end defun
@defun semantic-tag-type-members tag @anchor{semantic-tag-type-members} Return the members of the type that @var{tag} describes. That is the value of the `:members' attribute. @obsolete{semantic-token-type-parts,semantic-tag-type-members} @end defun
@subsection Includes
@defun semantic-tag-include-system-p tag @anchor{semantic-tag-include-system-p} Return non-@code{nil} if the include that @var{tag} describes is a system include. That is the value of the attribute `:system-flag'. @obsolete{semantic-token-include-system,semantic-tag-include-system-p} @end defun
@defun semantic-tag-include-filename tag @anchor{semantic-tag-include-filename} Return a filename representation of @var{tag}. The default action is to return the @dfn{semantic-tag-name}. Some languages do not use full filenames in their include statements. Override this method to translate the code represenation into a filename. (A relative filename if necessary.)
See @dfn{semantic-dependency-tag-file} to expand an include tag to a full file name. This function can be overloaded (see @dfn{define-mode-local-override} for details). @end defun
@subsection Code
@defun semantic-tag-code-detail tag @anchor{semantic-tag-code-detail} Return detail information from code that @var{tag} describes. That is the value of the attribute `:detail'. @end defun
@subsection Tag Children
@defun semantic-tag-components tag @anchor{semantic-tag-components} Return a list of components for @var{tag}. A Component is a part of @var{tag} which itself may be a @var{tag}. Examples include the elements of a structure in a tag of class `type, or the list of arguments to a tag of class @code{'function}. This function can be overloaded (see @dfn{define-mode-local-override} for details). @end defun
@defun semantic-tag-components-default tag @anchor{semantic-tag-components-default} Return a list of components for @var{tag}. Perform the described task in @dfn{semantic-tag-components}. @end defun
@defun semantic-tag-children-compatibility tag &optional positiononly @anchor{semantic-tag-children-compatibility} Return children of @var{tag}. If @var{positiononly} is @code{nil}, use @dfn{semantic-tag-components}. If @var{positiononly} is non-@code{nil}, use @dfn{semantic-tag-components-with-overlays}. @var{do} @var{not} use this fcn in new code. Use one of the above instead. @obsolete{semantic-nonterminal-children,semantic-tag-children-compatibility} @end defun
@subsection Location
@node Tag Overlay @section Tag Overlay @cindex Tag Overlay
The functions in this answer questions regarding the overly such as the buffer in which the tags is located, the start and/or end position of the tag, and the overlay itself which spans the tags.
@defun semantic-tag-start tag @anchor{semantic-tag-start} Return the start location of @var{tag}. @obsolete{semantic-token-start,semantic-tag-start} @end defun
@defun semantic-tag-end tag @anchor{semantic-tag-end} Return the end location of @var{tag}. @obsolete{semantic-token-end,semantic-tag-end} @end defun
@defun semantic-tag-bounds tag @anchor{semantic-tag-bounds} Return the location (@var{start} @var{end}) of data @var{tag} describes. @obsolete{semantic-token-extent,semantic-tag-bounds} @end defun
@defun semantic-tag-buffer tag @anchor{semantic-tag-buffer} Return the buffer @var{tag} resides in. If @var{tag} has an originating file, read that file into a (maybe new) buffer, and return it. Return @code{nil} if there is no buffer for this tag. @obsolete{semantic-token-buffer,semantic-tag-buffer} @end defun
@defun semantic-tag-file-name tag @anchor{semantic-tag-file-name} Return the name of the file from which @var{tag} originated. Return @code{nil} if that information can't be obtained. If @var{tag} is from a loaded buffer, then that buffer's filename is used. If @var{tag} is unlinked, but has a @code{:filename} property, then that is used. @end defun
@defun semantic-tag-overlay tag @anchor{semantic-tag-overlay} Return the @var{overlay} part of @var{tag}. That is, an overlay or an unloaded buffer representation. This function can also return an array of the form [ @var{start} @var{end} ]. This occurs for tags that are not currently linked into a buffer. @obsolete{semantic-token-overlay,semantic-tag-overlay} @end defun
@defun semantic-tag-with-position-p tag @anchor{semantic-tag-with-position-p} Return non-@code{nil} if @var{tag} has positional information. @obsolete{semantic-token-with-position-p,semantic-tag-with-position-p} @end defun
@defun semantic-tag-components-with-overlays tag @anchor{semantic-tag-components-with-overlays} Return the list of top level components belonging to @var{tag}. Children are any sub-tags which contain overlays.
Default behavior is to get @dfn{semantic-tag-components} in addition to the components of an anonymous types (if applicable.)
@table @strong @item Language authors, please note:
If a mode defines a language tag that has tags in it with overlays you should
still return them with this function. Ignoring this step will prevent
several features from working correctly. This function can be overloaded
(see @dfn{define-mode-local-override} for details). @end table @end
defun
@defun semantic-tag-components-with-overlays-default tag @anchor{semantic-tag-components-with-overlays-default} Return the list of top level components belonging to @var{tag}. Children are any sub-tags which contain overlays. The default action collects regular components of @var{tag}, in addition to any components beloning to an anonymous type. @end defun
@node Tag Hooks @section Tag Hooks @cindex Tag Hooks
Individual tags can have hooks associated with them. Hooks are saved as properties, but can cause specific tags to have special behaviors after a hook is added.
You can manipulate tag hooks with these functions:
@defun semantic-tag-add-hook tag hook function &optional append @anchor{semantic-tag-add-hook} Onto @var{tag}, add to the value of @var{hook} the function @var{function}. @var{function} is added (if necessary) at the beginning of the hook list unless the optional argument @var{append} is non-@code{nil}, in which case @var{function} is added at the end. @var{hook} should be a symbol, and @var{function} may be any valid function. See also the function @dfn{add-hook}. @end defun
@defun semantic-tag-remove-hook tag hook function @anchor{semantic-tag-remove-hook} Onto @var{tag}, remove from the value of @var{hook} the function @var{function}. @var{hook} should be a symbol, and @var{function} may be any valid function. If @var{function} isn't the value of @var{hook}, or, if @var{function} doesn't appear in the list of hooks to run in @var{hook}, then nothing is done. See also the function @dfn{remove-hook}. @end defun
For a developer, if you have an application for which you want to support a special kind of hook on a per tag basis, you can use this to run those hooks.
@defun semantic--tag-run-hooks tag hook &rest args @anchor{semantic--tag-run-hooks} Run for @var{tag} all expressions saved on the property @var{hook}. Each hook expression must take at least one argument, the @var{tag}. For any given situation, additional @var{args} may be passed. @end defun
Semantic supports two TAG specific hooks at this time:
@table @code @item link-hook This hook is run whenever a tag is linked into a buffer. This occurs just after parsing, and whenever a tag is loaded into memory. This hook also executes after a datase save, when all tags are first unlinked from the current buffer before the save. @item unlink-hook This hook is run whenever a tag is unlinked from a buffer. This ocucrs during a database save, or when a tag is modified by the incremental parser. @item unlink-copy-hook This hook is run whenever a tag is copied. This occurs in the function @code{semantic-tag-copy}. Use this hook to remove properties from the tag that link it to a buffer, as this tag should no longer have direct buffer links. @end table
@node Misc Tag Functions @section Misc Tag Functions @cindex Misc Tag Functions
@deffn Command semantic-narrow-to-tag &optional tag @anchor{semantic-narrow-to-tag} Narrow to the region specified by the bounds of @var{tag}. See @dfn{semantic-tag-bounds}. @obsolete{semantic-narrow-to-token,semantic-narrow-to-tag} @end deffn
@defun semantic-with-buffer-narrowed-to-current-tag &rest body @anchor{semantic-with-buffer-narrowed-to-current-tag} Execute @var{body} with the buffer narrowed to the current tag. @obsolete{semantic-with-buffer-narrowed-to-current-token,semantic-with-buffer-narrowed-to-current-tag} @end defun
@defun semantic-with-buffer-narrowed-to-tag tag &rest body @anchor{semantic-with-buffer-narrowed-to-tag} Narrow to @var{tag}, and execute @var{body}. @obsolete{semantic-with-buffer-narrowed-to-token,semantic-with-buffer-narrowed-to-tag} @end defun
@node Tag Internals @section Tag Internals @cindex Tag Internals
@menu * Tag Attributes Internals:: * Tag Properties Internals:: * Tag Overlay Internals:: * Creating Tags:: * Misc Tag Internals:: @end menu
@node Tag Attributes Internals @subsection Tag Attributes Internals
@ignore Attribute Accessor Method | Property Symbol ---------------------------------------------------- semantic-tag-variable-constant-p | :constant-flag semantic-tag-function-destructor-p | :destructor-flag semantic-tag-function-parent | :parent semantic-tag-function-throws | :throws semantic-tag-modifiers | :typemodifiers semantic-tag-function-arguments | :arguments semantic-tag-variable-default | :default-value semantic-tag-docstring | :documentation semantic-tag-type-interfaces | :interfaces semantic-tag-type-members | :members semantic-tag-type-superclasses | :superclasses semantic-tag-include-system-p | :system-flag semantic-tag-type | :type @end ignore
@defun semantic-tag-attributes tag @anchor{semantic-tag-attributes} Return the list of public attributes of @var{tag}. That is a property list: (@var{attribute-1} @var{value-1} @var{attribute-2} @var{value-2}@dots{}). @obsolete{semantic-token-extra-specs,semantic-tag-attributes} @obsolete{semantic-token-function-extra-specs,semantic-tag-attributes} @obsolete{semantic-token-variable-extra-specs,semantic-tag-attributes} @obsolete{semantic-token-type-extra-specs,semantic-tag-attributes} @end defun
@defun semantic-tag-get-attribute tag attribute @anchor{semantic-tag-get-attribute} From @var{tag}, return the value of @var{attribute}. @var{attribute} is a symbol whose specification value to get. Return the value found, or @code{nil} if @var{attribute} is not one of the attributes of @var{tag}. @obsolete{semantic-token-extra-spec,semantic-tag-get-attribute} @obsolete{semantic-token-function-extra-spec,semantic-tag-get-attribute} @obsolete{semantic-token-variable-extra-spec,semantic-tag-get-attribute} @end defun
@defun semantic-tag-put-attribute tag attribute value @anchor{semantic-tag-put-attribute} Change value in @var{tag} of @var{attribute} to @var{value}. If @var{attribute} already exists, its value is set to @var{value}, otherwise the new @var{attribute} @var{value} pair is added. Return @var{tag}. Use this function in a parser when not all attributes are known at the same time. @obsolete{semantic-token-add-extra-spec,semantic-tag-put-attribute} @end defun
@defun semantic-tag-put-attribute-no-side-effect tag attribute value @anchor{semantic-tag-put-attribute-no-side-effect} Change value in @var{tag} of @var{attribute} to @var{value} without side effects. All cons cells in the attribute list are replicated so that there are no side effects if @var{tag} is in shared lists. If @var{attribute} already exists, its value is set to @var{value}, otherwise the new @var{attribute} @var{value} pair is added. Return @var{tag}. @end defun
@node Tag Properties Internals @subsection Tag Properties Internals
@ignore Property symbols:
reparse-symbol
:filename
secondary-overlays
Related functions not yet documented:
semantic-brute-find-tag-by-property
semantic-tag-add-hook
semantic-tag-remove-hook
semantic-show-label @end ignore
@defun semantic-tag-properties tag @anchor{semantic-tag-properties} Return the list of private properties of @var{tag}. That is a property list: (@var{property-1} @var{value-1} @var{property-2} @var{value-2}@dots{}). @obsolete{semantic-token-properties,semantic-tag-properties} @end defun
@defun semantic--tag-put-property tag property value @anchor{semantic--tag-put-property} Change value in @var{tag} of @var{property} to @var{value}. If @var{property} already exists, its value is set to @var{value}, otherwise the new @var{property} @var{value} pair is added. Return @var{tag}. That function is for internal use only. @obsolete{semantic-token-put,semantic--tag-put-property} @end defun
@defun semantic--tag-get-property tag property @anchor{semantic--tag-get-property} From @var{tag}, extract the value of @var{property}. Return the value found, or @code{nil} if @var{property} is not one of the properties of @var{tag}. That function is for internal use only. @obsolete{semantic-token-get,semantic--tag-get-property} @end defun
@defun semantic--tag-put-property-no-side-effect tag property value @anchor{semantic--tag-put-property-no-side-effect} Change value in @var{tag} of @var{property} to @var{value} without side effects. All cons cells in the property list are replicated so that there are no side effects if @var{tag} is in shared lists. If @var{property} already exists, its value is set to @var{value}, otherwise the new @var{property} @var{value} pair is added. Return @var{tag}. That function is for internal use only. @obsolete{semantic-token-put-no-side-effect,semantic--tag-put-property-no-side-effect} @end defun
@defun semantic-tag-make-plist args @anchor{semantic-tag-make-plist} Create a property list with @var{args}. Args is a property list of the form (@var{key1} @var{value1} @dots{} @var{keyn} @var{valuen}). Where @var{key} is a symbol, and @var{value} is the value for that symbol. The return value will be a new property list, with these @var{key}/@var{value} pairs eliminated:
- @var{key} associated to @code{nil} @var{value}.
- @var{key} associated to an empty string @var{value}.
- @var{key} associated to a zero @var{value}.
@obsolete{semantic-tag-make-assoc-list,semantic-tag-make-plist} @end
defun
@node Tag Overlay Internals @subsection Tag Overlay Internals
Many of the overlay related functions were already documented in @ref{Tag Overlay,Tag Overlay}.
@ignore Functions not yet documented:
semantic--tag-overlay-cdr
semantic--tag-set-overlay @end ignore
@defun semantic-tag-set-bounds tag start end @anchor{semantic-tag-set-bounds} In @var{tag}, set the @var{start} and @var{end} location of data it describes. @end defun
@node Creating Tags @subsection Creating Tags
@defun semantic-tag name class &rest attributes @anchor{semantic-tag} Create a generic semantic tag. @var{name} is a string representing the name of this tag. @var{class} is the symbol that represents the class of tag this is, such as @code{'variable}, or @code{'function}. @var{attributes} is a list of additional attributes belonging to this tag. @obsolete{semantic-token,semantic-tag} @end defun
@defun semantic-tag-new-variable name type default-value &rest attributes @anchor{semantic-tag-new-variable} Create a semantic tag of class @code{'variable}. @var{name} is the name of this variable. @var{type} is a string or semantic tag representing the type of this variable. @var{default-value} is a string representing the default value of this variable. @var{attributes} is a list of additional attributes belonging to this tag. @obsolete{semantic-token-new-variable,semantic-tag-new-variable} @end defun
@defun semantic-tag-new-function name type arg-list &rest attributes @anchor{semantic-tag-new-function} Create a semantic tag of class @code{'function}. @var{name} is the name of this function. @var{type} is a string or semantic tag representing the type of this function. @var{arg-list} is a list of strings or semantic tags representing the arguments of this function. @var{attributes} is a list of additional attributes belonging to this tag. @obsolete{semantic-token-new-function,semantic-tag-new-function} @end defun
@defun semantic-tag-new-type name type members parents &rest
attributes @anchor{semantic-tag-new-type} Create a semantic tag of class
@code{'type}. @var{name} is the name of this type. @var{type} is a string or
semantic tag representing the type of this type. @var{members} is a list of
strings or semantic tags representing the elements that make up this type if
it is a composite type. @var{parents} is a cons cell.
(@var{explicit-parents} . @var{interface-parents}) @var{explicit-parents}
can be a single string (Just one parent) or a list of parents (in a multiple
inheritance situation). It can also be @code{nil}. @var{interface-parents}
is a list of strings representing the names of all @var{interfaces}, or
abstract classes inherited from. It can also be @code{nil}. This slot can be
interesting because the form:
( @code{nil} ``string'') is a valid parent where there is no explicit parent,
and only an interface. @var{attributes} is a list of additional attributes
belonging to this tag.
@obsolete{semantic-token-new-type,semantic-tag-new-type} @end defun
@defun semantic-tag-new-include name system-flag &rest attributes @anchor{semantic-tag-new-include} Create a semantic tag of class @code{'include}. @var{name} is the name of this include. @var{system-flag} represents that we were able to identify this include as belonging to the system, as opposed to belonging to the local project. @var{attributes} is a list of additional attributes belonging to this tag. @obsolete{semantic-token-new-include,semantic-tag-new-include} @end defun
@defun semantic-tag-new-package name detail &rest attributes @anchor{semantic-tag-new-package} Create a semantic tag of class @code{'package}. @var{name} is the name of this package. @var{detail} is extra information about this package, such as a location where it can be found. @var{attributes} is a list of additional attributes belonging to this tag. @obsolete{semantic-token-new-package,semantic-tag-new-package} @end defun
@defun semantic-tag-new-code name detail &rest attributes @anchor{semantic-tag-new-code} Create a semantic tag of class @code{'code}. @var{name} is a name for this code. @var{detail} is extra information about the code. @var{attributes} is a list of additional attributes belonging to this tag. @end defun
@defun semantic-tag-clone tag &optional name @anchor{semantic-tag-clone} Clone @var{tag}, creating a new @var{tag}. If optional argument @var{name} is not @code{nil} it specifies a new name for the cloned tag. @obsolete{semantic-clone-tag,semantic-tag-clone} @end defun
@defun semantic-tag-copy tag &optional name keep-file @anchor{semantic-tag-copy} Return a copy of @var{tag} unlinked from the originating buffer. If optional argument @var{name} is non-@code{nil} it specifies a new name for the copied tag. If optional argument @var{keep-file} is non-@code{nil}, and @var{tag} was linked to a buffer, the originating buffer file name is kept in the `:filename' property of the copied tag. This runs the tag hook `unlink-copy-hook`. @end defun
@node Misc Tag Internals @subsection Misc Tag Internals
@defun semantic--tag-run-hooks tag hook &rest args Run for @var{tag} all expressions saved on the property @var{hook}. Each hook expression must take at least one argument, the @var{tag}. For any given situation, additional @var{args} may be passed. @end defun
@defun semantic--tag-unlink-from-buffer tag Convert @var{tag} from using an overlay to using an overlay proxy. This function is for internal use only. This runs the tag hook @code{unlink-hook}. @ref{Tag Hooks} @end defun
@defun semantic--tag-link-to-buffer tag Convert @var{tag} from using an overlay proxy to using an overlay. This function is for internal use only. This runs the tag hook @code{link-hook}. @ref{Tag Hooks} @end defun
@defun semantic--tag-unlink-list-from-buffer tags Convert @var{tags} from using an overlay to using an overlay proxy. This function is for internal use only. @end defun
@defun semantic--tag-link-list-to-buffer tags Convert @var{tags} from using an overlay proxy to using an overlay. This function is for internal use only. @end defun
@defun semantic--tag-unlink-cache-from-buffer Convert all tags in the current cache to use overlay proxys. This function is for internal use only. @end defun
@defun semantic--tag-link-cache-to-buffer Convert all tags in the current cache to use overlays. This function is for internal use only. @end defun
@defun semantic--tag-expanded-p tag Return non-@code{nil} if @var{tag} is expanded. This function is for internal use only. See also the function @code{semantic--expand-tag}. @end defun
@defun semantic--tag-expand tag Convert @var{tag} from a raw state to a cooked state, and expand it. Returns a list of cooked tags.
The parser returns raw tags with positional data @var{start} @var{end} at the end of the tag data structure (a list for now). We convert it from that to a cooked state that uses an overlay proxy, that is, a vector [@var{start} @var{end}].
The raw tag is changed with side effects and maybe expanded in several derived tags when the variable @code{semantic-tag-expand-function} is set.
This function is for internal use only. @end defun
@ignore @c @node Semantic Functions Called within ECB @c @section Semantic Functions Called within ECB @c @cindex Semantic Functions Called within ECB
I was curious as to what semantic functions were called by a real semantic application such as ECB. So I searched ECB and listed all functions that ECB calls that start with ``semantic-''. Then as I document one by one, I deleted them. The functions below are ones that I have not yet gone through. -ryk8/13/03.
semantic-active-p semantic-adopt-external-members semantic-after-partial-cache-change-hook semantic-after-toplevel-cache-change-hook semantic-bucketize semantic-c-template-string semantic-clear-toplevel-cache semantic-colorize-text semantic-current-nonterminal semantic-find-dependency semantic-name-nonterminal semantic-nonterminal-children semantic-nonterminal-protection semantic-overlay-live-p semantic-overlay-p semantic-prototype-nonterminal semantic-require-version semantic-token-buffer semantic-token-end semantic-token-function-parent semantic-token-get semantic-token-name semantic-token-overlay semantic-token-put semantic-token-start semantic-token-token semantic-token-type-parent @end ignore