To support rapid source code development and decrease the occurrence of syntactic errors, LSE provides language-specific tokens and placeholders. Tokens and placeholders allow for the insertion of source code, within language constructs, by expanding the name a user types and by further expanding tokens and placeholders on syntactic markers. On-line help for language features is also provided that is keyed to the names of tokens and placeholders.
1 – Tokens
Tokens are models of program language constructs that are referenced by name from a template buffer. When a token name is entered, LSE replaces the name with the specified template body from the buffer (see also topic "Tokens_and_Placeholders"). The LSE commands used for the manipulation of tokens are: DEFINE TOKEN name specifies template characteristics for an EXPAND command. DELETE TOKEN name cancels the effect of a DEFINE TEMPLATE command. END DEFINE terminates a DEFINE command. EXPAND expands the token name at the current cursor position. EXTRACT TOKEN token-name selects the definition of the named token and formats it as a command. SAVE ENVIRONMENT [ file-spec ] writes all user-defined tokens to a specified file SHOW TOKEN [ name | * ] displays information about the specified token. UNEXPAND reverses the effect of the last EXPAND command.
2 – Placeholders
Placeholders are syntactic character strings that hold the place of program language constructs. When a placeholder name is expanded, it expands to either an actual value (terminal node) or another construct (nonterminal node) requiring further expansion (see also Topics "Tokens_and_Placeholders"). The LSE commands used for the manipulation of placeholders are: DEFINE PLACEHOLDER name specifies placeholder characteristics for the current language. DELETE PLACEHOLDER name cancels the effect of a DEFINE PLACEHOLDER command. END DEFINE terminates a DEFINE command. ERASE PLACEHOLDER deletes the text of a selected placeholder. EXPAND expands the placeholder-name at the current cursor postion. EXTRACT PLACEHOLDER placeholder-name selects the definition of the named placeholder and formats it as a command. GOTO PLACEHOLDER moves the cursor to the next placeholder. SAVE ENVIRONMENT [file-spec] writes all user-defined placeholders to the specified file. SHOW PLACEHOLDER [name | * ] displays the characteristics of the specified placeholder. UNEXPAND reverses the effect of the last EXPAND command.
3 – Aliases
Aliases are abbreviated reference names for long identifiers that have been entered in the source code. To define an alias for an identifier on which the cursor is currently located, press the GOLD-CTRL/A key sequence and type the abbreviation at the prompt: _Alias name: name Whenever the abbreviated reference name is typed and expanded (CTRL/E), the original identifier string will appear in the buffer. The LSE commands used for the manipulation of aliases are: EXTRACT ALIAS alias-name selects the definition of the alias name and formats it as a command. DEFINE ALIAS name [value] specifies the alias name to be assigned and the value of the string to be referenced. DELETE ALIAS name specifies the alias name to be deleted.
4 – New Files
To edit a new file in one of the supported languages, the following commands are required for the manipulation of tokens and placeholders: o ERASE PLACEHOLDER/FORWARD (CTRL/K) o EXPAND (CTRL/E) o GOTO PLACEHOLDER/FORWARD (CTRL/N) o GOTO PLACEHOLDER/REVERSE (CTRL/P) o UNERASE PLACEHOLDER (PF1-CTRL/K) o UNEXPAND (PF1-CTRL/E) When you press the EXPAND key (CTRL/E), while the cursor is on a placeholder name, one of the following will occur: o The placeholder will be replaced automatically with a template consisting of language constructs. This type of placeholder is called a "nonterminal placeholder" because it will insert a template into the buffer when expanded. o Text will appear in a separate window to aid you in supplying a value. This type of placeholder is called a "terminal placeholder" because it does not insert a template into the buffer when expanded. Instead, you must supply the necessary text. You can press the spacebar to remove the window. o A menu will appear that provides you with options that can be selected and expanded into templates. This type of placeholder is called a "menu placeholder". In any of these three cases, you may type in the desired text over the placeholder, and the placeholder will be erased automatically. When expanding a menu placeholder, you can move through the options by using the up and down arrow keys. To select an option, you press the EXPAND key, the RETURN key, or the ENTER key. To exit the menu without selecting an option, you press the spacebar. You can construct a complete program by repeatedly expanding templates. You do not have to continuously expand templates until you reach a terminal placeholder. Rather, you may find it more appropriate to type in the desired value yourself at a higher level (see also topics "Tokens_and_Placeholders" and "Getting_Started").
5 – Old Files
To edit an existing file, in one of the supported languages, you use tokens. Since tokens exist for many reserved words, simply type the token name and press the EXPAND key (CTRL/E). For example, typing IF followed by a CTRL/E causes a template for an IF construct to appear on your screen. (Use the SHOW TOKEN command to acquire a listing of all the predefined tokens.)