예제 #1
0
파일: parser.py 프로젝트: xw2060/exabgp
def community(tokeniser):
    communities = Communities()

    value = tokeniser()
    if value == '[':
        while True:
            value = tokeniser()
            if value == ']':
                break
            communities.add(_community(value))
    else:
        communities.add(_community(value))

    return communities
예제 #2
0
 def community(self, scope, name, command, tokens):
     communities = Communities()
     community = tokens.pop(0)
     try:
         if community == '[':
             while True:
                 try:
                     community = tokens.pop(0)
                 except IndexError:
                     return self.error.set(self.syntax)
                 if community == ']':
                     break
                 communities.add(self._parse_community(scope, community))
         else:
             communities.add(self._parse_community(scope, community))
     except ValueError:
         return self.error.set(self.syntax)
     scope[-1]['announce'][-1].attributes.add(communities)
     return True