def minify(input)
@js = StringScanner.new(input.is_a?(IO) ? input.read : input.to_s)
@a = "\n"
@b = nil
@lookahead = nil
@output = ''
action_get
while !@a.nil? do
case @a
when CHR_SPACE
if alphanum?(@b)
action_output
else
action_copy
end
when CHR_LF
if @b == CHR_SPACE
action_get
elsif @b =~ /[{\[\(+-]/
action_output
else
if alphanum?(@b)
action_output
else
action_copy
end
end
else
if @b == CHR_SPACE
if alphanum?(@a)
action_output
else
action_get
end
elsif @b == CHR_LF
if @a =~ /[}\]\)\\"+-]/
action_output
else
if alphanum?(@a)
action_output
else
action_get
end
end
else
action_output
end
end
end
@output
end