mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-28 10:52:33 +00:00
243 lines
3.9 KiB
Plaintext
243 lines
3.9 KiB
Plaintext
NEW
|
||
AUTO 3,1
|
||
*--------------------------------------
|
||
STMT.Get jsr CC.GetCharNB
|
||
jsr CC.IsLetter
|
||
ldx #$ff
|
||
bcc .20
|
||
|
||
>LDYA L.CC.PREOPS ++var ?
|
||
jsr CC.LookupOP
|
||
bcs .9
|
||
|
||
.20 stx StmtPreOp
|
||
|
||
jsr SYM.Lookup var or func() ?
|
||
bcs .99
|
||
|
||
ldy #SYM.SC
|
||
lda (ZPLookupSymPtr),y
|
||
cmp #SYM.SC.TYPEDEF
|
||
bne .60
|
||
*--------------------------------------
|
||
jsr CORE.GetNCharNB
|
||
bcs .9
|
||
|
||
ldy #SYM.Q
|
||
lda (ZPLookupSymPtr),y
|
||
pha
|
||
lda (ZPLookupSymPtr)
|
||
pha
|
||
|
||
jsr SYM.LookupFree
|
||
|
||
ply
|
||
pla
|
||
|
||
sec Reset Buffer
|
||
|
||
jmp DECL.YAC
|
||
*--------------------------------------
|
||
.60 ldy #SYM.Q
|
||
lda (ZPLookupSymPtr),y
|
||
bit #SYM.Q.FUNC
|
||
beq .61
|
||
|
||
bit StmtPreOp
|
||
bpl .9 ++func ????????
|
||
|
||
jsr F.CallNoRetV func( ... );
|
||
bcs .99
|
||
|
||
jmp SYM.LookupFree
|
||
*--------------------------------------
|
||
.61 jsr STMT.SetVar
|
||
bcs .99
|
||
|
||
jmp SYM.LookupFree
|
||
|
||
.9 lda #E.CSYN
|
||
sec
|
||
.99 rts
|
||
*--------------------------------------
|
||
STMT.SetVar stz ExpState
|
||
|
||
jsr EXP.POSTOPS var++, var[0]... ?
|
||
bcs .99
|
||
|
||
ldx StmtPreOp
|
||
jsr EXP.PREOPS apply ++var, ....
|
||
bcs .99
|
||
|
||
jsr CC.GetCharNB
|
||
bcs .90
|
||
|
||
jsr CC.IsEndArg var++; or ++var; ?
|
||
bcc .8
|
||
|
||
jsr CC.LookupAOP var=, var+= ... ?
|
||
bcs .90
|
||
|
||
cpx #0 TOTO : all AOPS
|
||
bne *
|
||
|
||
lda ExpState
|
||
bmi .90 VonStack
|
||
|
||
asl
|
||
|
||
bmi .7 AinPTR
|
||
|
||
asl
|
||
bmi .6 AonStack
|
||
|
||
jsr EXP.GetAddr1
|
||
bcc .7
|
||
|
||
rts
|
||
|
||
.6 >LDYA L.PCC.PopAddr1
|
||
jsr CODE.EmitPCC
|
||
bcs .99
|
||
|
||
.7 ldy #SYM.Q
|
||
lda (ZPLookupSymPtr),y
|
||
pha
|
||
lda (ZPLookupSymPtr)
|
||
tay
|
||
pla get expected T/Q
|
||
|
||
jsr EXP.Eval
|
||
bcs .99
|
||
|
||
jmp SYM.PopValue
|
||
|
||
.8 clc
|
||
rts
|
||
|
||
.90 lda #E.CSYN
|
||
sec
|
||
|
||
.99 rts
|
||
*--------------------------------------
|
||
|
||
*--------------------------------------
|
||
STMT.Stmt.END ldy StmtPtr
|
||
beq STMT.End.8 Global context
|
||
|
||
lda (StmtStk),y
|
||
bmi STMT.End.8 local F context
|
||
* in an instruction ...
|
||
iny STMT.TERM
|
||
lda (StmtStk),y
|
||
cmp #'}'
|
||
beq STMT.End.8 in a STMT...
|
||
|
||
cmp #';' must be ';' on stack....
|
||
bne STMT.End.9
|
||
|
||
jsr STMT.End
|
||
bcc STMT.Stmt.END
|
||
|
||
rts
|
||
|
||
STMT.End.9 lda #E.STACKERROR
|
||
sec
|
||
rts
|
||
|
||
STMT.End.8 clc
|
||
rts
|
||
*--------------------------------------
|
||
STMT.CPStmt.END ldy StmtPtr
|
||
beq STMT.End.9
|
||
|
||
lda (StmtStk),y
|
||
bpl .1
|
||
|
||
jmp F.Def.END local F context
|
||
|
||
.1 iny
|
||
lda (StmtStk),y STMT.TERM
|
||
|
||
cmp #'}' must be '}' on stack....
|
||
bne STMT.End.9
|
||
*--------------------------------------
|
||
STMT.End ldy StmtPtr STMT.KW
|
||
lda (StmtStk),y
|
||
tax
|
||
jmp (J.CC.KW.END,x)
|
||
*--------------------------------------
|
||
STMT.New00 lda #0
|
||
jsr CC.Push STMT.hMEM
|
||
bcs STMT.New.RTS
|
||
|
||
jsr CC.Push STMT.MemPtr
|
||
bcs STMT.New.RTS
|
||
|
||
STMT.New lda #';' STMT.TERM
|
||
jsr CC.Push
|
||
bcs .99
|
||
|
||
>LDA.G CC.CmdSave STMT.KW
|
||
jmp CC.Push
|
||
|
||
.99
|
||
STMT.New.RTS rts
|
||
*--------------------------------------
|
||
STMT.SetType jsr CORE.GetNCharNBNL
|
||
bcs STMT.SetType.9
|
||
|
||
ldx #';'
|
||
|
||
cmp #'{'
|
||
bne STMT.SetType.1
|
||
|
||
STMT.SetTypeCP jsr SCOPE.New
|
||
bcs STMT.New.RTS
|
||
|
||
ldx #'}'
|
||
|
||
STMT.SetType.1 txa
|
||
ldy StmtPtr
|
||
iny STMT.TERM
|
||
sta (StmtStk),y
|
||
|
||
clc
|
||
rts
|
||
|
||
STMT.SetType.9 lda #E.CSYN
|
||
sec
|
||
rts
|
||
*--------------------------------------
|
||
STMT.Close lda StmtPtr
|
||
clc
|
||
adc #STMT.hMEM
|
||
tay
|
||
lda (StmtStk),y
|
||
beq .1
|
||
|
||
>SYSCALL FreeMem
|
||
|
||
.1 ldy StmtPtr STMT.KW
|
||
iny STMT.TERM
|
||
lda (StmtStk),y
|
||
cmp #'}'
|
||
bne .2
|
||
|
||
jsr SCOPE.Close {};
|
||
bcs .99
|
||
|
||
.2 lda StmtPtr
|
||
clc
|
||
adc #STMT
|
||
sta StmtPtr
|
||
|
||
clc
|
||
|
||
.99 rts
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE usr/src/bin/cc.s.stmt
|
||
LOAD usr/src/bin/cc.s
|
||
ASM
|