本文整理汇总了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;未经允许,请勿转载。 |
请发表评论