[613] | 1 | DIM ;SFISC/JFW,GFT,TOAD-FileMan: M Syntax Checker, Main ;5/6/97 08:34
|
---|
| 2 | ;;22.0;VA FileMan;;Mar 30, 1999
|
---|
| 3 | ;Per VHA Directive 10-93-142, this routine should not be modified.
|
---|
| 4 | ;12275;2236006;1898;
|
---|
| 5 | ;
|
---|
| 6 | S %X=X,%END="",%ERR=0,%LAST="" G ER:X'?.ANP
|
---|
| 7 | ;
|
---|
| 8 | GC ; get next command on line (*)
|
---|
| 9 | G ER:%ERR,LAST:";"[$E(%X),ER:"BCDEFGHIKLMNOQRSUWXZ"'[$E(%X)
|
---|
| 10 | S %LAST=%X D SEP G ER:%ERR S %COM=$P(%ARG,":") ; command word
|
---|
| 11 | I $L(%COM)>1 D G ER:%ERR
|
---|
| 12 | . I $T(COMMAND)'[(";"_%COM_";"),%COM'?1"Z"1.U S %ERR=1
|
---|
| 13 | . E S %COM=$E(%COM)
|
---|
| 14 | S %=$P(%ARG,":",2,99),%COM(1)=% I %ARG[":",%="" G ER ; command postcond
|
---|
| 15 | I %]"" D ^DIM1 G ER:%ERR
|
---|
| 16 | D SEP G ER:%ERR I %ARG="","CDGMORSUWXZ"[%COM G ER ; argument list
|
---|
| 17 | S %END=%ARG G @%COM
|
---|
| 18 | ;
|
---|
| 19 | B G GC:%ARG=""&(%COM(1)=""),BK^DIM4
|
---|
| 20 | C G CL^DIM4
|
---|
| 21 | D G DG^DIM3
|
---|
| 22 | E G GC:%ARG=""&(%COM(1)=""),ER
|
---|
| 23 | F G ER:%COM(1)]"",GC:%ARG="",FR^DIM3
|
---|
| 24 | G G DG^DIM3
|
---|
| 25 | H G GC:%ARG=""&(%COM(1)="")&(%X]""),HN^DIM3:%ARG]"",ER Q
|
---|
| 26 | I G ER:%COM(1)]"",IX^DIM4
|
---|
| 27 | K G GC:%ARG=""&(%COM(1)="")&(%X]""),KL^DIM3:%ARG]"",ER
|
---|
| 28 | L G LK^DIM3
|
---|
| 29 | M G S
|
---|
| 30 | N G ER:%ARG=""&(%X=""),K
|
---|
| 31 | O G OP^DIM3
|
---|
| 32 | Q G ER:%ARG]"",GC:%ARG=""&(%COM(1)=""),BK^DIM4
|
---|
| 33 | R G RD^DIM4
|
---|
| 34 | S G ST^DIM4
|
---|
| 35 | U G OP^DIM3
|
---|
| 36 | W G WR^DIM4
|
---|
| 37 | X G IX^DIM4
|
---|
| 38 | Z G GC
|
---|
| 39 | ;
|
---|
| 40 | SEP ; remove first " "-piece of %X into %ARG: parse commands (GC)
|
---|
| 41 | F %I=1:1 S %C=$E(%X,%I) D:%C="""" Q:" "[%C
|
---|
| 42 | . N %OUT S %OUT=0 F D Q:%OUT!%ERR
|
---|
| 43 | . . S %I=%I+1,%C=$E(%X,%I) I %C="" S %ERR=1 Q
|
---|
| 44 | . . Q:%C'="""" S %I=%I+1,%C=$E(%X,%I) Q:%C="""" S %OUT=1
|
---|
| 45 | S %ARG=$E(%X,1,%I-1),%I=%I+1,%X=$E(%X,%I,999)
|
---|
| 46 | Q
|
---|
| 47 | ;
|
---|
| 48 | COMMAND ;;BREAK;CLOSE;DO;ELSE;FOR;GOTO;HALT;HANG;IF;KILL;LOCK;MERGE;NEW;OPEN;QUIT;READ;SET;USE;WRITE;XECUTE;
|
---|
| 49 | ;
|
---|
| 50 | LAST ; check to ensure no trailing "," or " " at end of command (GC)
|
---|
| 51 | S %L=$L(%LAST),$E(%LAST,%L+1-$L(%X),%L)=""
|
---|
| 52 | I $E(%END,$L(%END))="," G ER
|
---|
| 53 | I $E(%X)="",$E(%LAST,%L)=" " G ER
|
---|
| 54 | G END
|
---|
| 55 | ;
|
---|
| 56 | ER K X
|
---|
| 57 | END K %,%A,%A1,%A2,%ARG,%C1,%C,%COM,%END,%ERR,%H,%I,%L,%LAST,%P,%X,%Z Q
|
---|