Next: , Previous: , Up: Software Evolution Library Index   [Contents][Index]


A.43 SOFTWARE-EVOLUTION-LIBRARY/SOFTWARE/LISP

Class: lisp [sel/sw/lisp]

Class precedence list: lisp, parseable, software, oid-object, file, standard-object, slot-object, t

Common Lisp source represented naturally as lists of code.

Class: lisp-ast [sel/sw/lisp]

Class precedence list: lisp-ast, functional-tree-ast, node, identity-ordering-mixin, ast, stored-hash, standard-object, slot-object, t

Slots:

Class of Common Lisp ASTs.

Variable: *bindings-allows-macros-p* [sel/sw/lisp]

A special variable that modifies the functionality of get-functions-from-binding-form. If set to a non-nil value, macros will be returned as if they were functions.

Variable: *bindings-allows-symbol-macros-p* [sel/sw/lisp]

A special variable that modifies the functionality of get-vars-from-binding-form. If set to a non-nil value, symbol macros will be returned as if they were variables.

Variable: *bindings-allows-top-level-p* [sel/sw/lisp]

A special variable that modifies the functionality of bindings. If set to a non-nil value,top level variable definitions will be included.

Variable: *bindings-form-is-macro-p* [sel/sw/lisp]

A special variable that modifies the functionality of functions that get bindings such that the returned information is marked as a macro.

Generic Function: bindings [sel/sw/lisp] obj ast &key functions variables all

Return bindings that are local to obj and in scope of AST. This method calls get-vars-from-binding-form and get-functions-from-binding-form. All of the special variables that modify the behavior of these methods can be utilized by this method.

Macro: define-fun-body-alias [sel/sw/lisp] car-of-form-alias car-of-form

Creates a fun-body method that specializes the parameter car-of-form on car-of-form-alias. The method immediately calls the specialization for car-of-form.

Macro: define-function-binding-form-alias [sel/sw/lisp] binding-form-alias binding-form

Creates a get-function-from-binding-form method that specializes the parameter car-of-form on binding-form-alias. The method immediately calls the specialization for binding-form.

Macro: define-get-vars-from-binding-form [sel/sw/lisp] binding-form-name (&key software binding-form reference-ast) &body body

Defines a specialization of get-vars-from-binding-form that specializes on binding-form-name. The keyword arguments allow for explicit naming of the parameters of the method.

A convenience local function, handle-as, is defined for the method body which allows for easy transferring to another specialization to handle the form. For exmaple, if a ’let* form has a reference ast that is inside it but after its definitions,it can transfer control to ’let by calling handle-as: (handle-as ’let). handle-as has a :reference-ast keyword which serves the same purpose as in get-vars-from-binding-form. It also has a :macro-p keyword which adds a cons to the returned list that shows that the symbol is a macro.

A convenience local function, collect-var-info, is defined for the method body which collects info on a form in a format that can be returned.

Macro: define-lambda-list-alias [sel/sw/lisp] car-of-form-alias car-of-form

Creates a lambda-list method that specializes the parameter car-of-form on car-of-form-alias. The method immediately calls the specialization for car-of-form.

Macro: define-var-binding-form-alias [sel/sw/lisp] binding-form-alias binding-form

Creates a get-vars-from-binding-form method that specializes the parameter car-of-form on binding-form-alias. The method immediately calls the specialization for binding-form.

Function: bindings-contains-function-p [sel/sw/lisp] bindings symbol &key allow-macros

Return the binding for symbol if it is in bindings.

Function: bindings-contains-variable-p [sel/sw/lisp] bindings symbol &key allow-macros

Return the binding for symbol if it is in bindings.

Function: car-of-enclosing-form-p [sel/sw/lisp] obj ast

Return t if AST is the car of its enclosing form in obj.

Function: children-of-type [sel/sw/lisp] ast type

Returns a list of the children of AST that are of type type.

Function: collect-symbols [sel/sw/lisp] obj ast

Collect the symbols in AST into a hash table. The hash table maps symbol asts to their possible usage. This can be in the form of any of the following:

  (:special-form)
  (:function-declaration)
  (:macro)
  (:macro binding-information)
  (:function)
  (:function binding-information)
  (:variable-declaration)
  (:symbol-macro)
  (:symbol-macro binding-information)
  (:variable)
  (:variable binding-information)
  (:literal)
  (:keyword)
  (:symbol)

binding-information will be in the same form as returned by #’bindings and will contain all information gathered for that specific symbol.

Function: compound-form-p [sel/sw/lisp] ast &key name

If the AST is a compound form, return the car of the form. If name is provided, return t if the car of the form is eq to name.

Function: compound-form-p* [sel/sw/lisp] ast

If the AST is a compound form, return the AST in the car of the form.

Function: featurep-with [sel/sw/lisp] feature-expression *features*

Test feature-expression against the features in *features*.

The global value of ‘*features*‘ is ignored.

Function: find-in-defining-form [sel/sw/lisp] obj defining-form name &key referencing-ast

Returns the ast in defining-form that defines name. If referencing-ast is supplied, the returned ast must occur before it.

Function: find-local-function [sel/sw/lisp] obj enclosed-form function-name &key referencing-ast

Return the ast of the local function named function-name which is in scope of enclosed-form.

Generic Function: fun-body [sel/sw/lisp] car-of-form function-declaration

Retrieve the function body of function-declaration as though it were defined in a car-of-form form. The trailing parenthesis should be removed. *bindings-allows-macros-p* can be set to get the body from macros.

Function: get-compound-form-args [sel/sw/lisp] ast

Return the args to the compound form represented by AST.

Generic Function: get-functions-from-binding-form [sel/sw/lisp] obj car-of-form binding-form &key reference-ast

Retrieves the functions defined by binding-form. car-of-form can be used as an ’eql specializer to dispatch to a specific method for the form. reference-ast is a reference point for the method to filter out variables that aren’t in scope of it. This is useful for forms like ’let* or for forms at the top-level which reference-ast may not be in the body of, such as ’defun.

Methods for this generic shouldn’t check if car-of-form is what is expected as there are different forms that can have their variables retrieved in the exact same way, such as let and when-let.

Generic Function: get-vars-from-binding-form [sel/sw/lisp] obj car-of-form binding-form &key reference-ast

Retrieves the variables defined by binding-form. car-of-form can be used as an ’eql specializer to dispatch to a specific method for the form. reference-ast is a reference point for the method to filter out variables that aren’t in scope of it. This is useful for forms like ’let* or for forms at the top-level which reference-ast may not be in the body of, such as ’defun.

Methods for this generic shouldn’t check if car-of-form is what is expected as there are different forms that can have their variables retrieved in the exact same way, such as let and when-let.

Generic Function: lambda-list [sel/sw/lisp] car-of-form function-declaration

Retrieve the lambda list of function-declaration as though it were defined in a car-of-form form. *bindings-allows-macros-p* can be set to retrieve lambda lists from macros.

Function: literalp [sel/sw/lisp] ast

Return t if AST likely represents a literal.

Function: map-feature-expressions [sel/sw/lisp] fn ast &key remove-empty remove-newly-empty

Build a new ast by calling fun, a function, on each feature expression in AST, substituting the old feature expression with the return value of fn.

remove-empty and remove-not-empty have the same meaning as for ‘map-reader-conditionals’.

Function: map-reader-conditionals [sel/sw/lisp] fn ast &key remove-empty remove-newly-empty

Build a new ast by calling fn, an function, on each reader conditional in AST (as if by ‘transform-reader-conditional’) and substituting the old reader conditional with the new one.

If :remove-empty is true, remove any reader conditionals where the feature expression is empty. If the sign is +, the entire reader conditional is removed. If the sign is -, then only the guarded expression is retained.

If :remove-newly-empty is true, reader conditionals are removed if the new feature expression is empty, but reader conditionals that were already empty are retained.

Function: quasiquote-p [sel/sw/lisp] ast

Return the quoted form if AST represents a quasiquote ast.

Function: quote-p [sel/sw/lisp] ast

Return the quoted form if AST represents a quote ast.

Function: quoted-p [sel/sw/lisp] obj ast

Return the quoted form if the AST is quoted.

Function: remove-expression-features [sel/sw/lisp] feature-expression features

Remove features from feature-expression. If there are no features left, ‘nil’ is returned.

Function: remove-feature-support [sel/sw/lisp] ast features

Remove support for features from AST. Each feature in features will be removed from all feature expressions, and if any of the resulting expressions are empty their guards (and possibly expressions) will be omitted according to the sign of the guard.

Function: scope-contains-function-p [sel/sw/lisp] scope symbol

Return the binding for symbol in a list if it is in scope.

Function: scope-contains-variable-p [sel/sw/lisp] scope symbol

Return the binding for symbol in a list if it is in scope.

Function: transform-feature-expression [sel/sw/lisp] feature-expression fn

Call fn, a function, on each feature in feature-expression. Substitute the return value of fn for the existing feature.

If fn returns nil, the feature is removed.

fn may return any feature expression, not just a symbol.

Generic Function: transform-reader-conditional [sel/sw/lisp] reader-conditional fn

Build a new reader condition by calling fn on reader-conditional.

fn is called with three arguments: the sign, as a character (+ or -); the feature expresion (as a list); and the guarded expression.

fn should return three values - a new sign, a new test, and a new expression - which are used to build a new reader conditional.

If the sign, the test, and the expression are unchanged, reader-conditional is returned unchanged and a second value of t is returned.

Function: walk-feature-expressions [sel/sw/lisp] fn ast

Call fn, a function, on each feature expression in AST.

Function: walk-reader-conditionals [sel/sw/lisp] fn ast

Call fn, a function, on each reader conditional in AST.

fn is called with three arguments: the sign of the reader conditional (+ or -), the feature expression (as a list), and the guarded expression.


Next: , Previous: , Up: Software Evolution Library Index   [Contents][Index]