public Token match(ITokenType expectedToken, int tokenNum) {
if(hasToken(_currentTokenNum))
if(expectedToken == getToken(tokenNum).get_type())
return getToken(tokenNum);
return null;
}
public Token match(Class<?> clazz, int tokenNum) {
if(hasToken(_currentTokenNum))
if(clazz.isInstance(getToken(tokenNum).get_type()))
return getToken(tokenNum);
return null;
}
I tried to make a single match method, and put the condition into two methods, but it didn’t work out.
Aucun commentaire:
Enregistrer un commentaire