Handbook
Glossary
read-til-semicolon ( n string slice -- n' string semi )
Vocabulary
modern
Inputs
n
an
object
string
an
object
slice
an
object
Outputs
n'
an
object
string
an
object
semi
an
object
Definition
USING:
arrays
combinators
kernel
modern.slices
sequences
;
IN:
modern
:
read-til-semicolon
( n string slice -- n' string semi )
dup
[
but-last
";"
append
";"
2array
{
"--"
")"
}
append
lex-colon-until
]
dip
swap
dup
?last
{
{
[
dup
";"
sequence=
]
[
drop
unclip-last
3array
]
}
{
[
dup
";"
tail?
]
[
drop
unclip-last
3array
]
}
{
[
dup
"--"
sequence=
]
[
drop
unclip-last
-rot
2array
[
rewind-slice
]
dip
]
}
{
[
dup
"]"
sequence=
]
[
drop
unclip-last
-rot
2array
[
rewind-slice
]
dip
]
}
{
[
dup
"}"
sequence=
]
[
drop
unclip-last
-rot
2array
[
rewind-slice
]
dip
]
}
{
[
dup
")"
sequence=
]
[
drop
unclip-last
-rot
2array
[
rewind-slice
]
dip
]
}
{
[
dup
section-close?
]
[
drop
unclip-last
-rot
2array
[
rewind-slice
]
dip
]
}
{
[
dup
upper-colon?
]
[
drop
unclip-last
-rot
2array
[
rewind-slice
]
dip
]
}
[
drop
2array
]
}
cond
;