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 expand(self, start, end, context):
     
     start\
     .connect(tnode(SUPER))\
     .connect(TypePath('typePath'))\
     .connect(tnode(SEMICOLON))\
     .connect(end)
 def expand(self, start, end, context):
     
     start\
     .connect(tnode(IMPLEMENTS))\
     .connect(TypePath('interfaceName'))\
     .connect(tnode(SEMICOLON))\
     .connect(end)
 def expand(self, start, end, context):
     
     seq = sequence(tnode(DASH), tnode(ID))
     start\
     .connect(tnode(ID))\
     .connect(zeroToMany(seq))\
     .connect(end)
 def expand(self, start, end, context):
     
     start\
     .connect(tnode(PREFIX))\
     .connect(tnode(ID, 'id'))\
     .connect(tnode(SEMICOLON))\
     .connect(end)
 def expand(self, start, end, context):
     
     start\
     .connect(tnode(OVERRIDE))\
     .connect(tnode(ID, 'name'))\
     .connect(tnode(SEMICOLON))\
     .connect(end)
 def expand(self, start, end, context):
     
     start\
     .connect(tnode(INIT_PROPERTIES))\
     .connect(tnode(BRACE_OPEN))\
     .connect(oneToMany(InitProperty('init')))\
     .connect(tnode(BRACE_CLOSE))\
     .connect(end)
def type_expand(start, end, context):
    
    start\
    .connect(tnode(TYPE))\
    .connect(tnode(COLON))\
    .connect(ArgType('type'))\
    .connect(tnode(SEMICOLON))\
    .connect(end)
 def expand(self, start, end, context):
     
     start\
     .connect(ComposedId('name'))\
     .connect(tnode(COLON))\
     .connect(LiteralOrCode('value'))\
     .connect(tnode(SEMICOLON))\
     .connect(end)
Esempio n. 10
0
 def expand(self, start, end, context):
     
     seq = sequence(tnode(ID), tnode(NAMESPACE_SEP))
     
     start\
     .connect(zeroToOne(tnode(NAMESPACE_ROOT_SEP)))\
     .connect(zeroToMany(seq))\
     .connect(tnode(ID))\
     .connect(end)
 def expand(self, start, end, context):
     
     start\
     .connect(tnode(ERROR_DOMAIN))\
     .connect(tnode(ID, 'name'))\
     .connect(tnode(BRACE_OPEN))\
     .connect(oneToMany(Code('code')))\
     .connect(tnode(BRACE_CLOSE))\
     .connect(end)
def _lc_expand(start, end, context):
    
    start\
    .connect(tnode(LITERAL, 'value'))\
    .connect(end)
    
    start\
    .connect(TypePath('enum'))\
    .connect(tnode(DOT))\
    .connect(tnode(ID, 'code'))\
    .connect(end)
Esempio n. 13
0
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 expand(self, start, end, context):    
     
     values = []
     for vtt in self._valueTokenTypes:
         values.append(tnode(vtt, 'value'))
     
     start\
     .connect(tnode(self._enumTokenType))\
     .connect(tnode(COLON))\
     .connect(fork(*values))\
     .connect(tnode(SEMICOLON))\
     .connect(end)    
Esempio n. 15
0
 def expand(self, start, end, context):
     
     branches = {
                 PARAMETER: Parameter('parameter'),
                 RESULT: Result('result')
                 }       
     
     start\
     .connect(tnode(SIGNAL))\
     .connect(ComposedId('name'))\
     .connect(tnode(BRACE_OPEN))\
     .connect(zeroToMany(Switch(branches)))\
     .connect(tnode(BRACE_CLOSE))\
     .connect(end)
Esempio n. 16
0
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)
Esempio n. 17
0
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)
Esempio n. 18
0
 def expand(self, start, end, context):
     
     branches = {
                 METHOD: Method('method'),
                 SIGNAL: Signal('signal'),
                 PREFIX: PrefixRule('prefix')
                 }
     
     start\
     .connect(tnode(GINTERFACE))\
     .connect(tnode(ID, 'interfaceName'))\
     .connect(tnode(BRACE_OPEN))\
     .connect(zeroToMany(Switch(branches)))\
     .connect(tnode(BRACE_CLOSE))\
     .connect(end)
Esempio n. 19
0
 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()
     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)
Esempio n. 21
0
 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)
Esempio n. 22
0
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 _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)
Esempio n. 24
0
 def expand(self, start, end, context):
     
     modifiers = sequence(tnode(MODIFIERS, 'modifiers'),
                          tnode(COLON),  
                          tnode(CONST, 'const'),
                          tnode(SEMICOLON)
                          )      
     start\
     .connect(tnode(RESULT))\
     .connect(tnode(BRACE_OPEN))\
     .connect(Type('type'))\
     .connect(zeroToOne(modifiers))\
     .connect(tnode(BRACE_CLOSE))\
     .connect(end)
def argtype_expand(start, end, context):
    
    start.connect(TypeName('type')).connect(end)
    
    start\
    .connect(tnode(REF, 'reference'))\
    .connect(tnode(PAR_OPEN))\
    .connect(ArgType('arg'))\
    .connect(tnode(PAR_CLOSE))\
    .connect(end)
    
    start\
    .connect(tnode(LIST, 'list'))\
    .connect(tnode(PAR_OPEN))\
    .connect(ArgType('arg'))\
    .connect(tnode(PAR_CLOSE))\
    .connect(end)
Esempio n. 26
0
 def expand(self, start, end, context):
     
     start.connect(tnode(FINAL)).connect(tnode(SEMICOLON)).connect(end)
Esempio n. 27
0
 def expand(self, start, end, context):
     
     start.connect(tnode(ABSTRACT)).connect(tnode(SEMICOLON)).connect(end)
Esempio n. 28
0
def _iw_expand(start, end, context):

    start.connect(tnode(INITIAL)).connect(tnode(DASH)).connect(tnode(WRITE)).connect(end)
Esempio n. 29
0
    def expand(self, start, end, context):

        start.connect(tnode(self._keyToken)).connect(tnode(COLON)).connect(LiteralOrCode("value")).connect(
            tnode(SEMICOLON)
        ).connect(end)
Esempio n. 30
0
def _rw_expand(start, end, context):

    start.connect(tnode(READ)).connect(tnode(DASH)).connect(tnode(WRITE)).connect(end)