public static Token nextRealToken(CommonTokenStream tokens, int i) {
int n = tokens.size();
i++; // search after current i token
if ( i>=n || i<0 ) return null;
Token t = tokens.get(i);
while ( t.getChannel()==Token.HIDDEN_CHANNEL ) {
if ( t.getType()==Token.EOF ) {
TokenSource tokenSource = tokens.getTokenSource();
if ( tokenSource==null ) {
return new CommonToken(Token.EOF, "EOF");
}
TokenFactory<?> tokenFactory = tokenSource.getTokenFactory();
if ( tokenFactory==null ) {
return new CommonToken(Token.EOF, "EOF");
}
return tokenFactory.create(Token.EOF, "EOF");
}
i++;
if ( i>=n ) return null; // just in case no EOF
t = tokens.get(i);
}
return t;
}
ParsingUtils.java 文件源码
java
阅读 33
收藏 0
点赞 0
评论 0
项目:intellij-plugin-v4
作者:
评论列表
文章目录