Added buffer_match() function.

Replaced for loops in some match_X() lexer functions with calls to
buffer_match().