'A generalized field-based parser. Handles whitespace, csv etc.
Args:
comments: Line comment patterns (e.g. "#").
cont: Continuation patterns (e.g. "\\").
ml_quote: Boolean flag to allow quoted strings to span lines.
quot: Quotation patterns (e.g. "\\"" or "\'").
sep: Field separator patterns (e.g. "[\\s,]").
term: Entry termination patterns (e.g. "\\n").
verbose: Enable verbose mode for the lexer. Useful for debugging.'

def __init__(self, comments='#', cont='\\\\\\s*\\n', ml_quote=False, quot=('\\"', "'"), sep='[    \\t\\f\\v]+', term='[\\r\\n]', verbose=0):

    super(FieldParser, self).__init__()
    self.entries = []
    self.fields = []
    self.field = ''
    self.comments = AsIter(comments)
    self.cont = AsIter(cont)
    self.ml_quote = AsIter(ml_quote)
    self.quot = AsIter(quot)
    self.sep = AsIter(sep)
    self.term = AsIter(term)
    self.verbose = verbose
    self._GenStates()
