LXIDNT ( Lex identifer )
ENTRY LXIDNT ( IDSPEC, STRING, FIRST, LAST, NCHAR )
Lex (scan) an identifer, starting from a specified character
position.
None.
CHARACTER
PARSING
SCANNING
STRING
UTILITY
INTEGER IDSPEC ( LBCELL : * )
CHARACTER*(*) STRING
INTEGER FIRST
INTEGER LAST
INTEGER NCHAR
Variable I/O Description
-------- --- --------------------------------------------------
IDSPEC I Identifier character specification.
STRING I String to be scanned.
FIRST I Character position at which to start scanning.
LAST O Character position of end of token.
NCHAR O Number of characters in token.
IDSPEC is an integer cell containing a specification of
the head and tail identifier character sets to be
used in scanning the input argument STRING. IDSPEC
should be obtained by calling LXDFID or LXCSID.
The structure of IDSPEC is not part of the
specification of this routine suite and should not
be relied upon by calling code.
STRING is a character string that may contain an
`identifier' starting at the character position
indicated by the input argument FIRST (see
below). Identifier tokens are sequences of
characters that represent names. Syntactically, an
identifier is a sequence of characters that begins
with a character belonging to a set of valid `head'
characters and is followed by zero or more
characters belonging to a set of valid `tail'
characters.
FIRST is the character position at which the routine
is to start scanning an identifier. Note
that the character STRING(FIRST:FIRST) must be a
valid head character if an identifier is to
be found; this routine does *not* attempt to locate
the first identifier following the position
FIRST.
LAST is the last character position such that the
substring STRING(FIRST:LAST) is an identifier, if
such a substring exists. Otherwise, the
returned value of LAST is FIRST-1.
NCHAR is the length of the identifier found by this
routine, if such a token exists. If an identifier
is not found, the returned value of NCHAR is
zero.
None.
Error free.
1) If the input argument FIRST is less than 1 or greater than
LEN(STRING)-1, the returned value of LAST is FIRST-1, and the
returned value of NCHAR is zero.
None.
The default syntax rules for valid identifiers are specified in
the $Particulars section of the umbrella routine LXNAME. These
rules may be overridden by calling LXCSID.
See the $Examples section of the umbrella routine LXNAME.
None.
None.
N.J. Bachman (JPL)
Beta Version 1.0.0, 25-OCT-1995 (NJB)
|