DIM ;SFISC/JFW,GFT,TOAD-FileMan: M Syntax Checker, Main ;5/6/97 08:34
;;22.0;VA FileMan;;Mar 30, 1999
;Per VHA Directive 10-93-142, this routine should not be modified.
;12275;2236006;1898;
;
S %X=X,%END="",%ERR=0,%LAST="" G ER:X'?.ANP
;
GC ; get next command on line (*)
G ER:%ERR,LAST:";"[$E(%X),ER:"BCDEFGHIKLMNOQRSUWXZ"'[$E(%X)
S %LAST=%X D SEP G ER:%ERR S %COM=$P(%ARG,":") ; command word
I $L(%COM)>1 D G ER:%ERR
. I $T(COMMAND)'[(";"_%COM_";"),%COM'?1"Z"1.U S %ERR=1
. E S %COM=$E(%COM)
S %=$P(%ARG,":",2,99),%COM(1)=% I %ARG[":",%="" G ER ; command postcond
I %]"" D ^DIM1 G ER:%ERR
D SEP G ER:%ERR I %ARG="","CDGMORSUWXZ"[%COM G ER ; argument list
S %END=%ARG G @%COM
;
B G GC:%ARG=""&(%COM(1)=""),BK^DIM4
C G CL^DIM4
D G DG^DIM3
E G GC:%ARG=""&(%COM(1)=""),ER
F G ER:%COM(1)]"",GC:%ARG="",FR^DIM3
G G DG^DIM3
H G GC:%ARG=""&(%COM(1)="")&(%X]""),HN^DIM3:%ARG]"",ER Q
I G ER:%COM(1)]"",IX^DIM4
K G GC:%ARG=""&(%COM(1)="")&(%X]""),KL^DIM3:%ARG]"",ER
L G LK^DIM3
M G S
N G ER:%ARG=""&(%X=""),K
O G OP^DIM3
Q G ER:%ARG]"",GC:%ARG=""&(%COM(1)=""),BK^DIM4
R G RD^DIM4
S G ST^DIM4
U G OP^DIM3
W G WR^DIM4
X G IX^DIM4
Z G GC
;
SEP ; remove first " "-piece of %X into %ARG: parse commands (GC)
F %I=1:1 S %C=$E(%X,%I) D:%C="""" Q:" "[%C
. N %OUT S %OUT=0 F D Q:%OUT!%ERR
. . S %I=%I+1,%C=$E(%X,%I) I %C="" S %ERR=1 Q
. . Q:%C'="""" S %I=%I+1,%C=$E(%X,%I) Q:%C="""" S %OUT=1
S %ARG=$E(%X,1,%I-1),%I=%I+1,%X=$E(%X,%I,999)
Q
;
COMMAND ;;BREAK;CLOSE;DO;ELSE;FOR;GOTO;HALT;HANG;IF;KILL;LOCK;MERGE;NEW;OPEN;QUIT;READ;SET;USE;WRITE;XECUTE;
;
LAST ; check to ensure no trailing "," or " " at end of command (GC)
S %L=$L(%LAST),$E(%LAST,%L+1-$L(%X),%L)=""
I $E(%END,$L(%END))="," G ER
I $E(%X)="",$E(%LAST,%L)=" " G ER
G END
;
ER K X
END K %,%A,%A1,%A2,%ARG,%C1,%C,%COM,%END,%ERR,%H,%I,%L,%LAST,%P,%X,%Z Q
DIM ;SFISC/JFW,GFT,TOAD-FileMan: M Syntax Checker, Main ;5/6/97 08:34
+1 ;;22.0;VA FileMan;;Mar 30, 1999
+2 ;Per VHA Directive 10-93-142, this routine should not be modified.
+3 ;12275;2236006;1898;
+4 ;
+5 SET %X=X
SET %END=""
SET %ERR=0
SET %LAST=""
IF X'?.ANP
GOTO ER
+6 ;
GC ; get next command on line (*)
+1 IF %ERR
GOTO ER
IF ";"[$EXTRACT(%X)
GOTO LAST
IF "BCDEFGHIKLMNOQRSUWXZ"'[$EXTRACT(%X)
GOTO ER
+2 ; command word
SET %LAST=%X
DO SEP
IF %ERR
GOTO ER
SET %COM=$PIECE(%ARG,":")
+3 IF $LENGTH(%COM)>1
Begin DoDot:1
+4 IF $TEXT(COMMAND)'[(";"_%COM_";")
IF %COM'?1"Z"1.U
SET %ERR=1
+5 IF '$TEST
SET %COM=$EXTRACT(%COM)
End DoDot:1
IF %ERR
GOTO ER
+6 ; command postcond
SET %=$PIECE(%ARG,":",2,99)
SET %COM(1)=%
IF %ARG[":"
IF %=""
GOTO ER
+7 IF %]""
DO ^DIM1
IF %ERR
GOTO ER
+8 ; argument list
DO SEP
IF %ERR
GOTO ER
IF %ARG=""
IF "CDGMORSUWXZ"[%COM
GOTO ER
+9 SET %END=%ARG
GOTO @%COM
+10 ;
B IF %ARG=""&(%COM(1)="")
GOTO GC
GOTO BK^DIM4
C GOTO CL^DIM4
D GOTO DG^DIM3
E IF %ARG=""&(%COM(1)="")
GOTO GC
GOTO ER
F IF %COM(1)]""
GOTO ER
IF %ARG=""
GOTO GC
GOTO FR^DIM3
G GOTO DG^DIM3
H IF %ARG=""&(%COM(1)="")&(%X]"")
GOTO GC
IF %ARG]""
GOTO HN^DIM3
GOTO ER
QUIT
I IF %COM(1)]""
GOTO ER
GOTO IX^DIM4
K IF %ARG=""&(%COM(1)="")&(%X]"")
GOTO GC
IF %ARG]""
GOTO KL^DIM3
GOTO ER
L GOTO LK^DIM3
M GOTO S
N IF %ARG=""&(%X="")
GOTO ER
GOTO K
O GOTO OP^DIM3
Q IF %ARG]""
GOTO ER
IF %ARG=""&(%COM(1)="")
GOTO GC
GOTO BK^DIM4
R GOTO RD^DIM4
S GOTO ST^DIM4
U GOTO OP^DIM3
W GOTO WR^DIM4
X GOTO IX^DIM4
Z GOTO GC
+1 ;
SEP ; remove first " "-piece of %X into %ARG: parse commands (GC)
+1 FOR %I=1:1
SET %C=$EXTRACT(%X,%I)
IF %C=""""
Begin DoDot:1
+2 NEW %OUT
SET %OUT=0
FOR
Begin DoDot:2
+3 SET %I=%I+1
SET %C=$EXTRACT(%X,%I)
IF %C=""
SET %ERR=1
QUIT
+4 IF %C'=""""
QUIT
SET %I=%I+1
SET %C=$EXTRACT(%X,%I)
IF %C=""""
QUIT
SET %OUT=1
End DoDot:2
IF %OUT!%ERR
QUIT
End DoDot:1
IF " "[%C
QUIT
+5 SET %ARG=$EXTRACT(%X,1,%I-1)
SET %I=%I+1
SET %X=$EXTRACT(%X,%I,999)
+6 QUIT
+7 ;
COMMAND ;;BREAK;CLOSE;DO;ELSE;FOR;GOTO;HALT;HANG;IF;KILL;LOCK;MERGE;NEW;OPEN;QUIT;READ;SET;USE;WRITE;XECUTE;
+1 ;
LAST ; check to ensure no trailing "," or " " at end of command (GC)
+1 SET %L=$LENGTH(%LAST)
SET $EXTRACT(%LAST,%L+1-$LENGTH(%X),%L)=""
+2 IF $EXTRACT(%END,$LENGTH(%END))=","
GOTO ER
+3 IF $EXTRACT(%X)=""
IF $EXTRACT(%LAST,%L)=" "
GOTO ER
+4 GOTO END
+5 ;
ER KILL X
END KILL %,%A,%A1,%A2,%ARG,%C1,%C,%COM,%END,%ERR,%H,%I,%L,%LAST,%P,%X,%Z
QUIT