java.lang.ClassCastException: org.antlr.runtime.CommonToken cannot be cast to antlr.Token -



java.lang.ClassCastException: org.antlr.runtime.CommonToken cannot be cast to antlr.Token -

i trying check similarities between 2 codes, need id of tokens lexer, don't know why error:

java.lang.classcastexception: org.antlr.runtime.commontoken cannot cast antlr.token

here code:

final commontokenstream tokens; tokens = new commontokenstream(); tokens.settokensource(lexer); tokens.lt(10); // forcefulness load antlr3javaparser parser = new antlr3javaparser(tokens); list tokenlist = tokens.gettokens(); (int = 0; < tokenlist.size(); i++) { token t = (token) tokenlist.get(i); }

org.antlr.runtime.commontoken implements org.antlr.runtime.token , not antlr.token. need import org.antlr.runtime.token.

the exception occurs when converting org.antlr.runtime.commontoken antlr.token in token t = (token) tokenlist.get(i);

java antlr antlr3

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -