Beispiel #1
0
 def __init__(self):
     self.curvar = var.groupvar("top")
     self.top = self.curvar
     self.cnt = 0
     self.state = "defs"
     self.stack = []
     self.curvar.add("TARGETS", {})
Beispiel #2
0
 def __init__ (self):
     self.curvar = var.groupvar("top")
     self.top = self.curvar
     self.cnt = 0
     self.state = "defs"
     self.stack = []
     self.curvar.add("TARGETS", {})
Beispiel #3
0
 def parse(self, token, srow, line):
     # order is important
     if self.state == "defs" and token == "\n":
         return
     if self.state == "\\" and token == "\n":
         self.state = "="
     elif self.state == "defs" and isName(token):
         if self.curvar != None:
             self.stack.append(self.curvar)
         self.curvar = var.var(token)
         self.state = "var"
     elif self.state == "=" and token == "\\":
         self.state = "\\"
     elif self.state == "var" and token == "=":
         self.state = "="
     elif self.state == "=" and token == "{":
         self.curvar = var.groupvar(self.curvar._name)
         self.state = "defs"
         self.cnt = self.cnt + 1
     elif (self.state == "defs"
           and token == "}") or (self.state == "="
                                 and token == "\n") or (self.state == "var"
                                                        and token == "\n"):
         last = len(self.stack) - 1
         v = self.stack[last]
         del self.stack[last]
         v.add(self.curvar._name, self.curvar._values)
         self.curvar = v
         self.cnt = self.cnt - 1
         self.state = "defs"
     elif self.state == "=" and isName(token):
         if token == '""':
             token = ""
         if token in self.top:
             for i in self.top[token]:
                 self.curvar.append(i)
         else:
             self.curvar.append(token)
     elif self.state == "var" and token != "=":
         print("Missing = " + token, srow)
     else:
         print("error", token, self.state)
Beispiel #4
0
 def parse(self, token, srow, line):
     # order is important
     if self.state == "defs" and token == "\n":
         return
     if self.state == "\\" and token == "\n":
         self.state = "="
     elif self.state == "defs" and isName(token):
         if self.curvar != None:
             self.stack.append(self.curvar)
         self.curvar = var.var(token)
         self.state = "var"
     elif self.state == "=" and token == "\\":
         self.state = "\\"
     elif self.state == "var" and token == "=":
         self.state = "="
     elif self.state == "=" and token == "{":
         self.curvar = var.groupvar(self.curvar._name)
         self.state = "defs"
         self.cnt = self.cnt+1
     elif (self.state == "defs" and token == "}") or (self.state == "=" and token == "\n") or (self.state == "var" and token == "\n"):
         last = len(self.stack)-1
         v = self.stack[last]
         del self.stack[last]
         v.add(self.curvar._name, self.curvar._values)
         self.curvar = v
         self.cnt = self.cnt - 1
         self.state = "defs"
     elif self.state == "=" and isName(token):
         if token == '""':
             token = ""
         if token in self.top:
             for i in self.top[token]:
                 self.curvar.append(i)
         else:
             self.curvar.append(token)
     elif self.state == "var" and token != "=":
         print("Missing = " + token, srow)
     else:
         print("error", token, self.state)