[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This chapter deals with how to derive the current context, and also how a language maintainer can get the current context API to work with their language.
By default, the behavior will function in C like languages. This means languages with parenthetical blocks, and type dereferencing which uses a similar form.
10.1 Blocks and Navigation | ||
10.2 Deriving local variables | Getting lists of local variables. | |
10.3 Deriving the Current Context | What goes at a given location? | |
10.4 Analysis of the current context | Analysis information about the local context. |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Source code is typically built up of control structures, and blocks of context, or lexical scope. Semantic terms these lexical scopes as a "context". The following functions can be used to navigate contexts. Some of them are override functions. Language authors can override a subset of them to make them work for their language.
nil
if there are no more context levels.
Overloaded functions using up-context
take no parameters.
nil
if there is no upper context.
The default behavior uses semantic-up-context
. It can
be overridden with beginning-of-context
.
nil
if there is no upper context.
Be default, this uses semantic-up-context
, and assumes parenthetical
block delimiters. This can be overridden with end-of-context
.
These next set of functions can be used to navigate across commands.
semantic-command-separation-character
.
Override with end-of-command
.
semantic-command-separation-character
.
Override with beginning-of-command
.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Within a given context, or block of code, local variables are often defined. These functions can be used to retrieve lists of locally scoped variables.
bovine-inner-scope
to
parse tokens at the beginning of the context.
This can be overridden with get-local-variables
.
get-local-arguments
.
get-all-local-variables
.
Optional argument POINT is the location to start getting the variables from.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
While a context has already been used to describe blocks of code, other context include more local details, such as the symbol the cursor is on, or the fact we are assigning into some other variable.
These context deriving functions can be overridden to provide language specific behavior. By default, it assumes a C like language.
ctxt-current-symbol
.
semantic-ctxt-current-symbol
.
Return nil
if there is nothing relevant.
Override with ctxt-current-assignment
.
ctxt-current-argument
.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The context parsing API is used in a context analysis library. This library provides high level routines for scanning through token databases to create lists of token associates. At it's core is a set of EIEIO classes defining a context. The context contains information about what was parsed at a given position, such as the strings there, and they type of assignment. The analysis library then searches the databases to determine the types and names available.
Two high level functions which can be run interactively are:
*NOTE TO SELF: Add more here*
semantic-analyze-context
.
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |