本文整理匯總了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;
}