def expand(self, start, end, context): start_ = connector() end_ = connector() clsNameNode = tnode(ID, 'classname') clsNameNode.setEnvChange(self._onClassNameAccepted, self._onClassNameRejected ) start\ .connect(tnode(GOBJECT))\ .connect(clsNameNode)\ .connect(tnode(BRACE_OPEN))\ .connect(start_) switch = Switch({ SUPER: Super('super'), ABSTRACT: Abstract('abstract'), FINAL: Final('final'), PREFIX: Prefix('prefix'), IMPLEMENTS: Implements('implements'), #CONSTRUCTOR: Constructor('constructor'), METHOD: Method('method'), OVERRIDE: Override('override'), ATTRIBUTE: Attribute('attr'), PROPERTY: Property('prop'), SIGNAL: Signal('signal') }) start_.connect(switch).connect(start_) start_.connect(Constructor('constructor')).connect(start_) start_.connect(end_) end_.connect(tnode(BRACE_CLOSE)).connect(end)
def prop_expand(start, end, context): start_ = connector() end_ = connector() start.connect(tnode(PROPERTY)).connect(ComposedId("name")).connect(tnode(BRACE_OPEN)).connect(start_) descr = sequence(tnode(DESCRIPTION), tnode(COLON), tnode(LITERAL, "description"), tnode(SEMICOLON)) auto = sequence(tnode(AUTO_CREATE, "auto"), tnode(SEMICOLON)) switch = Switch( { TYPE: _PropType("type"), ACCESS: _Access("access"), DESCRIPTION: descr, GTYPE: _PropGType("gtype"), PROP_MAX: _PropMax("max"), PROP_MIN: _PropMin("min"), PROP_DEFAULT: _PropDefault("default"), AUTO_CREATE: auto, } ) start_.connect(switch).connect(start_) start_.connect(end_) end_.connect(tnode(BRACE_CLOSE)).connect(end)
def expand(self, start, end, context): start_ = connector() end_ = connector() start\ .connect(tnode(PARAMETER))\ .connect(tnode(ID, 'name'))\ .connect(tnode(BRACE_OPEN))\ .connect(Type('type'))\ .connect(start_) end_.connect(tnode(BRACE_CLOSE)).connect(end) start_.connect(end_) start_\ .connect(tnode(MODIFIERS, 'modifiers'))\ .connect(tnode(COLON))\ .connect(tnode(CONST, 'const'))\ .connect(tnode(SEMICOLON))\ .connect(start_) if context.getEnvVar('CONSTRUCTOR'): start_\ .connect(tnode(BIND_PROPERTY, 'bindProperty'))\ .connect(tnode(COLON))\ .connect(ComposedId('propertyId'))\ .connect(tnode(SEMICOLON))\ .connect(start_)
def _access_expand(start, end, context): start_ = connector() end_ = connector() start.connect(tnode(ACCESS)).connect(tnode(COLON)).connect(start_) start_.connect(_ReadOnly("val")).connect(end_) start_.connect(_InitWrite("val")).connect(end_) start_.connect(_ReadWrite("val")).connect(end_) end_.connect(tnode(SEMICOLON)).connect(end)
def _gt_expand(start, end, context): start_ = connector() end_ = connector() start.connect(tnode(GTYPE)).connect(tnode(COLON)).connect(start_) start_.connect(tnode(GTYPENAME)).connect(tnode(PAR_OPEN)).connect(TypeName("typeName")).connect( tnode(PAR_CLOSE) ).connect(end_) start_.connect(tnode(ID, "id")).connect(end_) end_.connect(tnode(SEMICOLON)).connect(end)
def expand(self, start, end, context): start_ = connector() end_ = connector() braceOpen = tnode(BRACE_OPEN) start.connect(tnode(CONSTRUCTOR)).connect(braceOpen) start.connect(Condition(self._isConstructorName)).connect(tnode(ID)).connect(braceOpen) braceOpen.connect(start_) start_.connect(Parameter('parameter')).connect(start_) start_.connect(InitProperties('initProps')).connect(start_) start_.connect(end_) end_.connect(tnode(BRACE_CLOSE)).connect(end)
def expand(self, start, end, context): start_ = connector() branches = {} branches[PARAMETER] = Parameter('parameter') branches[RESULT] = Result('result') if not context.getEnvVar('INTERFACE'): branches[VISI] = Visibility('visi') branches[INHERITANCE] = Inheritance('inh') branches[SCOPE] = Scope('scope') start\ .connect(tnode(METHOD))\ .connect(tnode(ID, 'name'))\ .connect(tnode(BRACE_OPEN))\ .connect(start_) start_.connect(Switch(branches)).connect(start_) start_\ .connect(zeroToOne(sequence(tnode(FURTHER_PARAMETERS, 'further_params'), tnode(SEMICOLON))))\ .connect(tnode(BRACE_CLOSE))\ .connect(end)
def expand(self, start, end, context): start_ = connector() end_ = connector() start\ .connect(tnode(PACKAGE))\ .connect(tnode(ID, 'name'))\ .connect(tnode(BRACE_OPEN))\ .connect(start_) self._connect_branch(PackageDef('content'), start_, end_) self._connect_branch(ClassDef('content'), start_, end_) self._connect_branch(InterfaceDef('content'), start_, end_) self._connect_branch(ErrorDomainDef('content'), start_, end_) self._connect_branch(EnumerationDef('content'), start_, end_) self._connect_branch(FlagsDef('content'), start_, end_) self._connect_branch(TypeDecl('content'), start_, end_) end_.connect(tnode(BRACE_CLOSE)).connect(end)
def _expand(start, end, contex): start_ = connector() start\ .connect(tnode(ATTRIBUTE))\ .connect(tnode(ID, 'name'))\ .connect(tnode(BRACE_OPEN))\ .connect(Type('type'))\ .connect(start_) start_.connect(Visibility('visi')).connect(start_) start_.connect(Scope('scope')).connect(start_) start_.connect(tnode(BRACE_CLOSE)).connect(end)
def _code_expand(start, end, context): start_ = connector() start\ .connect(tnode(CODE))\ .connect(tnode(ID, 'name'))\ .connect(start_) start_.connect(tnode(SEMICOLON)).connect(end) if context.getEnvVar('ENUMERATION'): start_\ .connect(tnode(BRACE_OPEN))\ .connect(tnode(VALUE))\ .connect(tnode(COLON))\ .connect(tnode(INT, 'value'))\ .connect(tnode(SEMICOLON))\ .connect(tnode(BRACE_CLOSE))\ .connect(end)