def __init__(self, real_code, config): Fishier.__init__(self, real_code, config) with open(os.path.join("languages", "ansi_c.json"), "r") as f: self.language = self.byteify_json(json.load(f)) self.regex_function = "[\w\*\[\]]+\s\w+\\(([\w\*\[\]]+\s\w+(\s*),(\s*))*([\w\*\[\]]+\s\w+){0,1}\\)" self.regex_conditional = "^(if|else if|else)" self.regex_loop = "^(for|while|do)" self.regex_return = "^return" self.regex_assignment = "^({})\s\w\s=".format("|".join(self.language["var_types"].keys())).replace("*", "\\*")
def __init__(self, real_code, config): Fishier.__init__(self, real_code, config) with open(os.path.join("languages", "perl.json"), "r") as f: self.language = self.byteify_json(json.load(f)) self.regex_function = "^sub" self.regex_conditional = "^(if|elif|else)" self.regex_assignment = "^$\w(\s+)=" self.regex_loop = "^(for|while|with)" self.regex_return = "^return"
def __init__(self, real_code, config): Fishier.__init__(self, real_code, config) with open(os.path.join("languages", "golang.json"), "r") as f: self.language = self.byteify_json(json.load(f)) self.regex_function = "^func" self.regex_conditional = "^(if|else if|else)" self.regex_loop = "^(for|while)" self.regex_return = "^return" self.regex_assignment = "^var\s\w"
def __init__(self, real_code, config): Fishier.__init__(self, real_code, config) with open(os.path.join("languages", "python27.json"), "r") as f: self.language = self.byteify_json(json.load(f)) self.regex_function = "def\s\w+\\((\s\w+(\s*),(\s*))*(\w+){0,1}\\):" self.regex_conditional = "^(if|elif|else)" self.regex_loop = "^(for|while|with)" self.regex_assignment = "^\w(\s+)=" self.regex_return = "^return"