      SUBROUTINE PC.PARSE(S,OBJ)
*PRE-COMPILER
*
*
*BASIC
*N
*     PRECISION 6
*
************************************************************************
************************************************************************
***                                                                  ***
*** PICK PARSING PRE-COMPILER SYSTEM                                 ***
***                                                                  ***
*** COPYRIGHT 1988 MODULAR SOFTWARE                                  ***
***                P.O. BOX 204                                      ***
***                ATLANTA, GA  30291                                ***
***                (404) 964 - 7171                                  ***
***                                                                  ***
*** THIS PROGRAM IS PROPRIETARY TO MODULAR SOFTWARE AND MAY NOT BE   ***
*** USED, COPIED, EXAMINED, OR DISCLOSED WITHOUT A VALID LICENSE     ***
*** FROM MODULAR SOFTWARE.                                           ***
***                                                                  ***
************************************************************************
************************************************************************
*
*
* Pre-compiler parse routine
*
*
* PRE-COMPILE parsing routine
*
*    This routine accepts the following escape syntax:
*
*        {{                - Insert the { character     TYPE =  0
*        {X'##'}           - Insert control character   TYPE =  0
*        {*symbol.name}    - Insert symbol              TYPE =  0
*        {%}               - Variable                   TYPE = -1
*        {W...}            - Multi-word symbol          TYPE = -2
*        {S...}            - Multi-string symbol        TYPE = -3
*        {V}               - Variable format-string     TYPE = -4
*
* S is a syntax string that is free-form
*
* OBJ    is a syntax string that is multi-valued with two attributes
*        Attr 1 contains the elements
*        Attr 2 contains the element types which are:
*           0 - a "normal" element
*           1 - a parentheses
*           2 - a line seperator
*           3 - an element seperator
*           4 - an operator
*           5 - a space
*
      $INCLUDE PC.COMMON
*
      DIM SEP(5)
      SEP(1) = '()'
      SEP(2) = ';'
      SEP(3) = ','
      SEP(4) = '+-/*!^:<>#=@'
      SEP(5) = ' '
      NO.SEP = 5
*
      O = ''
      OBJ = ''
*
      STRIP.SPACE = YES
*
      C = 1
      LOOP
         CH = S[C,1]
         C = C + 1
      UNTIL CH = '' DO
         IF STRIP.SPACE THEN
            LOOP WHILE CH = ' ' DO
               CH = S[C,1]
               C = C + 1
            REPEAT
            STRIP.SPACE = NO
         END
*
         IF CH = '"' OR CH = "'" OR CH = '\' THEN
            GOSUB 100
            CH0 = CH
            O = CH
            LOOP
               CH = S[C,1]
               C = C + 1
               GOSUB 200
            UNTIL CH = '' OR CH = CH0 DO
               O = O : CH
            REPEAT
            O = O : CH
            GOSUB 100
            CH = S[C,1]
            C = C + 1
         END
*
         GOSUB 200
*
         IF CH <> '' THEN
            FLG = NO
            FOR I = 1 TO NO.SEP UNTIL FLG
               IF INDEX(SEP(I),CH,1) THEN
                  GOSUB 100
                  OBJ<1,1,-1> = CH
                  OBJ<1,2,-1> = I
                  IF I = 5 THEN STRIP.SPACE = YES
                  FLG = YES
               END
            NEXT I
            IF NOT(FLG) THEN O = O : CH
         END
      REPEAT
      GOSUB 100
*
      RETURN
*
100 *
*
      IF O <> '' THEN
         OBJ<1,1,-1> = O
         OBJ<1,2,-1> = 0
         O = ''
      END
*
      RETURN
*
200 *
*
      LOOP WHILE CH = '{' DO
         IF S[C,1] = '{' THEN
            O = O : '{'
            CH = S[C+1,1]
            C = C + 2
         END ELSE
            GOSUB 100
            T = INDEX(S[C,3200],'}',1)
            IF T THEN
               O = S[C,T-1]
               C = C + T + 1
               CH = S[C-1,1]
            END ELSE
               O = S[C,32000]
               C = LEN(S) + 2
               CH = ''
            END
            BEGIN CASE
               CASE O MATCHES "'X'2N"
                  OBJ<1,1,-1> = ICONV(O[2,2],'MX')
                  OBJ<1,2,-1> = 0
               CASE O[1,1] = '*'
                  ID = O[2,32000]
                  READ SYMBOL FROM SRC.FD , ID ELSE STOP 202,ID
                  IF SYMBOL<1> = 'C' THEN
                     OBJ<1,1,-1> = SYMBOL<2>
                     OBJ<1,2,-1> = 0
                  END ELSE
                     STOP 'X','INVALID SYMBOL DEFINITION'
                  END
               CASE O[1,1] = 'W'
                  OBJ<1,1,-1> = O[2,32000]
                  OBJ<1,2,-1> = -2
               CASE O[1,1] = 'S'
                  OBJ<1,1,-1> = O[2,32000]
                  OBJ<1,2,-1> = -3
               CASE O = 'V'
                  OBJ<1,1,-1> = O
                  OBJ<1,2,-1> = -4
               CASE YES
                  OBJ<1,1,-1> = O
                  OBJ<1,2,-1> = -1
               CASE YES
                  STOP 'PC','Invalid variable  {' : O : '}'
            END CASE
            O = ''
         END
      REPEAT
*
*
      RETURN
*
      CW = '(C) Copyright 1985-1989 Modular Software.  All rights reserved.'
   END
