Ejemplo n.º 1
0
def _group_expand(start, end, context):
    
    start\
    .connect(tn(PAR_OPEN))\
    .connect(_BranchRule('branch'))\
    .connect(zeroToMany(sequence(tn(OR), _BranchRule('branch'))))\
    .connect(tn(PAR_CLOSE))\
    .connect(end)
Ejemplo n.º 2
0
 def expand(self, start, end, context):
     
     start\
     .connect(zeroToMany(fork(
                              _CommentRule('comment-style'),
                              _EnableRule('enable'),
                              _TokensRule('tokens'),
                              _RuleRule('rule')
                              )))\
     .connect(end)
Ejemplo n.º 3
0
def _rule_expand(start, end, context):
    
    branch = _BranchRule('branch')
    
    start\
    .connect(zeroToOne(tn(GRAMMAR_ANNOTATION, 'is-grammar')))\
    .connect(tn(RULE_ID, 'rule-id'))\
    .connect(tn(ASSIGN))\
    .connect(branch)\
    .connect(zeroToMany(sequence(tn(OR), branch)))\
    .connect(tn(SEMICOLON))\
    .connect(end)