本文整理匯總了Java中org.antlr.v4.runtime.Lexer.DEFAULT_TOKEN_CHANNEL屬性的典型用法代碼示例。如果您正苦於以下問題:Java Lexer.DEFAULT_TOKEN_CHANNEL屬性的具體用法?Java Lexer.DEFAULT_TOKEN_CHANNEL怎麽用?Java Lexer.DEFAULT_TOKEN_CHANNEL使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.antlr.v4.runtime.Lexer
的用法示例。
在下文中一共展示了Lexer.DEFAULT_TOKEN_CHANNEL屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: isContext
boolean isContext(Token token, int offset, boolean allowInStrings, boolean allowInActions) {
if (token == null) {
return false;
}
switch (token.getType()) {
case GrammarLexer.LEXER_CHAR_SET:
case GrammarLexer.ACTION_COMMENT:
return false;
case GrammarLexer.STRING_LITERAL:
case GrammarLexer.DOUBLE_QUOTE_STRING_LITERAL:
return allowInStrings;
case GrammarLexer.ARG_ACTION_WORD:
case GrammarLexer.ACTION_WORD:
return allowInActions;
case GrammarLexer.WS:
return true;
default:
return token.getChannel() == Lexer.DEFAULT_TOKEN_CHANNEL;
}
}
示例2: isGoContext
static boolean isGoContext(Token token, int offset, boolean allowInStrings) {
if (token == null) {
return false;
}
switch (token.getType()) {
case GoLexer.COMMENT:
return false;
case GoLexer.CharLiteral:
case GoLexer.StringLiteral:
return allowInStrings;
case GoLexer.WS:
case GoLexer.NEWLINE:
return true;
default:
return token.getChannel() == Lexer.DEFAULT_TOKEN_CHANNEL;
}
}
示例3: getRealTokens
public static List<Token> getRealTokens(CommonTokenStream tokens) {
List<Token> real = new ArrayList<>();
for (int i=0; i<tokens.size(); i++) {
Token t = tokens.get(i);
if ( t.getType()!=Token.EOF &&
t.getChannel()==Lexer.DEFAULT_TOKEN_CHANNEL )
{
real.add(t);
}
}
return real;
}
示例4: getRealTokens
public List<Token> getRealTokens(int from, int to) {
List<Token> real = new ArrayList<Token>();
for (int i=from; i<=to; i++) {
Token t = tokens.get(i);
if ( t.getChannel()==Lexer.DEFAULT_TOKEN_CHANNEL ) real.add(t);
}
if ( real.size()==0 ) return null;
return real;
}
示例5: maybeStash
private T maybeStash(T token) {
if (token.getChannel() == Lexer.DEFAULT_TOKEN_CHANNEL) {
lastToken = token;
}
return token;
}