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)
def expand(self, start, end, context): start\ .connect(zeroToMany(fork( _CommentRule('comment-style'), _EnableRule('enable'), _TokensRule('tokens'), _RuleRule('rule') )))\ .connect(end)
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)