use of org.jf.smalidea.SmaliLexer in project smali by JesusFreke.
the class SmaliWordScanner method processWords.
@Override
public void processWords(CharSequence fileText, Processor<WordOccurrence> processor) {
SmaliLexer lexer = new SmaliLexer();
lexer.start(fileText);
IElementType type = lexer.getTokenType();
while (type != null) {
if (type == SmaliTokens.CLASS_DESCRIPTOR) {
processClassDescriptor(fileText, lexer.getTokenStart(), lexer.getTokenEnd(), processor);
} else if (MEMBER_NAME_TOKENS.contains(type)) {
processor.process(new WordOccurrence(fileText, lexer.getTokenStart(), lexer.getTokenEnd(), Kind.CODE));
} else if (type == SmaliTokens.PARAM_LIST_OR_ID_PRIMITIVE_TYPE) {
int tokenStart = lexer.getTokenStart();
while (type == SmaliTokens.PARAM_LIST_OR_ID_PRIMITIVE_TYPE) {
lexer.advance();
type = lexer.getTokenType();
}
int tokenEnd = lexer.getTokenStart();
processor.process(new WordOccurrence(fileText, tokenStart, tokenEnd, Kind.CODE));
}
lexer.advance();
type = lexer.getTokenType();
}
}
Aggregations