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