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

📄 ctokenmaker.java

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

/*
 * 11/13/2004
 *
 * CTokenMaker.java - An object that can take a chunk of text and
 * return a linked list of tokens representing it in the C programming
 * language.
 * Copyright (C) 2004 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 the C programming language.
 *
 * 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 CTokenMaker.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 CTokenMaker 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 YYINITIAL = 0;
  public static final int MLC = 1;

  /** 
   * Translates characters to character classes
   */
  private static final String ZZ_CMAP_PACKED = 
    "\11\0\1\47\1\42\1\0\1\47\1\55\22\0\1\47\1\35\1\43"+
    "\1\56\1\57\1\105\1\107\1\32\1\30\1\30\1\50\1\6\1\106"+
    "\1\36\1\53\1\31\1\46\1\70\1\67\1\40\4\4\2\2\1\106"+
    "\1\111\1\33\1\27\1\34\1\26\1\0\1\75\1\3\1\103\1\74"+
    "\1\5\1\54\2\1\1\77\2\1\1\52\1\100\1\101\4\1\1\102"+
    "\1\76\1\51\2\1\1\41\2\1\1\104\1\37\1\104\1\106\1\73"+
    "\1\0\1\23\1\45\1\20\1\7\1\10\1\11\1\24\1\65\1\12"+
    "\1\71\1\61\1\14\1\25\1\13\1\17\1\22\1\72\1\16\1\15"+
    "\1\60\1\21\1\44\1\64\1\62\1\66\1\63\1\104\1\110\1\104"+
    "\1\106\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 =
    "\2\0\1\1\1\2\1\3\1\4\16\2\2\4\1\5"+
    "\1\4\1\6\4\4\1\2\1\7\1\10\2\2\1\3"+
    "\1\11\1\4\2\1\4\2\2\4\1\2\1\12\1\13"+
    "\1\12\2\14\2\3\1\15\2\2\1\16\21\2\1\16"+
    "\50\2\1\0\1\17\1\20\2\21\1\22\1\6\1\10"+
    "\1\23\5\2\1\14\6\1\1\0\11\2\1\24\1\3"+
    "\1\0\1\3\1\14\1\15\2\2\1\25\24\2\1\26"+
    "\15\2\1\25\1\2\1\25\45\2\1\6\1\27\1\6"+
    "\3\21\1\6\3\10\5\2\1\30\4\1\1\31\4\1"+
    "\6\0\13\2\1\15\1\0\27\2\1\26\36\2\1\25"+
    "\1\2\1\25\5\2\1\6\1\10\1\32\1\23\1\10"+
    "\5\2\2\30\7\1\4\0\1\31\4\0\55\2\1\30"+
    "\1\31\3\1\7\0\17\2\2\1\1\31\3\0\3\2"+
    "\2\0\1\2\1\31";

  private static int [] zzUnpackAction() {
    int [] result = new int[448];
    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\112\0\224\0\336\0\u0128\0\u0172\0\u01bc\0\u0206"+
    "\0\u0250\0\u029a\0\u02e4\0\u032e\0\u0378\0\u03c2\0\u040c\0\u0456"+
    "\0\u04a0\0\u04ea\0\u0534\0\u057e\0\u05c8\0\u0612\0\u065c\0\u06a6"+
    "\0\u06f0\0\u073a\0\u0784\0\u065c\0\u07ce\0\224\0\u065c\0\u0818"+
    "\0\u0862\0\u08ac\0\u08f6\0\u0940\0\u098a\0\u065c\0\u09d4\0\u0a1e"+
    "\0\u0a68\0\u0ab2\0\u0afc\0\u0b46\0\u0b90\0\u065c\0\u0bda\0\u065c"+
    "\0\u0c24\0\u0c6e\0\u0cb8\0\u0d02\0\u0d4c\0\u0d96\0\u0de0\0\u0e2a"+
    "\0\u0e74\0\u0ebe\0\u0f08\0\u0f52\0\u0f9c\0\u0fe6\0\u1030\0\u107a"+
    "\0\u10c4\0\u110e\0\u1158\0\u11a2\0\u11ec\0\u1236\0\u1280\0\u12ca"+
    "\0\u1314\0\u135e\0\336\0\u13a8\0\u13f2\0\u143c\0\u1486\0\u14d0"+
    "\0\u151a\0\u1564\0\u15ae\0\u15f8\0\u1642\0\u168c\0\u16d6\0\u1720"+
    "\0\u176a\0\u17b4\0\u17fe\0\u1848\0\u1892\0\u18dc\0\u1926\0\u1970"+
    "\0\u19ba\0\u1a04\0\u1a4e\0\u1a98\0\u1ae2\0\u1b2c\0\u1b76\0\u1bc0"+
    "\0\u1c0a\0\u1c54\0\u1c9e\0\u1ce8\0\u1d32\0\u1d7c\0\u1dc6\0\u1e10"+
    "\0\u1e5a\0\u1ea4\0\u1eee\0\u1f38\0\u1f82\0\u065c\0\u1fcc\0\u2016"+
    "\0\u065c\0\u2060\0\u20aa\0\u065c\0\u20f4\0\u213e\0\u2188\0\u21d2"+
    "\0\u221c\0\u2266\0\u22b0\0\u22fa\0\u2344\0\u238e\0\u23d8\0\u2422"+
    "\0\u246c\0\u24b6\0\u2500\0\u254a\0\u2594\0\u25de\0\u2628\0\u2672"+
    "\0\u26bc\0\u2706\0\u065c\0\u2750\0\u279a\0\u0c6e\0\u27e4\0\u0c6e"+
    "\0\u282e\0\u2878\0\336\0\u28c2\0\u290c\0\u2956\0\u29a0\0\u29ea"+
    "\0\u2a34\0\u2a7e\0\u2ac8\0\u2b12\0\u2b5c\0\u2ba6\0\u2bf0\0\u2c3a"+
    "\0\u2c84\0\u2cce\0\u2d18\0\u2d62\0\u2dac\0\u2df6\0\u2e40\0\336"+
    "\0\u2e8a\0\u2ed4\0\u2f1e\0\u2f68\0\u2fb2\0\u2ffc\0\u3046\0\u3090"+
    "\0\u30da\0\u3124\0\u316e\0\u31b8\0\u3202\0\u324c\0\u3296\0\u32e0"+
    "\0\u332a\0\u3374\0\u33be\0\u3408\0\u3452\0\u349c\0\u34e6\0\u3530"+
    "\0\u357a\0\u35c4\0\u360e\0\u3658\0\u36a2\0\u36ec\0\u3736\0\u3780"+
    "\0\u37ca\0\u3814\0\u385e\0\u38a8\0\u38f2\0\u393c\0\u3986\0\u39d0"+
    "\0\u3a1a\0\u3a64\0\u3aae\0\u3af8\0\u3b42\0\u3b8c\0\u3bd6\0\u3c20"+
    "\0\u3c6a\0\u3cb4\0\u3cfe\0\u3d48\0\u3d92\0\u3ddc\0\u065c\0\u3e26"+
    "\0\u3e70\0\u3eba\0\u3f04\0\u3f4e\0\u3f98\0\u3fe2\0\u402c\0\u4076"+
    "\0\u40c0\0\u410a\0\u4154\0\u419e\0\u41e8\0\u4232\0\u427c\0\u42c6"+
    "\0\u4310\0\u435a\0\u43a4\0\u43ee\0\u4438\0\u4482\0\u44cc\0\u4516"+
    "\0\u4560\0\u45aa\0\u45f4\0\u463e\0\u4688\0\u46d2\0\u471c\0\u4766"+
    "\0\u47b0\0\u47fa\0\u4844\0\u488e\0\u48d8\0\u4922\0\u496c\0\u49b6"+
    "\0\u4a00\0\u4a4a\0\u4a94\0\u4ade\0\u4b28\0\u4b72\0\u4bbc\0\u4c06"+
    "\0\u4c50\0\u4c9a\0\u4ce4\0\u4d2e\0\u4d78\0\u4dc2\0\u4e0c\0\u4e56"+
    "\0\u4ea0\0\u4eea\0\u4f34\0\u4f7e\0\u4fc8\0\u5012\0\u505c\0\u50a6"+
    "\0\u50f0\0\u513a\0\u5184\0\u51ce\0\u5218\0\u5262\0\u52ac\0\u52f6"+
    "\0\u5340\0\u538a\0\u53d4\0\u541e\0\u5468\0\u54b2\0\u54fc\0\u5546"+
    "\0\u5590\0\u55da\0\u5624\0\u566e\0\u56b8\0\u5702\0\u574c\0\u5796"+
    "\0\u57e0\0\u582a\0\u5874\0\u58be\0\u5908\0\u5952\0\u599c\0\u59e6"+
    "\0\u5a30\0\u5a7a\0\u5ac4\0\u5b0e\0\u5b58\0\u5ba2\0\u5bec\0\u5c36"+
    "\0\u5c80\0\u065c\0\u3f98\0\u5cca\0\u5d14\0\u5d5e\0\u5da8\0\u5df2"+
    "\0\u5e3c\0\u5e86\0\u5ed0\0\u5f1a\0\u5f64\0\u5fae\0\u5ff8\0\u6042"+
    "\0\u608c\0\u60d6\0\u6120\0\u616a\0\u61b4\0\u61fe\0\u6248\0\u6292"+
    "\0\u62dc\0\u6326\0\u6370\0\u63ba\0\u6404\0\u644e\0\u6498\0\u64e2"+
    "\0\u652c\0\u6576\0\u65c0\0\u660a\0\u6654\0\u669e\0\u66e8\0\u32e0"+
    "\0\u6732\0\u677c\0\u67c6\0\u6810\0\u685a\0\u68a4\0\u68ee\0\u6938"+
    "\0\u6982\0\u69cc\0\u6a16\0\u6a60\0\u6aaa\0\u6af4\0\u6b3e\0\u6b88"+
    "\0\u6bd2\0\u6c1c\0\u6c66\0\u6cb0\0\u6cfa\0\u6d44\0\u6d8e\0\u6dd8"+
    "\0\u6e22\0\u6e6c\0\u6eb6\0\u6f00\0\u6f4a\0\u6f94\0\u6fde\0\u7028"+
    "\0\u0c6e\0\224\0\u7072\0\u70bc\0\u7106\0\u7150\0\u719a\0\u71e4"+
    "\0\u722e\0\u7278\0\u72c2\0\u730c\0\u7356\0\u73a0\0\u73ea\0\u7434"+
    "\0\u747e\0\u74c8\0\u7512\0\u755c\0\u75a6\0\u75f0\0\u763a\0\u7684"+
    "\0\u76ce\0\u7718\0\u7762\0\u77ac\0\u77f6\0\u065c\0\u7840\0\u788a"+
    "\0\u78d4\0\u791e\0\u7968\0\u79b2\0\u79fc\0\u7a46\0\u7a90\0\336";

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

⌨️ 快捷键说明

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