From 3e24a1de72c054bcddc21f1e4959b9a905a60fa2 Mon Sep 17 00:00:00 2001 From: Shunsuke Shibayama Date: Sat, 3 Dec 2022 19:57:04 +0900 Subject: [PATCH] Update re.d.er --- compiler/erg_compiler/lib/pystd/re.d.er | 49 ++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/compiler/erg_compiler/lib/pystd/re.d.er b/compiler/erg_compiler/lib/pystd/re.d.er index 98515c8a..42cbd566 100644 --- a/compiler/erg_compiler/lib/pystd/re.d.er +++ b/compiler/erg_compiler/lib/pystd/re.d.er @@ -1 +1,48 @@ -.sub: (pattern: Str, repl: Str, string: Str, count := Nat) -> Str +.RegexFlag: ClassType +.A: .RegexFlag +.ASCII: .RegexFlag +.DEBUG: .RegexFlag +.I: .RegexFlag +.IGNORECASE: .RegexFlag +.L: .RegexFlag +.LOCALE: .RegexFlag +.M: .RegexFlag +.MULTILINE: .RegexFlag +.NOFLAG: .RegexFlag +.S: .RegexFlag +.DOTALL: .RegexFlag +.X: .RegexFlag +.VERBOSE: .RegexFlag + +.Match: ClassType +.Match.expand: (self: .Match, template: Str) -> Str +# TODO: tuple +.Match.group: (self: .Match, x := Int or Str) -> Str +.Match.__getitem__: (self: .Match, x := Int or Str) -> Str + +.Pattern: ClassType +.Pattern.search: (self: .Pattern, string: Str) -> .Match or NoneType +.Pattern.match: (self: .Pattern, string: Str) -> .Match or NoneType +.Pattern.fullmatch: (self: .Pattern, string: Str) -> .Match or NoneType +.Pattern.split: (self: .Pattern, string: Str, maxspilit := Nat) -> [Str; _] +.Pattern.findall: (self: .Pattern, string: Str) -> [Str; _] +# TODO: iterator +.Pattern.finditer: (self: .Pattern, string: Str) -> [.Match; _] +.Pattern.sub: (self: .Pattern, repl: Str, string: Str, count := Nat) -> Str +.Pattern.subn: (self: .Pattern, repl: Str, string: Str, count := Nat) -> (Str, Nat) +.Pattern.flags: Nat +.Pattern.groups: Nat +.Pattern.pattern: Str + +.compile: (pattern: Str, flags := Nat or .RegexFlag) -> .Pattern +.search: (pattern: Str, string: Str, flags := Nat or .RegexFlag) -> .Match or NoneType +.match: (pattern: Str, string: Str, flags := Nat or .RegexFlag) -> .Match or NoneType +.fullmatch: (pattern: Str, string: Str, flags := Nat or .RegexFlag) -> .Match or NoneType +.split: (pattern: Str, string: Str, maxspilit := Nat, flags := Nat or .RegexFlag) -> [Str; _] +.findall: (pattern: Str, string: Str, flags := Nat or .RegexFlag) -> [Str; _] +# TODO: iterator +.finditer: (pattern: Str, string: Str, flags := Nat or .RegexFlag) -> [.Match; _] +.sub: (pattern: Str, repl: Str, string: Str, count := Nat, flags := Nat or .RegexFlag) -> Str +.subn: (pattern: Str, repl: Str, string: Str, count := Nat, flags := Nat or .RegexFlag) -> (Str, Nat) +.escape: (pattern: Str) -> Str +.purge!: () => ()