refactor

added the 'consume' method in parser.py