示例#1
0
 def __init__(self):
     specDict = {
         r'^".+"$': self.literal,
         r"^\<\S+\>$": self.rule,
         r"\|": self.brake,
         r"::=": self.equil,
         r";": self.end,
         r'""': self.epsilon,
     }
     Scanner.__init__(self, specDict)  # how you initialize parent class
示例#2
0
 def __init__(self):
     specDict = {
         r"x": self.terminal,
         r"y": self.terminal,
         r"z": self.terminal,
         r"\+": self.terminal,
         r"\*": self.terminal,
         r"\-": self.terminal,
         r"/": self.terminal,
         r"\)": self.terminal,
         r"\(": self.terminal,
     }
     Scanner.__init__(self, specDict)
示例#3
0
 def __init__(self):
     specDict={
     r'\(':self.leftPerens,
     r'\)':self.rightPerens
     }
     Scanner.__init__(self,specDict)
示例#4
0
 def __init__(self):
     specDict={
     r'(I|the|man|telescope|with|saw|cat|dog|pig|hill|park|roof|from|on|in)':self.terminal
     }
     Scanner.__init__(self,specDict)