Add save and restore state methods in scala parser.