本文整理汇总了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"));
}
}
}
示例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"));
}
}
}
示例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"));
}
}
}
示例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"));
}
}
}