Package gavo :: Package grammars :: Module common :: Class Grammar
[frames] | no frames]

Class Grammar

source code

                   object --+            
                            |            
 base.structure.StructureBase --+        
                                |        
                   object --+   |        
                            |   |        
           base.common.Parser --+        
                                |        
base.structure.ParseableStructure --+    
                                    |    
             base.structure.Structure --+
                                        |
                   object --+           |
                            |           |
     base.macros.MacroPackage --+       |
                                |       |
   base.macros.StandardMacroMixin --+   |
                                    |   |
                    GrammarMacroMixin --+
                                        |
                                       Grammar
Known Subclasses:

An abstract grammar.

Grammars are configured via their structure parameters. Their parse(sourceToken) method returns an object that iterates over rawdicts (dictionaries mapping keys to (typically) strings) that can then be fed through rowmakers; it also has a method getParameters that returns global properties of the whole document (like parameters in VOTables; this will be empty for many kinds of grammars).

RowIterators will return a reference to themselves in the raw dicts in the parser_ key unless you override their _iterRowsProcessed method (which you shouldn't). This is used by rowmaker macros.

What exactly sourceToken is is up to the concrete grammar. While typically it's a file name, it might be a sequence of dictionaries, a nevow context, or whatever.

To derive a concrete Grammar, define a RowIterator for your source and set the rowIterator class attribute to it.

Nested Classes
  rowIterator
An object that encapsulates the a source being parsed by a grammar.

Inherited from base.structure.StructureBase: __metaclass__

Instance Methods
 
clearProperty(self, name) source code
 
getFullId(self) source code
 
getProperty(self, name, default=<Undefined>) source code
 
getSourceFields(self, sourceToken, data)
returns a dict containing user-defined fields to be added to all results.
source code
 
hasProperty(self, name) source code
 
parse(self, sourceToken, targetData=None) source code
 
setProperty(self, name, value) source code

Inherited from base.structure.Structure: __provides__, callCompletedCallbacks, completeElement, finishElement, onElementComplete, validate

Inherited from base.structure.ParseableStructure: __init__, end_, feed, feedFrom, feedObject, getAttribute, iterEvents, start_, value_

Inherited from base.structure.StructureBase: __providedBy__, adopt, breakCircles, change, copy, getAttributes, getCopyableAttributes, getSourcePosition, iterChildren, setPosition

Inherited from base.common.Parser: feedEvent

Inherited from GrammarMacroMixin: macro_colNames, macro_dlMetaURI, macro_fullDLURL, macro_inputRelativePath, macro_inputSize, macro_lastSourceElements, macro_property, macro_rootlessPath, macro_rowsProcessed, macro_sourceDate, macro_splitPreviewPath, macro_srcstem, macro_standardPreviewPath

Inherited from base.macros.StandardMacroMixin: macro_RSTservicelink, macro_RSTtable, macro_decapitalize, macro_getConfig, macro_internallink, macro_magicEmpty, macro_metaSeq, macro_metaString, macro_rdId, macro_rdIdDotted, macro_schema, macro_test, macro_today, macro_upper, macro_urlquote

Inherited from base.macros.MacroPackage: execMacro, expand, getExpander, listMacros, macro_quote, macro_reSub, macro_sql_standardPubDID, macro_sqlquote

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods

Inherited from base.structure.StructureBase: fromStructure

Class Variables
  attrSeq = [<gavo.base.attrdef.UnicodeAttribute object>, <gavo....
  isDispatching = False
  managedAttrs = {'enc': <gavo.base.attrdef.UnicodeAttribute obj...
  name_ = 'grammar'
a sentinel for all kinds of undefined values.

Inherited from base.structure.Structure: __implemented__

Inherited from base.structure.StructureBase: completedCallbacks

Properties
  rd

Inherited from object: __class__

Class Variable Details

attrSeq

Value:
[<gavo.base.attrdef.UnicodeAttribute object>,
 <gavo.base.parsecontext.IdAttribute object>,
 <gavo.base.complexattrs.StructAttribute object>,
 <gavo.base.parsecontext.OriginalAttribute object>,
 <gavo.base.complexattrs.PropertyAttribute object>,
 <gavo.rscdef.common.RDAttribute object>,
 <gavo.base.complexattrs.StructListAttribute object>,
 <gavo.base.complexattrs.StructAttribute object>]

managedAttrs

Value:
{'enc': <gavo.base.attrdef.UnicodeAttribute object>,
 'id': <gavo.base.parsecontext.IdAttribute object>,
 'ignoreOn': <gavo.base.complexattrs.StructAttribute object>,
 'original': <gavo.base.parsecontext.OriginalAttribute object>,
 'properties': <gavo.base.complexattrs.PropertyAttribute object>,
 'property': <gavo.base.complexattrs.PropertyAttribute object>,
 'rd': <gavo.rscdef.common.RDAttribute object>,
 'rowfilter': <gavo.base.complexattrs.StructListAttribute object>,
...

Property Details

rd

Get Method:
unreachable._getRD(self)