Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/lexer
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27481/lexer
Modified Files:
Lexer.java
Log Message:
Fix bug #899413 bug in javascript end detection.
Patch submitted by Gernot Fricke handles escaped quotes in strings when
lexing with smartquote turned on. Added test case in LexerTests.
Index: Lexer.java
===================================================================
RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/lexer/Lexer.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** Lexer.java 7 Feb 2004 12:53:09 -0000 1.26
--- Lexer.java 18 Feb 2004 12:34:04 -0000 1.27
***************
*** 401,404 ****
--- 401,413 ----
else if (quotesmart && (0 == quote) && (('\'' == ch) || ('"' == ch)))
quote = ch; // enter quoted state
+ // patch contributed by Gernot Fricke to handle escaped closing quote
+ else if (quotesmart && (0 != quote) && ('\\' == ch))
+ {
+ ch = mPage.getCharacter (cursor); //try to consume escaped character
+ if ( (ch != '\\') // escaped backslash
+ && (ch != quote)) // escaped quote character
+ // ( reflects ["] or ['] whichever opened the quotation)
+ cursor.retreat(); // unconsume char if character was not an escapable char.
+ }
else if (quotesmart && (ch == quote))
quote = 0; // exit quoted state
|