LSE$CLIHELP.HLB  —  Features
UNEXPAND reverses the effect of the last EXPAND command.

9.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.

9.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.

9.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").

9.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.)

10  –  Compiling

  While writing your program,  you  can  use  the  COMPILE  and  REVIEW
  commands  to  compile your code and review compilation errors without
  leaving the editing session.

  Supported VMS language compilers  generate  a  file  of  compile-time
  diagnostic information that LSE can use to review compilation errors.
  The  diagnostic  information  is  generated  with  the   /DIAGNOSTICS
  qualifier.

  The COMPILE command issues a DCL command in a  subprocess  to  invoke
  the appropriate compiler.  LSE checks to see if the language provides
  /DIAGNOSTICS capabilities.   If  so,  LSE  appends  the  /DIAGNOSTICS
  qualifier onto the compilation command.

  For example, if you issue the COMPILE command  while  in  the  buffer
  TEST.ADA, the resulting DCL command is as follows:

      $ ADA DEV:[DIRECTORY]TEST.ADA/DIAGNOSTICS=DEV:[DIRECTORY]TEST.DIA

  LSE supports all of the compiler's  command  qualifiers  as  well  as
  user-supplied  command  procedures.   You can specify DCL qualifiers,
  such as /LIBRARY, when invoking the  compiler  from  LSE.   (See  the
  Command Dictionary for details on the COMPILE command.)

  The REVIEW command displays any  diagnostic  messages  that  resulted
  from  a  compilation.   LSE  displays  the  compilation errors in one
  window, with the corresponding source  code  displayed  in  a  second
  window.

  This multiwindow capability allows you to review  your  errors  while
  examining  the associated source code.  This eliminates tedious steps
  in the error correction process and helps ensure that all the  errors
  are fixed before looping back through the compilation process.

  LSE provides several commands to help you review errors and exam your
  source  code.   The  following lists these commands and their default
  key bindings.

       COMPILE/REVIEW
            compiles and reviews the content of the current buffer.

       END REVIEW
            terminates the current review session.

       GOTO SOURCE
            uses the current cursor position in $REVIEW to select
            the diagnostic in the source buffer. This command is
            bound to CTRL/G.

       NEXT ERROR
            selects the next diagnostic message from $REVIEW.

       NEXT STEP
            selects the next diagnostic message from $REVIEW.
            This command is bound to CTRL/F.

       PREVIOUS ERROR
            selects the previous diagnostic message from $REVIEW.

       PREVIOUS STEP
            selects the previous diagnostic message from $REVIEW.
            This command is bound to CTRL/B.

       REVIEW
            displays the diagnostic messages resulting from a
            compilation.

11  –  CMS Interface

  LSE V3.0 provides for invoking CMS from the LSE  command  line  using
  the  CMS  command.   Also,  when  LSE  must  access  a  file from the
  directory that is the user's CMS library, LSE will automatically  use
  CMS to FETCH the file.  LSE also has a RESERVE command to reserve the
  element in your current CMS library that has the same name  and  type
  as  the  file associated with your current buffer.  The UNRESERVE and
  REPLACE commands also provide the corresonding CMS operation for  the
  file in your current buffer.

  See  the  manual  for  information  "File   Manipulation"   and   for
  descriptions  of  the  following  new or enhanced commands related to
  source code management and CMS:

        CMS
        GOTO FILE
        GOTO SOURCE
        READ
        REPLACE
        RESERVE
        SET CMS
        UNRESERVE

12  –  Patterns

   The three pattern styles VMS, ULTRIX and TPU can be used in search
   and substitute commands. The pattern style is set by the SET SEARCH
   command.

12.1  –  VMS

   The VMS pattern style enables the special interpretation of wildcard
   characters and a quote character in the search-string parameter as
   shown below:

      VMS-Style Wildcards

      Wildcard      Matches

      *             One or more characters of any kind on a line.

      **            One or more characters of any kind crossing lines.

      %             A single character.

      \<            Beginning of a line.

      \>            End of a line.

      \[set-of-     Any character in the specified set. For example,
      characters]   \[abc] matches any letter in the set "abc" and
                    \[c-t] matches any letter in the set "c" through
                    "t."

      \[~set-of-    Anything not in the specified set of characters.
      characters]

      \             Lets you specify the characters \,*,% or ] within
                    wildcard expressions. For example, \\ matches the
                    backslash character (\).

      \.            Repeats the previous pattern zero or more times,
                    including the original.

      \:            Repeats the previous pattern at least once,
                    including the original; that is, a null occurrence
                    does not match.

      \w            Any empty space created by the space bar or tab
                    stops, including no more than one line break.

      \d            Any decimal digit.

      \o            Any octal digit.

      \x            Any hexadecimal digit.

      \a            Any alphabetic character, including accented
                    letters, other marked letters, and non-English
                    letters.

      \n            Any alphanumeric character.

      \s            Any character that can be used in a symbol:
                    alphanumeric, dollar sign, and underscore.

      \l            Any lowercase letter.

      \u            Any uppercase letter.

      \p            Any punctuation character.

      \f            Any formatting characters: backspace, tab, line
                    feed, vertical tab, form feed, and carriage return.

      \^            Any control character.

      \+            Any character with bit 7 set; that is, ASCII decimal
                    values from 128 through 255.

   For example the following command will find a line starting with an
   uppercase letter:

      SEARCH/PATTERN  "\<\u"

12.2  –  ULTRIX

   The ULTRIX pattern style enables the special interpretation of
   wildcard characters and a quote character in the search-string
   parameter as shown below:

      ULTRIX-Style Wildcards

      Wildcard      Matches

      .             A single character.

      ^             Beginning of a line.

      $             End of a line.

      [set-of-      Any character in the specified set. For example,
      characters]   [abc] matches any letter in the set "abc" and [c-t]
                    matches any letter in the set "c" through "t."

      [^set-of-     Anything not in the specified set of characters.
      characters]

      \             Lets you specify the characters \,.,^,$,[,],or * in
                    wildcard expressions. For example, \\ matches the
                    backslash character (\).

      *             Repeats the previous pattern zero or more times,
                    including the original.

      +             Repeats the previous pattern at least once,
                    including the original; that is, a null occurrence
                    does not match.

   For example the following command will find a line starting with
   a, b or c:

      SEARCH/PATTERN  "^[abc]"

12.3  –  TPU

   The TPU pattern style enables the use of TPU patterns. For full
   details of TPU patterns see the DEC Text Processing Utility Manual.

   1.  Simple examples

   The first example searches for abc or def and the second example
   substitutes all occurrences of abc or def by ghi:

      SEARCH/PATTERN  "'abc' | 'def'"

      SUBSTITUTE/PATTERN/ALL   "'abc' | 'def'"  "'ghi'"

   In the examples 'abc', 'def' and 'ghi' are TPU
   strings and | is the TPU pattern alternation operator.

   The outermost quotes in the examples must be omitted
   if the parameters are prompted for or if a dialog box is
   used.

   2.  Search string

   The search string is a TPU expression that must evaluate to a
   TPU pattern.

   3.  Replace string

   The replace string is a TPU expression that must evaluate to a
   TPU string.

   4.  Partial pattern assignment variables

   Partial pattern assignment variables allow a substitution
   to be a function of the found pattern.

   For example, the following command replaces a date of the
   form yyyy/mm/dd with one of the form dd/mm/yyyy:

      SUBSTITUTE/PATTERN -
         "(_year@_v1)+'/'+(_month@_v2)+'/'+(_day@_v3)" -
         "str(_v3)+'/'+str(_v2)+'/'+ str(_v1)"

      when applied to:  1998/04/21  generates:  21/04/1998

   In the above example _year, _month and _day are TPU
   variables holding patterns that match the year, month
   and day parts of a date, for details of how to set up
   these variables see Section 8.

   @ is the TPU partial pattern assignment operator and _v1,
   _v2 and _v3 are partial pattern assignment variables that
   are set to the found year, date and day.

   A partial pattern assignment variable holds a TPU range
   and when used in the replacement string must be converted
   to a string using the TPU procedure STR.

   For example, the following command will prefix any lines
   that start with any three characters from ABCDEFGHI with
   XYZ_ :

      SUBSTITUTE/PATTERN/ALL -
         "LINE_BEGIN + (ANY('ABCDEFGHI',3)@_v1)" -
         "'XYZ_'+ str(_v1)"

      when applied to:  abc        generates:  XYZ_abc
                        012                    012
                        defghi                 XYZ_defghi

   In the above example LINE_BEGIN is a TPU keyword that
   matches the beginning of a line and ANY is a TPU pattern
   procedure that matches a specified number of characters
   from a specified set of characters.

   5.  New line

   A new line will be generated for each line feed character
   in the replacement string, a line feed character can be
   introduced by means of the TPU procedure ASCII with the
   value 10 as a parameter.

   For example, to replace any numbers at the end of lines
   with the string 'xxx' (a line feed is necessary because
   the search pattern includes the end of the line):

      SUBSTITUTE/PATTERN/ALL -
         "_n + LINE_END" -
         "'xxx' + ASCII(10)"

      when applied to:  123 456    generates:  123 xxx
                        789                    xxx

   In the above example LINE_END is a TPU keyword that
   matches the end of a line and _n is TPU variable holding a
   pattern that matches a number.

   When a partial pattern assignment variable is converted
   to a string by the TPU procedure STR an optional second
   parameter can be set to ASCII(10) to cause any end
   of lines in the range described by the variable to be
   converted to line feed characters (without the parameter
   they are represented by the null string). For example:

      SUBSTITUTE/PATTERN/ALL -
         "(LINE_BEGIN + _n + LINE_END + _n + LINE_END)@_v1" -
         "STR(_v1, ASCII(10)) + STR(_v1, ASCII(10))"

      when applied to:  123        generates:  123
                        456                    456
                                               123
                                               456

   Carriage return characters adjacent to line feed characters
   in the replacement string are ignored.

   6.  Errors

   The search and replace strings are TPU expressions
   which have to be evaluated and may generate various TPU
   compilation / evaluation error messages.

   The following error messages are generated for invalid
   search or replace strings:

      Error in search pattern
      Error in replacement string

   These messages will normally be preceded by various TPU
   error messages. For example, the search string "'aaa' +
   bbb" would result in the following error messages:

      Undefined procedure call BBB
      Operand combination STRING + INTEGER unsupported
      Error in search pattern

   7.  Global variables

   Partial pattern assignment variables and pattern variables
   (such as _year in an earlier example) need to be global
   and must not clash with any TPU global variables used by
   LSE. This can be achieved by starting any such variable
   names with an underscore character.

   8.  Pattern variables

   Any complicated search or substitution is likely to need
   various pattern variables to have already been set up.
   This can be achieved in various ways.

   The definitions can be setup by issuing DO/TPU commands,
   for example:

      DO/TPU "_digits:='0123456789'"
      DO/TPU "_digit:=any(_digits)"
      DO/TPU "_year:=any(_digits,4)"

      DO/TPU "_month:=any('01',1)+_digit"
      DO/TPU "_day:=any('0123',1)+_digit"
      DO/TPU "_n:=span(_digits)"

   The file LSE$PATTERNS.TPU in the LSE$EXAMPLE directory
   contains some examples of patterns which can be added to
   LSE by means of the following commands:

      GOTO FILE LSE$EXAMPLE:LSE$PATTERNS.TPU
      EXTEND *
      DO/TPU "LSE$PATTERNS_MODULE_INIT"

   9.  Use for developing DTM user filters

   The user defined filters global replace feature introduced
   in Digital Test Manager for OpenVMS Version V4.0 can
   be simulated using the SUBSTITUTE/PATTERN/ALL command.
   This allows DTM user defined filters to be developed
   interactively using LSE.

   For example, to replace any numbers at the end of lines
   with the string 'xxx':

      global_replace(
         _n + LINE_END,
         'xxx' + ASCII(10),
         NO_EXACT,
         OFF,
         ON);

   The LSE equivalent (assuming that the current search
   attributes are equivalent to NO_EXACT) is:

      SUBSTITUTE/PATTERN/ALL -
         "_n + LINE_END" -
         "'xxx' + ASCII(1O)"

   The LSE equivalent of the pattern to replace parameter
   (first parameter of the global_replace routine) is the
   same except that the parameter has to be in quotes.

   The LSE equivalent of the replacement string parameter
   (second parameter) is the same if the evaluate replacement
   parameter (fourth parameter) is set to ON and is the
   same except that the parameter has to be in quotes if
   the evaluate replacement parameter is set to OFF.

   The LSE equivalent of the search mode parameter (third
   parameter) is the setting of the search options (set by
   the SET SEARCH command).

   LSE does not have equivalents of the evaluate replacement
   parameter (fourth parameter) or the convert linefeeds
   parameter (fifth parameter). It always evaluates the
   replacement string parameter and it always converts
   linefeed characters (and ignores adjacent carriage return
   characters).
Close Help