[Htmlparser-cvs] htmlparser/src/org/htmlparser/lexer Lexer.java,1.13,1.14
Brought to you by:
derrickoswald
From: <der...@us...> - 2003-10-19 08:18:52
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/lexer In directory sc8-pr-cvs1:/tmp/cvs-serv10542/lexer Modified Files: Lexer.java Log Message: Partition Attribute into a base class and PageAttribute class for the Lexer. Fixed the AppletTag.setAppletParams in a cheesy manner. Clear out the released NodeList entry on remove(). Dropped the HTMLTagParserTest tests, because they really weren't relevant any more. Index: Lexer.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/lexer/Lexer.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Lexer.java 13 Oct 2003 21:48:12 -0000 1.13 --- Lexer.java 18 Oct 2003 20:50:36 -0000 1.14 *************** *** 42,46 **** import org.htmlparser.Node; import org.htmlparser.lexer.nodes.AbstractNode; ! import org.htmlparser.lexer.nodes.Attribute; import org.htmlparser.lexer.nodes.NodeFactory; import org.htmlparser.lexer.nodes.RemarkNode; --- 42,46 ---- import org.htmlparser.Node; import org.htmlparser.lexer.nodes.AbstractNode; ! import org.htmlparser.lexer.nodes.PageAttribute; import org.htmlparser.lexer.nodes.NodeFactory; import org.htmlparser.lexer.nodes.RemarkNode; *************** *** 374,409 **** { if (bookmarks[1] > bookmarks[0]) ! attributes.addElement (new Attribute (mPage, -1, -1, bookmarks[0], bookmarks[1], (char)0)); ! //attributes.addElement (new Attribute (null, mPage.getText (bookmarks[0], bookmarks[1]), (char)0)); } private void standalone (Vector attributes, int[] bookmarks) { ! attributes.addElement (new Attribute (mPage, bookmarks[1], bookmarks[2], -1, -1, (char)0)); ! //attributes.addElement (new Attribute (mPage.getText (bookmarks[1], bookmarks[2]), null, (char)0)); } private void empty (Vector attributes, int[] bookmarks) { ! attributes.addElement (new Attribute (mPage, bookmarks[1], bookmarks[2], bookmarks[2] + 1, -1, (char)0)); ! //attributes.addElement (new Attribute (mPage.getText (bookmarks[1], bookmarks[2]), "", (char)0)); } private void naked (Vector attributes, int[] bookmarks) { ! attributes.addElement (new Attribute (mPage, bookmarks[1], bookmarks[2], bookmarks[3], bookmarks[4], (char)0)); ! //attributes.addElement (new Attribute (mPage.getText (bookmarks[1], bookmarks[2]), mPage.getText (bookmarks[3], bookmarks[4]), (char)0)); } private void single_quote (Vector attributes, int[] bookmarks) { ! attributes.addElement (new Attribute (mPage, bookmarks[1], bookmarks[2], bookmarks[4] + 1, bookmarks[5], '\'')); ! //attributes.addElement (new Attribute (mPage.getText (bookmarks[1], bookmarks[2]), mPage.getText (bookmarks[4] + 1, bookmarks[5]), '\'')); } private void double_quote (Vector attributes, int[] bookmarks) { ! attributes.addElement (new Attribute (mPage, bookmarks[1], bookmarks[2], bookmarks[5] + 1, bookmarks[6], '"')); ! //attributes.addElement (new Attribute (mPage.getText (bookmarks[1], bookmarks[2]), mPage.getText (bookmarks[5] + 1, bookmarks[6]), '"')); } --- 374,403 ---- { if (bookmarks[1] > bookmarks[0]) ! attributes.addElement (new PageAttribute (mPage, -1, -1, bookmarks[0], bookmarks[1], (char)0)); } private void standalone (Vector attributes, int[] bookmarks) { ! attributes.addElement (new PageAttribute (mPage, bookmarks[1], bookmarks[2], -1, -1, (char)0)); } private void empty (Vector attributes, int[] bookmarks) { ! attributes.addElement (new PageAttribute (mPage, bookmarks[1], bookmarks[2], bookmarks[2] + 1, -1, (char)0)); } private void naked (Vector attributes, int[] bookmarks) { ! attributes.addElement (new PageAttribute (mPage, bookmarks[1], bookmarks[2], bookmarks[3], bookmarks[4], (char)0)); } private void single_quote (Vector attributes, int[] bookmarks) { ! attributes.addElement (new PageAttribute (mPage, bookmarks[1], bookmarks[2], bookmarks[4] + 1, bookmarks[5], '\'')); } private void double_quote (Vector attributes, int[] bookmarks) { ! attributes.addElement (new PageAttribute (mPage, bookmarks[1], bookmarks[2], bookmarks[5] + 1, bookmarks[6], '"')); } *************** *** 541,545 **** break; case 3: // within naked attribute value ! if ('>' == ch) { naked (attributes, bookmarks); --- 535,539 ---- break; case 3: // within naked attribute value ! if ((0 == ch) || ('>' == ch)) { naked (attributes, bookmarks); *************** *** 631,640 **** protected void fixAttributes (Vector attributes) throws ParserException { ! Attribute attribute; Cursor cursor; char ch1; // name starting character char ch2; // name ending character ! Attribute prev1; // attribute prior to the current ! Attribute prev2; // attribute prior but one to the current char quote; --- 625,634 ---- protected void fixAttributes (Vector attributes) throws ParserException { ! PageAttribute attribute; Cursor cursor; char ch1; // name starting character char ch2; // name ending character ! PageAttribute prev1; // attribute prior to the current ! PageAttribute prev2; // attribute prior but one to the current char quote; *************** *** 645,649 **** for (int i = 2; i < attributes.size (); ) { ! attribute = (Attribute)attributes.elementAt (i); if (!attribute.isWhitespace ()) { --- 639,643 ---- for (int i = 2; i < attributes.size (); ) { ! attribute = (PageAttribute)attributes.elementAt (i); if (!attribute.isWhitespace ()) { |