1 (* Copyright (C
) 1999-2006 Henry Cejtin
, Matthew Fluet
, Suresh
2 * Jagannathan
, and Stephen Weeks
.
4 * MLton is released under a BSD
-style license
.
5 * See the file MLton
-LICENSE for details
.
11 val initialSize
: int = 40
12 val growFactor
: int = 2
21 in (prev
:= tab ^ cur
;
26 val tabs
= ref(makeTabs initialSize
)
28 fun size() = Array
.length(!tabs
)
30 fun resize() = tabs
:= makeTabs(growFactor
* size())
34 fun maybeResize() = if !index
= size() then resize() else ()
36 fun reset() = index
:= 0
38 fun indent() = Out
.output(out
, Array
.sub(!tabs
, !index
))
40 fun right() = (index
:= !index
+ 1 ;
43 fun left() = if !index
= 0 then Error
.bug
"Tab.left"
44 else index
:= !index
- 1
49 Out
.output(out
, "\n"))