Exemple #1
0
 def indexingBraces(self, root):
     self.consume()
     sub = Tree(Token(Token.TOK_BRACES, self.lex.contextNum()))
     while (not self.match('}')):
         if (self.match(':')):
             sub.addChild(self.expect(':'))
         else:
             sub.addChild(self.expression())
         if (not self.match('}')): self.expect(',')
         if (sub.numChildren() == 0):
             self.serror("The expression A{} is not allowed.")
     self.expect('}')
     root.addChild(sub)
Exemple #2
0
 def indexingParens(self, root, blankRefOK):
     self.consume()
     if (self.octCompat): self.lex.pushWSFlag(True)
     sub = Tree(Token(Token.TOK_PARENS, self.lex.contextNum()))
     while (not self.match(')')):
         if (self.match(':')):
             sub.addChild(self.expect(':'))
         elif (self.match('/')):
             sub.addChild(self.keyword())
         else:
             sub.addChild(self.expression())
         if (not self.match(')')): self.expect(',')
     if ((sub.numChildren() == 0) and (not blankRefOK)):
         if (self.octCompat): self.lex.popWSFlag()
         self.serror("The expression A() is not allowed.")
     self.expect(')')
     if (self.octCompat): self.lex.popWSFlag()
     root.addChild(sub)