Search in sources :

Example 1 with InvalidToken

use of org.jf.smali.InvalidToken in project smali by JesusFreke.

the class PsiBuilderTokenStream method buildCurrentToken.

private void buildCurrentToken() {
    IElementType element = psiBuilder.getTokenType();
    if (element != null) {
        if (element instanceof SmaliLexicalElementType) {
            SmaliLexicalElementType elementType = (SmaliLexicalElementType) element;
            currentToken = new CommonToken(elementType.tokenId, psiBuilder.getTokenText());
        } else if (element == TokenType.BAD_CHARACTER) {
            currentToken = new InvalidToken("", psiBuilder.getTokenText());
        } else {
            throw new UnsupportedOperationException();
        }
    } else {
        currentToken = new CommonToken(Token.EOF);
    }
}
Also used : IElementType(com.intellij.psi.tree.IElementType) InvalidToken(org.jf.smali.InvalidToken) CommonToken(org.antlr.runtime.CommonToken)

Aggregations

IElementType (com.intellij.psi.tree.IElementType)1 CommonToken (org.antlr.runtime.CommonToken)1 InvalidToken (org.jf.smali.InvalidToken)1