From the classic "Lex - A Lexical Analyzer Generator" from http://dinosaur.compilertools.net/lex/index.html