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

📄 htmltokenmaker.java

📁 具有不同语法高亮的编辑器实例
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
/* The following code was generated by JFlex 1.4.1 on 12/15/05 1:43 PM */

/*
 * 01/24/2005
 *
 * HTMLTokenMaker.java - Generates tokens for HTML syntax highlighting.
 * Copyright (C) 2005 Robert Futrell
 * email@address.com
 * www.website.com
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
package org.fife.ui.rsyntaxtextarea.modes;

import java.io.*;
import javax.swing.text.Segment;

import org.fife.ui.rsyntaxtextarea.*;


/**
 * Scanner for HTML files.
 *
 * This implementation was created using
 * <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
 * was modified for performance.  Memory allocation needs to be almost
 * completely removed to be competitive with the handwritten lexers (subclasses
 * of <code>AbstractTokenMaker</code>, so this class has been modified so that
 * Strings are never allocated (via yytext()), and the scanner never has to
 * worry about refilling its buffer (needlessly copying chars around).
 * We can achieve this because RText always scans exactly 1 line of tokens at a
 * time, and hands the scanner this line as an array of characters (a Segment
 * really).  Since tokens contain pointers to char arrays instead of Strings
 * holding their contents, there is no need for allocating new memory for
 * Strings.<p>
 *
 * The actual algorithm generated for scanning has, of course, not been
 * modified.<p>
 *
 * If you wish to regenerate this file yourself, keep in mind the following:
 * <ul>
 *   <li>The generated HTMLTokenMaker.java</code> file will contain two
 *       definitions of both <code>zzRefill</code> and <code>yyreset</code>.
 *       You should hand-delete the second of each definition (the ones
 *       generated by the lexer), as these generated methods modify the input
 *       buffer, which we'll never have to do.</li>
 *   <li>You should also change the declaration/definition of zzBuffer to NOT
 *       be initialized.  This is a needless memory allocation for us since we
 *       will be pointing the array somewhere else anyway.</li>
 *   <li>You should NOT call <code>yylex()</code> on the generated scanner
 *       directly; rather, you should use <code>getTokenList</code> as you would
 *       with any other <code>TokenMaker</code> instance.</li>
 * </ul>
 *
 * @author Robert Futrell
 * @version 0.4
 *
 */

public class HTMLTokenMaker extends AbstractJFlexTokenMaker implements TokenMaker {

  /** This character denotes the end of file */
  public static final int YYEOF = -1;

  /** initial size of the lookahead buffer */
  private static final int ZZ_BUFFERSIZE = 16384;

  /** lexical states */
  public static final int INTAG_SCRIPT = 5;
  public static final int JAVASCRIPT = 6;
  public static final int INTAG = 4;
  public static final int DTD = 3;
  public static final int YYINITIAL = 0;
  public static final int JS_MLC = 7;
  public static final int COMMENT = 1;
  public static final int PI = 2;

  /** 
   * Translates characters to character classes
   */
  private static final String ZZ_CMAP_PACKED = 
    "\11\0\1\4\1\2\1\0\1\1\1\36\22\0\1\4\1\54\1\11"+
    "\1\0\1\37\1\53\1\5\1\12\2\50\1\40\1\52\1\51\1\46"+
    "\1\47\1\13\1\24\1\35\1\35\1\35\1\72\1\72\1\72\1\26"+
    "\2\23\1\56\1\7\1\3\1\10\1\22\1\55\1\0\1\57\1\25"+
    "\1\15\1\64\1\45\1\43\1\65\1\71\1\17\1\73\1\66\1\42"+
    "\1\63\1\61\1\60\1\20\1\67\1\16\1\14\1\21\1\30\1\70"+
    "\1\74\1\41\1\62\1\6\1\50\1\27\1\50\1\53\1\37\1\0"+
    "\1\57\1\34\1\15\1\64\1\45\1\44\1\65\1\71\1\17\1\73"+
    "\1\66\1\42\1\63\1\31\1\60\1\20\1\67\1\32\1\14\1\33"+
    "\1\30\1\70\1\74\1\41\1\62\1\6\1\50\1\53\1\50\1\56"+
    "\uff81\0";

  /** 
   * Translates characters to character classes
   */
  private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);

  /** 
   * Translates DFA states to action switch labels.
   */
  private static final int [] ZZ_ACTION = zzUnpackAction();

  private static final String ZZ_ACTION_PACKED_0 =
    "\10\0\2\1\1\2\1\3\1\4\1\5\1\6\1\7"+
    "\2\6\1\10\2\6\1\11\1\12\2\1\1\13\1\14"+
    "\1\15\2\16\1\1\2\16\1\1\1\17\2\16\4\1"+
    "\1\16\4\1\1\16\2\1\1\20\1\21\1\22\2\13"+
    "\2\1\1\13\1\23\1\24\1\13\6\1\1\13\2\25"+
    "\3\1\1\21\3\1\1\13\1\1\1\26\1\13\5\1"+
    "\1\6\1\27\1\6\1\0\1\30\1\31\1\5\1\0"+
    "\1\32\1\33\1\34\30\1\1\16\7\1\1\16\5\1"+
    "\1\16\22\1\2\0\1\21\1\23\3\15\1\24\1\35"+
    "\1\36\13\1\2\16\7\1\1\13\1\37\1\25\1\40"+
    "\1\37\1\40\1\37\1\41\1\37\24\1\1\16\4\1"+
    "\1\42\2\0\1\43\12\1\1\16\44\1\1\0\1\21"+
    "\3\23\1\24\2\15\1\24\1\0\16\1\1\5\14\1"+
    "\1\40\1\0\2\41\32\1\1\0\1\44\15\1\1\16"+
    "\14\1\1\0\1\21\1\14\1\23\1\33\1\23\1\24"+
    "\1\45\5\1\1\5\14\1\1\46\12\1\1\47\6\1"+
    "\1\0\10\1\1\16\5\1\1\0\1\21\1\23\1\24"+
    "\16\1\1\16\1\1\1\16\6\1\1\0\7\1\1\0"+
    "\1\21\1\23\1\24\17\1\1\50\2\1\1\0\7\1"+
    "\1\0\3\1\1\51\1\1";

  private static int [] zzUnpackAction() {
    int [] result = new int[493];
    int offset = 0;
    offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
    return result;
  }

  private static int zzUnpackAction(String packed, int offset, int [] result) {
    int i = 0;       /* index in packed string  */
    int j = offset;  /* index in unpacked array */
    int l = packed.length();
    while (i < l) {
      int count = packed.charAt(i++);
      int value = packed.charAt(i++);
      do result[j++] = value; while (--count > 0);
    }
    return j;
  }


  /** 
   * Translates a state to a row index in the transition table
   */
  private static final int [] ZZ_ROWMAP = zzUnpackRowMap();

  private static final String ZZ_ROWMAP_PACKED_0 =
    "\0\0\0\75\0\172\0\267\0\364\0\u0131\0\u016e\0\u01ab"+
    "\0\u01e8\0\u0225\0\u0262\0\u029f\0\u02dc\0\u0319\0\u0356\0\u0262"+
    "\0\u0393\0\u03d0\0\u0262\0\u040d\0\u044a\0\u0262\0\u0262\0\u0487"+
    "\0\u04c4\0\u0262\0\u0501\0\u053e\0\u0262\0\u057b\0\u05b8\0\u05f5"+
    "\0\u0632\0\u066f\0\u0262\0\u06ac\0\u06e9\0\u0726\0\u0763\0\u07a0"+
    "\0\u07dd\0\u081a\0\u0857\0\u0894\0\u08d1\0\u090e\0\u0487\0\u094b"+
    "\0\u0988\0\u0262\0\u09c5\0\u0262\0\u0a02\0\u0a3f\0\u0a7c\0\u0262"+
    "\0\u0ab9\0\u0af6\0\u0b33\0\u0b70\0\u0bad\0\u0bea\0\u0c27\0\u0c64"+
    "\0\u0ca1\0\u0cde\0\u0d1b\0\u0d58\0\u0d95\0\u0dd2\0\u0e0f\0\u0e4c"+
    "\0\u0262\0\u0e89\0\u0ec6\0\u0f03\0\u0f40\0\u0f7d\0\u0262\0\u0fba"+
    "\0\u0ff7\0\u1034\0\u1071\0\u10ae\0\u10eb\0\u1128\0\u0262\0\u1165"+
    "\0\u11a2\0\u11df\0\u0262\0\u0262\0\u121c\0\u0262\0\u0262\0\u0262"+
    "\0\u1259\0\u1296\0\u12d3\0\u1310\0\u134d\0\u138a\0\u13c7\0\u1404"+
    "\0\u1441\0\u147e\0\u14bb\0\u14f8\0\u1535\0\u1572\0\u15af\0\u15ec"+
    "\0\u1629\0\u1666\0\u16a3\0\u16e0\0\u171d\0\u175a\0\u1797\0\u17d4"+
    "\0\u1811\0\u184e\0\u188b\0\u18c8\0\u1905\0\u1942\0\u197f\0\u19bc"+
    "\0\u19f9\0\u1a36\0\u1a73\0\u1ab0\0\u1aed\0\u1b2a\0\u1b67\0\u1ba4"+
    "\0\u1be1\0\u1c1e\0\u1c5b\0\u1c98\0\u1cd5\0\u1d12\0\u1d4f\0\u1d8c"+
    "\0\u1dc9\0\u1e06\0\u1e43\0\u06e9\0\u1e80\0\u1ebd\0\u1efa\0\u1f37"+
    "\0\u1f74\0\u0ab9\0\u1fb1\0\u1fee\0\u202b\0\u2068\0\u20a5\0\u0262"+
    "\0\u20e2\0\u211f\0\u215c\0\u2199\0\u21d6\0\u2213\0\u2250\0\u228d"+
    "\0\u22ca\0\u2307\0\u2344\0\u2381\0\u23be\0\u23fb\0\u2438\0\u0a7c"+
    "\0\u2475\0\u24b2\0\u24ef\0\u252c\0\u2569\0\u25a6\0\u25e3\0\u2620"+
    "\0\u265d\0\u265d\0\u265d\0\u269a\0\u26d7\0\u2714\0\u2751\0\u278e"+
    "\0\u27cb\0\u2808\0\u2845\0\u2882\0\u28bf\0\u28fc\0\u2939\0\u2976"+
    "\0\u29b3\0\u29f0\0\u2a2d\0\u2a6a\0\u2aa7\0\u2ae4\0\u2b21\0\u2b5e"+
    "\0\u2b9b\0\u2bd8\0\u2c15\0\u2c52\0\u2c8f\0\u2ccc\0\u2d09\0\u2d46"+
    "\0\u2d83\0\u0262\0\u2dc0\0\u2dfd\0\u0262\0\u2e3a\0\u2e77\0\u2eb4"+
    "\0\u2ef1\0\u2f2e\0\u2f6b\0\u2fa8\0\u2fe5\0\u3022\0\u305f\0\u309c"+
    "\0\u30d9\0\u3116\0\u3153\0\u3190\0\u31cd\0\u320a\0\u3247\0\u3284"+
    "\0\u32c1\0\u32fe\0\u19f9\0\u333b\0\u3378\0\u33b5\0\u33f2\0\u342f"+
    "\0\u346c\0\u34a9\0\u34e6\0\u3523\0\u3560\0\u359d\0\u35da\0\u3617"+
    "\0\u3654\0\u3691\0\u36ce\0\u370b\0\u3748\0\u3785\0\u37c2\0\u37ff"+
    "\0\u383c\0\u3879\0\u38b6\0\u38f3\0\u3930\0\u396d\0\u39aa\0\u39e7"+
    "\0\u3a24\0\u3a61\0\u3a9e\0\u3adb\0\u3b18\0\u3b55\0\u3b92\0\u3bcf"+
    "\0\u3c0c\0\u3c49\0\u3c86\0\u3cc3\0\u3d00\0\u3d3d\0\u3d7a\0\u3db7"+
    "\0\u3df4\0\u3e31\0\u3e6e\0\u3eab\0\u3ee8\0\u3f25\0\u3f62\0\u3f9f"+
    "\0\u3fdc\0\u4019\0\u4056\0\u4093\0\u40d0\0\u410d\0\u414a\0\u4187"+
    "\0\u41c4\0\u4201\0\u423e\0\u265d\0\u427b\0\u42b8\0\u42f5\0\u4332"+
    "\0\u436f\0\u43ac\0\u43e9\0\u4426\0\u4463\0\u44a0\0\u44dd\0\u451a"+
    "\0\u4557\0\u4594\0\u45d1\0\u460e\0\u464b\0\u4688\0\u46c5\0\u4702"+
    "\0\u473f\0\u477c\0\u47b9\0\u47f6\0\u4833\0\u4870\0\u48ad\0\u48ea"+
    "\0\u0262\0\u4927\0\u4964\0\u49a1\0\u49de\0\u4a1b\0\u4a58\0\u4a95"+
    "\0\u4ad2\0\u4b0f\0\u4b4c\0\u4b89\0\u4bc6\0\u4c03\0\u4c40\0\u4c7d"+
    "\0\u4cba\0\u1b67\0\u4cf7\0\u4d34\0\u4d71\0\u4dae\0\u4deb\0\u4e28"+
    "\0\u4e65\0\u4ea2\0\u4edf\0\u4f1c\0\u4f59\0\u0262\0\u4f96\0\u39aa"+
    "\0\u4fd3\0\u5010\0\u0262\0\u504d\0\u508a\0\u50c7\0\u5104\0\u5141"+
    "\0\u0a7c\0\u517e\0\u51bb\0\u51f8\0\u5235\0\u5272\0\u52af\0\u52ec"+
    "\0\u5329\0\u5366\0\u53a3\0\u53e0\0\u541d\0\u0a7c\0\u545a\0\u5497"+
    "\0\u54d4\0\u5511\0\u554e\0\u558b\0\u55c8\0\u5605\0\u5642\0\u567f"+
    "\0\u0a7c\0\u56bc\0\u56f9\0\u5736\0\u5773\0\u57b0\0\u57ed\0\u582a"+
    "\0\u5867\0\u58a4\0\u58e1\0\u591e\0\u595b\0\u5998\0\u59d5\0\u5a12"+
    "\0\u5a4f\0\u5a4f\0\u5a8c\0\u5ac9\0\u5b06\0\u5b43\0\u5b80\0\u5bbd"+
    "\0\u5bfa\0\u5c37\0\u5c74\0\u5cb1\0\u5cee\0\u5d2b\0\u5d68\0\u5da5"+
    "\0\u5de2\0\u5e1f\0\u5e5c\0\u5e99\0\u5ed6\0\u5f13\0\u5f50\0\u5f8d"+
    "\0\u41c4\0\u5fca\0\u6007\0\u6044\0\u6081\0\u60be\0\u60fb\0\u6138"+
    "\0\u6175\0\u61b2\0\u61ef\0\u622c\0\u6269\0\u62a6\0\u62e3\0\u6320"+
    "\0\u635d\0\u639a\0\u63d7\0\u6414\0\u6451\0\u648e\0\u64cb\0\u6508"+
    "\0\u6545\0\u6582\0\u65bf\0\u65fc\0\u6639\0\u6676\0\u66b3\0\u66f0"+
    "\0\u672d\0\u676a\0\u67a7\0\u67e4\0\u0262\0\u6821\0\u685e\0\u689b"+
    "\0\u68d8\0\u6915\0\u6952\0\u698f\0\u69cc\0\u6a09\0\u6a46\0\u6a83"+
    "\0\u6ac0\0\u6afd\0\u6b3a\0\u0262\0\u6b77";

  private static int [] zzUnpackRowMap() {
    int [] result = new int[493];
    int offset = 0;
    offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
    return result;
  }

  private static int zzUnpackRowMap(String packed, int offset, int [] result) {
    int i = 0;  /* index in packed string  */
    int j = offset;  /* index in unpacked array */
    int l = packed.length();
    while (i < l) {
      int high = packed.charAt(i++) << 16;
      result[j++] = high | packed.charAt(i++);
    }
    return j;
  }

  /** 
   * The transition table of the DFA
   */
  private static final int [] ZZ_TRANS = zzUnpackTrans();

  private static final String ZZ_TRANS_PACKED_0 =
    "\1\11\1\12\1\13\1\14\1\15\1\16\67\11\2\17"+
    "\1\20\43\17\1\21\26\17\2\22\1\23\52\22\1\24"+
    "\17\22\2\25\1\26\17\25\1\27\52\25\1\30\1\31"+
    "\1\0\1\30\1\15\3\30\1\32\1\33\1\34\1\35"+
    "\1\36\1\37\1\30\1\40\1\41\1\42\1\43\2\30"+
    "\1\44\2\30\1\45\1\46\1\30\1\42\1\44\5\30"+
    "\1\47\2\50\1\51\11\30\1\52\1\53\1\46\1\30"+
    "\1\54\1\55\1\30\1\56\1\57\1\60\1\61\4\30"+
    "\1\31\1\0\1\30\1\15\3\30\1\32\1\33\1\34"+
    "\1\35\6\30\1\62\52\30\1\63\1\15\1\64\1\65"+
    "\1\15\1\66\1\67\1\70\1\71\1\72\1\73\1\74"+
    "\1\75\1\76\1\77\1\100\1\101\1\102\1\103\1\104"+
    "\1\105\1\106\1\104\1\63\1\107\1\110\1\77\1\102"+
    "\1\106\1\104\1\111\1\67\1\71\1\67\1\112\2\113"+
    "\1\114\1\115\1\116\1\117\1\70\1\120\2\71\2\32"+
    "\1\121\1\67\1\110\2\67\1\122\1\123\2\67\1\124"+
    "\1\67\1\104\1\67\1\125\2\126\1\127\35\126\1\130"+
    "\34\126\2\11\4\0\70\11\1\12\2\0\1\15\1\0"+
    "\67\11\111\0\1\131\37\0\1\132\1\133\20\0\1\15"+
    "\2\0\1\15\76\0\1\16\1\134\4\0\6\16\3\0"+
    "\1\16\2\0\5\16\4\0\5\16\11\0\13\16\1\0"+
    "\2\16\2\17\1\0\43\17\1\0\26\17\46\0\1\135"+
    "\26\0\2\22\1\0\52\22\1\0\17\22\22\0\1\136"+
    "\52\0\2\25\1\0\17\25\1\0\52\25\2\30\1\0"+
    "\1\30\1\0\3\30\4\0\6\30\1\0\53\30\1\31"+
    "\1\0\1\30\1\15\3\30\4\0\6\30\1\0\52\30"+
    "\11\33\1\137\63\33\12\34\1\140\62\34\2\30\1\0"+
    "\1\30\1\0\3\30\4\0\1\30\1\141\2\30\1\142"+
    "\1\143\1\0\5\30\1\144\2\30\1\143\11\30\1\145"+
    "\11\30\1\146\3\30\1\147\13\30\1\0\1\30\1\0"+
    "\3\30\4\0\3\30\1\150\2\30\1\0\22\30\1\151"+
    "\11\30\1\152\1\153\16\30\1\0\1\30\1\0\3\30"+
    "\4\0\1\154\5\30\1\0\6\30\1\155\10\30\1\156"+
    "\2\157\14\30\1\155\1\30\1\160\13\30\1\0\1\30"+
    "\1\0\3\30\4\0\2\30\1\161\3\30\1\0\7\30"+
    "\1\161\7\30\1\162\14\30\1\163\17\30\1\0\1\30"+
    "\1\0\3\30\4\0\2\30\1\57\1\164\1\30\1\57"+
    "\1\0\2\30\1\165\4\30\2\57\1\165\6\30\2\166"+
    "\1\167\11\30\1\170\4\30\1\57\4\30\1\171\5\30"+
    "\1\0\1\30\1\0\3\30\4\0\2\30\1\57\1\160"+
    "\2\30\1\0\5\30\1\172\1\30\1\57\7\30\1\173"+
    "\14\30\1\174\1\175\3\30\1\176\1\177\11\30\1\0"+
    "\1\30\1\0\3\30\4\0\6\30\1\0\17\30\1\57"+
    "\34\30\1\0\1\30\1\0\3\30\4\0\6\30\1\0"+
    "\35\30\1\200\16\30\1\0\1\30\1\0\3\30\4\0"+
    "\3\30\1\201\2\30\1\0\22\30\1\202\11\30\1\203"+
    "\17\30\1\0\1\30\1\0\3\30\4\0\2\30\1\204"+
    "\1\205\2\30\1\0\7\30\1\204\25\30\1\206\16\30"+
    "\1\0\1\30\1\0\3\30\4\0\6\30\1\0\40\30"+
    "\1\207\13\30\1\0\1\30\1\0\3\30\4\0\1\30"+
    "\1\210\1\211\1\30\1\212\1\30\1\0\2\30\1\213"+
    "\4\30\1\211\1\30\1\213\27\30\1\214\12\30\1\0"+
    "\1\30\1\0\3\30\4\0\4\30\1\215\1\30\1\0"+
    "\2\30\1\216\6\30\1\216\5\30\1\57\34\30\1\0"+
    "\1\30\1\0\3\30\4\0\6\30\1\0\5\30\1\217"+
    "\14\30\1\220\11\30\1\221\17\30\1\0\1\30\1\0"+
    "\3\30\4\0\3\30\1\222\1\30\1\57\1\0\10\30"+
    "\1\57\6\30\1\57\2\223\1\224\16\30\1\57\12\30"+
    "\1\0\1\30\1\0\3\30\4\0\6\30\1\0\2\30"+
    "\1\225\6\30\1\225\10\30\1\226\31\30\1\0\1\30"+
    "\1\0\3\30\4\0\6\30\1\0\34\30\1\227\17\30"+

⌨️ 快捷键说明

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