home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 144 / DPCS0200.iso / Internet / Supanet / system / swing.jar / javax / swing / text / html / parser / Parser.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-11-05  |  21.1 KB  |  1,580 lines

  1. package javax.swing.text.html.parser;
  2.  
  3. import java.io.CharArrayReader;
  4. import java.io.IOException;
  5. import java.io.InterruptedIOException;
  6. import java.io.Reader;
  7. import java.util.Enumeration;
  8. import java.util.Vector;
  9. import javax.swing.text.ChangedCharSetException;
  10. import javax.swing.text.SimpleAttributeSet;
  11. import javax.swing.text.html.HTML;
  12. import javax.swing.text.html.HTML.Attribute;
  13.  
  14. public class Parser implements DTDConstants {
  15.    private char[] text = new char[1024];
  16.    private int textpos = 0;
  17.    private TagElement last;
  18.    private boolean space;
  19.    private char[] str = new char[128];
  20.    private int strpos = 0;
  21.    protected DTD dtd = null;
  22.    // $FF: renamed from: ch int
  23.    private int field_0;
  24.    // $FF: renamed from: ln int
  25.    private int field_1;
  26.    // $FF: renamed from: in java.io.Reader
  27.    private Reader field_2;
  28.    private Element recent;
  29.    private TagStack stack;
  30.    private boolean skipTag = false;
  31.    private TagElement lastFormSent = null;
  32.    private SimpleAttributeSet attributes = new SimpleAttributeSet();
  33.    private boolean seenHtml = false;
  34.    private boolean seenHead = false;
  35.    private boolean seenBody = false;
  36.    protected boolean strict = false;
  37.    private char[] buf = new char[256];
  38.    private int pos;
  39.    private int len;
  40.    private int currentPosition;
  41.  
  42.    public Parser(DTD var1) {
  43.       this.dtd = var1;
  44.    }
  45.  
  46.    void addString(int var1) {
  47.       if (this.strpos == this.str.length) {
  48.          char[] var2 = new char[this.str.length + 128];
  49.          System.arraycopy(this.str, 0, var2, 0, this.str.length);
  50.          this.str = var2;
  51.       }
  52.  
  53.       this.str[this.strpos++] = (char)var1;
  54.    }
  55.  
  56.    protected void endTag(boolean var1) {
  57.       this.handleText(this.stack.tag);
  58.       if (var1 && !this.stack.elem.omitEnd()) {
  59.          this.error("end.missing", this.stack.elem.getName());
  60.       } else if (!this.stack.terminate()) {
  61.          this.error("end.unexpected", this.stack.elem.getName());
  62.       }
  63.  
  64.       this.handleEndTag(this.stack.tag);
  65.       this.stack = this.stack.next;
  66.       this.recent = this.stack != null ? this.stack.elem : null;
  67.    }
  68.  
  69.    protected void error(String var1) {
  70.       this.error(var1, "?", "?", "?");
  71.    }
  72.  
  73.    protected void error(String var1, String var2) {
  74.       this.error(var1, var2, "?", "?");
  75.    }
  76.  
  77.    protected void error(String var1, String var2, String var3) {
  78.       this.error(var1, var2, var3, "?");
  79.    }
  80.  
  81.    protected void error(String var1, String var2, String var3, String var4) {
  82.       this.handleError(this.field_1, var1 + var2 + var3 + var4);
  83.    }
  84.  
  85.    void errorContext() throws ChangedCharSetException {
  86.       while(this.stack != null && this.stack.tag.getElement() != this.dtd.body) {
  87.          this.handleEndTag(this.stack.tag);
  88.          this.stack = this.stack.next;
  89.       }
  90.  
  91.       if (this.stack == null) {
  92.          this.legalElementContext(this.dtd.body);
  93.          this.startTag(this.makeTag(this.dtd.body, true));
  94.       }
  95.  
  96.    }
  97.  
  98.    protected void flushAttributes() {
  99.       this.attributes.removeAttributes(this.attributes);
  100.    }
  101.  
  102.    protected SimpleAttributeSet getAttributes() {
  103.       return this.attributes;
  104.    }
  105.  
  106.    char[] getChars(int var1) {
  107.       char[] var2 = new char[this.strpos - var1];
  108.       System.arraycopy(this.str, var1, var2, 0, this.strpos - var1);
  109.       this.strpos = var1;
  110.       return var2;
  111.    }
  112.  
  113.    char[] getChars(int var1, int var2) {
  114.       char[] var3 = new char[var2 - var1];
  115.       System.arraycopy(this.str, var1, var3, 0, var2 - var1);
  116.       return var3;
  117.    }
  118.  
  119.    protected int getCurrentLine() {
  120.       return this.field_1;
  121.    }
  122.  
  123.    protected int getCurrentPos() {
  124.       return this.currentPosition;
  125.    }
  126.  
  127.    String getString(int var1) {
  128.       char[] var2 = new char[this.strpos - var1];
  129.       System.arraycopy(this.str, var1, var2, 0, this.strpos - var1);
  130.       this.strpos = var1;
  131.       return new String(var2);
  132.    }
  133.  
  134.    protected void handleComment(char[] var1) {
  135.    }
  136.  
  137.    protected void handleEOFInComment() {
  138.       int var1 = this.strIndexOf('\n');
  139.       if (var1 >= 0) {
  140.          this.handleComment(this.getChars(0, var1));
  141.  
  142.          try {
  143.             this.field_2.close();
  144.             this.field_2 = new CharArrayReader(this.getChars(var1 + 1));
  145.             this.field_0 = 62;
  146.          } catch (IOException var2) {
  147.             this.error("ioexception");
  148.          }
  149.  
  150.          this.resetStrBuffer();
  151.       } else {
  152.          this.error("eof.comment");
  153.       }
  154.  
  155.    }
  156.  
  157.    protected void handleEmptyTag(TagElement var1) throws ChangedCharSetException {
  158.    }
  159.  
  160.    protected void handleEndTag(TagElement var1) {
  161.    }
  162.  
  163.    protected void handleError(int var1, String var2) {
  164.       Thread.dumpStack();
  165.       System.out.println("**** " + this.stack);
  166.       System.out.println("line " + var1 + ": error: " + var2);
  167.       System.out.println();
  168.    }
  169.  
  170.    protected void handleStartTag(TagElement var1) {
  171.    }
  172.  
  173.    void handleText(TagElement var1) {
  174.       if (var1.breaksFlow()) {
  175.          this.space = false;
  176.       }
  177.  
  178.       if (this.textpos != 0 || this.space && this.stack != null && !this.last.breaksFlow() && this.stack.advance(this.dtd.pcdata)) {
  179.          if (this.space) {
  180.             if (this.textpos + 1 > this.text.length) {
  181.                char[] var2 = new char[this.text.length + 200];
  182.                System.arraycopy(this.text, 0, var2, 0, this.text.length);
  183.                this.text = var2;
  184.             }
  185.  
  186.             this.text[this.textpos++] = ' ';
  187.             this.space = false;
  188.          }
  189.  
  190.          char[] var3 = new char[this.textpos];
  191.          System.arraycopy(this.text, 0, var3, 0, this.textpos);
  192.          if (var1.getElement().getName().equals("title")) {
  193.             this.handleTitle(var3);
  194.          } else {
  195.             this.handleText(var3);
  196.          }
  197.  
  198.          this.textpos = 0;
  199.          this.last = var1;
  200.          this.space = false;
  201.       } else {
  202.          this.last = var1;
  203.          this.space = false;
  204.       }
  205.    }
  206.  
  207.    protected void handleText(char[] var1) {
  208.    }
  209.  
  210.    protected void handleTitle(char[] var1) {
  211.       this.handleText(var1);
  212.    }
  213.  
  214.    boolean ignoreElement(Element var1) {
  215.       String var2 = this.stack.elem.getName();
  216.       String var3 = var1.getName();
  217.       if ((!var3.equals("html") || !this.seenHtml) && (!var3.equals("head") || !this.seenHead) && (!var3.equals("body") || !this.seenBody)) {
  218.          if (var3.equals("dt") || var3.equals("dd")) {
  219.             TagStack var4;
  220.             for(var4 = this.stack; var4 != null && !var4.elem.getName().equals("dl"); var4 = var4.next) {
  221.             }
  222.  
  223.             if (var4 == null) {
  224.                return true;
  225.             }
  226.          }
  227.  
  228.          return var2.equals("table") && !var3.equals("#pcdata") && !var3.equals("input") || var3.equals("font") && (var2.equals("ul") || var2.equals("ol")) || var3.equals("meta") && this.stack != null || var3.equals("style") || var2.equals("table") && var3.equals("a");
  229.       } else {
  230.          return true;
  231.       }
  232.    }
  233.  
  234.    boolean legalElementContext(Element var1) throws ChangedCharSetException {
  235.       if (this.stack == null) {
  236.          if (var1 != this.dtd.html) {
  237.             this.startTag(this.makeTag(this.dtd.html, true));
  238.             return this.legalElementContext(var1);
  239.          } else {
  240.             return true;
  241.          }
  242.       } else if (this.stack.advance(var1)) {
  243.          this.markFirstTime(var1);
  244.          return true;
  245.       } else {
  246.          boolean var2 = false;
  247.          String var3 = this.stack.elem.getName();
  248.          String var4 = var1.getName();
  249.          if (!this.strict && (var3.equals("table") && var4.equals("td") || var3.equals("table") && var4.equals("th") || var3.equals("tr") && !var4.equals("tr"))) {
  250.             var2 = true;
  251.          }
  252.  
  253.          if (!this.strict && !var2 && (this.stack.elem.getName() != var1.getName() || var1.getName().equals("body")) && (this.skipTag = this.ignoreElement(var1))) {
  254.             this.error("tag.ignore", var1.getName());
  255.             return this.skipTag;
  256.          } else if (!this.strict && var3.equals("table") && !var4.equals("tr") && !var4.equals("td") && !var4.equals("th") && !var4.equals("caption")) {
  257.             Element var15 = this.dtd.getElement("tr");
  258.             TagElement var17 = this.makeTag(var15, true);
  259.             this.legalTagContext(var17);
  260.             this.startTag(var17);
  261.             this.error("start.missing", var1.getName());
  262.             return this.legalElementContext(var1);
  263.          } else {
  264.             if (!var2 && this.stack.terminate() && (!this.strict || this.stack.elem.omitEnd())) {
  265.                for(TagStack var5 = this.stack.next; var5 != null; var5 = var5.next) {
  266.                   if (var5.advance(var1)) {
  267.                      while(this.stack != var5) {
  268.                         this.endTag(true);
  269.                      }
  270.  
  271.                      return true;
  272.                   }
  273.  
  274.                   if (!var5.terminate() || this.strict && !var5.elem.omitEnd()) {
  275.                      break;
  276.                   }
  277.                }
  278.             }
  279.  
  280.             Element var14 = this.stack.first();
  281.             if (var14 == null || this.strict && !var14.omitStart() || var14 == this.dtd.head && var1 == this.dtd.pcdata) {
  282.                if (!this.strict) {
  283.                   ContentModel var16 = this.stack.contentModel();
  284.                   Vector var7 = new Vector();
  285.                   if (var16 != null) {
  286.                      var16.getElements(var7);
  287.                      Enumeration var8 = var7.elements();
  288.  
  289.                      while(var8.hasMoreElements()) {
  290.                         Element var9 = (Element)var8.nextElement();
  291.                         if (!this.stack.excluded(var9.getIndex())) {
  292.                            boolean var10 = false;
  293.  
  294.                            for(AttributeList var11 = var9.getAttributes(); var11 != null; var11 = var11.next) {
  295.                               if (var11.modifier == 2) {
  296.                                  var10 = true;
  297.                                  break;
  298.                               }
  299.                            }
  300.  
  301.                            if (!var10) {
  302.                               ContentModel var12 = var9.getContent();
  303.                               if (var12 != null && var12.first(var1)) {
  304.                                  TagElement var13 = this.makeTag(var9, true);
  305.                                  this.legalTagContext(var13);
  306.                                  this.startTag(var13);
  307.                                  this.error("start.missing", var9.getName());
  308.                                  return this.legalElementContext(var1);
  309.                               }
  310.                            }
  311.                         }
  312.                      }
  313.                   }
  314.                }
  315.  
  316.                if (this.stack.terminate() && this.stack.elem != this.dtd.body && (!this.strict || this.stack.elem.omitEnd())) {
  317.                   if (!this.stack.elem.omitEnd()) {
  318.                      this.error("end.missing", var1.getName());
  319.                   }
  320.  
  321.                   this.endTag(true);
  322.                   return this.legalElementContext(var1);
  323.                } else {
  324.                   return false;
  325.                }
  326.             } else {
  327.                TagElement var6 = this.makeTag(var14, true);
  328.                this.legalTagContext(var6);
  329.                this.startTag(var6);
  330.                if (!var14.omitStart()) {
  331.                   this.error("start.missing", var1.getName());
  332.                }
  333.  
  334.                return this.legalElementContext(var1);
  335.             }
  336.          }
  337.       }
  338.    }
  339.  
  340.    void legalTagContext(TagElement var1) throws ChangedCharSetException {
  341.       if (this.legalElementContext(var1.getElement())) {
  342.          this.markFirstTime(var1.getElement());
  343.       } else if (var1.breaksFlow() && this.stack != null && !this.stack.tag.breaksFlow()) {
  344.          this.endTag(true);
  345.          this.legalTagContext(var1);
  346.       } else {
  347.          for(TagStack var2 = this.stack; var2 != null; var2 = var2.next) {
  348.             if (var2.tag.getElement() == this.dtd.head) {
  349.                while(this.stack != var2) {
  350.                   this.endTag(true);
  351.                }
  352.  
  353.                this.endTag(true);
  354.                this.legalTagContext(var1);
  355.                return;
  356.             }
  357.          }
  358.  
  359.          this.error("tag.unexpected", var1.getElement().getName());
  360.       }
  361.    }
  362.  
  363.    protected TagElement makeTag(Element var1) {
  364.       return this.makeTag(var1, false);
  365.    }
  366.  
  367.    protected TagElement makeTag(Element var1, boolean var2) {
  368.       return new TagElement(var1, var2);
  369.    }
  370.  
  371.    protected void markFirstTime(Element var1) {
  372.       String var2 = var1.getName();
  373.       if (var2.equals("html")) {
  374.          this.seenHtml = true;
  375.       } else if (var2.equals("head")) {
  376.          this.seenHead = true;
  377.       } else if (var2.equals("body")) {
  378.          this.seenBody = true;
  379.       }
  380.  
  381.    }
  382.  
  383.    public synchronized void parse(Reader var1) throws IOException {
  384.       this.field_2 = var1;
  385.       this.field_1 = 1;
  386.       this.seenHtml = false;
  387.       this.seenHead = false;
  388.       this.seenBody = false;
  389.  
  390.       try {
  391.          try {
  392.             this.field_0 = this.readCh();
  393.             this.text = new char[1024];
  394.             this.str = new char[128];
  395.             this.parseContent();
  396.  
  397.             while(this.stack != null) {
  398.                this.endTag(true);
  399.             }
  400.          } finally {
  401.             var1.close();
  402.          }
  403.       } catch (IOException var17) {
  404.          this.errorContext();
  405.          this.error("ioexception");
  406.          throw var17;
  407.       } catch (Exception var18) {
  408.          this.errorContext();
  409.          this.error("exception", var18.getClass().getName(), ((Throwable)var18).getMessage());
  410.          ((Throwable)var18).printStackTrace();
  411.       } catch (ThreadDeath var19) {
  412.          this.errorContext();
  413.          this.error("terminated");
  414.          ((Throwable)var19).printStackTrace();
  415.          throw var19;
  416.       } finally {
  417.          while(this.stack != null) {
  418.             this.handleEndTag(this.stack.tag);
  419.             this.stack = this.stack.next;
  420.          }
  421.  
  422.          this.text = null;
  423.          this.str = null;
  424.       }
  425.  
  426.    }
  427.  
  428.    void parseAttributeSpecificationList(Element var1) throws IOException {
  429.       while(true) {
  430.          this.skipSpace();
  431.          switch (this.field_0) {
  432.             case -1:
  433.             case 47:
  434.             case 60:
  435.             case 62:
  436.                return;
  437.             case 45:
  438.                if ((this.field_0 = this.readCh()) == 45) {
  439.                   this.field_0 = this.readCh();
  440.                   this.parseComment();
  441.                   this.strpos = 0;
  442.                   break;
  443.                }
  444.  
  445.                this.error("invalid.tagchar", "-", var1.getName());
  446.                this.field_0 = this.readCh();
  447.                break;
  448.             default:
  449.                Object var2 = null;
  450.                Object var3 = null;
  451.                Object var4 = null;
  452.                AttributeList var6;
  453.                String var7;
  454.                String var8;
  455.                if (this.parseIdentifier(true)) {
  456.                   var7 = this.getString(0);
  457.                   this.skipSpace();
  458.                   if (this.field_0 == 61) {
  459.                      this.field_0 = this.readCh();
  460.                      this.skipSpace();
  461.                      var6 = var1.getAttribute(var7);
  462.                      var8 = this.parseAttributeValue(var6 != null && var6.type != 1 && var6.type != 11 && var6.type != 7);
  463.                   } else {
  464.                      var8 = var7;
  465.                      var6 = var1.getAttributeByValue(var7);
  466.                      if (var6 == null) {
  467.                         var6 = var1.getAttribute(var7);
  468.                         if (var6 != null) {
  469.                            var8 = var6.getValue();
  470.                         }
  471.                      }
  472.                   }
  473.                } else {
  474.                   if (!this.strict && this.field_0 == 44) {
  475.                      this.field_0 = this.readCh();
  476.                      continue;
  477.                   }
  478.  
  479.                   if (!this.strict && this.field_0 == 34) {
  480.                      this.field_0 = this.readCh();
  481.                      this.skipSpace();
  482.                      if (!this.parseIdentifier(true)) {
  483.                         char[] var10 = new char[]{(char)this.field_0};
  484.                         this.error("invalid.tagchar", new String(var10), var1.getName());
  485.                         this.field_0 = this.readCh();
  486.                         continue;
  487.                      }
  488.  
  489.                      var7 = this.getString(0);
  490.                      if (this.field_0 == 34) {
  491.                         this.field_0 = this.readCh();
  492.                      }
  493.  
  494.                      this.skipSpace();
  495.                      if (this.field_0 == 61) {
  496.                         this.field_0 = this.readCh();
  497.                         this.skipSpace();
  498.                         var6 = var1.getAttribute(var7);
  499.                         var8 = this.parseAttributeValue(var6 != null && var6.type != 1 && var6.type != 11);
  500.                      } else {
  501.                         var8 = var7;
  502.                         var6 = var1.getAttributeByValue(var7);
  503.                         if (var6 == null) {
  504.                            var6 = var1.getAttribute(var7);
  505.                            if (var6 != null) {
  506.                               var8 = var6.getValue();
  507.                            }
  508.                         }
  509.                      }
  510.                   } else {
  511.                      if (this.strict || !this.attributes.isEmpty() || this.field_0 != 61) {
  512.                         if (!this.strict && this.field_0 == 61) {
  513.                            this.field_0 = this.readCh();
  514.                            this.skipSpace();
  515.                            var8 = this.parseAttributeValue(true);
  516.                            this.error("attvalerr");
  517.                            return;
  518.                         }
  519.  
  520.                         char[] var5 = new char[]{(char)this.field_0};
  521.                         this.error("invalid.tagchar", new String(var5), var1.getName());
  522.                         if (this.strict) {
  523.                            return;
  524.                         }
  525.  
  526.                         this.field_0 = this.readCh();
  527.                         continue;
  528.                      }
  529.  
  530.                      this.field_0 = this.readCh();
  531.                      this.skipSpace();
  532.                      var7 = var1.getName();
  533.                      var6 = var1.getAttribute(var7);
  534.                      var8 = this.parseAttributeValue(var6 != null && var6.type != 1 && var6.type != 11);
  535.                   }
  536.                }
  537.  
  538.                if (var6 != null) {
  539.                   var7 = var6.getName();
  540.                } else {
  541.                   this.error("invalid.tagatt", var7, var1.getName());
  542.                }
  543.  
  544.                if (this.attributes.isDefined(var7)) {
  545.                   this.error("multi.tagatt", var7, var1.getName());
  546.                }
  547.  
  548.                if (var8 == null) {
  549.                   var8 = var6 != null && var6.value != null ? var6.value : "#DEFAULT";
  550.                } else if (var6 != null && var6.values != null && !var6.values.contains(var8)) {
  551.                   this.error("invalid.tagattval", var7, var1.getName());
  552.                }
  553.  
  554.                HTML.Attribute var11 = HTML.getAttributeKey(var7);
  555.                if (var11 == null) {
  556.                   this.attributes.addAttribute(var7, var8);
  557.                } else {
  558.                   this.attributes.addAttribute(var11, var8);
  559.                }
  560.          }
  561.       }
  562.    }
  563.  
  564.    String parseAttributeValue(boolean var1) throws IOException {
  565.       int var2 = -1;
  566.       switch (this.field_0) {
  567.          case 34:
  568.          case 39:
  569.             var2 = this.field_0;
  570.             this.field_0 = this.readCh();
  571.          case 35:
  572.          case 36:
  573.          case 37:
  574.          case 38:
  575.       }
  576.  
  577.       label95:
  578.       while(true) {
  579.          int var3 = this.field_0;
  580.          switch (var3) {
  581.             case -1:
  582.                return this.getString(0);
  583.             case 9:
  584.                if (var2 < 0) {
  585.                   var3 = 32;
  586.                }
  587.             case 32:
  588.                this.field_0 = this.readCh();
  589.                if (var2 < 0) {
  590.                   return this.getString(0);
  591.                }
  592.                break;
  593.             case 10:
  594.                ++this.field_1;
  595.                this.field_0 = this.readCh();
  596.                if (var2 < 0) {
  597.                   return this.getString(0);
  598.                }
  599.                break;
  600.             case 13:
  601.                ++this.field_1;
  602.                if ((this.field_0 = this.readCh()) == 10) {
  603.                   this.field_0 = this.readCh();
  604.                }
  605.  
  606.                if (var2 < 0) {
  607.                   return this.getString(0);
  608.                }
  609.                break;
  610.             case 34:
  611.             case 39:
  612.                this.field_0 = this.readCh();
  613.                if (var3 == var2) {
  614.                   return this.getString(0);
  615.                }
  616.  
  617.                if (var2 == -1) {
  618.                   this.error("attvalerr");
  619.                   if (!this.strict && this.field_0 != 32) {
  620.                      continue;
  621.                   }
  622.  
  623.                   return this.getString(0);
  624.                }
  625.                break;
  626.             case 38:
  627.                if (this.strict && var2 < 0) {
  628.                   this.field_0 = this.readCh();
  629.                   break;
  630.                }
  631.  
  632.                char[] var4 = this.parseEntityReference();
  633.                int var5 = 0;
  634.  
  635.                while(true) {
  636.                   if (var5 >= var4.length) {
  637.                      continue label95;
  638.                   }
  639.  
  640.                   var3 = var4[var5];
  641.                   this.addString(var1 && var3 >= 65 && var3 <= 90 ? 97 + var3 - 65 : var3);
  642.                   ++var5;
  643.                }
  644.             case 60:
  645.             case 62:
  646.                if (var2 < 0) {
  647.                   return this.getString(0);
  648.                }
  649.  
  650.                this.field_0 = this.readCh();
  651.                break;
  652.             case 61:
  653.                if (var2 < 0) {
  654.                   this.error("attvalerr");
  655.                   if (this.strict) {
  656.                      return this.getString(0);
  657.                   }
  658.                }
  659.  
  660.                this.field_0 = this.readCh();
  661.                break;
  662.             default:
  663.                if (var1 && var3 >= 65 && var3 <= 90) {
  664.                   var3 = 97 + var3 - 65;
  665.                }
  666.  
  667.                this.field_0 = this.readCh();
  668.          }
  669.  
  670.          this.addString(var3);
  671.       }
  672.    }
  673.  
  674.    void parseComment() throws IOException {
  675.       while(true) {
  676.          int var1 = this.field_0;
  677.          switch (var1) {
  678.             case -1:
  679.                this.handleEOFInComment();
  680.                return;
  681.             case 10:
  682.                ++this.field_1;
  683.                this.field_0 = this.readCh();
  684.                break;
  685.             case 13:
  686.                ++this.field_1;
  687.                if ((this.field_0 = this.readCh()) == 10) {
  688.                   this.field_0 = this.readCh();
  689.                }
  690.  
  691.                var1 = 10;
  692.                break;
  693.             case 45:
  694.                if (!this.strict && this.strpos != 0 && this.str[this.strpos - 1] == '-') {
  695.                   if ((this.field_0 = this.readCh()) == 62) {
  696.                      return;
  697.                   }
  698.  
  699.                   if (this.field_0 == 33) {
  700.                      if ((this.field_0 = this.readCh()) == 62) {
  701.                         return;
  702.                      }
  703.  
  704.                      this.addString(45);
  705.                      this.addString(33);
  706.                      continue;
  707.                   }
  708.                } else if ((this.field_0 = this.readCh()) == 45) {
  709.                   this.field_0 = this.readCh();
  710.                   if (this.strict || this.field_0 == 62) {
  711.                      return;
  712.                   }
  713.  
  714.                   if (this.field_0 == 33) {
  715.                      if ((this.field_0 = this.readCh()) == 62) {
  716.                         return;
  717.                      }
  718.  
  719.                      this.addString(45);
  720.                      this.addString(33);
  721.                      continue;
  722.                   } else {
  723.                      this.addString(45);
  724.                   }
  725.                }
  726.                break;
  727.             case 62:
  728.                this.field_0 = this.readCh();
  729.                break;
  730.             default:
  731.                this.field_0 = this.readCh();
  732.          }
  733.  
  734.          this.addString(var1);
  735.       }
  736.    }
  737.  
  738.    void parseContent() throws IOException {
  739.       Thread var1 = Thread.currentThread();
  740.  
  741.       while(!var1.isInterrupted()) {
  742.          int var2 = this.field_0;
  743.          switch (var2) {
  744.             case -1:
  745.                return;
  746.             case 9:
  747.             case 32:
  748.                this.field_0 = this.readCh();
  749.                if (this.stack == null || !this.stack.pre) {
  750.                   this.space = true;
  751.                   continue;
  752.                }
  753.                break;
  754.             case 10:
  755.                ++this.field_1;
  756.                this.field_0 = this.readCh();
  757.                if (this.stack == null || !this.stack.pre) {
  758.                   this.space = true;
  759.                   continue;
  760.                }
  761.                break;
  762.             case 13:
  763.                ++this.field_1;
  764.                var2 = 10;
  765.                if ((this.field_0 = this.readCh()) == 10) {
  766.                   this.field_0 = this.readCh();
  767.                }
  768.  
  769.                if (this.stack == null || !this.stack.pre) {
  770.                   this.space = true;
  771.                   continue;
  772.                }
  773.                break;
  774.             case 38:
  775.                if (this.textpos == 0) {
  776.                   if (!this.legalElementContext(this.dtd.pcdata)) {
  777.                      this.error("unexpected.pcdata");
  778.                   }
  779.  
  780.                   if (this.last.breaksFlow()) {
  781.                      this.space = false;
  782.                   }
  783.                }
  784.  
  785.                char[] var3 = this.parseEntityReference();
  786.                if (this.textpos + var3.length + 1 > this.text.length) {
  787.                   char[] var4 = new char[Math.max(this.textpos + var3.length + 128, this.text.length * 2)];
  788.                   System.arraycopy(this.text, 0, var4, 0, this.text.length);
  789.                   this.text = var4;
  790.                }
  791.  
  792.                if (this.space) {
  793.                   this.space = false;
  794.                   this.text[this.textpos++] = ' ';
  795.                }
  796.  
  797.                System.arraycopy(var3, 0, this.text, this.textpos, var3.length);
  798.                this.textpos += var3.length;
  799.                continue;
  800.             case 47:
  801.                this.field_0 = this.readCh();
  802.                if (this.stack != null && this.stack.net) {
  803.                   this.endTag(false);
  804.                   continue;
  805.                }
  806.                break;
  807.             case 60:
  808.                this.parseTag();
  809.                continue;
  810.             default:
  811.                if (this.textpos == 0) {
  812.                   if (!this.legalElementContext(this.dtd.pcdata)) {
  813.                      this.error("unexpected.pcdata");
  814.                   }
  815.  
  816.                   if (this.last.breaksFlow()) {
  817.                      this.space = false;
  818.                   }
  819.                }
  820.  
  821.                this.field_0 = this.readCh();
  822.          }
  823.  
  824.          if (this.textpos + 2 > this.text.length) {
  825.             char[] var5 = new char[this.text.length + 128];
  826.             System.arraycopy(this.text, 0, var5, 0, this.text.length);
  827.             this.text = var5;
  828.          }
  829.  
  830.          if (this.space) {
  831.             this.text[this.textpos++] = ' ';
  832.             this.space = false;
  833.          }
  834.  
  835.          this.text[this.textpos++] = (char)var2;
  836.       }
  837.  
  838.       var1.interrupt();
  839.    }
  840.  
  841.    public String parseDTDMarkup() throws IOException {
  842.       StringBuffer var1 = new StringBuffer();
  843.       this.field_0 = this.readCh();
  844.  
  845.       while(true) {
  846.          switch (this.field_0) {
  847.             case -1:
  848.                this.error("invalid.markup");
  849.                return var1.toString();
  850.             case 10:
  851.                ++this.field_1;
  852.                this.field_0 = this.readCh();
  853.                break;
  854.             case 13:
  855.                ++this.field_1;
  856.                if ((this.field_0 = this.readCh()) == 10) {
  857.                   this.field_0 = this.readCh();
  858.                }
  859.                break;
  860.             case 34:
  861.                this.field_0 = this.readCh();
  862.                break;
  863.             case 62:
  864.                this.field_0 = this.readCh();
  865.                return var1.toString();
  866.             default:
  867.                var1.append((char)(this.field_0 & 255));
  868.                this.field_0 = this.readCh();
  869.          }
  870.       }
  871.    }
  872.  
  873.    private char[] parseEntityReference() throws IOException {
  874.       int var1 = this.strpos;
  875.       if ((this.field_0 = this.readCh()) == 35) {
  876.          int var2 = 0;
  877.          this.field_0 = this.readCh();
  878.          if (this.field_0 >= 48 && this.field_0 <= 57) {
  879.             while(this.field_0 >= 48 && this.field_0 <= 57) {
  880.                var2 = var2 * 10 + this.field_0 - 48;
  881.                this.field_0 = this.readCh();
  882.             }
  883.  
  884.             switch (this.field_0) {
  885.                case 10:
  886.                   ++this.field_1;
  887.                   this.field_0 = this.readCh();
  888.                   break;
  889.                case 13:
  890.                   ++this.field_1;
  891.                   if ((this.field_0 = this.readCh()) == 10) {
  892.                      this.field_0 = this.readCh();
  893.                   }
  894.                   break;
  895.                case 59:
  896.                   this.field_0 = this.readCh();
  897.             }
  898.  
  899.             char[] var8 = new char[]{(char)var2};
  900.             return var8;
  901.          }
  902.  
  903.          this.addString(35);
  904.          if (!this.parseIdentifier(false)) {
  905.             this.error("ident.expected");
  906.             this.strpos = var1;
  907.             char[] var3 = new char[]{'&', '#'};
  908.             return var3;
  909.          }
  910.       } else if (!this.parseIdentifier(false)) {
  911.          char[] var7 = new char[]{'&'};
  912.          return var7;
  913.       }
  914.  
  915.       switch (this.field_0) {
  916.          case 10:
  917.             ++this.field_1;
  918.             this.field_0 = this.readCh();
  919.             break;
  920.          case 13:
  921.             ++this.field_1;
  922.             if ((this.field_0 = this.readCh()) == 10) {
  923.                this.field_0 = this.readCh();
  924.             }
  925.             break;
  926.          case 59:
  927.             this.field_0 = this.readCh();
  928.       }
  929.  
  930.       String var6 = this.getString(var1);
  931.       Entity var9 = this.dtd.getEntity(var6);
  932.       if (!this.strict && var9 == null) {
  933.          var9 = this.dtd.getEntity(var6.toLowerCase());
  934.       }
  935.  
  936.       if (var9 != null && var9.isGeneral()) {
  937.          return var9.getData();
  938.       } else if (var6.length() == 0) {
  939.          this.error("invalid.entref", var6);
  940.          return new char[0];
  941.       } else {
  942.          String var4 = "&" + var6;
  943.          char[] var5 = new char[var4.length()];
  944.          var4.getChars(0, var5.length, var5, 0);
  945.          return var5;
  946.       }
  947.    }
  948.  
  949.    boolean parseIdentifier(boolean var1) throws IOException {
  950.       switch (this.field_0) {
  951.          case 65:
  952.          case 66:
  953.          case 67:
  954.          case 68:
  955.          case 69:
  956.          case 70:
  957.          case 71:
  958.          case 72:
  959.          case 73:
  960.          case 74:
  961.          case 75:
  962.          case 76:
  963.          case 77:
  964.          case 78:
  965.          case 79:
  966.          case 80:
  967.          case 81:
  968.          case 82:
  969.          case 83:
  970.          case 84:
  971.          case 85:
  972.          case 86:
  973.          case 87:
  974.          case 88:
  975.          case 89:
  976.          case 90:
  977.             if (var1) {
  978.                this.field_0 = 97 + (this.field_0 - 65);
  979.             }
  980.             break;
  981.          case 91:
  982.          case 92:
  983.          case 93:
  984.          case 94:
  985.          case 95:
  986.          case 96:
  987.          default:
  988.             return false;
  989.          case 97:
  990.          case 98:
  991.          case 99:
  992.          case 100:
  993.          case 101:
  994.          case 102:
  995.          case 103:
  996.          case 104:
  997.          case 105:
  998.          case 106:
  999.          case 107:
  1000.          case 108:
  1001.          case 109:
  1002.          case 110:
  1003.          case 111:
  1004.          case 112:
  1005.          case 113:
  1006.          case 114:
  1007.          case 115:
  1008.          case 116:
  1009.          case 117:
  1010.          case 118:
  1011.          case 119:
  1012.          case 120:
  1013.          case 121:
  1014.          case 122:
  1015.       }
  1016.  
  1017.       while(true) {
  1018.          this.addString(this.field_0);
  1019.          switch (this.field_0 = this.readCh()) {
  1020.             case 45:
  1021.             case 46:
  1022.             case 48:
  1023.             case 49:
  1024.             case 50:
  1025.             case 51:
  1026.             case 52:
  1027.             case 53:
  1028.             case 54:
  1029.             case 55:
  1030.             case 56:
  1031.             case 57:
  1032.             case 95:
  1033.             case 97:
  1034.             case 98:
  1035.             case 99:
  1036.             case 100:
  1037.             case 101:
  1038.             case 102:
  1039.             case 103:
  1040.             case 104:
  1041.             case 105:
  1042.             case 106:
  1043.             case 107:
  1044.             case 108:
  1045.             case 109:
  1046.             case 110:
  1047.             case 111:
  1048.             case 112:
  1049.             case 113:
  1050.             case 114:
  1051.             case 115:
  1052.             case 116:
  1053.             case 117:
  1054.             case 118:
  1055.             case 119:
  1056.             case 120:
  1057.             case 121:
  1058.             case 122:
  1059.                break;
  1060.             case 47:
  1061.             case 58:
  1062.             case 59:
  1063.             case 60:
  1064.             case 61:
  1065.             case 62:
  1066.             case 63:
  1067.             case 64:
  1068.             case 91:
  1069.             case 92:
  1070.             case 93:
  1071.             case 94:
  1072.             case 96:
  1073.             default:
  1074.                return true;
  1075.             case 65:
  1076.             case 66:
  1077.             case 67:
  1078.             case 68:
  1079.             case 69:
  1080.             case 70:
  1081.             case 71:
  1082.             case 72:
  1083.             case 73:
  1084.             case 74:
  1085.             case 75:
  1086.             case 76:
  1087.             case 77:
  1088.             case 78:
  1089.             case 79:
  1090.             case 80:
  1091.             case 81:
  1092.             case 82:
  1093.             case 83:
  1094.             case 84:
  1095.             case 85:
  1096.             case 86:
  1097.             case 87:
  1098.             case 88:
  1099.             case 89:
  1100.             case 90:
  1101.                if (var1) {
  1102.                   this.field_0 = 97 + (this.field_0 - 65);
  1103.                }
  1104.          }
  1105.       }
  1106.    }
  1107.  
  1108.    void parseInvalidTag() throws IOException {
  1109.       while(true) {
  1110.          this.skipSpace();
  1111.          switch (this.field_0) {
  1112.             case -1:
  1113.             case 62:
  1114.                this.field_0 = this.readCh();
  1115.                return;
  1116.             case 60:
  1117.                return;
  1118.             default:
  1119.                this.field_0 = this.readCh();
  1120.          }
  1121.       }
  1122.    }
  1123.  
  1124.    void parseLiteral(boolean var1) throws IOException {
  1125.       while(true) {
  1126.          int var2 = this.field_0;
  1127.          switch (var2) {
  1128.             case -1:
  1129.                this.error("eof.literal", this.stack.elem.getName());
  1130.                this.endTag(true);
  1131.                return;
  1132.             case 10:
  1133.                ++this.field_1;
  1134.                this.field_0 = this.readCh();
  1135.                break;
  1136.             case 13:
  1137.                ++this.field_1;
  1138.                if ((this.field_0 = this.readCh()) == 10) {
  1139.                   this.field_0 = this.readCh();
  1140.                }
  1141.  
  1142.                var2 = 10;
  1143.                break;
  1144.             case 38:
  1145.                char[] var5 = this.parseEntityReference();
  1146.                if (this.textpos + var5.length > this.text.length) {
  1147.                   char[] var6 = new char[Math.max(this.textpos + var5.length + 128, this.text.length * 2)];
  1148.                   System.arraycopy(this.text, 0, var6, 0, this.text.length);
  1149.                   this.text = var6;
  1150.                }
  1151.  
  1152.                System.arraycopy(var5, 0, this.text, this.textpos, var5.length);
  1153.                this.textpos += var5.length;
  1154.                continue;
  1155.             case 62:
  1156.                this.field_0 = this.readCh();
  1157.                int var3 = this.textpos - (this.stack.elem.name.length() + 2);
  1158.                int var4 = 0;
  1159.                if (var3 >= 0 && this.text[var3++] == '<' && this.text[var3] == '/') {
  1160.                   do {
  1161.                      ++var3;
  1162.                   } while(var3 < this.textpos && Character.toLowerCase(this.text[var3]) == this.stack.elem.name.charAt(var4++));
  1163.  
  1164.                   if (var3 == this.textpos) {
  1165.                      this.textpos -= this.stack.elem.name.length() + 2;
  1166.                      if (this.textpos > 0 && this.text[this.textpos - 1] == '\n') {
  1167.                         --this.textpos;
  1168.                      }
  1169.  
  1170.                      this.endTag(false);
  1171.                      return;
  1172.                   }
  1173.                }
  1174.                break;
  1175.             default:
  1176.                this.field_0 = this.readCh();
  1177.          }
  1178.  
  1179.          if (this.textpos == this.text.length) {
  1180.             char[] var8 = new char[this.text.length + 128];
  1181.             System.arraycopy(this.text, 0, var8, 0, this.text.length);
  1182.             this.text = var8;
  1183.          }
  1184.  
  1185.          this.text[this.textpos++] = (char)var2;
  1186.       }
  1187.    }
  1188.  
  1189.    protected boolean parseMarkupDeclarations(StringBuffer var1) throws IOException {
  1190.       if (var1.length() == "DOCTYPE".length() && var1.toString().toUpperCase().equals("DOCTYPE")) {
  1191.          this.parseDTDMarkup();
  1192.          return true;
  1193.       } else {
  1194.          return false;
  1195.       }
  1196.    }
  1197.  
  1198.    void parseTag() throws IOException {
  1199.       Object var1 = null;
  1200.       boolean var2 = false;
  1201.       boolean var3 = false;
  1202.       boolean var4 = false;
  1203.       switch (this.field_0 = this.readCh()) {
  1204.          case -1:
  1205.             this.error("eof");
  1206.             return;
  1207.          case 33:
  1208.             switch (this.field_0 = this.readCh()) {
  1209.                case 45:
  1210.                   while(true) {
  1211.                      if (this.field_0 == 45) {
  1212.                         if (!this.strict || (this.field_0 = this.readCh()) == 45) {
  1213.                            this.field_0 = this.readCh();
  1214.                            if (!this.strict && this.field_0 == 45) {
  1215.                               this.field_0 = this.readCh();
  1216.                            }
  1217.  
  1218.                            if (this.textpos != 0) {
  1219.                               char[] var13 = new char[this.textpos];
  1220.                               System.arraycopy(this.text, 0, var13, 0, this.textpos);
  1221.                               this.handleText(var13);
  1222.                               this.textpos = 0;
  1223.                            }
  1224.  
  1225.                            this.parseComment();
  1226.                            this.handleComment(this.getChars(0));
  1227.                            continue;
  1228.                         }
  1229.  
  1230.                         if (!var3) {
  1231.                            var3 = true;
  1232.                            this.error("invalid.commentchar", "-");
  1233.                         }
  1234.                      }
  1235.  
  1236.                      this.skipSpace();
  1237.                      switch (this.field_0) {
  1238.                         case 45:
  1239.                            break;
  1240.                         case 62:
  1241.                            this.field_0 = this.readCh();
  1242.                         case -1:
  1243.                            return;
  1244.                         default:
  1245.                            this.field_0 = this.readCh();
  1246.                            if (!var3) {
  1247.                               var3 = true;
  1248.                               this.error("invalid.commentchar", String.valueOf((char)this.field_0));
  1249.                            }
  1250.                      }
  1251.                   }
  1252.                default:
  1253.                   StringBuffer var14 = new StringBuffer();
  1254.  
  1255.                   while(true) {
  1256.                      var14.append((char)this.field_0);
  1257.                      if (this.parseMarkupDeclarations(var14)) {
  1258.                         return;
  1259.                      }
  1260.  
  1261.                      switch (this.field_0) {
  1262.                         case 10:
  1263.                            ++this.field_1;
  1264.                            this.field_0 = this.readCh();
  1265.                            break;
  1266.                         case 13:
  1267.                            ++this.field_1;
  1268.                            if ((this.field_0 = this.readCh()) == 10) {
  1269.                               this.field_0 = this.readCh();
  1270.                            }
  1271.                            break;
  1272.                         case 62:
  1273.                            this.field_0 = this.readCh();
  1274.                         case -1:
  1275.                            this.error("invalid.markup");
  1276.                            return;
  1277.                         default:
  1278.                            this.field_0 = this.readCh();
  1279.                      }
  1280.                   }
  1281.             }
  1282.          case 47:
  1283.             Element var7;
  1284.             switch (this.field_0 = this.readCh()) {
  1285.                case 61:
  1286.                default:
  1287.                   if (!this.parseIdentifier(true)) {
  1288.                      this.error("expected.endtagname");
  1289.                      return;
  1290.                   }
  1291.  
  1292.                   this.skipSpace();
  1293.                   switch (this.field_0) {
  1294.                      case 60:
  1295.                         break;
  1296.                      case 61:
  1297.                      default:
  1298.                         this.error("expected", "'>'");
  1299.  
  1300.                         while(this.field_0 != -1 && this.field_0 != 10 && this.field_0 != 62) {
  1301.                            this.field_0 = this.readCh();
  1302.                         }
  1303.  
  1304.                         if (this.field_0 == 62) {
  1305.                            this.field_0 = this.readCh();
  1306.                         }
  1307.                         break;
  1308.                      case 62:
  1309.                         this.field_0 = this.readCh();
  1310.                   }
  1311.  
  1312.                   String var5 = this.getString(0);
  1313.                   if (!this.dtd.elementExists(var5)) {
  1314.                      this.error("end.unrecognized", var5);
  1315.                      if (this.textpos > 0 && this.text[this.textpos - 1] == '\n') {
  1316.                         --this.textpos;
  1317.                      }
  1318.  
  1319.                      var7 = this.dtd.getElement("unknown");
  1320.                      var7.name = var5;
  1321.                      var4 = true;
  1322.                   } else {
  1323.                      var7 = this.dtd.getElement(var5);
  1324.                   }
  1325.                   break;
  1326.                case 62:
  1327.                   this.field_0 = this.readCh();
  1328.                case 60:
  1329.                   if (this.recent == null) {
  1330.                      this.error("invalid.shortend");
  1331.                      return;
  1332.                   }
  1333.  
  1334.                   var7 = this.recent;
  1335.             }
  1336.  
  1337.             if (this.stack == null) {
  1338.                this.error("end.extra.tag", var7.getName());
  1339.                return;
  1340.             } else {
  1341.                if (this.textpos > 0 && this.text[this.textpos - 1] == '\n') {
  1342.                   if (this.stack.pre) {
  1343.                      if (this.textpos > 1 && this.text[this.textpos - 2] != '\n') {
  1344.                         --this.textpos;
  1345.                      }
  1346.                   } else {
  1347.                      --this.textpos;
  1348.                   }
  1349.                }
  1350.  
  1351.                if (!this.strict && var7.getName().equals("form")) {
  1352.                   if (this.lastFormSent != null) {
  1353.                      this.handleEndTag(this.lastFormSent);
  1354.                      return;
  1355.                   }
  1356.  
  1357.                   return;
  1358.                } else if (var4) {
  1359.                   TagElement var12 = this.makeTag(var7);
  1360.                   this.handleText(var12);
  1361.                   this.attributes.addAttribute(Attribute.ENDTAG, "true");
  1362.                   this.handleEmptyTag(this.makeTag(var7));
  1363.                   var4 = false;
  1364.                   return;
  1365.                } else {
  1366.                   if (!this.strict) {
  1367.                      String var10 = this.stack.elem.getName();
  1368.                      if (var10.equals("table") && !var7.getName().equals(var10)) {
  1369.                         this.error("tag.ignore", var7.getName());
  1370.                         return;
  1371.                      }
  1372.  
  1373.                      if ((var10.equals("tr") || var10.equals("td")) && !var7.getName().equals("table") && !var7.getName().equals(var10)) {
  1374.                         this.error("tag.ignore", var7.getName());
  1375.                         return;
  1376.                      }
  1377.                   }
  1378.  
  1379.                   TagStack var11;
  1380.                   for(var11 = this.stack; var11 != null && var7 != var11.elem; var11 = var11.next) {
  1381.                   }
  1382.  
  1383.                   if (var11 == null) {
  1384.                      this.error("unmatched.endtag", var7.getName());
  1385.                      return;
  1386.                   } else {
  1387.                      String var6 = var7.getName();
  1388.                      if (this.stack == var11 || !var6.equals("font") && !var6.equals("center")) {
  1389.                         while(this.stack != var11) {
  1390.                            this.endTag(true);
  1391.                         }
  1392.  
  1393.                         this.endTag(false);
  1394.                         return;
  1395.                      }
  1396.  
  1397.                      if (var6.equals("center")) {
  1398.                         while(this.stack.elem.omitEnd() && this.stack != var11) {
  1399.                            this.endTag(true);
  1400.                         }
  1401.  
  1402.                         if (this.stack.elem == var7) {
  1403.                            this.endTag(false);
  1404.                         }
  1405.                      }
  1406.  
  1407.                      return;
  1408.                   }
  1409.                }
  1410.             }
  1411.          default:
  1412.             Element var8;
  1413.             if (!this.parseIdentifier(true)) {
  1414.                var8 = this.recent;
  1415.                if (this.field_0 != 62 || var8 == null) {
  1416.                   this.error("expected.tagname");
  1417.                   return;
  1418.                }
  1419.             } else {
  1420.                String var15 = this.getString(0);
  1421.                if (var15.equals("image")) {
  1422.                   var15 = new String("img");
  1423.                }
  1424.  
  1425.                if (!this.dtd.elementExists(var15)) {
  1426.                   this.error("tag.unrecognized ", var15);
  1427.                   var8 = this.dtd.getElement("unknown");
  1428.                   var8.name = var15;
  1429.                   var4 = true;
  1430.                } else {
  1431.                   var8 = this.dtd.getElement(var15);
  1432.                }
  1433.             }
  1434.  
  1435.             this.parseAttributeSpecificationList(var8);
  1436.             switch (this.field_0) {
  1437.                case 47:
  1438.                   var2 = true;
  1439.                case 62:
  1440.                   this.field_0 = this.readCh();
  1441.                case 60:
  1442.                   break;
  1443.                default:
  1444.                   this.error("expected", "'>'");
  1445.             }
  1446.  
  1447.             if (!this.strict && var8.getName().equals("script")) {
  1448.                this.error("javascript.unsupported");
  1449.             }
  1450.  
  1451.             if (!var8.isEmpty()) {
  1452.                if (this.field_0 == 10) {
  1453.                   ++this.field_1;
  1454.                   this.field_0 = this.readCh();
  1455.                } else if (this.field_0 == 13) {
  1456.                   ++this.field_1;
  1457.                   if ((this.field_0 = this.readCh()) == 10) {
  1458.                      this.field_0 = this.readCh();
  1459.                   }
  1460.                }
  1461.             }
  1462.  
  1463.             TagElement var16 = this.makeTag(var8, false);
  1464.             if (!this.strict && var8.getName().equals("form")) {
  1465.                if (this.lastFormSent == null) {
  1466.                   this.lastFormSent = var16;
  1467.                } else {
  1468.                   this.handleEndTag(this.lastFormSent);
  1469.                   this.lastFormSent = var16;
  1470.                }
  1471.             } else if (!var4) {
  1472.                this.legalTagContext(var16);
  1473.                if (!this.strict && this.skipTag) {
  1474.                   this.skipTag = false;
  1475.                   return;
  1476.                }
  1477.             }
  1478.  
  1479.             this.startTag(var16);
  1480.             if (!var8.isEmpty()) {
  1481.                switch (var8.getType()) {
  1482.                   case 1:
  1483.                      this.parseLiteral(false);
  1484.                      break;
  1485.                   case 16:
  1486.                      this.parseLiteral(true);
  1487.                      break;
  1488.                   default:
  1489.                      if (this.stack != null) {
  1490.                         this.stack.net = var2;
  1491.                      }
  1492.                }
  1493.             }
  1494.  
  1495.       }
  1496.    }
  1497.  
  1498.    private final int readCh() throws IOException {
  1499.       if (this.pos >= this.len) {
  1500.          try {
  1501.             this.len = this.field_2.read(this.buf);
  1502.          } catch (InterruptedIOException var2) {
  1503.             throw var2;
  1504.          }
  1505.  
  1506.          if (this.len <= 0) {
  1507.             return -1;
  1508.          }
  1509.  
  1510.          this.pos = 0;
  1511.       }
  1512.  
  1513.       ++this.currentPosition;
  1514.       return this.buf[this.pos++];
  1515.    }
  1516.  
  1517.    void resetStrBuffer() {
  1518.       this.strpos = 0;
  1519.    }
  1520.  
  1521.    void skipSpace() throws IOException {
  1522.       while(true) {
  1523.          switch (this.field_0) {
  1524.             case 9:
  1525.             case 32:
  1526.                this.field_0 = this.readCh();
  1527.                break;
  1528.             case 10:
  1529.                ++this.field_1;
  1530.                this.field_0 = this.readCh();
  1531.                break;
  1532.             case 13:
  1533.                ++this.field_1;
  1534.                if ((this.field_0 = this.readCh()) == 10) {
  1535.                   this.field_0 = this.readCh();
  1536.                }
  1537.                break;
  1538.             default:
  1539.                return;
  1540.          }
  1541.       }
  1542.    }
  1543.  
  1544.    protected void startTag(TagElement var1) throws ChangedCharSetException {
  1545.       Element var2 = var1.getElement();
  1546.       if (var2.isEmpty() && this.textpos == 0) {
  1547.          this.last = var1;
  1548.       } else {
  1549.          this.handleText(var1);
  1550.       }
  1551.  
  1552.       for(AttributeList var3 = var2.atts; var3 != null; var3 = var3.next) {
  1553.          if (var3.modifier == 2 && (this.attributes.isEmpty() || !this.attributes.isDefined(var3.name))) {
  1554.             this.error("req.att ", var3.getName(), var2.getName());
  1555.          }
  1556.       }
  1557.  
  1558.       if (var2.isEmpty()) {
  1559.          this.handleEmptyTag(var1);
  1560.       } else if (var2.getName().equals("form")) {
  1561.          this.handleStartTag(var1);
  1562.       } else {
  1563.          this.recent = var2;
  1564.          this.stack = new TagStack(var1, this.stack);
  1565.          this.handleStartTag(var1);
  1566.       }
  1567.  
  1568.    }
  1569.  
  1570.    int strIndexOf(char var1) {
  1571.       for(int var2 = 0; var2 < this.strpos; ++var2) {
  1572.          if (this.str[var2] == var1) {
  1573.             return var2;
  1574.          }
  1575.       }
  1576.  
  1577.       return -1;
  1578.    }
  1579. }
  1580.