[613] | 1 | XTLKTOKN ;IHS/OHPRD/ACC,SFISC/JC - CONVERT INPUT LINE TO TOKENS ;07/22/93 15:51
|
---|
| 2 | ;;7.3;TOOLKIT;;Apr 25, 1995
|
---|
| 3 | ; XTLKX IS PASSED IN AND SHOULD NOT BE KILLED
|
---|
| 4 | ; XTLKWT IS PASSED OUT AND SHOULD NOT BE KILLED
|
---|
| 5 | K XTLKWT
|
---|
| 6 | Q:'$D(XTLKX) Q:XTLKX?.E1C.E
|
---|
| 7 | S XTLKSWB="",XTLKST="SKIP",XTLKI=0,XTLKXLEN=$L(XTLKX)
|
---|
| 8 | CHLOOP S XTLKI=XTLKI+1 G:XTLKI>XTLKXLEN EXIT
|
---|
| 9 | S XTLKC=$E(XTLKX,XTLKI)
|
---|
| 10 | S XTLKOST=XTLKST
|
---|
| 11 | I XTLKOST="SKIP",(XTLKC'?1P!("'~"[XTLKC&(($E(XTLKX,XTLKI+1)?1U)!("'~"[$E(XTLKX,XTLKI+1))))) S XTLKST="SCAN",XTLKWS=XTLKI
|
---|
| 12 | I XTLKOST="SCAN",XTLKC?1P,"-'~"'[XTLKC S XTLKEND=0 D ENDWORD S XTLKST="SKIP"
|
---|
| 13 | G CHLOOP
|
---|
| 14 | EXIT I XTLKST="SCAN" S XTLKEND=1 D ENDWORD
|
---|
| 15 | K XTLKSWB,XTLKOST,XTLKST,XTLKXLEN,XTLKC,XTLKWF,XTLKWS,XTLKWD,XTLKWD2,XTLKWL,XTLKEND,XTLKI,XTLKJ,XTLKQ
|
---|
| 16 | Q
|
---|
| 17 | ENDWORD S XTLKWL=XTLKI-XTLKWS,XTLKWD=$E(XTLKX,XTLKWS,XTLKI-1)
|
---|
| 18 | I XTLKWL=1 S XTLKSWB=XTLKSWB_XTLKWD I XTLKEND S XTLKWD=XTLKSWB D STOREWD
|
---|
| 19 | I XTLKWL>1 D STOREWD I XTLKSWB'="" S XTLKWD=XTLKSWB,XTLKSWB="" D STOREWD
|
---|
| 20 | Q
|
---|
| 21 | STOREWD ;
|
---|
| 22 | Q:XTLKWD'?.E1U.E
|
---|
| 23 | S XTLKJ=$S($E(XTLKWD)="'":2,$E(XTLKWD,1,2)="~'":3,1:1)
|
---|
| 24 | RMQ S XTLKJ=$F(XTLKWD,"'",XTLKJ) I XTLKJ S XTLKWD=$E(XTLKWD,1,XTLKJ-2)_$E(XTLKWD,XTLKJ,255),XTLKJ=XTLKJ-1 G RMQ
|
---|
| 25 | N XTLKL S XTLKL=$L(XTLKWD)
|
---|
| 26 | I XTLKWD'["-" S XTLKWT(XTLKWD)="" Q
|
---|
| 27 | S XTLKWD2="" F XTLKJ=1:1 S XTLKWF=$P(XTLKWD,"-",XTLKJ) Q:XTLKWF="" Q:$L(XTLKWF)>2 S XTLKWD2=XTLKWD2_XTLKWF
|
---|
| 28 | I XTLKWF="" S XTLKWT(XTLKWD2)="" Q
|
---|
| 29 | S XTLKWD2=XTLKWD F XTLKJ=1:1 S XTLKWF=$P(XTLKWD2,"-",XTLKJ) Q:XTLKWF="" S XTLKWT(XTLKWF)=""
|
---|
| 30 | Q
|
---|