WHILE@position<=DATALENGTH(@script)
BEGIN
--猎取以后字符
SET@curChar=ASCII(SUBSTRING(@script,@position,1))
IF@preChar=ASCII(/)AND@curChar=ASCII(*)AND@InLineCommented=0AND@InString=0
BEGIN
--SETthesigninsectioncomment
SET@InSectionCommented=1
SET@preChar=@curChar
SET@position=@position+1
CONTINUE
END
IF@preChar=ASCII(*)AND@curChar=ASCII(/)AND@InLineCommented=0AND@InString=0
BEGIN
SET@InSectionCommented=0
SET@preChar=@curChar
SET@position=@position+1
CONTINUE
END
IF@preChar=ASCII(-)AND@curChar=ASCII(-)AND@InSectionCommented=0AND@InString=0
BEGIN
SET@InLineCommented=1
SET@preChar=@curChar
SET@position=@position+1
CONTINUE
END
IF@curChar=ASCII()AND@InString=0AND@InSectionCommented=0AND@InLineCommented=0
BEGIN
SET@InString=1
END
IF@inString=1AND@curChar=ASCII()
BEGIN
IFASCII(SUBSTRING(@script,@position+1,1))=ASCII()
BEGIN
SET@extractedScript=@extractedScript+
SET@position=@position+1
END
ELSE
BEGIN
SET@InString=0
END
END
IF@InSectionCommented=1
BEGIN
SET@preChar=@curChar
SET@position=@position+1
CONTINUE
END
IF@InLineCommented=1
BEGIN
--ifmeetstheendofthelinesettheInLineCommentedtofalse
IF@curChar=10AND@preChar=13
BEGIN
SET@InLineCommented=0
END
SET@preChar=@curChar
SET@position=@position+1
CONTINUE
END
IF@curChar=ASCII()OR@curChar=10OR@curChar=13OR@curChar=ASCII()OR@curChar=32
BEGIN
SET@preChar=@curChar
SET@position=@position+1
CONTINUE
END
SET@extractedScript=@extractedScript+CHAR(@curChar)
SET@preChar=@curChar
SET@position=@position+1
END