yes right..longest matching rule is followed everytime....why this happening?
because we give all the regular expressions for keywords,identifiers,operators etc in the beginning itself to our lexical analyser...it will do patttern matching thereafter...