lexer html解析一个js过滤的改进(三)

2014-11-24 02:50:41 · 作者: · 浏览: 6
te))
quote = 0; // exit quoted state
else if (quotesmart && (0 == quote) && (ch == '/')) {
// handle multiline and double slash comments (with a quote)
// in script like:
// I can't handle single quotations.
ch = mPage.getCharacter(mCursor);
if (Page.EOF == ch)
done = true;
else if ('/' == ch) {
do
ch = mPage.getCharacter(mCursor);
while ((Page.EOF != ch) && ('\n' != ch));
} else if ('*' == ch) {
do {
do
ch = mPage.getCharacter(mCursor);
while ((Page.EOF != ch) && ('*' != ch));
ch = mPage.getCharacter(mCursor);
if (ch == '*')
mPage.ungetCharacter(mCursor);
} while ((Page.EOF != ch) && ('/' != ch));
} else
mPage.ungetCharacter(mCursor);
} else if ((0 == quote) && ('<' == ch)) {
ch = mPage.getCharacter(mCursor);
if (Page.EOF == ch)
done = true;
// the order of these tests might be optimized for speed:
else if ('/' == ch
|| (Character.isLetter(ch) && this.script==0)
|| '!' == ch || '%' == ch || ' ' == ch) {
done = true;
mPage.ungetCharacter(mCursor);
mPage.ungetCharacter(mCursor);
} else {
// it's not a tag, so keep going, but check for quotes
mPage.ungetCharacter(mCursor);
}
}
}

return (makeString(start, mCursor.getPosition()));
}
}

作者“edwardpro”