Package gavo :: Package grammars :: Module embeddedgrammar :: Class EmbeddedGrammar
[frames] | no frames]

Class EmbeddedGrammar

source code

                   object --+                
                            |                
 base.structure.StructureBase --+            
                                |            
                   object --+   |            
                            |   |            
           base.common.Parser --+            
                                |            
base.structure.ParseableStructure --+        
                                    |        
             base.structure.Structure --+    
                                        |    
                   object --+           |    
                            |           |    
     base.macros.MacroPackage --+       |    
                                |       |    
   base.macros.StandardMacroMixin --+   |    
                                    |   |    
             common.GrammarMacroMixin --+    
                                        |    
                           common.Grammar --+
                                            |
                               object --+   |
                                        |   |
          base.structure.RestrictionMixin --+
                                            |
                                           EmbeddedGrammar

A Grammar defined by a code application.

To define this grammar, write a ProcApp iterator leading to code yielding row dictionaries. The grammar input is available as self.sourceToken; for normal grammars within data elements, that would be a fully qualified file name.

Grammars can also return one "parameter" dictionary per source (the input to a make's parmaker). In an embedded grammar, you can define a pargetter to do that. It works like the iterator, except that it returns a single dictionary rather than yielding several of them.

This could look like this, when the grammar input is some iterable:

       <embeddedGrammar>
       <iterator>
       <setup>
       <code>
               testData = "a"*1024
       </code>
       </setup>
       <code>
       for i in self.sourceToken:
               yield {'index': i, 'data': testData}
       </code>
       </iterator>
       </embeddedGrammar>
Nested Classes

Inherited from common.Grammar: rowIterator

Inherited from base.structure.StructureBase: __metaclass__

Instance Methods
 
onElementComplete(self) source code
 
clearProperty(self, name) source code
 
getFullId(self) source code
 
getProperty(self, name, default=<Undefined>) source code
 
hasProperty(self, name) source code
 
setProperty(self, name, value) source code

Inherited from common.Grammar: getSourceFields, parse

Inherited from base.structure.Structure: __provides__, callCompletedCallbacks, completeElement, finishElement, 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 common.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
  name_ = 'embeddedGrammar'
a sentinel for all kinds of undefined values.
  attrSeq = [<gavo.base.attrdef.UnicodeAttribute object>, <gavo....
  managedAttrs = {'enc': <gavo.base.attrdef.UnicodeAttribute obj...

Inherited from common.Grammar: isDispatching

Inherited from base.structure.Structure: __implemented__

Inherited from base.structure.StructureBase: completedCallbacks

Properties
  rd

Inherited from object: __class__

Method Details

onElementComplete(self)

source code 
Overrides: base.structure.Structure.onElementComplete

clearProperty(self, name)

source code 
Overrides: common.Grammar.clearProperty

getFullId(self)

source code 
Overrides: common.Grammar.getFullId

getProperty(self, name, default=<Undefined>)

source code 
Overrides: common.Grammar.getProperty

hasProperty(self, name)

source code 
Overrides: common.Grammar.hasProperty

setProperty(self, name, value)

source code 
Overrides: common.Grammar.setProperty

Class Variable Details

attrSeq

Value:
[<gavo.base.attrdef.UnicodeAttribute object>,
 <gavo.base.parsecontext.IdAttribute object>,
 <gavo.base.complexattrs.StructAttribute object>,
 <gavo.base.attrdef.BooleanAttribute object>,
 <gavo.base.complexattrs.StructAttribute object>,
 <gavo.base.attrdef.BooleanAttribute object>,
 <gavo.base.parsecontext.OriginalAttribute 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>,
 'isDispatching': <gavo.base.attrdef.BooleanAttribute object>,
 'iterator': <gavo.base.complexattrs.StructAttribute object>,
 'notify': <gavo.base.attrdef.BooleanAttribute object>,
 'original': <gavo.base.parsecontext.OriginalAttribute object>,
 'pargetter': <gavo.base.complexattrs.StructAttribute object>,
...

Property Details

rd

Get Method:
unreachable._getRD(self)