clean up some parsing code and fix bug involving decorators and dividing input into blocks
clean up some parsing code and fix bug involving decorators and dividing input into blocks

sagemathinc/smc,sagemathinc/smc,DrXyzzy/smc,sagemathinc/smc,sagemathinc/smc,tscholl2/smc,DrXyzzy/smc,tscholl2/smc,DrXyzzy/smc,tscholl2/smc,DrXyzzy/smc,tscholl2/smc,tscholl2/smc