当前位置: 首页>>代码示例>>Java>>正文


Java TokenImpl类代码示例

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


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


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