Do some simple recursion avoidence and improve reprs in lists/dicts

This commit is contained in:
K. Lange 2021-01-02 14:28:37 +09:00
parent 355dcb3705
commit cbdd60d768
4 changed files with 171 additions and 149 deletions

View File

@ -13,37 +13,45 @@ const char _builtins_src[] = {
0x0a,0x20,0x20,0x20,0x73,0x65,0x6c,0x66,0x2e,0x61,0x70,0x70,0x65,0x6e,0x64,0x28,
0x76,0x29,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x73,0x65,0x6c,0x66,
0x2e,0x5f,0x5f,0x6c,0x65,0x6e,0x5f,0x5f,0x28,0x29,0x0a,0x20,0x64,0x65,0x66,0x20,
0x5f,0x5f,0x72,0x65,0x70,0x72,0x5f,0x5f,0x28,0x73,0x65,0x6c,0x66,0x29,0x3a,0x20,
0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x73,0x65,0x6c,0x66,0x2e,0x5f,0x5f,0x73,0x74,
0x72,0x5f,0x5f,0x28,0x29,0x0a,0x20,0x64,0x65,0x66,0x20,0x5f,0x5f,0x73,0x74,0x72,
0x5f,0x5f,0x28,0x73,0x65,0x6c,0x66,0x29,0x3a,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,
0x62,0x3d,0x22,0x5b,0x22,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x6c,0x3d,0x73,0x65,
0x6c,0x66,0x2e,0x5f,0x5f,0x6c,0x65,0x6e,0x5f,0x5f,0x28,0x29,0x0a,0x20,0x20,0x66,
0x6f,0x72,0x20,0x69,0x3d,0x30,0x2c,0x69,0x3c,0x6c,0x2c,0x69,0x3d,0x69,0x2b,0x31,
0x3a,0x0a,0x20,0x20,0x20,0x69,0x66,0x20,0x69,0x3e,0x30,0x3a,0x0a,0x20,0x20,0x20,
0x20,0x62,0x2b,0x3d,0x22,0x2c,0x20,0x22,0x0a,0x20,0x20,0x20,0x62,0x2b,0x3d,0x72,
0x65,0x70,0x72,0x28,0x73,0x65,0x6c,0x66,0x5b,0x69,0x5d,0x29,0x0a,0x20,0x20,0x72,
0x65,0x74,0x75,0x72,0x6e,0x20,0x62,0x2b,0x22,0x5d,0x22,0x0a,0x20,0x64,0x65,0x66,
0x20,0x5f,0x5f,0x69,0x74,0x65,0x72,0x5f,0x5f,0x28,0x73,0x65,0x6c,0x66,0x29,0x3a,
0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x6d,0x20,0x3d,0x20,0x73,0x65,0x6c,0x66,0x0a,
0x20,0x20,0x64,0x65,0x66,0x20,0x49,0x28,0x69,0x29,0x3a,0x0a,0x20,0x20,0x20,0x6c,
0x65,0x74,0x20,0x65,0x3d,0x6d,0x0a,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x6c,0x3d,
0x65,0x2e,0x5f,0x5f,0x6c,0x65,0x6e,0x5f,0x5f,0x28,0x29,0x0a,0x20,0x20,0x20,0x6c,
0x65,0x74,0x20,0x78,0x3d,0x69,0x0a,0x20,0x20,0x20,0x64,0x65,0x66,0x20,0x5f,0x28,
0x29,0x3a,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x78,0x3e,0x3d,0x6c,0x3a,0x0a,
0x20,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x5f,0x0a,0x20,0x20,
0x20,0x20,0x6c,0x65,0x74,0x20,0x6f,0x3d,0x65,0x5b,0x78,0x5d,0x0a,0x20,0x20,0x20,
0x20,0x78,0x2b,0x2b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,
0x6f,0x0a,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x5f,0x0a,0x20,0x20,
0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x49,0x28,0x30,0x29,0x0a,0x0a,0x63,0x6c,0x61,
0x73,0x73,0x20,0x64,0x69,0x63,0x74,0x28,0x29,0x3a,0x0a,0x20,0x22,0x48,0x61,0x73,
0x68,0x6d,0x61,0x70,0x20,0x6f,0x66,0x20,0x61,0x72,0x62,0x69,0x74,0x72,0x61,0x72,
0x79,0x20,0x6b,0x65,0x79,0x73,0x20,0x74,0x6f,0x20,0x61,0x72,0x62,0x69,0x74,0x72,
0x61,0x72,0x79,0x20,0x76,0x61,0x6c,0x75,0x65,0x73,0x2e,0x22,0x0a,0x20,0x64,0x65,
0x66,0x20,0x5f,0x5f,0x72,0x65,0x70,0x72,0x5f,0x5f,0x28,0x73,0x65,0x6c,0x66,0x29,
0x3a,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x73,0x65,0x6c,0x66,0x2e,0x5f,0x5f,
0x73,0x74,0x72,0x5f,0x5f,0x28,0x29,0x0a,0x20,0x64,0x65,0x66,0x20,0x5f,0x5f,0x73,
0x74,0x72,0x5f,0x5f,0x28,0x73,0x65,0x6c,0x66,0x29,0x3a,0x0a,0x20,0x20,0x6c,0x65,
0x5f,0x5f,0x73,0x74,0x72,0x5f,0x5f,0x28,0x73,0x65,0x6c,0x66,0x29,0x3a,0x20,0x72,
0x65,0x74,0x75,0x72,0x6e,0x20,0x73,0x65,0x6c,0x66,0x2e,0x5f,0x5f,0x72,0x65,0x70,
0x72,0x5f,0x5f,0x28,0x29,0x0a,0x20,0x64,0x65,0x66,0x20,0x5f,0x5f,0x72,0x65,0x70,
0x72,0x5f,0x5f,0x28,0x73,0x65,0x6c,0x66,0x29,0x3a,0x0a,0x20,0x20,0x69,0x66,0x20,
0x73,0x65,0x6c,0x66,0x2e,0x5f,0x5f,0x69,0x6e,0x72,0x65,0x70,0x72,0x3a,0x20,0x72,
0x65,0x74,0x75,0x72,0x6e,0x20,0x22,0x5b,0x2e,0x2e,0x2e,0x5d,0x22,0x0a,0x20,0x20,
0x73,0x65,0x6c,0x66,0x2e,0x5f,0x5f,0x69,0x6e,0x72,0x65,0x70,0x72,0x3d,0x31,0x0a,
0x20,0x20,0x6c,0x65,0x74,0x20,0x62,0x3d,0x22,0x5b,0x22,0x0a,0x20,0x20,0x6c,0x65,
0x74,0x20,0x6c,0x3d,0x73,0x65,0x6c,0x66,0x2e,0x5f,0x5f,0x6c,0x65,0x6e,0x5f,0x5f,
0x28,0x29,0x0a,0x20,0x20,0x66,0x6f,0x72,0x20,0x69,0x3d,0x30,0x2c,0x69,0x3c,0x6c,
0x2c,0x69,0x3d,0x69,0x2b,0x31,0x3a,0x0a,0x20,0x20,0x20,0x69,0x66,0x20,0x69,0x3e,
0x30,0x3a,0x0a,0x20,0x20,0x20,0x20,0x62,0x2b,0x3d,0x22,0x2c,0x20,0x22,0x0a,0x20,
0x20,0x20,0x62,0x2b,0x3d,0x72,0x65,0x70,0x72,0x28,0x73,0x65,0x6c,0x66,0x5b,0x69,
0x5d,0x29,0x0a,0x20,0x20,0x73,0x65,0x6c,0x66,0x2e,0x5f,0x5f,0x69,0x6e,0x72,0x65,
0x70,0x72,0x3d,0x30,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x62,0x2b,
0x22,0x5d,0x22,0x0a,0x20,0x64,0x65,0x66,0x20,0x5f,0x5f,0x69,0x74,0x65,0x72,0x5f,
0x5f,0x28,0x73,0x65,0x6c,0x66,0x29,0x3a,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x6d,
0x20,0x3d,0x20,0x73,0x65,0x6c,0x66,0x0a,0x20,0x20,0x64,0x65,0x66,0x20,0x49,0x28,
0x69,0x29,0x3a,0x0a,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x65,0x3d,0x6d,0x0a,0x20,
0x20,0x20,0x6c,0x65,0x74,0x20,0x6c,0x3d,0x65,0x2e,0x5f,0x5f,0x6c,0x65,0x6e,0x5f,
0x5f,0x28,0x29,0x0a,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x3d,0x69,0x0a,0x20,
0x20,0x20,0x64,0x65,0x66,0x20,0x5f,0x28,0x29,0x3a,0x0a,0x20,0x20,0x20,0x20,0x69,
0x66,0x20,0x78,0x3e,0x3d,0x6c,0x3a,0x0a,0x20,0x20,0x20,0x20,0x20,0x72,0x65,0x74,
0x75,0x72,0x6e,0x20,0x5f,0x0a,0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x6f,0x3d,
0x65,0x5b,0x78,0x5d,0x0a,0x20,0x20,0x20,0x20,0x78,0x2b,0x2b,0x0a,0x20,0x20,0x20,
0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x0a,0x20,0x20,0x20,0x72,0x65,0x74,
0x75,0x72,0x6e,0x20,0x5f,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x49,
0x28,0x30,0x29,0x0a,0x0a,0x63,0x6c,0x61,0x73,0x73,0x20,0x64,0x69,0x63,0x74,0x28,
0x29,0x3a,0x0a,0x20,0x22,0x48,0x61,0x73,0x68,0x6d,0x61,0x70,0x20,0x6f,0x66,0x20,
0x61,0x72,0x62,0x69,0x74,0x72,0x61,0x72,0x79,0x20,0x6b,0x65,0x79,0x73,0x20,0x74,
0x6f,0x20,0x61,0x72,0x62,0x69,0x74,0x72,0x61,0x72,0x79,0x20,0x76,0x61,0x6c,0x75,
0x65,0x73,0x2e,0x22,0x0a,0x20,0x64,0x65,0x66,0x20,0x5f,0x5f,0x73,0x74,0x72,0x5f,
0x5f,0x28,0x73,0x65,0x6c,0x66,0x29,0x3a,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,
0x73,0x65,0x6c,0x66,0x2e,0x5f,0x5f,0x72,0x65,0x70,0x72,0x5f,0x5f,0x28,0x29,0x0a,
0x20,0x64,0x65,0x66,0x20,0x5f,0x5f,0x72,0x65,0x70,0x72,0x5f,0x5f,0x28,0x73,0x65,
0x6c,0x66,0x29,0x3a,0x0a,0x20,0x20,0x69,0x66,0x20,0x73,0x65,0x6c,0x66,0x2e,0x5f,
0x5f,0x69,0x6e,0x72,0x65,0x70,0x72,0x3a,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,
0x22,0x7b,0x2e,0x2e,0x2e,0x7d,0x22,0x0a,0x20,0x20,0x73,0x65,0x6c,0x66,0x2e,0x5f,
0x5f,0x69,0x6e,0x72,0x65,0x70,0x72,0x20,0x3d,0x20,0x31,0x0a,0x20,0x20,0x6c,0x65,
0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x22,0x7b,0x22,0x0a,0x20,0x20,0x6c,0x65,
0x74,0x20,0x66,0x69,0x72,0x73,0x74,0x20,0x3d,0x20,0x54,0x72,0x75,0x65,0x0a,0x20,
0x20,0x66,0x6f,0x72,0x20,0x76,0x20,0x69,0x6e,0x20,0x73,0x65,0x6c,0x66,0x2e,0x6b,
@ -51,118 +59,120 @@ const char _builtins_src[] = {
0x20,0x66,0x69,0x72,0x73,0x74,0x3a,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x20,
0x2b,0x3d,0x20,0x22,0x2c,0x20,0x22,0x0a,0x20,0x20,0x20,0x66,0x69,0x72,0x73,0x74,
0x20,0x3d,0x20,0x46,0x61,0x6c,0x73,0x65,0x0a,0x20,0x20,0x20,0x6f,0x75,0x74,0x20,
0x2b,0x3d,0x20,0x72,0x65,0x70,0x72,0x28,0x76,0x29,0x20,0x2b,0x20,0x22,0x3a,0x20,
0x22,0x20,0x2b,0x20,0x72,0x65,0x70,0x72,0x28,0x73,0x65,0x6c,0x66,0x5b,0x76,0x5d,
0x29,0x0a,0x20,0x20,0x6f,0x75,0x74,0x20,0x2b,0x3d,0x20,0x22,0x7d,0x22,0x0a,0x20,
0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x0a,0x20,0x64,0x65,0x66,
0x20,0x6b,0x65,0x79,0x73,0x28,0x73,0x65,0x6c,0x66,0x29,0x3a,0x0a,0x20,0x20,0x22,
0x52,0x65,0x74,0x75,0x72,0x6e,0x73,0x20,0x61,0x6e,0x20,0x69,0x74,0x65,0x72,0x61,
0x62,0x6c,0x65,0x20,0x6f,0x66,0x20,0x74,0x68,0x65,0x20,0x6b,0x65,0x79,0x73,0x20,
0x69,0x6e,0x20,0x74,0x68,0x69,0x73,0x20,0x64,0x69,0x63,0x74,0x69,0x6f,0x6e,0x61,
0x72,0x79,0x2e,0x22,0x0a,0x20,0x20,0x63,0x6c,0x61,0x73,0x73,0x20,0x4b,0x65,0x79,
0x49,0x74,0x65,0x72,0x61,0x74,0x6f,0x72,0x28,0x29,0x3a,0x0a,0x20,0x20,0x20,0x64,
0x65,0x66,0x20,0x5f,0x5f,0x69,0x6e,0x69,0x74,0x5f,0x5f,0x28,0x73,0x65,0x6c,0x66,
0x2c,0x20,0x74,0x61,0x72,0x67,0x65,0x74,0x29,0x3a,0x0a,0x20,0x20,0x20,0x20,0x73,
0x65,0x6c,0x66,0x2e,0x74,0x61,0x72,0x67,0x65,0x74,0x20,0x3d,0x20,0x74,0x61,0x72,
0x67,0x65,0x74,0x0a,0x20,0x20,0x20,0x64,0x65,0x66,0x20,0x5f,0x5f,0x69,0x74,0x65,
0x72,0x5f,0x5f,0x28,0x73,0x65,0x6c,0x66,0x29,0x3a,0x0a,0x20,0x20,0x20,0x20,0x6c,
0x65,0x74,0x20,0x6d,0x65,0x20,0x3d,0x20,0x73,0x65,0x6c,0x66,0x0a,0x20,0x20,0x20,
0x20,0x64,0x65,0x66,0x20,0x6d,0x61,0x6b,0x65,0x49,0x74,0x65,0x72,0x28,0x69,0x6e,
0x64,0x29,0x3a,0x0a,0x20,0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x6d,0x20,0x3d,
0x20,0x6d,0x65,0x2e,0x74,0x61,0x72,0x67,0x65,0x74,0x0a,0x20,0x20,0x20,0x20,0x20,
0x6c,0x65,0x74,0x20,0x63,0x20,0x3d,0x20,0x6d,0x2e,0x63,0x61,0x70,0x61,0x63,0x69,
0x74,0x79,0x28,0x29,0x0a,0x20,0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x69,0x20,
0x3d,0x20,0x69,0x6e,0x64,0x0a,0x20,0x20,0x20,0x20,0x20,0x64,0x65,0x66,0x20,0x69,
0x74,0x65,0x72,0x28,0x29,0x3a,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x6c,0x65,0x74,
0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x4e,0x6f,0x6e,0x65,0x0a,0x20,0x20,0x20,0x20,
0x20,0x20,0x77,0x68,0x69,0x6c,0x65,0x20,0x6f,0x75,0x74,0x20,0x3d,0x3d,0x20,0x4e,
0x6f,0x6e,0x65,0x20,0x61,0x6e,0x64,0x20,0x69,0x20,0x3c,0x20,0x63,0x3a,0x0a,0x20,
0x20,0x20,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x6d,0x2e,0x5f,0x6b,
0x65,0x79,0x5f,0x61,0x74,0x5f,0x69,0x6e,0x64,0x65,0x78,0x28,0x69,0x29,0x0a,0x20,
0x20,0x20,0x20,0x20,0x20,0x20,0x69,0x2b,0x2b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
0x69,0x66,0x20,0x6f,0x75,0x74,0x20,0x3d,0x3d,0x20,0x4e,0x6f,0x6e,0x65,0x3a,0x0a,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x69,0x74,
0x65,0x72,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x65,0x6c,0x73,0x65,0x3a,0x0a,0x20,
0x20,0x20,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,
0x0a,0x20,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x69,0x74,0x65,
0x72,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6d,0x61,0x6b,
0x65,0x49,0x74,0x65,0x72,0x28,0x30,0x29,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,
0x6e,0x20,0x4b,0x65,0x79,0x49,0x74,0x65,0x72,0x61,0x74,0x6f,0x72,0x28,0x73,0x65,
0x6c,0x66,0x29,0x0a,0x0a,0x63,0x6c,0x61,0x73,0x73,0x20,0x72,0x61,0x6e,0x67,0x65,
0x3a,0x0a,0x20,0x22,0x48,0x65,0x6c,0x70,0x66,0x75,0x6c,0x20,0x69,0x74,0x65,0x72,
0x61,0x62,0x6c,0x65,0x2e,0x22,0x0a,0x20,0x64,0x65,0x66,0x20,0x5f,0x5f,0x69,0x6e,
0x69,0x74,0x5f,0x5f,0x28,0x73,0x65,0x6c,0x66,0x2c,0x20,0x6d,0x69,0x6e,0x2c,0x20,
0x6d,0x61,0x78,0x29,0x3a,0x0a,0x20,0x20,0x73,0x65,0x6c,0x66,0x2e,0x6d,0x69,0x6e,
0x20,0x3d,0x20,0x6d,0x69,0x6e,0x0a,0x20,0x20,0x73,0x65,0x6c,0x66,0x2e,0x6d,0x61,
0x78,0x20,0x3d,0x20,0x6d,0x61,0x78,0x0a,0x20,0x64,0x65,0x66,0x20,0x5f,0x5f,0x69,
0x74,0x65,0x72,0x5f,0x5f,0x28,0x73,0x65,0x6c,0x66,0x29,0x3a,0x0a,0x20,0x20,0x6c,
0x65,0x74,0x20,0x6d,0x65,0x20,0x3d,0x20,0x73,0x65,0x6c,0x66,0x0a,0x20,0x20,0x64,
0x2b,0x3d,0x20,0x76,0x2e,0x5f,0x5f,0x72,0x65,0x70,0x72,0x5f,0x5f,0x28,0x29,0x20,
0x2b,0x20,0x22,0x3a,0x20,0x22,0x20,0x2b,0x20,0x73,0x65,0x6c,0x66,0x5b,0x76,0x5d,
0x2e,0x5f,0x5f,0x72,0x65,0x70,0x72,0x5f,0x5f,0x28,0x29,0x0a,0x20,0x20,0x6f,0x75,
0x74,0x20,0x2b,0x3d,0x20,0x22,0x7d,0x22,0x0a,0x20,0x20,0x73,0x65,0x6c,0x66,0x2e,
0x5f,0x5f,0x69,0x6e,0x72,0x65,0x70,0x72,0x20,0x3d,0x20,0x30,0x0a,0x20,0x20,0x72,
0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x0a,0x20,0x64,0x65,0x66,0x20,0x6b,
0x65,0x79,0x73,0x28,0x73,0x65,0x6c,0x66,0x29,0x3a,0x0a,0x20,0x20,0x22,0x52,0x65,
0x74,0x75,0x72,0x6e,0x73,0x20,0x61,0x6e,0x20,0x69,0x74,0x65,0x72,0x61,0x62,0x6c,
0x65,0x20,0x6f,0x66,0x20,0x74,0x68,0x65,0x20,0x6b,0x65,0x79,0x73,0x20,0x69,0x6e,
0x20,0x74,0x68,0x69,0x73,0x20,0x64,0x69,0x63,0x74,0x69,0x6f,0x6e,0x61,0x72,0x79,
0x2e,0x22,0x0a,0x20,0x20,0x63,0x6c,0x61,0x73,0x73,0x20,0x4b,0x65,0x79,0x49,0x74,
0x65,0x72,0x61,0x74,0x6f,0x72,0x28,0x29,0x3a,0x0a,0x20,0x20,0x20,0x64,0x65,0x66,
0x20,0x5f,0x5f,0x69,0x6e,0x69,0x74,0x5f,0x5f,0x28,0x73,0x65,0x6c,0x66,0x2c,0x20,
0x74,0x61,0x72,0x67,0x65,0x74,0x29,0x3a,0x0a,0x20,0x20,0x20,0x20,0x73,0x65,0x6c,
0x66,0x2e,0x74,0x61,0x72,0x67,0x65,0x74,0x20,0x3d,0x20,0x74,0x61,0x72,0x67,0x65,
0x74,0x0a,0x20,0x20,0x20,0x64,0x65,0x66,0x20,0x5f,0x5f,0x69,0x74,0x65,0x72,0x5f,
0x5f,0x28,0x73,0x65,0x6c,0x66,0x29,0x3a,0x0a,0x20,0x20,0x20,0x20,0x6c,0x65,0x74,
0x20,0x6d,0x65,0x20,0x3d,0x20,0x73,0x65,0x6c,0x66,0x0a,0x20,0x20,0x20,0x20,0x64,
0x65,0x66,0x20,0x6d,0x61,0x6b,0x65,0x49,0x74,0x65,0x72,0x28,0x69,0x6e,0x64,0x29,
0x3a,0x0a,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x6c,0x20,0x3d,0x20,0x6d,0x65,0x0a,
0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x69,0x20,0x3d,0x20,0x69,0x6e,0x64,0x0a,0x20,
0x20,0x20,0x64,0x65,0x66,0x20,0x69,0x74,0x65,0x72,0x28,0x29,0x3a,0x0a,0x20,0x20,
0x20,0x20,0x69,0x66,0x20,0x69,0x20,0x3e,0x3d,0x20,0x6c,0x2e,0x6d,0x61,0x78,0x3a,
0x0a,0x20,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x69,0x74,0x65,
0x72,0x0a,0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,
0x69,0x0a,0x20,0x20,0x20,0x20,0x69,0x2b,0x2b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,
0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x0a,0x20,0x20,0x20,0x72,0x65,0x74,0x75,
0x72,0x6e,0x20,0x69,0x74,0x65,0x72,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,
0x20,0x6d,0x61,0x6b,0x65,0x49,0x74,0x65,0x72,0x28,0x73,0x65,0x6c,0x66,0x2e,0x6d,
0x69,0x6e,0x29,0x0a,0x0a,0x64,0x65,0x66,0x20,0x6c,0x65,0x6e,0x28,0x6f,0x62,0x6a,
0x3d,0x4e,0x6f,0x6e,0x65,0x29,0x3a,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x28,
0x6f,0x62,0x6a,0x20,0x61,0x6e,0x64,0x20,0x6f,0x62,0x6a,0x2e,0x5f,0x5f,0x6c,0x65,
0x6e,0x5f,0x5f,0x28,0x29,0x29,0x20,0x6f,0x72,0x20,0x30,0x0a,0x64,0x65,0x66,0x20,
0x73,0x74,0x72,0x28,0x6f,0x62,0x6a,0x3d,0x4e,0x6f,0x6e,0x65,0x29,0x3a,0x20,0x72,
0x65,0x74,0x75,0x72,0x6e,0x20,0x28,0x6f,0x62,0x6a,0x20,0x61,0x6e,0x64,0x20,0x6f,
0x62,0x6a,0x2e,0x5f,0x5f,0x73,0x74,0x72,0x5f,0x5f,0x28,0x29,0x29,0x20,0x6f,0x72,
0x20,0x22,0x22,0x0a,0x64,0x65,0x66,0x20,0x72,0x65,0x70,0x72,0x28,0x6f,0x62,0x6a,
0x29,0x3a,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x62,0x6a,0x2e,0x5f,0x5f,
0x72,0x65,0x70,0x72,0x5f,0x5f,0x28,0x29,0x0a,0x64,0x65,0x66,0x20,0x69,0x6e,0x74,
0x28,0x6f,0x62,0x6a,0x3d,0x4e,0x6f,0x6e,0x65,0x29,0x3a,0x20,0x72,0x65,0x74,0x75,
0x72,0x6e,0x20,0x28,0x6f,0x62,0x6a,0x20,0x61,0x6e,0x64,0x20,0x6f,0x62,0x6a,0x2e,
0x5f,0x5f,0x69,0x6e,0x74,0x5f,0x5f,0x28,0x29,0x29,0x20,0x6f,0x72,0x20,0x30,0x0a,
0x64,0x65,0x66,0x20,0x66,0x6c,0x6f,0x61,0x74,0x28,0x6f,0x62,0x6a,0x3d,0x4e,0x6f,
0x6e,0x65,0x29,0x3a,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x28,0x6f,0x62,0x6a,
0x20,0x61,0x6e,0x64,0x20,0x6f,0x62,0x6a,0x2e,0x5f,0x5f,0x66,0x6c,0x6f,0x61,0x74,
0x5f,0x5f,0x28,0x29,0x29,0x20,0x6f,0x72,0x20,0x30,0x2e,0x30,0x0a,0x64,0x65,0x66,
0x20,0x74,0x79,0x70,0x65,0x28,0x6f,0x62,0x6a,0x29,0x3a,0x20,0x72,0x65,0x74,0x75,
0x72,0x6e,0x20,0x6f,0x62,0x6a,0x2e,0x5f,0x5f,0x63,0x6c,0x61,0x73,0x73,0x5f,0x5f,
0x0a,0x64,0x65,0x66,0x20,0x64,0x69,0x72,0x28,0x6f,0x62,0x6a,0x29,0x3a,0x20,0x72,
0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x62,0x6a,0x2e,0x5f,0x5f,0x64,0x69,0x72,0x5f,
0x5f,0x28,0x29,0x0a,0x0a,0x64,0x65,0x66,0x20,0x68,0x65,0x6c,0x70,0x28,0x6f,0x62,
0x6a,0x3d,0x4e,0x6f,0x6e,0x65,0x29,0x3a,0x0a,0x20,0x69,0x66,0x20,0x6e,0x6f,0x74,
0x20,0x6f,0x62,0x6a,0x3a,0x0a,0x20,0x20,0x70,0x72,0x69,0x6e,0x74,0x20,0x22,0x4b,
0x75,0x72,0x6f,0x6b,0x6f,0x20,0x2d,0x20,0x49,0x6e,0x74,0x65,0x72,0x70,0x72,0x65,
0x74,0x65,0x64,0x20,0x62,0x79,0x74,0x65,0x63,0x6f,0x64,0x65,0x20,0x56,0x4d,0x2e,
0x22,0x0a,0x20,0x20,0x70,0x72,0x69,0x6e,0x74,0x20,0x22,0x20,0x20,0x75,0x73,0x61,
0x67,0x65,0x3a,0x22,0x0a,0x20,0x20,0x70,0x72,0x69,0x6e,0x74,0x20,0x22,0x20,0x20,
0x20,0x20,0x68,0x65,0x6c,0x70,0x28,0x29,0x20,0x20,0x20,0x20,0x20,0x20,0x2d,0x20,
0x44,0x69,0x73,0x70,0x6c,0x61,0x79,0x73,0x20,0x74,0x68,0x69,0x73,0x20,0x6d,0x65,
0x73,0x73,0x61,0x67,0x65,0x2e,0x22,0x0a,0x20,0x20,0x70,0x72,0x69,0x6e,0x74,0x20,
0x22,0x20,0x20,0x20,0x20,0x68,0x65,0x6c,0x70,0x28,0x66,0x75,0x6e,0x63,0x29,0x20,
0x20,0x2d,0x20,0x44,0x69,0x73,0x70,0x6c,0x61,0x79,0x73,0x20,0x64,0x6f,0x63,0x73,
0x74,0x72,0x69,0x6e,0x67,0x20,0x66,0x6f,0x72,0x20,0x66,0x75,0x6e,0x63,0x74,0x69,
0x6f,0x6e,0x2c,0x20,0x69,0x66,0x20,0x70,0x72,0x65,0x73,0x65,0x6e,0x74,0x2e,0x22,
0x0a,0x20,0x20,0x70,0x72,0x69,0x6e,0x74,0x20,0x22,0x20,0x20,0x20,0x20,0x68,0x65,
0x6c,0x70,0x28,0x63,0x6c,0x61,0x73,0x73,0x29,0x20,0x2d,0x20,0x44,0x69,0x73,0x70,
0x6c,0x61,0x79,0x73,0x20,0x64,0x6f,0x63,0x73,0x74,0x72,0x69,0x6e,0x67,0x20,0x66,
0x6f,0x72,0x20,0x63,0x6c,0x61,0x73,0x73,0x2c,0x20,0x69,0x66,0x20,0x70,0x72,0x65,
0x73,0x65,0x6e,0x74,0x2e,0x22,0x0a,0x20,0x65,0x6c,0x73,0x65,0x3a,0x0a,0x20,0x20,
0x74,0x72,0x79,0x3a,0x0a,0x20,0x20,0x20,0x70,0x72,0x69,0x6e,0x74,0x20,0x6f,0x62,
0x6a,0x2e,0x5f,0x5f,0x64,0x6f,0x63,0x5f,0x5f,0x0a,0x20,0x20,0x65,0x78,0x63,0x65,
0x70,0x74,0x3a,0x0a,0x20,0x20,0x20,0x70,0x72,0x69,0x6e,0x74,0x20,0x22,0x4e,0x6f,
0x20,0x64,0x6f,0x63,0x73,0x74,0x72,0x69,0x6e,0x67,0x20,0x61,0x76,0x61,0x69,0x6c,
0x61,0x62,0x6c,0x65,0x20,0x66,0x6f,0x72,0x22,0x2c,0x20,0x6f,0x62,0x6a,0x0a,0x0a,
0x65,0x78,0x70,0x6f,0x72,0x74,0x20,0x6c,0x69,0x73,0x74,0x2c,0x64,0x69,0x63,0x74,
0x2c,0x72,0x61,0x6e,0x67,0x65,0x2c,0x6c,0x65,0x6e,0x2c,0x73,0x74,0x72,0x2c,0x72,
0x65,0x70,0x72,0x2c,0x69,0x6e,0x74,0x2c,0x66,0x6c,0x6f,0x61,0x74,0x2c,0x64,0x69,
0x72,0x2c,0x68,0x65,0x6c,0x70,0x0a,0x0a,0x5f,0x5f,0x62,0x75,0x69,0x6c,0x74,0x69,
0x6e,0x73,0x5f,0x5f,0x2e,0x6d,0x6f,0x64,0x75,0x6c,0x65,0x5f,0x70,0x61,0x74,0x68,
0x73,0x20,0x3d,0x20,0x5b,0x22,0x2e,0x2f,0x22,0x2c,0x22,0x2e,0x2f,0x6d,0x6f,0x64,
0x75,0x6c,0x65,0x73,0x2f,0x22,0x2c,0x22,0x2f,0x68,0x6f,0x6d,0x65,0x2f,0x6b,0x6c,
0x61,0x6e,0x67,0x65,0x2f,0x50,0x72,0x6f,0x6a,0x65,0x63,0x74,0x73,0x2f,0x6b,0x75,
0x72,0x6f,0x6b,0x6f,0x2f,0x6d,0x6f,0x64,0x75,0x6c,0x65,0x73,0x2f,0x22,0x2c,0x22,
0x2f,0x75,0x73,0x72,0x2f,0x73,0x68,0x61,0x72,0x65,0x2f,0x6b,0x75,0x72,0x6f,0x6b,
0x6f,0x2f,0x22,0x5d,0x0a,0x0a,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x62,0x6a,
0x65,0x63,0x74,0x28,0x29,0x0a,
0x3a,0x0a,0x20,0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x6d,0x20,0x3d,0x20,0x6d,
0x65,0x2e,0x74,0x61,0x72,0x67,0x65,0x74,0x0a,0x20,0x20,0x20,0x20,0x20,0x6c,0x65,
0x74,0x20,0x63,0x20,0x3d,0x20,0x6d,0x2e,0x63,0x61,0x70,0x61,0x63,0x69,0x74,0x79,
0x28,0x29,0x0a,0x20,0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x69,0x20,0x3d,0x20,
0x69,0x6e,0x64,0x0a,0x20,0x20,0x20,0x20,0x20,0x64,0x65,0x66,0x20,0x69,0x74,0x65,
0x72,0x28,0x29,0x3a,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x6f,
0x75,0x74,0x20,0x3d,0x20,0x4e,0x6f,0x6e,0x65,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
0x77,0x68,0x69,0x6c,0x65,0x20,0x6f,0x75,0x74,0x20,0x3d,0x3d,0x20,0x4e,0x6f,0x6e,
0x65,0x20,0x61,0x6e,0x64,0x20,0x69,0x20,0x3c,0x20,0x63,0x3a,0x0a,0x20,0x20,0x20,
0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x6d,0x2e,0x5f,0x6b,0x65,0x79,
0x5f,0x61,0x74,0x5f,0x69,0x6e,0x64,0x65,0x78,0x28,0x69,0x29,0x0a,0x20,0x20,0x20,
0x20,0x20,0x20,0x20,0x69,0x2b,0x2b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x69,0x66,
0x20,0x6f,0x75,0x74,0x20,0x3d,0x3d,0x20,0x4e,0x6f,0x6e,0x65,0x3a,0x0a,0x20,0x20,
0x20,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x69,0x74,0x65,0x72,
0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x65,0x6c,0x73,0x65,0x3a,0x0a,0x20,0x20,0x20,
0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x0a,0x20,
0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x69,0x74,0x65,0x72,0x0a,
0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6d,0x61,0x6b,0x65,0x49,
0x74,0x65,0x72,0x28,0x30,0x29,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,
0x4b,0x65,0x79,0x49,0x74,0x65,0x72,0x61,0x74,0x6f,0x72,0x28,0x73,0x65,0x6c,0x66,
0x29,0x0a,0x0a,0x63,0x6c,0x61,0x73,0x73,0x20,0x72,0x61,0x6e,0x67,0x65,0x3a,0x0a,
0x20,0x22,0x48,0x65,0x6c,0x70,0x66,0x75,0x6c,0x20,0x69,0x74,0x65,0x72,0x61,0x62,
0x6c,0x65,0x2e,0x22,0x0a,0x20,0x64,0x65,0x66,0x20,0x5f,0x5f,0x69,0x6e,0x69,0x74,
0x5f,0x5f,0x28,0x73,0x65,0x6c,0x66,0x2c,0x20,0x6d,0x69,0x6e,0x2c,0x20,0x6d,0x61,
0x78,0x29,0x3a,0x0a,0x20,0x20,0x73,0x65,0x6c,0x66,0x2e,0x6d,0x69,0x6e,0x20,0x3d,
0x20,0x6d,0x69,0x6e,0x0a,0x20,0x20,0x73,0x65,0x6c,0x66,0x2e,0x6d,0x61,0x78,0x20,
0x3d,0x20,0x6d,0x61,0x78,0x0a,0x20,0x64,0x65,0x66,0x20,0x5f,0x5f,0x69,0x74,0x65,
0x72,0x5f,0x5f,0x28,0x73,0x65,0x6c,0x66,0x29,0x3a,0x0a,0x20,0x20,0x6c,0x65,0x74,
0x20,0x6d,0x65,0x20,0x3d,0x20,0x73,0x65,0x6c,0x66,0x0a,0x20,0x20,0x64,0x65,0x66,
0x20,0x6d,0x61,0x6b,0x65,0x49,0x74,0x65,0x72,0x28,0x69,0x6e,0x64,0x29,0x3a,0x0a,
0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x6c,0x20,0x3d,0x20,0x6d,0x65,0x0a,0x20,0x20,
0x20,0x6c,0x65,0x74,0x20,0x69,0x20,0x3d,0x20,0x69,0x6e,0x64,0x0a,0x20,0x20,0x20,
0x64,0x65,0x66,0x20,0x69,0x74,0x65,0x72,0x28,0x29,0x3a,0x0a,0x20,0x20,0x20,0x20,
0x69,0x66,0x20,0x69,0x20,0x3e,0x3d,0x20,0x6c,0x2e,0x6d,0x61,0x78,0x3a,0x0a,0x20,
0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x69,0x74,0x65,0x72,0x0a,
0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x69,0x0a,
0x20,0x20,0x20,0x20,0x69,0x2b,0x2b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,
0x72,0x6e,0x20,0x6f,0x75,0x74,0x0a,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,
0x20,0x69,0x74,0x65,0x72,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6d,
0x61,0x6b,0x65,0x49,0x74,0x65,0x72,0x28,0x73,0x65,0x6c,0x66,0x2e,0x6d,0x69,0x6e,
0x29,0x0a,0x0a,0x64,0x65,0x66,0x20,0x6c,0x65,0x6e,0x28,0x6f,0x62,0x6a,0x3d,0x4e,
0x6f,0x6e,0x65,0x29,0x3a,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x28,0x6f,0x62,
0x6a,0x20,0x61,0x6e,0x64,0x20,0x6f,0x62,0x6a,0x2e,0x5f,0x5f,0x6c,0x65,0x6e,0x5f,
0x5f,0x28,0x29,0x29,0x20,0x6f,0x72,0x20,0x30,0x0a,0x64,0x65,0x66,0x20,0x73,0x74,
0x72,0x28,0x6f,0x62,0x6a,0x3d,0x4e,0x6f,0x6e,0x65,0x29,0x3a,0x20,0x72,0x65,0x74,
0x75,0x72,0x6e,0x20,0x28,0x6f,0x62,0x6a,0x20,0x61,0x6e,0x64,0x20,0x6f,0x62,0x6a,
0x2e,0x5f,0x5f,0x73,0x74,0x72,0x5f,0x5f,0x28,0x29,0x29,0x20,0x6f,0x72,0x20,0x22,
0x22,0x0a,0x64,0x65,0x66,0x20,0x72,0x65,0x70,0x72,0x28,0x6f,0x62,0x6a,0x29,0x3a,
0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x62,0x6a,0x2e,0x5f,0x5f,0x72,0x65,
0x70,0x72,0x5f,0x5f,0x28,0x29,0x0a,0x64,0x65,0x66,0x20,0x69,0x6e,0x74,0x28,0x6f,
0x62,0x6a,0x3d,0x4e,0x6f,0x6e,0x65,0x29,0x3a,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,
0x20,0x28,0x6f,0x62,0x6a,0x20,0x61,0x6e,0x64,0x20,0x6f,0x62,0x6a,0x2e,0x5f,0x5f,
0x69,0x6e,0x74,0x5f,0x5f,0x28,0x29,0x29,0x20,0x6f,0x72,0x20,0x30,0x0a,0x64,0x65,
0x66,0x20,0x66,0x6c,0x6f,0x61,0x74,0x28,0x6f,0x62,0x6a,0x3d,0x4e,0x6f,0x6e,0x65,
0x29,0x3a,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x28,0x6f,0x62,0x6a,0x20,0x61,
0x6e,0x64,0x20,0x6f,0x62,0x6a,0x2e,0x5f,0x5f,0x66,0x6c,0x6f,0x61,0x74,0x5f,0x5f,
0x28,0x29,0x29,0x20,0x6f,0x72,0x20,0x30,0x2e,0x30,0x0a,0x64,0x65,0x66,0x20,0x74,
0x79,0x70,0x65,0x28,0x6f,0x62,0x6a,0x29,0x3a,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,
0x20,0x6f,0x62,0x6a,0x2e,0x5f,0x5f,0x63,0x6c,0x61,0x73,0x73,0x5f,0x5f,0x0a,0x64,
0x65,0x66,0x20,0x64,0x69,0x72,0x28,0x6f,0x62,0x6a,0x29,0x3a,0x20,0x72,0x65,0x74,
0x75,0x72,0x6e,0x20,0x6f,0x62,0x6a,0x2e,0x5f,0x5f,0x64,0x69,0x72,0x5f,0x5f,0x28,
0x29,0x0a,0x0a,0x64,0x65,0x66,0x20,0x68,0x65,0x6c,0x70,0x28,0x6f,0x62,0x6a,0x3d,
0x4e,0x6f,0x6e,0x65,0x29,0x3a,0x0a,0x20,0x69,0x66,0x20,0x6e,0x6f,0x74,0x20,0x6f,
0x62,0x6a,0x3a,0x0a,0x20,0x20,0x70,0x72,0x69,0x6e,0x74,0x20,0x22,0x4b,0x75,0x72,
0x6f,0x6b,0x6f,0x20,0x2d,0x20,0x49,0x6e,0x74,0x65,0x72,0x70,0x72,0x65,0x74,0x65,
0x64,0x20,0x62,0x79,0x74,0x65,0x63,0x6f,0x64,0x65,0x20,0x56,0x4d,0x2e,0x22,0x0a,
0x20,0x20,0x70,0x72,0x69,0x6e,0x74,0x20,0x22,0x20,0x20,0x75,0x73,0x61,0x67,0x65,
0x3a,0x22,0x0a,0x20,0x20,0x70,0x72,0x69,0x6e,0x74,0x20,0x22,0x20,0x20,0x20,0x20,
0x68,0x65,0x6c,0x70,0x28,0x29,0x20,0x20,0x20,0x20,0x20,0x20,0x2d,0x20,0x44,0x69,
0x73,0x70,0x6c,0x61,0x79,0x73,0x20,0x74,0x68,0x69,0x73,0x20,0x6d,0x65,0x73,0x73,
0x61,0x67,0x65,0x2e,0x22,0x0a,0x20,0x20,0x70,0x72,0x69,0x6e,0x74,0x20,0x22,0x20,
0x20,0x20,0x20,0x68,0x65,0x6c,0x70,0x28,0x66,0x75,0x6e,0x63,0x29,0x20,0x20,0x2d,
0x20,0x44,0x69,0x73,0x70,0x6c,0x61,0x79,0x73,0x20,0x64,0x6f,0x63,0x73,0x74,0x72,
0x69,0x6e,0x67,0x20,0x66,0x6f,0x72,0x20,0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e,
0x2c,0x20,0x69,0x66,0x20,0x70,0x72,0x65,0x73,0x65,0x6e,0x74,0x2e,0x22,0x0a,0x20,
0x20,0x70,0x72,0x69,0x6e,0x74,0x20,0x22,0x20,0x20,0x20,0x20,0x68,0x65,0x6c,0x70,
0x28,0x63,0x6c,0x61,0x73,0x73,0x29,0x20,0x2d,0x20,0x44,0x69,0x73,0x70,0x6c,0x61,
0x79,0x73,0x20,0x64,0x6f,0x63,0x73,0x74,0x72,0x69,0x6e,0x67,0x20,0x66,0x6f,0x72,
0x20,0x63,0x6c,0x61,0x73,0x73,0x2c,0x20,0x69,0x66,0x20,0x70,0x72,0x65,0x73,0x65,
0x6e,0x74,0x2e,0x22,0x0a,0x20,0x65,0x6c,0x73,0x65,0x3a,0x0a,0x20,0x20,0x74,0x72,
0x79,0x3a,0x0a,0x20,0x20,0x20,0x70,0x72,0x69,0x6e,0x74,0x20,0x6f,0x62,0x6a,0x2e,
0x5f,0x5f,0x64,0x6f,0x63,0x5f,0x5f,0x0a,0x20,0x20,0x65,0x78,0x63,0x65,0x70,0x74,
0x3a,0x0a,0x20,0x20,0x20,0x70,0x72,0x69,0x6e,0x74,0x20,0x22,0x4e,0x6f,0x20,0x64,
0x6f,0x63,0x73,0x74,0x72,0x69,0x6e,0x67,0x20,0x61,0x76,0x61,0x69,0x6c,0x61,0x62,
0x6c,0x65,0x20,0x66,0x6f,0x72,0x22,0x2c,0x20,0x6f,0x62,0x6a,0x0a,0x0a,0x65,0x78,
0x70,0x6f,0x72,0x74,0x20,0x6c,0x69,0x73,0x74,0x2c,0x64,0x69,0x63,0x74,0x2c,0x72,
0x61,0x6e,0x67,0x65,0x2c,0x6c,0x65,0x6e,0x2c,0x73,0x74,0x72,0x2c,0x72,0x65,0x70,
0x72,0x2c,0x69,0x6e,0x74,0x2c,0x66,0x6c,0x6f,0x61,0x74,0x2c,0x64,0x69,0x72,0x2c,
0x68,0x65,0x6c,0x70,0x0a,0x0a,0x5f,0x5f,0x62,0x75,0x69,0x6c,0x74,0x69,0x6e,0x73,
0x5f,0x5f,0x2e,0x6d,0x6f,0x64,0x75,0x6c,0x65,0x5f,0x70,0x61,0x74,0x68,0x73,0x20,
0x3d,0x20,0x5b,0x22,0x2e,0x2f,0x22,0x2c,0x22,0x2e,0x2f,0x6d,0x6f,0x64,0x75,0x6c,
0x65,0x73,0x2f,0x22,0x2c,0x22,0x2f,0x68,0x6f,0x6d,0x65,0x2f,0x6b,0x6c,0x61,0x6e,
0x67,0x65,0x2f,0x50,0x72,0x6f,0x6a,0x65,0x63,0x74,0x73,0x2f,0x6b,0x75,0x72,0x6f,
0x6b,0x6f,0x2f,0x6d,0x6f,0x64,0x75,0x6c,0x65,0x73,0x2f,0x22,0x2c,0x22,0x2f,0x75,
0x73,0x72,0x2f,0x73,0x68,0x61,0x72,0x65,0x2f,0x6b,0x75,0x72,0x6f,0x6b,0x6f,0x2f,
0x22,0x5d,0x0a,0x0a,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x62,0x6a,0x65,0x63,
0x74,0x28,0x29,0x0a,
0x00 };

View File

@ -5,14 +5,17 @@ class list():
for v in i:
self.append(v)
return self.__len__()
def __repr__(self): return self.__str__()
def __str__(self):
def __str__(self): return self.__repr__()
def __repr__(self):
if self.__inrepr: return "[...]"
self.__inrepr=1
let b="["
let l=self.__len__()
for i=0,i<l,i=i+1:
if i>0:
b+=", "
b+=repr(self[i])
self.__inrepr=0
return b+"]"
def __iter__(self):
let m = self
@ -31,16 +34,19 @@ class list():
class dict():
"Hashmap of arbitrary keys to arbitrary values."
def __repr__(self): return self.__str__()
def __str__(self):
def __str__(self): return self.__repr__()
def __repr__(self):
if self.__inrepr: return "{...}"
self.__inrepr = 1
let out = "{"
let first = True
for v in self.keys():
if not first:
out += ", "
first = False
out += repr(v) + ": " + repr(self[v])
out += v.__repr__() + ": " + self[v].__repr__()
out += "}"
self.__inrepr = 0
return out
def keys(self):
"Returns an iterable of the keys in this dictionary."

5
vm.c
View File

@ -190,6 +190,7 @@ static KrkValue _dict_init(int argc, KrkValue argv[]) {
KrkClass * dict = krk_newClass(NULL);
krk_push(OBJECT_VAL(dict));
krk_tableSet(&AS_INSTANCE(argv[0])->fields, vm.specialMethodNames[METHOD_DICT_INT], OBJECT_VAL(dict));
krk_tableSet(&AS_INSTANCE(argv[0])->fields, OBJECT_VAL(S("__inrepr")), INTEGER_VAL(0));
krk_pop();
return argv[0];
}
@ -281,6 +282,7 @@ static KrkValue _list_init(int argc, KrkValue argv[]) {
KrkFunction * list = krk_newFunction(NULL);
krk_push(OBJECT_VAL(list));
krk_tableSet(&AS_INSTANCE(argv[0])->fields, vm.specialMethodNames[METHOD_LIST_INT], OBJECT_VAL(list));
krk_tableSet(&AS_INSTANCE(argv[0])->fields, vm.specialMethodNames[METHOD_INREPR], INTEGER_VAL(0));
krk_pop();
return argv[0];
}
@ -377,6 +379,7 @@ static KrkValue krk_list_of(int argc, KrkValue argv[]) {
KrkFunction * listContents = krk_newFunction(NULL);
krk_push(OBJECT_VAL(listContents));
krk_tableSet(&outList->fields, vm.specialMethodNames[METHOD_LIST_INT], OBJECT_VAL(listContents));
krk_tableSet(&outList->fields, vm.specialMethodNames[METHOD_INREPR], INTEGER_VAL(0));
for (int ind = 0; ind < argc; ++ind) {
krk_writeValueArray(&listContents->chunk.constants, argv[ind]);
}
@ -402,6 +405,7 @@ static KrkValue krk_dict_of(int argc, KrkValue argv[]) {
KrkClass * dictContents = krk_newClass(NULL);
krk_push(OBJECT_VAL(dictContents));
krk_tableSet(&outDict->fields, vm.specialMethodNames[METHOD_DICT_INT], OBJECT_VAL(dictContents));
krk_tableSet(&outDict->fields, vm.specialMethodNames[METHOD_INREPR], INTEGER_VAL(0));
for (int ind = 0; ind < argc; ind += 2) {
krk_tableSet(&dictContents->methods, argv[ind], argv[ind+1]);
}
@ -1178,6 +1182,7 @@ void krk_initVM(int flags) {
vm.specialMethodNames[METHOD_GETSLICE] = OBJECT_VAL(S("__getslice__"));
vm.specialMethodNames[METHOD_LIST_INT] = OBJECT_VAL(S("__list"));
vm.specialMethodNames[METHOD_DICT_INT] = OBJECT_VAL(S("__dict"));
vm.specialMethodNames[METHOD_INREPR] = OBJECT_VAL(S("__inrepr"));
/* Create built-in class `object` */
vm.objectClass = krk_newClass(S("object"));

1
vm.h
View File

@ -34,6 +34,7 @@ typedef enum {
METHOD_GETSLICE,
METHOD_LIST_INT,
METHOD_DICT_INT,
METHOD_INREPR,
METHOD__MAX,
} KrkSpecialMethods;