diff --git a/compiler/erg_common/python_util.rs b/compiler/erg_common/python_util.rs index ada53809..9ec7a385 100644 --- a/compiler/erg_common/python_util.rs +++ b/compiler/erg_common/python_util.rs @@ -6,7 +6,8 @@ use std::process::Command; use crate::serialize::get_magic_num_from_bytes; #[cfg(unix)] -pub const BUILTIN_PYTHON_MODS: [&str; 23] = [ +pub const BUILTIN_PYTHON_MODS: [&str; 24] = [ + "argparse", "copy", "datetime", "glob", @@ -32,7 +33,8 @@ pub const BUILTIN_PYTHON_MODS: [&str; 23] = [ "zipfile", ]; #[cfg(not(unix))] -pub const BUILTIN_PYTHON_MODS: [&str; 22] = [ +pub const BUILTIN_PYTHON_MODS: [&str; 23] = [ + "argparse", "copy", "datetime", "glob", diff --git a/compiler/erg_compiler/lib/pystd/argparse.d.er b/compiler/erg_compiler/lib/pystd/argparse.d.er new file mode 100644 index 00000000..6b0737e8 --- /dev/null +++ b/compiler/erg_compiler/lib/pystd/argparse.d.er @@ -0,0 +1,14 @@ +._StoreAction: ClassType + +.ArgumentParser!: ClassType +.new = 'ArgumentParser': (description := Str, prog := Str) -> .ArgumentParser! +.ArgumentParser!.add_argument!: ( + name: Str, # TODO: var-args + action := Str or NoneType, + default := Obj or NoneType, + type := Type, + required := Bool, + help := Str or NoneType, + choices := Obj or NoneType, +) => ._StoreAction +.ArgumentParser!.parse_args!: (args := Str or [Str; _] or NoneType,) => Obj # TODO: type with dependent types