22 lines
586 B
Text
22 lines
586 B
Text
proc Expand(Range);
|
|
char Range;
|
|
int Lo, Hi, N;
|
|
[Text(8, Range);
|
|
loop [Lo:= IntIn(8);
|
|
BackUp; \get what terminated number
|
|
case ChIn(8) of
|
|
^-: [Hi:= IntIn(8);
|
|
for N:= Lo to Hi do
|
|
[IntOut(0, N);
|
|
if N < Hi then Text(0, ", ");
|
|
];
|
|
BackUp;
|
|
if ChIn(8) = $1A \EOF\ then quit;
|
|
];
|
|
^,: IntOut(0, Lo)
|
|
other \EOF\ [IntOut(0, Lo); quit];
|
|
Text(0, ", ");
|
|
];
|
|
];
|
|
|
|
Expand("-6,-3--1,3-5,7-11,14,15,17-20")
|