gavo.grammars.regrammar module

A grammar splitting the input file into lines and lines into records using REs.

class gavo.grammars.regrammar.REGrammar(parent, **kwargs)[source]

Bases: Grammar, FileRowAttributes

A grammar that builds rowdicts from records and fields specified via REs separating them.

There is also a simple facility for “cleaning up” records. This can be used to remove standard shell-like comments; use recordCleaner="(?:#.*)?(.*)".

attrSeq = [<gavo.grammars.common.REAttribute object>, <gavo.base.attrdef.UnicodeAttribute object>, <gavo.grammars.common.REAttribute object>, <gavo.base.attrdef.BooleanAttribute object>, <gavo.base.parsecontext.IdAttribute object>, <gavo.base.complexattrs.StructAttribute object>, <gavo.base.attrdef.BooleanAttribute object>, <gavo.base.attrdef.StringListAttribute object>, <gavo.base.parsecontext.OriginalAttribute object>, <gavo.base.attrdef.UnicodeAttribute object>, <gavo.base.complexattrs.PropertyAttribute object>, <gavo.rscdef.common.RDAttribute object>, <gavo.grammars.common.REAttribute object>, <gavo.grammars.common.REAttribute object>, <gavo.base.complexattrs.StructListAttribute object>, <gavo.base.complexattrs.StructAttribute object>, <gavo.grammars.common.REAttribute object>, <gavo.base.attrdef.IntAttribute object>]
clearProperty(name)
completedCallbacks = []
getFullId()
getProperty(name, default=<Undefined>)
hasProperty(name)
managedAttrs = {'commentPat': <gavo.grammars.common.REAttribute object>, 'enc': <gavo.base.attrdef.UnicodeAttribute object>, 'fieldSep': <gavo.grammars.common.REAttribute object>, 'gunzip': <gavo.base.attrdef.BooleanAttribute object>, 'id': <gavo.base.parsecontext.IdAttribute object>, 'ignoreOn': <gavo.base.complexattrs.StructAttribute object>, 'lax': <gavo.base.attrdef.BooleanAttribute object>, 'names': <gavo.base.attrdef.StringListAttribute object>, 'original': <gavo.base.parsecontext.OriginalAttribute object>, 'preFilter': <gavo.base.attrdef.UnicodeAttribute object>, 'properties': <gavo.base.complexattrs.PropertyAttribute object>, 'property': <gavo.base.complexattrs.PropertyAttribute object>, 'rd': <gavo.rscdef.common.RDAttribute object>, 'recordCleaner': <gavo.grammars.common.REAttribute object>, 'recordSep': <gavo.grammars.common.REAttribute object>, 'rowfilter': <gavo.base.complexattrs.StructListAttribute object>, 'rowfilters': <gavo.base.complexattrs.StructListAttribute object>, 'sourceFields': <gavo.base.complexattrs.StructAttribute object>, 'stopPat': <gavo.grammars.common.REAttribute object>, 'topIgnoredLines': <gavo.base.attrdef.IntAttribute object>}
name_ = 'reGrammar'
property rd
rowIterator

alias of REIterator

setProperty(name, value)
class gavo.grammars.regrammar.REIterator(grammar, sourceToken, **kwargs)[source]

Bases: FileRowIterator

An iterator based on regular expressions.

chunkSize = 8192
getLocator()[source]