亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? token.java~1~

?? 具有不同語(yǔ)法高亮的編輯器實(shí)例
?? JAVA~1~
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
/*
 * 02/21/2004
 *
 * Token.java - A token used in syntax highlighting.
 * 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;

import java.awt.Color;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.geom.Rectangle2D;
import javax.swing.text.TabExpander;

import org.fife.RUtilities;


/**
 * A generic token that functions as a node in a linked list of syntax
 * highlighted tokens for some language.<p>
 *
 * A <code>Token</code> is a piece of text representing some logical token in
 * source code for a programming language.  For example, the line of C code:<p>
 * <pre>
 * int i = 0;
 * </pre>
 * would be broken into 8 <code>Token</code>s: the first representing
 * <code>int</code>, the second whitespace, the third <code>i</code>, the fourth
 * whitespace, the fifth <code>=</code>, etc.<p>
 *
 * @author Robert Futrell
 * @version 0.3
 */
public abstract class Token {

	/**
	 * The text this token represents.  This is implemented as a segment so we
	 * can point directly to the text in the document without having to make a
	 * copy of it.
	 */
	public char[] text;
	public int textOffset;
	public int textCount;
	
	/**
	 * The offset into the document at which this token resides.
	 */
	public int offset;

	/**
	 * The type of token this is; for example, <code>Token.FUNCTION</code>.
	 */
	public int type;

	/**
	 * The next token in this linked list.
	 */
	private Token nextToken;


/*****************************************************************************/


	// NOTE: All valid token types are >= 0, so extensions of the TokenMaker
	// class are free to internally use all ints < 0 ONLY for "end-of-line"
	// style markers; they are ignored by painting implementations.

	public static final int NULL							= 0;	// Marks EOL with no multiline token at end.

	public static final int COMMENT						= 1;	// Generic.
	public static final int COMMENT_EOL					= 2;
	public static final int COMMENT_MULTILINE				= 3;
	public static final int COMMENT_DOCUMENTATION			= 4;

	public static final int RESERVED_WORD					= 5;

	public static final int FUNCTION						= 6;

	public static final int LITERAL						= 7;	// Generic.
	public static final int LITERAL_BOOLEAN					= 8;
	public static final int LITERAL_NUMBER_DECIMAL_INT		= 9;
	public static final int LITERAL_NUMBER_FLOAT				= 10;
	public static final int LITERAL_NUMBER_HEXADECIMAL		= 11;
	public static final int LITERAL_STRING_DOUBLE_QUOTE		= 12;
	public static final int LITERAL_CHAR					= 13;	// Char or single-quote string.
	public static final int LITERAL_BACKQUOTE				= 14;	// Used in UNIX/Perl scripts.

	public static final int DATA_TYPE						= 15;

	public static final int VARIABLE						= 16;

	public static final int IDENTIFIER						= 17;

	public static final int WHITESPACE						= 18;

	public static final int SEPARATOR						= 19;

	public static final int OPERATOR						= 20;

	public static final int PREPROCESSOR					= 21;

	public static final int ERROR							= 22;	// Generic.
	public static final int ERROR_IDENTIFIER				= 23;
	public static final int ERROR_NUMBER_FORMAT				= 24;
	public static final int ERROR_STRING_DOUBLE 				= 25;
	public static final int ERROR_CHAR						= 26;	// Char or single-quote string.

	public static final int NUM_TOKEN_TYPES					= 27;


/*****************************************************************************/


	/**
	 * Creates a "null token."  The token itself is not null; rather, it
	 * signifies that it is the last token in a linked list of tokens and
	 * that it is not part of a "multiline token."
	 */
	public Token() {
		this.text = null;
		this.textOffset = -1;
		this.textCount = -1;
		this.type = NULL;
		offset = -1;
		nextToken = null;
	}


/*****************************************************************************/


	/**
	 * Constructor.
	 *
	 * @param line The segment from which to get the token.
	 * @param beg The first character's position in <code>line</code>.
	 * @param end The last character's position in <code>line</code>.
	 * @param startOffset The offset into the document at which this
	 *                    token begins.
	 * @param type A token type listed as "generic" above.
	 */
	public Token(final char[] line, final int beg, final int end,
							final int startOffset, final int type) {
		this();
		set(line, beg,end, startOffset, type);
	}


/*****************************************************************************/


	/**
	 * Creates this token as a deep copy of the passed-in token.
	 *
	 * @param t2 The token from which to make a copy.
	 */
	public Token(Token t2) {
		this();
		copyFrom(t2);
	}


/*****************************************************************************/


	/**
	 * Returns whether the token straddles the specified position in the
	 * document.
	 *
	 * @param pos The position in the document to check.
	 * @return Whether the specified position is straddled by this token.
	 */
	public boolean containsPosition(int pos) {
		return pos>=offset && pos<offset+textCount;
	}


/*****************************************************************************/


	/**
	 * Makes one token point to the same text segment, and have the same value
	 * as another token.
	 *
	 * @param t2 The token from which to copy.
	 */
	public void copyFrom(Token t2) {
		text = t2.text;
		textOffset = t2.textOffset;
		textCount = t2.textCount;
		offset = t2.offset;
		type = t2.type;
		nextToken = t2.nextToken;
	}


/*****************************************************************************/


	/**
	 * Returns the position in the token's internal char array corresponding
	 * to the specified document position.<p>
	 * Note that this method does NOT do any bounds checking; you can pass in
	 * a document position that does not correspond to a position in this
	 * token, and you will not receive an Exception or any other notification;
	 * it is up to the caller to ensure valid input.
	 *
	 * @param pos A position in the document that is represented by this token.
	 * @return The corresponding token position >= <code>textOffset</code> and
	 *         < <code>textOffset+textCount</code>.
	 * @see #tokenToDocument
	 */
	public int documentToToken(int pos) {
		return pos + (textOffset-offset);
	}


/*****************************************************************************/


	/**
	 * Returns a <code>String</code> containing HTML code for painting this
	 * token, using the given text area's color scheme.
	 *
	 * @param textArea The text area whose color scheme to use.
	 * @return The HTML representation of the token.
	 */
	public String getHTMLRepresentation(final RSyntaxTextArea textArea) {
		final SyntaxHighlightingColorScheme colorScheme =
					textArea.getSyntaxHighlightingColorScheme();
		final SyntaxScheme scheme = colorScheme.syntaxSchemes[type];
		Font font = scheme.font;
		StringBuffer buf = new StringBuffer();
		if (font.isBold()) buf.append("<b>");
		if (font.isItalic()) buf.append("<em>");
		buf.append("<font face=\"").append(font.getFamily()).
		    append("\" color=\"").
		    append(RUtilities.getHTMLFormatForColor(scheme.foreground)).
		    append("\">");
		// NOTE: Don't use getLexeme().trim() because whitespace tokens will
		// be turned into NOTHING.
		String text = getLexeme()./*replaceAll(" ", "&nbsp;").
					replaceAll("\t", "&nbsp;").*/replaceAll("<", "&lt;").
					replaceAll(">", "&gt;");
		buf.append(text);
		buf.append("</font>");
		if (font.isItalic()) buf.append("</em>");
		if (font.isBold()) buf.append("</b>");
		return buf.toString();
	}


/*****************************************************************************/


	/**
	 * Returns the text of this token, as a string.<p>
	 *
	 * Note that this method isn't used much by the
	 * <code>rsyntaxtextarea</code> package internally, as it tries to limit
	 * memory allocation.
	 *
	 * @return The text of this token.
	 */
	public String getLexeme() {
		return new String(text, textOffset, textCount);
	}


/*****************************************************************************/


	/**
	 * Determines the offset into this token list (i.e., into the
	 * document) that covers pixel location <code>x</code> if the token list
	 * starts at pixel location <code>x0</code><p>.
	 * This method will return the document position "closest" to the
	 * x-coordinate (i.e., if they click on the "right-half" of the
	 * <code>w</code> in <code>awe</code>, the caret will be placed in
	 * between the <code>w</code> and <code>e</code>; similarly, clicking on
	 * the left-half places the caret between the <code>a</code> and
	 * <code>w</code>).  This makes it useful for methods such as
	 * <code>viewToModel</code> found in <code>javax.swing.text.View</code>
	 * subclasses.<p>
	 *
	 * This method is abstract so subclasses who paint themselves differently
	 * (i.e., {@link VisibleWhitespaceToken} is painted a tad differently than
	 * {@link DefaultToken} when rendering hints are enabled) can still return
	 * accurate results.
	 *
	 * @param textArea The text area from which the token list was derived.
	 * @param e How to expand tabs.
	 * @param x0 The pixel x-location that is the beginning of
	 *           <code>tokenList</code>.
	 * @param x The pixel-position for which you want to get the corresponding
	 *          offset.
	 * @return The position (in the document, NOT into the token list!) that
	 *         covers the pixel location.  If <code>tokenList</code> is
	 *         <code>null</code> or has type <code>Token.NULL</code>, then
	 *         <code>-1</code is returned; the caller should recognize this and
	 *         return the actual end position of the (empty) line.
	 */
	public abstract int getListOffset(RSyntaxTextArea textArea, TabExpander e,
								float x0, float x);


/*****************************************************************************/


	/**
	 * Returns the token after this one in the linked list.
	 *
	 * @return The next token.
	 * @see #setNextToken

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产麻豆精品在线| 欧美精品一区二区三区四区| 岛国av在线一区| 美女看a上一区| 午夜久久久影院| 亚洲chinese男男1069| 一区二区三区欧美在线观看| 亚洲欧美自拍偷拍| 亚洲国产高清aⅴ视频| 久久久精品一品道一区| 久久综合狠狠综合| 国产日产欧产精品推荐色| 欧美精品一区视频| 久久久久久久av麻豆果冻| 久久久美女毛片| 久久久99精品免费观看不卡| 久久精品免视看| 欧美韩国日本一区| 国产精品美女久久久久久久| 中文字幕在线不卡国产视频| 亚洲人成电影网站色mp4| 国产精品麻豆欧美日韩ww| 国产精品国产三级国产a| 国产盗摄视频一区二区三区| 丁香一区二区三区| 91免费版在线看| 欧美影院一区二区| 欧美一区二区三区播放老司机| 欧美一区二区三区白人| wwwwww.欧美系列| 久久久不卡影院| 亚洲欧洲精品一区二区精品久久久| 亚洲欧洲无码一区二区三区| 亚洲免费在线观看| 亚洲mv在线观看| 久久国产精品99久久人人澡| 国产精品中文欧美| 99在线精品一区二区三区| 91激情五月电影| 91精品久久久久久久99蜜桃| 精品国产乱码久久久久久夜甘婷婷| 国产欧美日韩一区二区三区在线观看| 综合激情成人伊人| 日韩和欧美一区二区| 奇米精品一区二区三区在线观看一 | 日本vs亚洲vs韩国一区三区二区| 麻豆精品一二三| 成人激情综合网站| 欧美日韩国产另类不卡| 精品国产伦一区二区三区观看方式 | 欧美日韩国产欧美日美国产精品| 日韩欧美激情一区| 中文字幕一区二区三区乱码在线| 亚洲一级二级在线| 国产在线播放一区三区四| 91亚洲国产成人精品一区二三 | 国产精品二区一区二区aⅴ污介绍| 亚洲一线二线三线视频| 精品一区免费av| 91污在线观看| 日韩欧美一级特黄在线播放| 国产精品美女一区二区| 日本女人一区二区三区| 成人av在线资源网| 欧美一级片免费看| 亚洲女同ⅹxx女同tv| 激情五月激情综合网| 日本国产一区二区| 毛片基地黄久久久久久天堂| 97精品久久久午夜一区二区三区| 欧美一区二区三区四区久久| 日韩毛片视频在线看| 韩国v欧美v日本v亚洲v| 欧美日韩在线播放三区四区| 国产欧美一区在线| 日本不卡在线视频| 在线视频国内自拍亚洲视频| 国产女主播一区| 久久精品久久久精品美女| 在线免费观看不卡av| 欧美激情综合在线| 久久99热国产| 欧美福利一区二区| 一区二区视频在线| 成人美女视频在线观看| 精品国产伦一区二区三区观看体验| 亚洲国产精品一区二区www在线 | 琪琪一区二区三区| 欧美亚一区二区| 亚洲人成小说网站色在线| 国产精品综合二区| 精品美女一区二区三区| 午夜视频在线观看一区二区三区| 99精品国产视频| 国产日韩精品一区二区三区在线| 久久99精品久久只有精品| 91.com在线观看| 午夜精品久久一牛影视| 欧美亚洲动漫精品| 一区二区三区日韩欧美精品| 99国内精品久久| 国产精品麻豆一区二区| 成熟亚洲日本毛茸茸凸凹| 26uuu久久天堂性欧美| 免费不卡在线视频| 欧美一区二区免费观在线| 午夜欧美大尺度福利影院在线看| 欧美影院精品一区| 亚洲一二三四区| 欧美在线free| 亚洲午夜私人影院| 欧美日韩在线播放| 性欧美疯狂xxxxbbbb| 欧美群妇大交群的观看方式| 亚洲国产成人高清精品| 欧美视频精品在线观看| 午夜久久久久久| 91麻豆精品国产| 蜜臀av性久久久久蜜臀aⅴ四虎| 欧美一区二区三区不卡| 日韩一区二区三区免费观看| 天天色天天操综合| 日韩女优制服丝袜电影| 久草中文综合在线| 久久久不卡网国产精品二区| 国产黄色成人av| 中文字幕在线不卡一区| 色哟哟国产精品| 三级一区在线视频先锋| 日韩欧美国产综合一区 | 一色屋精品亚洲香蕉网站| 成人av电影在线| 亚洲欧美另类综合偷拍| 欧洲一区二区三区在线| 日韩精品乱码av一区二区| 日韩午夜在线影院| 国产二区国产一区在线观看| 亚洲婷婷在线视频| 欧美在线播放高清精品| 麻豆精品久久久| 欧美国产亚洲另类动漫| 色域天天综合网| 日韩福利视频网| 久久人人超碰精品| 91丨porny丨蝌蚪视频| 午夜日韩在线观看| 久久久久久久久久久黄色| 91美女在线看| 免费在线观看精品| 日本一区二区视频在线观看| 色国产精品一区在线观看| 日韩国产精品91| 欧美国产欧美综合| 欧美日韩综合不卡| 国产成人精品影院| 亚洲v日本v欧美v久久精品| 日本欧美一区二区| 中文无字幕一区二区三区| 欧美性大战久久久久久久蜜臀| 久久99国产乱子伦精品免费| 成人欧美一区二区三区白人| 这里只有精品视频在线观看| 顶级嫩模精品视频在线看| 亚洲成人av中文| 国产亚洲综合在线| 欧美欧美午夜aⅴ在线观看| 懂色av一区二区夜夜嗨| 午夜精品福利一区二区蜜股av| 久久精品一二三| 欧美精品一二三四| 成人动漫一区二区三区| 日韩av二区在线播放| 日韩毛片高清在线播放| 精品免费99久久| 欧美人与禽zozo性伦| 成人黄色片在线观看| 蜜臀av性久久久久蜜臀aⅴ流畅 | 777久久久精品| 成人高清视频在线观看| 美脚の诱脚舐め脚责91| 亚洲精品菠萝久久久久久久| 久久天堂av综合合色蜜桃网| 欧美日韩精品三区| av不卡在线播放| 国内精品伊人久久久久影院对白| 亚洲一区二区三区四区五区黄| 国产欧美精品一区| 欧美成人video| 欧美日本一道本在线视频| 97se亚洲国产综合在线| 国产黑丝在线一区二区三区| 日韩精品久久理论片| 亚洲一区二区三区在线看| 最新欧美精品一区二区三区| 国产午夜精品久久久久久久| 欧美v亚洲v综合ⅴ国产v| 欧美精品一卡二卡| 亚洲夂夂婷婷色拍ww47| 1000精品久久久久久久久| 欧美经典三级视频一区二区三区|