aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2010-12-09 23:01:39 +0000
committerdos-reis <gdr@axiomatics.org>2010-12-09 23:01:39 +0000
commit918d78b95c278f11bf70e4bd5265f0dfc40ba933 (patch)
tree921f519496d2f7ef541689ee5fdb516ea2df6245 /src
parentd3c6313afa09ce219c8c0857fe90285c3392060a (diff)
downloadopen-axiom-918d78b95c278f11bf70e4bd5265f0dfc40ba933.tar.gz
clean up
Diffstat (limited to 'src')
-rw-r--r--src/interp/scan.boot148
1 files changed, 71 insertions, 77 deletions
diff --git a/src/interp/scan.boot b/src/interp/scan.boot
index f52a4f65..62dfdfca 100644
--- a/src/interp/scan.boot
+++ b/src/interp/scan.boot
@@ -166,52 +166,57 @@ scanKeyWords == [ _
scanKeyTableCons()==
- KeyTable := hashTable 'EQUAL
- for st in scanKeyWords repeat
- HPUT(KeyTable,first st,second st)
- KeyTable
+ KeyTable := hashTable 'EQUAL
+ for st in scanKeyWords repeat
+ HPUT(KeyTable,first st,second st)
+ KeyTable
scanKeyTable:=scanKeyTableCons()
scanInsert(s,d) ==
- l := #s
- h := QENUM(s,0)
- u := d.h
- n := #u
- k:=0
- while l <= #(u.k) repeat
- k:=k+1
- v := MAKE_-VEC(n+1)
- for i in 0..k-1 repeat VEC_-SETELT(v,i,u.i)
- VEC_-SETELT(v,k,s)
- for i in k..n-1 repeat VEC_-SETELT(v,i+1,u.i)
- VEC_-SETELT(d,h,v)
- s
+ l := #s
+ h := QENUM(s,0)
+ u := d.h
+ n := #u
+ k:=0
+ while l <= #(u.k) repeat
+ k := k+1
+ v := MAKE_-VEC(n+1)
+ for i in 0..k-1 repeat
+ VEC_-SETELT(v,i,u.i)
+ VEC_-SETELT(v,k,s)
+ for i in k..n-1 repeat
+ VEC_-SETELT(v,i+1,u.i)
+ VEC_-SETELT(d,h,v)
+ s
scanDictCons()==
- l:= HKEYS scanKeyTable
- d :=
- a:=MAKE_-VEC(256)
- b:=MAKE_-VEC(1)
- VEC_-SETELT(b,0,MAKE_-CVEC 0)
- for i in 0..255 repeat VEC_-SETELT(a,i,b)
- a
- for s in l repeat scanInsert(s,d)
- d
+ l:= HKEYS scanKeyTable
+ d :=
+ a := MAKE_-VEC(256)
+ b := MAKE_-VEC(1)
+ VEC_-SETELT(b,0,MAKE_-CVEC 0)
+ for i in 0..255 repeat
+ VEC_-SETELT(a,i,b)
+ a
+ for s in l repeat
+ scanInsert(s,d)
+ d
scanDict:=scanDictCons()
scanPunCons()==
- listing := HKEYS scanKeyTable
- a:=MAKE_-BVEC 256
+ listing := HKEYS scanKeyTable
+ a := MAKE_-BVEC 256
-- SETSIZE(a,256)
- for i in 0..255 repeat BVEC_-SETELT(a,i,0)
- for k in listing repeat
- if not startsId? k.0
- then BVEC_-SETELT(a,QENUM(k,0),1)
- a
+ for i in 0..255 repeat
+ BVEC_-SETELT(a,i,0)
+ for k in listing repeat
+ if not startsId? k.0
+ then BVEC_-SETELT(a,QENUM(k,0),1)
+ a
scanPun:=scanPunCons()
@@ -256,54 +261,43 @@ for i in [ _
-- returning the token-dq and the rest of the line-stream
scanIgnoreLine(ln,n)==
- if null n
- then n
- else
- fst:=QENUM(ln,0)
- if EQ(fst,CLOSEPAREN)
- then if incPrefix?('"command",1,ln)
- then true
- else nil
- else n
+ n = nil => n
+ fst := QENUM(ln,0)
+ fst = CLOSEPAREN =>
+ incPrefix?('"command",1,ln) => true
+ nil
+ n
nextline(s)==
- if npNull s
- then false
- else
- $f:= first s
- $r:= rest s
- $ln := rest $f
- $linepos:=CAAR $f
- $n:=STRPOSL('" ",$ln,0,true)-- spaces at beginning
- $sz :=# $ln
- true
-
+ npNull s => false
+ $f := first s
+ $r := rest s
+ $ln := rest $f
+ $linepos := CAAR $f
+ $n := STRPOSL('" ",$ln,0,true)-- spaces at beginning
+ $sz := #$ln
+ true
lineoftoks(s)==
- $f: local:=nil
- $r:local :=nil
- $ln:local :=nil
- $linepos:local:=nil
- $n:local:=nil
- $sz:local := nil
- $floatok:local:=true
- if not nextline s
- then [nil,:nil]
- else
- if null scanIgnoreLine($ln,$n) -- line of spaces or starts ) or >
- then [nil,:$r]
- else
- toks:=[]
- a:= incPrefix?('"command",1,$ln)
- a =>
- $ln:=SUBSTRING($ln,8,nil)
- b:= dqUnit constoken($ln,$linepos,["command",$ln],0)
- [[[b,s]],:$r]
-
- while $n<$sz repeat toks:=dqAppend(toks,scanToken())
- if null toks
- then [[],:$r]
- else [[[toks,s]],:$r]
+ $f: local := nil
+ $r: local := nil
+ $ln: local := nil
+ $linepos: local := nil
+ $n: local := nil
+ $sz: local := nil
+ $floatok: local := true
+ not nextline s => [nil,:nil]
+ null scanIgnoreLine($ln,$n) => [nil,:$r] -- line of spaces or starts ) or >
+ toks := []
+ a := incPrefix?('"command",1,$ln)
+ a =>
+ $ln := SUBSTRING($ln,8,nil)
+ b := dqUnit constoken($ln,$linepos,["command",$ln],0)
+ [[[b,s]],:$r]
+ while $n<$sz repeat
+ toks := dqAppend(toks,scanToken())
+ null toks => [[],:$r]
+ [[[toks,s]],:$r]
scanToken() ==