def Proto( self, table, buffer): """Process a regular Prototype declaration""" (tag, left, right, children) = table proto = node.prototype(getString( children[0], buffer)) self.prototypeStack.append( proto ) try: dispatchList( self, children[1:-1], buffer ) setSceneGraph( proto, dispatch( self, children[-1], buffer )) self.sceneGraphStack[-1].addProto( proto ) finally: self.prototypeStack.pop( )
def Script(fields, **namedarguments): """Create a new script prototype and an instance of that prototype""" proto = node.prototype('Script', fields, baseClasses=(_Script, )) return proto(**namedarguments)
root = None protoTypes = self.basePrototypes self.sceneGraphStack.append( self.basePrototypes.get('sceneGraph')( root=root, protoTypes=protoTypes, baseURI=self.baseURI, )) dispatchList(self, children, buffer) node = self.sceneGraphStack.pop() return node ### The two prototype sub-types def Proto(self, (tag, left, right, children), buffer): """Process a regular Prototype declaration""" proto = node.prototype(getString(children[0], buffer)) self.prototypeStack.append(proto) try: dispatchList(self, children[1:-1], buffer) setSceneGraph(proto, dispatch(self, children[-1], buffer)) self.sceneGraphStack[-1].addProto(proto) finally: self.prototypeStack.pop() def ExternProto(self, (tag, left, right, children), buffer): """Process an external Prototype declaration""" proto = node.prototype(getString(children[0], buffer)) self.prototypeStack.append(proto) try: dispatchList(self, children[1:-1], buffer) setExternalURL(proto, dispatch(self, children[-1], buffer))
def Script( fields, **namedarguments ): """Create a new script prototype and an instance of that prototype""" proto = node.prototype( 'Script', fields, baseClasses = (_Script,) ) return proto( **namedarguments )