aUCBLogo Demos and Tests / testreadlistflattags
to testreadlistflattags
f="aUCBLogo.hhc
openRead f
setReader f
a=Array readListFlatTags
cc= count a
c_litem=0
lst_item="false
c_ppp=0
repeat int cc/1
[ p1 = item repcount a
if not empty? p1
[ p2 = parseTag p1
repeat count p2 [litem= item repcount p2
if litem=="<UL> [c_litem=c_litem+1]
if litem=="</UL> [c_litem=c_litem-1]
if 1 < count litem [o_litem]
]
]
]
close f
pr cc
pr c_ppp
end
to o_litem
if lst_item [
ppp=bf bf bf bf bf bf bf litem
if "> == last ppp [ppp=bl bl ppp]
if primitivep ppp [c_ppp=c_ppp+1 (pr c_litem ppp)]
lst_item="false]
if litem=="name="Name" [lst_item="true]
end
to parseTag t
out=[]
w="
inQuote=false
while [not empty? t]
[ c=first t
w=(word w c)
if not inQuote
[ if c=="
[ out=lput w out
w="
]
]
if c==""
[ inQuote=not inQuote
]
t=butFirst t
]
out=lput w out
output out
end