PARSE


GLOBAL

  The global variable named after 'GLOBAL' is retrieved,
  formatted as a string and then used as input. If the
  global variable is a histogram, then the resulting string
  only contains the word 'Histogram' - otherwise a more or
  less meaningful string will be offered.

INPUT

  A line of input is requested from the regular input stream
  and this line is compared with the template.

  The input line is treated like all other input, i.e. text
  outside quotes and within single quotes is converted to
  upper case.

  This format is only offered for completeness - the TERMINAL
  input format is probably more useful.

TERMINAL

  A line of input is requested from the terminal, or the
  batch input file, as appropriate. This line is compared
  with the template.

  The input line is treated like all other input, i.e. text
  outside quotes and within single quotes is converted to
  upper case.

  This is probably the most useful format since it permits
  obtaining user input while a file is being read.

VALUE

  The expression is evaluated, the result is formatted as a
  string and the result is compared with the template.

  The resulting value can be of any data type (Number, String,
  Logical, Histogram or Undefined), but the result is not
  of much use in the case of histograms since histograms that
  are formatted to a string become just the word 'Histogram'.

  The expression may contain global variables if desired.

template

  The template is to be seen as a format for assigning bits and
  pieces of the input to a set of global variables.

  A template can contain the following elements:

  --------------------------------------------------------------
  Element      Purpose
  --------------------------------------------------------------
  `string`     Locate string in the input and continue assigning
               globals from the end of the string.
  var          Name of a global variable that should receive the
               corresponding input field.
  .            Ignore the corresponding input field.
  --------------------------------------------------------------

  Notes:
  1. All elements can be repeated many times.
  2. Instead of reverse quotes (`), one can also use single and
     double quotes to delimit search strings. Keep in mind however
     that the quote is a syntax element - the quote must therefore
     still be visible after the PARSE statement has been processed
     by the usual input routines.

  Examples:

  --------------------------------------------------------------
  Input       Template      Result
  --------------------------------------------------------------
  1 2 3       x y z         x=1, y=2, z=3
  1 2 x+1     x y z         x=1, y=2, z=2
  1 2 3 4     x y .         x=1, y=2
  1 2         x y z         x=1, y=2, z not defined
  1 2 3       x y           Error: y := 2 3  is incorrect syntax
  1 2 A 3     x . 'A' y     x=1 y=3
  1 2 A 3     x 'A' y       Error: x := 1 2  is incorrect syntax
  1 `abc` 2   x y .         x=1 y=`abc`
  1>2         z .           z=False
  --------------------------------------------------------------

Keyword index. Formatted on 10/11/98.