本文整理汇总了Java中org.antlr.v4.runtime.Token.getChannel方法的典型用法代码示例。如果您正苦于以下问题:Java Token.getChannel方法的具体用法?Java Token.getChannel怎么用?Java Token.getChannel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.antlr.v4.runtime.Token
的用法示例。
在下文中一共展示了Token.getChannel方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isEmptyStatement
import org.antlr.v4.runtime.Token; //导入方法依赖的package包/类
public static boolean isEmptyStatement(String sql)
{
TokenSource tokens = getLexer(sql, ImmutableSet.of());
while (true) {
Token token = tokens.nextToken();
if (token.getType() == Token.EOF) {
return true;
}
if (token.getChannel() != Token.HIDDEN_CHANNEL) {
return false;
}
}
}
示例2: nextToken
import org.antlr.v4.runtime.Token; //导入方法依赖的package包/类
/**
* Return the next token from the character stream and records this last
* token in case it resides on the default channel. This recorded token
* is used to determine when the lexer could possibly match a regex
* literal.
*
* @return the next token from the character stream.
*/
@Override
public Token nextToken() {
// Get the next token.
Token next = super.nextToken();
if (next.getChannel() == Token.DEFAULT_CHANNEL) {
// Keep track of the last token on the default channel.
this.lastToken = next;
}
return next;
}
示例3: nextToken
import org.antlr.v4.runtime.Token; //导入方法依赖的package包/类
@Override
public Token nextToken() {
Token token;
do {
token = source().nextToken();
} while (token.getChannel() != channel());
return token;
}
示例4: getIrregularType
import org.antlr.v4.runtime.Token; //导入方法依赖的package包/类
private SyntaxElementType getIrregularType(Token t) {
SyntaxElementType type = SyntaxElementType.unknown;
if (t.getChannel() == FusionTablesSqlLexer.WHITESPACE) {
if (t.getText().equals("\n"))
type = SyntaxElementType.newline;
else
type = SyntaxElementType.whitespace;
} else if (t.getChannel() == FusionTablesSqlLexer.HIDDEN)
type = SyntaxElementType.comment;
return type;
}
示例5: getRealTokens
import org.antlr.v4.runtime.Token; //导入方法依赖的package包/类
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;
}
示例6: getRealTokens
import org.antlr.v4.runtime.Token; //导入方法依赖的package包/类
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;
}