home *** CD-ROM | disk | FTP | other *** search
/ Programmer's ROM - The Computer Language Library / programmersrom.iso / ada / misc / parser.pro < prev    next >
Encoding:
Text File  |  1988-05-03  |  4.2 KB  |  85 lines

  1.  
  2. -------- SIMTEL20 Ada Software Repository Prologue ------------
  3. --                                                           -*
  4. -- Unit name    : PARSER
  5. -- Version      : 1.0
  6. -- Author       : Richard Conn
  7. --              : Texas Instruments, Ada Technology Branch
  8. --              : PO Box 801, MS 8007
  9. --              : McKinney, TX  75069
  10. -- DDN Address  : RCONN at SIMTEL20
  11. -- Copyright    : (c) 
  12. -- Date created :  21 July 85
  13. -- Release date :  30 July 85
  14. -- Last update  :  30 July 85
  15. -- Machine/System Compiled/Run on : DG MV10000 (ROLM ADE) and
  16. --                    DEC VAX 11/785 (DEC Ada)
  17. --                                                           -*
  18. ---------------------------------------------------------------
  19. --                                                           -*
  20. -- Keywords     :  parser, generic parser, UNIX, ARGC, ARGV
  21. ----------------:
  22. --
  23. -- Abstract     :  
  24. --
  25. --|   PARSER is a generic parser that functions in a manner similar to
  26. --| the ARGC/ARGV parser of UNIX.  It contains one procedure, PARSE,
  27. --| which accepts a string as input and returns ARGC, a count of the number
  28. --| of tokens in the string, and ARGV, a vector of strings, each string
  29. --| containing a token.
  30. --|
  31. --|   PARSER is instantiated with two strings (DEL for DELIMITER and
  32. --| DEL_TOKEN for DELIMITER_TOKEN).  The DEL string is composed of characters
  33. --| which delimit each token (and are not a part of the token).  All
  34. --| characters less than space are automatically delimiters, and the DEL
  35. --| string should contain at least one character (such as a space).
  36. --| DEL_TOKEN is a string composed of characters which delimit tokens and
  37. --| which are tokens themselves.  If "=" is a DEL_TOKEN, for example, then
  38. --| "CAT= DOG" is composed of three tokens, "CAT", "=", and "DOG", where if
  39. --| "=" is a DEL, then "CAT= DOG" is composed of two tokens, "CAT" and "DOG".
  40. --| This assumes that the space character is a DEL.
  41. --|
  42. --|   PARSER may also be instantiated with ARGC_LIMIT, which indicates the
  43. --| maximum number of tokens allowed.  If this limit is exceeded, then the
  44. --| last ARGV token contains the remainder of the string.  The default value
  45. --| of ARGC_LIMIT is 20.
  46. --|
  47. --|   ARG_STRING_LENGTH is the last instantiation option for PARSER.  It
  48. --| indicates the maximum length of an ARGV string, and it defaults to 80.
  49. --|
  50. --                                                           -*
  51. ------------------ Revision history ---------------------------
  52. --                                                           -*
  53. -- DATE         VERSION    AUTHOR                  HISTORY
  54. -- 19850730        1.0  Richard Conn            Initial Release
  55. --                                                           -*
  56. ------------------ Distribution and Copyright -----------------
  57. --                                                           -*
  58. -- This prologue must be included in all copies of this software.
  59. --
  60. -- This software is released to the Ada community.
  61. -- This software is released to the Public Domain (note:
  62. --   software released to the Public Domain is not subject
  63. --   to copyright protection).
  64. -- Restrictions on use or distribution:  NONE
  65. --                                                           -*
  66. ------------------ Disclaimer ---------------------------------
  67. --                                                           -*
  68. -- This software and its documentation are provided "AS IS" and
  69. -- without any expressed or implied warranties whatsoever.
  70. -- No warranties as to performance, merchantability, or fitness
  71. -- for a particular purpose exist.
  72. --
  73. -- Because of the diversity of conditions and hardware under
  74. -- which this software may be used, no warranty of fitness for
  75. -- a particular purpose is offered.  The user is advised to
  76. -- test the software thoroughly before relying on it.  The user
  77. -- must assume the entire risk and liability of using this
  78. -- software.
  79. --
  80. -- In no event shall any person or organization of people be
  81. -- held responsible for any direct, indirect, consequential
  82. -- or inconsequential damages or lost profits.
  83. --                                                           -*
  84. -------------------END-PROLOGUE--------------------------------
  85.