26 lines
632 B
Text
26 lines
632 B
Text
with javascript_semantics
|
|
--integer fn = open(command_line()[2],"r") -- (reading the source file)
|
|
sequence fn = unix_dict()[1..40]&-1
|
|
|
|
function allx(string line)
|
|
line[1..-1] = 'x'
|
|
return line
|
|
end function
|
|
|
|
function longest(string mask)
|
|
-- object line = gets(fn)
|
|
object line = fn[1]; fn = fn[2..$];
|
|
if atom(line) then return mask end if
|
|
string newmask = allx(line)
|
|
if not match(mask,newmask) then return longest(mask) end if
|
|
mask = longest(newmask)
|
|
if match(mask,newmask) then
|
|
-- puts(1,line)
|
|
printf(1,"%s\n",line)
|
|
end if
|
|
return mask
|
|
end function
|
|
|
|
{} = longest("x")
|
|
|
|
--close(fn)
|