⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 java2xhtml.java

📁 linux下建立JAVA虚拟机的源码KAFFE
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
                            {                                qualifiedIdentifierLength++;                            }                            bufferOut.insert(bufferOut.length() -                                              qualifiedIdentifierLength,                                              "<span class=" +                                             "\"" + numericLiteralStyle + "\">");                            bufferOut.append("</span>");                        }                    }                }                qualifiedIdentifierLength = 0;                identifierLength = 0;            }            // process characters NOT in identifiers             switch (presentChar)            {                case '&': //ampersand                    bufferOut.append("&amp;");  // HTMLify character                    break;                case '<': // less than sign                    bufferOut.append("&lt;");   // HTMLify character                    break;                case '>': // greater than sign                    bufferOut.append("&gt;");   // HTMLify character                    break;                case '\"': // double quote                    bufferOut.append("&quot;"); // HTMLify character                    if (State.TEXT == presentState)                    {                        presentState = State.DOUBLE_QUOTE;                        bufferOut.insert(bufferOut.length()-("&quot;").length(),                                         "<span class=\"" + doubleQuoteStyle + "\">");                    }                       else if (State.DOUBLE_QUOTE == presentState)                    {                        presentState = State.TEXT;                        bufferOut.append("</span>");                    }                    break;                case '\'': // single quote                    bufferOut.append("\'");                    if (State.TEXT == presentState)                    {                        presentState = State.SINGLE_QUOTE;                        bufferOut.insert(bufferOut.length() - ("\'").length(),                                          "<span class=\"" + singleQuoteStyle + "\">");                    }                    else if (State.SINGLE_QUOTE == presentState)                    {                        presentState = State.TEXT;                        bufferOut.append("</span>");                    }                    break;                case '\\': // backslash                    bufferOut.append("\\");                    if ((State.DOUBLE_QUOTE == presentState) ||                          (State.SINGLE_QUOTE == presentState))                    {                        // treat as a character escape sequence                         bufferOut.append(bufferIn.charAt(++presentIndex));                    }                    break;                case '\t': // tab                    // replace tabs with tabsize number of spaces                    for (int i = 0; i < tabSize; i++)                     {                        bufferOut.append(' ');                    }                    break;                case '*': // star                    bufferOut.append("*");                    if ((State.TEXT ==  presentState) &&                         (bufferIn.charAt(presentIndex - 1) == '/'))                    {                        if (((bufferIn.length() - 1) > presentIndex)  &&                            (bufferIn.charAt(presentIndex + 1) == '*'))                        {                            presentState = State.JAVADOC;                            bufferOut.insert(bufferOut.length() -                                              ("/*").length(), "<span class=" +                                             "\"" + javadocCommentStyle + "\">");                        }                        else                        {                                                    presentState = State.TRADITIONAL_COMMENT;                            bufferOut.insert(bufferOut.length() -                                              ("/*").length(), "<span class=" +                                             "\"" + traditionalCommentStyle + "\">");                        }                    }                    break;                case '/': // foward slash                    bufferOut.append("/");                    if (((State.TRADITIONAL_COMMENT == presentState) ||                          (State.JAVADOC == presentState)) &&                        (bufferIn.charAt(presentIndex - 1) == '*'))                    {                        bufferOut.append("</span>");                        presentState = State.TEXT;                    }                    if ((State.TEXT == presentState) &&                         (presentIndex > 0)  &&                        (bufferIn.charAt(presentIndex - 1) == '/'))                    {                           bufferOut.insert(bufferOut.length() - ("//").length(),                                          "<span class=" +                                          "\"" + singleLineCommentStyle + "\">");                        presentState = State.LINE_COMMENT;                    }                     break;                case '\r': // carriage return                    // fall through                  case '\n': // line feed                    // all HTML lines end in \r\n                    if ((bufferIn.charAt(presentIndex) == '\r') &&                        ((bufferIn.length() - 1) > presentIndex)  &&                        (bufferIn.charAt(presentIndex + 1) == '\n'))                    {                            ++presentIndex;                    }                    // end single line comments                    if (State.LINE_COMMENT == presentState)                    {                        bufferOut.append("</span>");                        presentState = State.TEXT;                    }                    // end of block                      if ((lineModulus > 0) && hasLineModulusCodeBlocks &&                         ((codeLineNumber%lineModulus == 0) && !isNewBlock))                    {                        // end multi-line spanning states                        if ((State.TRADITIONAL_COMMENT == presentState) ||                            (State.JAVADOC == presentState))                        {                             bufferOut.append("</span>");                        }                        bufferOut.append("\r\n");                        bufferOut.append("</pre>\r\n");                        bufferOut.append("   </div>\r\n");                        bufferOut.append("<pre class=\"");                        bufferOut.append("modulusBlockPREStyle\">\r\n");                        // restart multi-line spanning states                        if (State.TRADITIONAL_COMMENT == presentState)                        {                            bufferOut.append("<span class=" +                                             "\"" + traditionalCommentStyle + "\">");                        }                        if (State.JAVADOC == presentState)                        {                            bufferOut.append("<span class=" +                                             "\"" + javadocCommentStyle + "\">");                        }                    }                    else                    {                        // div automatically starts new line                         bufferOut.append("\r\n");                    }                    isNewLine = true;                    break;                case 0: // nul character                    if ((State.LINE_COMMENT == presentState) &&                         (presentIndex == (bufferIn.length() - 1)))                    {                        bufferOut.append("</span>");                    }                    break;                default:  // everything else                     bufferOut.append(presentChar);            }            qualifiedIdentifierLength = 0;        }        if (presentState == State.LINE_COMMENT) {            bufferOut.append("</span>\r\n");        }        bufferOut.append("</pre>\r\n");        // end block early if no more source code        if ((lineModulus > 0) && hasLineModulusCodeBlocks && !isNewBlock &&             (codeLineNumber%lineModulus != 0))        {            bufferOut.append("   </div>\r\n");        }        bufferOut.append("  </div>\r\n");  // end div of sourceCodeStyle        // if code snippet then don't add ending tags of xhtml page        if (!isCodeSnippet)        {            // if footer mode then add a footer            if (hasFooter)            {                bufferOut.append("  <hr />\r\n");                bufferOut.append("  <div id=\"footer\">\r\n");                if (hasFooterIcons)                {                    if (hasFooterDate)                    {                        bufferOut.append("   <script type=\"text/javaScript\"");                        bufferOut.append(">\r\n");                        bufferOut.append("    <!-- // <![CDATA[\r\n");                        bufferOut.append("     document.write(\"Document last");                        bufferOut.append(" modified on \"");                        bufferOut.append(" + document.lastModified + ");                        bufferOut.append("\"<br />\");\r\n");                        bufferOut.append("    // ]]> -->\r\n");                        bufferOut.append("   </script>\r\n");                    }                    bufferOut.append("   <a href=\"");                    bufferOut.append("http://validator.w3.org/check/referer");                    bufferOut.append("\">\r\n");                    bufferOut.append("    <img class=\"" + iconStyle + "\" src=\"");                    bufferOut.append("http://www.w3.org/Icons/");                    if (isXHTML_1_1)                    {                        bufferOut.append("valid-xhtml11\"\r\n");                        bufferOut.append("         alt=\"Valid XHTML 1.1!\"");                    }                    else                    {                        bufferOut.append("valid-xhtml10\"\r\n");                        bufferOut.append("         alt=\"Valid XHTML 1.0!\"");                    }                    bufferOut.append(" height=\"31\" ");                    bufferOut.append("width=\"88\" />\r\n");                    bufferOut.append("   </a>\r\n");                    bufferOut.append("   &#160;\r\n");                    bufferOut.append("   <a href=\"");                    bufferOut.append("http://jigsaw.w3.org");                    bufferOut.append("/css-validator/check/referer");                    bufferOut.append("\">\r\n");                    bufferOut.append("    <img class=\"" + iconStyle + "\" src=\"");                    bufferOut.append("http://jigsaw.w3.org/");                    bufferOut.append("css-validator/images/vcss");                    bufferOut.append("\"\r\n");                    bufferOut.append("         alt=\"Valid CSS!\"");                    bufferOut.append(" height=\"31\" width=\"88\" />\r\n");                    bufferOut.append("   </a>\r\n");                }                else                {                    bufferOut.append("   This is a valid\r\n");                     bufferOut.append("   <a href=\"http://");                     bufferOut.append("validator.w3.org/check/referer");                    if (isXHTML_1_1)                    {                        bufferOut.append("\">XHTML 1.1</a>\r\n");                    }                    else                    {                        bufferOut.append("\">XHTML 1.0</a>\r\n");                    }                    bufferOut.append("   with\r\n");                    bufferOut.append("   <a href=\"http://");                    bufferOut.append("jigsaw.w3.org");                    bufferOut.append("/css-validator/check/referer");                    bufferOut.append("\">CSS</a>\r\n");                    bufferOut.append("   document \r\n");                     if (hasFooterDate)                    {                        bufferOut.append("   <script type=\"text/javaScript\"");                        bufferOut.append(">\r\n");                        bufferOut.append("    <!-- // <![CDATA[\r\n");    

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -