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


Java Token.length方法代码示例

本文整理汇总了Java中org.fife.ui.rsyntaxtextarea.Token.length方法的典型用法代码示例。如果您正苦于以下问题:Java Token.length方法的具体用法?Java Token.length怎么用?Java Token.length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.fife.ui.rsyntaxtextarea.Token的用法示例。


在下文中一共展示了Token.length方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testJS_EolComments_URL

import org.fife.ui.rsyntaxtextarea.Token; //导入方法依赖的package包/类
@Test
public void testJS_EolComments_URL() {

	String[] eolCommentLiterals = {
		// Note: The 0-length token at the end of the first example is a
		// minor bug/performance thing
		"// Hello world http://www.sas.com",
		"// Hello world http://www.sas.com extra",
	};

	for (String code : eolCommentLiterals) {

		Segment segment = createSegment(code);
		JavaScriptTokenMaker tm = new JavaScriptTokenMaker();

		Token token = tm.getTokenList(segment, JS_PREV_TOKEN_TYPE, 0);
		Assert.assertEquals(TokenTypes.COMMENT_EOL, token.getType());

		token = token.getNextToken();
		Assert.assertTrue(token.isHyperlink());
		Assert.assertEquals(TokenTypes.COMMENT_EOL, token.getType());
		Assert.assertEquals("http://www.sas.com", token.getLexeme());

		token = token.getNextToken();
		// Note: The 0-length token at the end of the first example is a
		// minor bug/performance thing
		if (token != null && token.isPaintable() && token.length() > 0) {
			Assert.assertFalse(token.isHyperlink());
			Assert.assertTrue(token.is(TokenTypes.COMMENT_EOL, " extra"));
		}

	}

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

示例2: testJS_EolComments_URL

import org.fife.ui.rsyntaxtextarea.Token; //导入方法依赖的package包/类
@Test
public void testJS_EolComments_URL() {

	String[] eolCommentLiterals = {
		// Note: The 0-length token at the end of the first example is a
		// minor bug/performance thing
		"// Hello world http://www.sas.com",
		"// Hello world http://www.sas.com extra",
	};

	for (String code : eolCommentLiterals) {

		Segment segment = createSegment(code);
		TokenMaker tm = createTokenMaker();

		Token token = tm.getTokenList(segment, HTMLTokenMaker.INTERNAL_IN_JS, 0);
		Assert.assertEquals("nope - " + token, TokenTypes.COMMENT_EOL, token.getType());

		token = token.getNextToken();
		Assert.assertTrue(token.isHyperlink());
		Assert.assertEquals(TokenTypes.COMMENT_EOL, token.getType());
		Assert.assertEquals("http://www.sas.com", token.getLexeme());

		token = token.getNextToken();
		// Note: The 0-length token at the end of the first example is a
		// minor bug/performance thing
		if (token != null && token.isPaintable() && token.length() > 0) {
			Assert.assertFalse(token.isHyperlink());
			Assert.assertTrue(token.is(TokenTypes.COMMENT_EOL, " extra"));
		}

	}

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

示例3: testTS_EolComments_URL

import org.fife.ui.rsyntaxtextarea.Token; //导入方法依赖的package包/类
@Test
public void testTS_EolComments_URL() {

	String[] eolCommentLiterals = {
		// Note: The 0-length token at the end of the first example is a
		// minor bug/performance thing
		"// Hello world http://www.sas.com",
		"// Hello world http://www.sas.com extra",
	};

	for (String code : eolCommentLiterals) {

		Segment segment = createSegment(code);
		TokenMaker tm = createTokenMaker();

		Token token = tm.getTokenList(segment, TS_PREV_TOKEN_TYPE, 0);
		Assert.assertEquals(TokenTypes.COMMENT_EOL, token.getType());

		token = token.getNextToken();
		Assert.assertTrue(token.isHyperlink());
		Assert.assertEquals(TokenTypes.COMMENT_EOL, token.getType());
		Assert.assertEquals("http://www.sas.com", token.getLexeme());

		token = token.getNextToken();
		// Note: The 0-length token at the end of the first example is a
		// minor bug/performance thing
		if (token != null && token.isPaintable() && token.length() > 0) {
			Assert.assertFalse(token.isHyperlink());
			Assert.assertTrue(token.is(TokenTypes.COMMENT_EOL, " extra"));
		}

	}

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

示例4: testJS_EolComments_URL

import org.fife.ui.rsyntaxtextarea.Token; //导入方法依赖的package包/类
@Test
public void testJS_EolComments_URL() {

	String[] eolCommentLiterals = {
		// Note: The 0-length token at the end of the first example is a
		// minor bug/performance thing
		"// Hello world http://www.sas.com",
		"// Hello world http://www.sas.com extra",
	};

	for (String code : eolCommentLiterals) {

		Segment segment = createSegment(code);
		TokenMaker tm = createTokenMaker();

		Token token = tm.getTokenList(segment, TokenTypes.NULL, 0);
		Assert.assertEquals(TokenTypes.COMMENT_EOL, token.getType());

		token = token.getNextToken();
		Assert.assertTrue(token.isHyperlink());
		Assert.assertEquals(TokenTypes.COMMENT_EOL, token.getType());
		Assert.assertEquals("http://www.sas.com", token.getLexeme());

		token = token.getNextToken();
		// Note: The 0-length token at the end of the first example is a
		// minor bug/performance thing
		if (token != null && token.isPaintable() && token.length() > 0) {
			Assert.assertFalse(token.isHyperlink());
			Assert.assertTrue(token.is(TokenTypes.COMMENT_EOL, " extra"));
		}

	}

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


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