def parse!(str)
      scanner = StringScanner.new(str)
      begin
        while (!scanner.eos?)
          start_pos = scanner.pos
          send(:"parse_#{@state}", scanner)
          if (scanner.pos == start_pos)
            # if we didn't move forward, we've run out of useful string so throw it back.
            return str
          end
        end
      ensure
        # clear out whatever we managed to scan.
        str[0, scanner.pos] = ""
      end
    end
def parse!(str)
      scanner = StringScanner.new(str)
      begin
        while (!scanner.eos?)
          start_pos = scanner.pos
          send(:"parse_#{@state}", scanner)
          if (scanner.pos == start_pos)
            # if we didn't move forward, we've run out of useful string so throw it back.
            return str
          end
        end
      ensure
        # clear out whatever we managed to scan.
        str[0, scanner.pos] = ""
      end
    end
Consumes as much of str as it can and then removes it from str. This
 allows you to iteratively pass data into the parser as it comes from
 the client.