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
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)
def __init__(self): specDict={ r'\(':self.leftPerens, r'\)':self.rightPerens } Scanner.__init__(self,specDict)
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)