• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java TokenImpl类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.fife.ui.rsyntaxtextarea.TokenImpl的典型用法代码示例。如果您正苦于以下问题:Java TokenImpl类的具体用法?Java TokenImpl怎么用?Java TokenImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TokenImpl类属于org.fife.ui.rsyntaxtextarea包,在下文中一共展示了TokenImpl类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testGetTokenList_identifierStart_LiteralBackQuote

import org.fife.ui.rsyntaxtextarea.TokenImpl; //导入依赖的package包/类
@Test
public void testGetTokenList_identifierStart_LiteralBackQuote() {

	UnixShellTokenMaker tm = new UnixShellTokenMaker();

	String text = "foo`cat foo.txt`";
	Segment s = createSegment(text);
	Token token = tm.getTokenList(s, TokenTypes.NULL, 0);
	Assert.assertTrue(token.is(TokenTypes.IDENTIFIER, "foo"));
	token = token.getNextToken();
	Assert.assertTrue(token.is(TokenTypes.LITERAL_BACKQUOTE, "`cat foo.txt`"));

	token = token.getNextToken();
	Assert.assertEquals(new TokenImpl(), token);

}
 
开发者ID:curiosag,项目名称:ftc,代码行数:17,代码来源:UnixShellTokenMakerTest.java


示例2: testGetTokenList_identifierStart_LiteralDoubleQuote

import org.fife.ui.rsyntaxtextarea.TokenImpl; //导入依赖的package包/类
@Test
public void testGetTokenList_identifierStart_LiteralDoubleQuote() {

	UnixShellTokenMaker tm = new UnixShellTokenMaker();

	String text = "foo\"Hello world\"";
	Segment s = createSegment(text);
	Token token = tm.getTokenList(s, TokenTypes.NULL, 0);
	Assert.assertTrue(token.is(TokenTypes.IDENTIFIER, "foo"));
	token = token.getNextToken();
	Assert.assertTrue(token.is(TokenTypes.LITERAL_STRING_DOUBLE_QUOTE, "\"Hello world\""));

	token = token.getNextToken();
	Assert.assertEquals(new TokenImpl(), token);

}
 
开发者ID:curiosag,项目名称:ftc,代码行数:17,代码来源:UnixShellTokenMakerTest.java


示例3: testGetTokenList_identifierStart_LiteralSingleQuote

import org.fife.ui.rsyntaxtextarea.TokenImpl; //导入依赖的package包/类
@Test
public void testGetTokenList_identifierStart_LiteralSingleQuote() {

	UnixShellTokenMaker tm = new UnixShellTokenMaker();

	String text = "foo'Hello world'";
	Segment s = createSegment(text);
	Token token = tm.getTokenList(s, TokenTypes.NULL, 0);
	Assert.assertTrue(token.is(TokenTypes.IDENTIFIER, "foo"));
	token = token.getNextToken();
	Assert.assertTrue(token.is(TokenTypes.LITERAL_CHAR, "'Hello world'"));

	token = token.getNextToken();
	Assert.assertEquals(new TokenImpl(), token);

}
 
开发者ID:curiosag,项目名称:ftc,代码行数:17,代码来源:UnixShellTokenMakerTest.java


示例4: testGetTokenList_nullStart_EscapedBackQuote

import org.fife.ui.rsyntaxtextarea.TokenImpl; //导入依赖的package包/类
@Test
public void testGetTokenList_nullStart_EscapedBackQuote() {

	UnixShellTokenMaker tm = new UnixShellTokenMaker();

	// Parsed as two identifiers: '\\' and '`'
	String text = "\\`";
	Segment s = createSegment(text);
	Token token = tm.getTokenList(s, TokenTypes.NULL, 0);
	Assert.assertTrue("Unexpected token type: " + token,
			token.is(TokenTypes.IDENTIFIER, "\\"));
	token = token.getNextToken();
	Assert.assertTrue("Unexpected token type: " + token,
			token.is(TokenTypes.IDENTIFIER, "`"));

	token = token.getNextToken();
	Assert.assertEquals(new TokenImpl(), token);

}
 
开发者ID:curiosag,项目名称:ftc,代码行数:20,代码来源:UnixShellTokenMakerTest.java


示例5: testGetTokenList_nullStart_EscapedDollarSign

import org.fife.ui.rsyntaxtextarea.TokenImpl; //导入依赖的package包/类
@Test
public void testGetTokenList_nullStart_EscapedDollarSign() {

	UnixShellTokenMaker tm = new UnixShellTokenMaker();

	// Parsed as two identifiers: '\\' and '$'
	String text = "\\$";
	Segment s = createSegment(text);
	Token token = tm.getTokenList(s, TokenTypes.NULL, 0);
	Assert.assertTrue("Unexpected token type: " + token,
			token.is(TokenTypes.IDENTIFIER, "\\"));
	token = token.getNextToken();
	Assert.assertTrue("Unexpected token type: " + token,
			token.is(TokenTypes.IDENTIFIER, "$"));

	token = token.getNextToken();
	Assert.assertEquals(new TokenImpl(), token);

}
 
开发者ID:curiosag,项目名称:ftc,代码行数:20,代码来源:UnixShellTokenMakerTest.java


示例6: testGetTokenList_nullStart_EscapedDoubleQuote

import org.fife.ui.rsyntaxtextarea.TokenImpl; //导入依赖的package包/类
@Test
public void testGetTokenList_nullStart_EscapedDoubleQuote() {

	UnixShellTokenMaker tm = new UnixShellTokenMaker();

	// Parsed as two identifiers: '\\' and '"'
	String text = "\\\"";
	Segment s = createSegment(text);
	Token token = tm.getTokenList(s, TokenTypes.NULL, 0);
	Assert.assertTrue("Unexpected token type: " + token,
			token.is(TokenTypes.IDENTIFIER, "\\"));
	token = token.getNextToken();
	Assert.assertTrue("Unexpected token type: " + token,
			token.is(TokenTypes.IDENTIFIER, "\""));

	token = token.getNextToken();
	Assert.assertEquals(new TokenImpl(), token);

}
 
开发者ID:curiosag,项目名称:ftc,代码行数:20,代码来源:UnixShellTokenMakerTest.java


示例7: testGetTokenList_nullStart_EscapedSingleQuote

import org.fife.ui.rsyntaxtextarea.TokenImpl; //导入依赖的package包/类
@Test
public void testGetTokenList_nullStart_EscapedSingleQuote() {

	UnixShellTokenMaker tm = new UnixShellTokenMaker();

	// Parsed as two identifiers: '\\' and "'"
	String text = "\\'";
	Segment s = createSegment(text);
	Token token = tm.getTokenList(s, TokenTypes.NULL, 0);
	Assert.assertTrue("Unexpected token type: " + token,
			token.is(TokenTypes.IDENTIFIER, "\\"));
	token = token.getNextToken();
	Assert.assertTrue("Unexpected token type: " + token,
			token.is(TokenTypes.IDENTIFIER, "'"));

	token = token.getNextToken();
	Assert.assertEquals(new TokenImpl(), token);

}
 
开发者ID:curiosag,项目名称:ftc,代码行数:20,代码来源:UnixShellTokenMakerTest.java


示例8: testGetTokenList_nullStart_Variable

import org.fife.ui.rsyntaxtextarea.TokenImpl; //导入依赖的package包/类
@Test
public void testGetTokenList_nullStart_Variable() {

	UnixShellTokenMaker tm = new UnixShellTokenMaker();

	String text = "$PATH";
	Segment s = createSegment(text);
	Token token = tm.getTokenList(s, TokenTypes.NULL, 0);
	Assert.assertTrue(token.is(TokenTypes.VARIABLE, text));

	token = token.getNextToken();
	Assert.assertEquals(new TokenImpl(), token);

	text = "${varName}";
	s = createSegment(text);
	token = tm.getTokenList(s, TokenTypes.NULL, 0);
	Assert.assertTrue(token.is(TokenTypes.VARIABLE, text));

	token = token.getNextToken();
	Assert.assertEquals(new TokenImpl(), token);

}
 
开发者ID:curiosag,项目名称:ftc,代码行数:23,代码来源:UnixShellTokenMakerTest.java


示例9: testGetTokenList_whitespaceStart_EolComment

import org.fife.ui.rsyntaxtextarea.TokenImpl; //导入依赖的package包/类
@Test
public void testGetTokenList_whitespaceStart_EolComment() {

	UnixShellTokenMaker tm = new UnixShellTokenMaker();

	String text = " # This is a comment";
	Segment s = createSegment(text);
	Token token = tm.getTokenList(s, TokenTypes.NULL, 0);
	Assert.assertTrue(token.isSingleChar(TokenTypes.WHITESPACE, ' '));
	token = token.getNextToken();
	Assert.assertTrue("Unexpected token type: " + token,
			token.is(TokenTypes.COMMENT_EOL, text.trim()));

	token = token.getNextToken();
	Assert.assertEquals(new TokenImpl(), token);

}
 
开发者ID:curiosag,项目名称:ftc,代码行数:18,代码来源:UnixShellTokenMakerTest.java


示例10: testGetTokenList_whitespaceStart_LiteralBackQuote

import org.fife.ui.rsyntaxtextarea.TokenImpl; //导入依赖的package包/类
@Test
public void testGetTokenList_whitespaceStart_LiteralBackQuote() {

	UnixShellTokenMaker tm = new UnixShellTokenMaker();

	String text = " `cat foo.txt`";
	Segment s = createSegment(text);
	Token token = tm.getTokenList(s, TokenTypes.NULL, 0);
	Assert.assertTrue(token.isSingleChar(TokenTypes.WHITESPACE, ' '));
	token = token.getNextToken();
	Assert.assertTrue(token.is(TokenTypes.LITERAL_BACKQUOTE, text.trim()));

	token = token.getNextToken();
	Assert.assertEquals(new TokenImpl(), token);

}
 
开发者ID:curiosag,项目名称:ftc,代码行数:17,代码来源:UnixShellTokenMakerTest.java


示例11: testGetTokenList_whitespaceStart_LiteralDoubleQuote

import org.fife.ui.rsyntaxtextarea.TokenImpl; //导入依赖的package包/类
@Test
public void testGetTokenList_whitespaceStart_LiteralDoubleQuote() {

	UnixShellTokenMaker tm = new UnixShellTokenMaker();

	String text = " \"Hello world\"";
	Segment s = createSegment(text);
	Token token = tm.getTokenList(s, TokenTypes.NULL, 0);
	Assert.assertTrue(token.isSingleChar(TokenTypes.WHITESPACE, ' '));
	token = token.getNextToken();
	Assert.assertTrue(token.is(TokenTypes.LITERAL_STRING_DOUBLE_QUOTE, text.trim()));

	token = token.getNextToken();
	Assert.assertEquals(new TokenImpl(), token);

}
 
开发者ID:curiosag,项目名称:ftc,代码行数:17,代码来源:UnixShellTokenMakerTest.java


示例12: testGetTokenList_whitespaceStart_LiteralSingleQuote

import org.fife.ui.rsyntaxtextarea.TokenImpl; //导入依赖的package包/类
@Test
public void testGetTokenList_whitespaceStart_LiteralSingleQuote() {

	UnixShellTokenMaker tm = new UnixShellTokenMaker();

	String text = " 'Hello world'";
	Segment s = createSegment(text);
	Token token = tm.getTokenList(s, TokenTypes.NULL, 0);
	Assert.assertTrue(token.isSingleChar(TokenTypes.WHITESPACE, ' '));
	token = token.getNextToken();
	Assert.assertTrue(token.is(TokenTypes.LITERAL_CHAR, text.trim()));

	token = token.getNextToken();
	Assert.assertEquals(new TokenImpl(), token);

}
 
开发者ID:curiosag,项目名称:ftc,代码行数:17,代码来源:UnixShellTokenMakerTest.java


示例13: testGetTokenList_whitespaceStart_Variable

import org.fife.ui.rsyntaxtextarea.TokenImpl; //导入依赖的package包/类
@Test
public void testGetTokenList_whitespaceStart_Variable() {

	UnixShellTokenMaker tm = new UnixShellTokenMaker();

	String text = " $PATH";
	Segment s = createSegment(text);
	Token token = tm.getTokenList(s, TokenTypes.NULL, 0);
	Assert.assertTrue(token.isSingleChar(TokenTypes.WHITESPACE, ' '));
	token = token.getNextToken();
	Assert.assertTrue(token.is(TokenTypes.VARIABLE, text.trim()));

	token = token.getNextToken();
	Assert.assertEquals(new TokenImpl(), token);

}
 
开发者ID:curiosag,项目名称:ftc,代码行数:17,代码来源:UnixShellTokenMakerTest.java


示例14: getTokenList

import org.fife.ui.rsyntaxtextarea.TokenImpl; //导入依赖的package包/类
/**
 * Returns the first token in the linked list of tokens generated
 * from <code>text</code>.  This method must be implemented by
 * subclasses so they can correctly implement syntax highlighting.
 *
 * @param text The text from which to get tokens.
 * @param initialTokenType The token type we should start with.
 * @param startOffset The offset into the document at which
 *        <code>text</code> starts.
 * @return The first <code>Token</code> in a linked list representing
 *         the syntax highlighted text.
 */
public Token getTokenList(Segment text, int initialTokenType, int startOffset) {

	resetTokenList();
	this.offsetShift = -text.offset + startOffset;

	// Start off in the proper state.
	int state = Token.NULL;
	switch (initialTokenType) {
		case Token.LITERAL_STRING_DOUBLE_QUOTE:
			state = LONG_STRING_2;
			break;
		case Token.LITERAL_CHAR:
			state = LONG_STRING_1;
			break;
		default:
			state = Token.NULL;
	}

	s = text;
	try {
		yyreset(zzReader);
		yybegin(state);
		return yylex();
	} catch (IOException ioe) {
		ioe.printStackTrace();
		return new TokenImpl();
	}

}
 
开发者ID:curiosag,项目名称:ftc,代码行数:42,代码来源:PythonTokenMaker.java


示例15: testGetTokenList_nullStart_EolComment

import org.fife.ui.rsyntaxtextarea.TokenImpl; //导入依赖的package包/类
@Test
public void testGetTokenList_nullStart_EolComment() {

	UnixShellTokenMaker tm = new UnixShellTokenMaker();

	String text = "# This is a comment";
	Segment s = createSegment(text);
	Token token = tm.getTokenList(s, TokenTypes.NULL, 0);
	Assert.assertTrue("Unexpected token type: " + token,
			token.is(TokenTypes.COMMENT_EOL, text));

	token = token.getNextToken();
	Assert.assertEquals(new TokenImpl(), token);

}
 
开发者ID:curiosag,项目名称:ftc,代码行数:16,代码来源:UnixShellTokenMakerTest.java


示例16: testGetTokenList_nullStart_LiteralBackQuote

import org.fife.ui.rsyntaxtextarea.TokenImpl; //导入依赖的package包/类
@Test
public void testGetTokenList_nullStart_LiteralBackQuote() {

	UnixShellTokenMaker tm = new UnixShellTokenMaker();

	String text = "`cat foo.txt`";
	Segment s = createSegment(text);
	Token token = tm.getTokenList(s, TokenTypes.NULL, 0);
	Assert.assertTrue(token.is(TokenTypes.LITERAL_BACKQUOTE, text));

	token = token.getNextToken();
	Assert.assertEquals(new TokenImpl(), token);

}
 
开发者ID:curiosag,项目名称:ftc,代码行数:15,代码来源:UnixShellTokenMakerTest.java


示例17: testGetTokenList_nullStart_LiteralDoubleQuote

import org.fife.ui.rsyntaxtextarea.TokenImpl; //导入依赖的package包/类
@Test
public void testGetTokenList_nullStart_LiteralDoubleQuote() {

	UnixShellTokenMaker tm = new UnixShellTokenMaker();

	String text = "\"Hello world\"";
	Segment s = createSegment(text);
	Token token = tm.getTokenList(s, TokenTypes.NULL, 0);
	Assert.assertTrue(token.is(TokenTypes.LITERAL_STRING_DOUBLE_QUOTE, text));

	token = token.getNextToken();
	Assert.assertEquals(new TokenImpl(), token);

}
 
开发者ID:curiosag,项目名称:ftc,代码行数:15,代码来源:UnixShellTokenMakerTest.java


示例18: testGetTokenList_nullStart_LiteralSingleQuote

import org.fife.ui.rsyntaxtextarea.TokenImpl; //导入依赖的package包/类
@Test
public void testGetTokenList_nullStart_LiteralSingleQuote() {

	UnixShellTokenMaker tm = new UnixShellTokenMaker();

	String text = "'Hello world'";
	Segment s = createSegment(text);
	Token token = tm.getTokenList(s, TokenTypes.NULL, 0);
	Assert.assertTrue(token.is(TokenTypes.LITERAL_CHAR, text));

	token = token.getNextToken();
	Assert.assertEquals(new TokenImpl(), token);

}
 
开发者ID:curiosag,项目名称:ftc,代码行数:15,代码来源:UnixShellTokenMakerTest.java


示例19: getTokenList

import org.fife.ui.rsyntaxtextarea.TokenImpl; //导入依赖的package包/类
/**
 * Returns the first token in the linked list of tokens generated
 * from <code>text</code>.  This method must be implemented by
 * subclasses so they can correctly implement syntax highlighting.
 *
 * @param text             The text from which to get tokens.
 * @param initialTokenType The token type we should start with.
 * @param startOffset      The offset into the document at which
 *                         <code>text</code> starts.
 * @return The first <code>Token</code> in a linked list representing
 * the syntax highlighted text.
 */
public Token getTokenList(Segment text, int initialTokenType, int startOffset)
{

    resetTokenList();
    this.offsetShift = -text.offset + startOffset;

    // Start off in the proper state.
    int state = Token.NULL;
    switch (initialTokenType)
    {
        default:
            state = Token.NULL;
    }

    s = text;
    try
    {
        yyreset(zzReader);
        yybegin(state);
        return yylex();
    }
    catch (IOException ioe)
    {
        ioe.printStackTrace();
        return new TokenImpl();
    }

}
 
开发者ID:dries007,项目名称:j8051,代码行数:41,代码来源:Assembler8051TokenMaker.java


示例20: checkForLinkableToken

import org.fife.ui.rsyntaxtextarea.TokenImpl; //导入依赖的package包/类
/**
 * Checks if the token at the specified offset is possibly a "click-able"
 * region.
 *
 * @param textArea The text area.
 * @param offs The offset, presumably at the mouse position.
 * @return A result object.
 */
private IsLinkableCheckResult checkForLinkableToken(
		RSyntaxTextArea textArea, int offs) {

	IsLinkableCheckResult result = null;

	if (offs>=0) {

		try {

			int line = textArea.getLineOfOffset(offs);
			Token first = textArea.getTokenListForLine(line);
			Token prev = null;

			for (Token t=first; t!=null && t.isPaintable(); t=t.getNextToken()) {

				if (t.containsPosition(offs)) {

					// RSTA's tokens are pooled and re-used, so we must
					// defensively make a copy of the one we want to keep!
					Token token = new TokenImpl(t);
					boolean isMethod = false;

					if (prev==null) {
						prev = RSyntaxUtilities.getPreviousImportantToken(textArea, line-1);
					}
					if (prev!=null && prev.isSingleChar('.')) {
						// Not a field or method defined in this class.
						break;
					}

					Token next = RSyntaxUtilities.getNextImportantToken(
							t.getNextToken(), textArea, line);
					if (next!=null && next.isSingleChar(Token.SEPARATOR, '(')) {
						isMethod = true;
					}

					result = new IsLinkableCheckResult(token, isMethod);
					break;

				}

				else if (!t.isCommentOrWhitespace()) {
					prev = t;
				}

			}

		} catch (BadLocationException ble) {
			ble.printStackTrace(); // Never happens
		}

	}

	return result;

}
 
开发者ID:pyros2097,项目名称:GdxStudio,代码行数:65,代码来源:JavaLinkGenerator.java



注:本文中的org.fife.ui.rsyntaxtextarea.TokenImpl类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MimeTypesFactory类代码示例发布时间:2022-05-23
下一篇:
Java MaxIterationsExceededException类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap