Next: , Previous: API, Up: API


analyze-declaration-specifier

Syntax

— Generic Function: analyze-declaration-specifier declaration-identifier declaration-args compilation-env

⇒ result-identifier, result-args, context

Method signatures

— Method: analyze-declaration-specifier (id (eql 'declaration)) args env
— Method: analyze-declaration-specifier (id (eql 'dynamic-extent)) args env
— Method: analyze-declaration-specifier (id (eql 'ftype)) args env
— Method: analyze-declaration-specifier (id (eql 'ignore)) args env
— Method: analyze-declaration-specifier (id (eql 'ignorable)) args env
— Method: analyze-declaration-specifier (id (eql 'inline)) args env
— Method: analyze-declaration-specifier (id (eql 'notinline)) args env
— Method: analyze-declaration-specifier (id (eql 'optimize)) args env
— Method: analyze-declaration-specifier (id (eql 'special)) args env
— Method: analyze-declaration-specifier (id (eql 'type)) args env
— Method: analyze-declaration-specifier (id class) args env
— Method: analyze-declaration-specifier (id cons) args env
— Method: analyze-declaration-specifier (id symbol) args env
— Method: analyze-declaration-specifier id args env

Arguments and Values

declaration-identifier
A declaration identifier.
declaration-args
A list of declaration arguments.
compilation-env
An environment object.
result-identifier
A declaration identifier.
result-args
A list of declaration arguments.
context
An object.

Description

The generic function analyze-declaration-specifier is used by parse-declarations to split an arbitrary declaration specifier into semantically-interesting parts. These parts are returned as multiple values.

At the moment, the following three values are returned:

  1. The declaration identifier of the declaration specifier. This may be a different identifier than the one analyze-declaration-specifier has been called with, for normalization purposes.
  2. A list of normalized binding names that are affected by the declaration specifier.
  3. An arbitrary object called the “context” that is used by build-declaration-specifier, along with the other two return values above, to reconstruct the declaration specifier.

Examples

  PARSE-DECLARATIONS> (analyze-declaration-specifier 'optimize '((speed 0) debug) nil)
  => OPTIMIZE
  => NIL
  => ((SPEED 0) DEBUG)
  PARSE-DECLARATIONS> (analyze-declaration-specifier 'type '(fixnum x y z) nil)
  => TYPE
  => (X Y Z)
  => FIXNUM
  PARSE-DECLARATIONS> (analyze-declaration-specifier 'inline '(f g h) nil)
  => INLINE
  => (#'F #'G #'H)
  => NIL
  PARSE-DECLARATIONS> (analyze-declaration-specifier '(string 512) '(str1 str2) nil)
  => TYPE
  => (STR1 STR2)
  => (STRING 512)

Exceptional Situations

None.

See Also

build-declaration-specifier
parse-declarations

Notes

The compilation-env is provided for methods that have to deal with type specifiers. Cf. X3J13 Issue #334.

The default method of analyze-declaration-specifier will construct an unknown declaration specifier whose “context” is the passed declaration-args. This is mostly interesting to know for usages of map-declaration-env.

Users of the library Parse-Declarations can extend the set of understood declaration specifiers by adding methods to the generic-functions analyze-declaration-specifier and build-declaration-specifier. These methods should most likely specialize on the first argument with an EQL specializer.