inlined filtering method for tokens