Commit Graph

112 Commits

Author SHA1 Message Date
K. Lange
97922d3922 Improvements to exceptions
- Exceptions get repr'd to print for better flexibility and no more weird
  if/else tree in dumpTraceback to handle other cases.
- Parser / compiler errors are now SyntaxError's.
- Try to read filenames when printing tracebacks.
- Fixup formatting to look more like CPython.
2021-01-17 18:19:00 +09:00
K. Lange
f97d8cd562 Fix a bad indentation handling for if/try. 2021-01-17 16:52:38 +09:00
K. Lange
fe737255ba Fix from ... import ... as? 2021-01-17 08:22:45 +09:00
K. Lange
129c92bdea Superclass-related cleanups.
- If no superclass, set `super` to `object`.
- Superclasses can be derived from any expression (but still must be a Class)
2021-01-16 22:46:10 +09:00
K. Lange
648ed8c85f Add something original for once 2021-01-15 19:31:00 +09:00
K. Lange
d6459d5930 Obvious correct approach to doing that... 2021-01-15 08:50:44 +09:00
K. Lange
7c279e3cd0 Better handling of single local declaration 2021-01-15 07:41:40 +09:00
K. Lange
13bbc3ae2d Change 'let' semantics to do unpacking; support unpacking more things 2021-01-14 21:16:48 +09:00
K. Lange
d2d1c98a1e Add 'del' statement. 2021-01-14 16:08:25 +09:00
K. Lange
976db6f954 Integer type behind macros 2021-01-14 09:15:44 +09:00
K. Lange
9015176bbb Cleanups clang asked for 2021-01-14 09:15:18 +09:00
K. Lange
10f3c16e40 Major overhaul of strings to support Unicode 2021-01-12 19:23:14 +09:00
K. Lange
eb27158173 Class fields and access to class member methods 2021-01-11 16:31:34 +09:00
K. Lange
3141678fa0 Add 'is'/'is not' for exact object equivalence 2021-01-11 15:03:05 +09:00
K. Lange
213c496372 Fix up string escapes, make sure we're handling nil bytes when printing 2021-01-11 11:41:26 +09:00
K. Lange
ff7dcbb92a Support 'return' from within a 'with' block 2021-01-10 23:39:05 +09:00
K. Lange
52427a5147 Add a basic 'with' statement
This is incomplete; it's missing the necessary plumbing to ensure __exit__
still gets called if the inner block returns or raises an exception. TODO
2021-01-09 12:46:59 +09:00
K. Lange
070b4bc356 Add tuple unpacking and 'if' conditions to list comprehensions 2021-01-08 18:00:49 +09:00
K. Lange
fc05327c42 Support unpacking tuples in for ... in ... loops. 2021-01-08 17:42:57 +09:00
K. Lange
8f9c1a4c1d Switch C-style loops to semicolons before I regret having used commas 2021-01-08 17:14:42 +09:00
K. Lange
ace8357c9a List comprehensions should not set their subfunctions to methods; ensures 'self' is an upvalue 2021-01-08 16:53:46 +09:00
K. Lange
ee518f9643 Fix two symbols missing namespacing prefixes 2021-01-08 06:49:27 +09:00
K. Lange
9eb5fb1cad Add ternary (a) if (cond) else (b) 2021-01-07 14:04:42 +09:00
K. Lange
ecb5f1e4ec Attach __doc__ to modules, default to None (but still set) if missing 2021-01-07 11:30:10 +09:00
K. Lange
11e6b79e49 Remove 'export' keyword 2021-01-07 11:15:57 +09:00
K. Lange
fbf4dda818 Fix tracking what should be 'global' through function calls? 2021-01-07 10:39:09 +09:00
K. Lange
902d2222b5 Make modules work like in Python. TODO: module class for better repring 2021-01-07 09:50:58 +09:00
K. Lange
d3d048a3f8 Allow trailing commas in lists, dicts 2021-01-06 21:45:39 +09:00
K. Lange
3898e5e51c Store the names of locals in functions for debugging later 2021-01-06 15:03:56 +09:00
K. Lange
5b19419045 Fix incorrect Compiler* reference in addUpvalue 2021-01-05 23:22:37 +09:00
K. Lange
2a901a71a0 Need to mess with stack slots when import multiple things as locals 2021-01-05 19:47:25 +09:00
K. Lange
a4a4da70df Fixup more kwargs stuff, need to pop values for defaults 2021-01-05 19:01:26 +09:00
K. Lange
ab158260f7 improve disassembly somewhat and add dis module 2021-01-05 15:33:33 +09:00
K. Lange
57455ea80d basic lambda expressions (TODO: needs complex argument lists) 2021-01-05 13:28:45 +09:00
K. Lange
f764c059fe compiler support for tuple expressions 2021-01-05 12:07:55 +09:00
K. Lange
20d5ce47bf Work towards generalizing fast calls 2021-01-05 09:30:23 +09:00
K Lange
ff8ed02ebd Make print() a function before it's too late 2021-01-04 23:34:10 +09:00
K. Lange
873ffb3428 Eat empty line in block? 2021-01-04 19:56:13 +09:00
K. Lange
bfae38538d Need to turn off whitespace eating _before_ the close paren 2021-01-04 19:07:19 +09:00
K. Lange
61a38f3a5f That dup isn't necessary 2021-01-04 18:15:17 +09:00
K. Lange
b93429d6a6 Oops, fix strings; simplify bytecode around getters/setters; use this approach for slicing 2021-01-04 18:10:55 +09:00
K. Lange
cfecb2e4f6 Accept BIG_STRING as __doc__ 2021-01-04 16:20:01 +09:00
K. Lange
583df9141c 'not in' comparison 2021-01-04 14:03:08 +09:00
K. Lange
b8c89c0550 add ValueError to builtin exceptions 2021-01-04 11:27:33 +09:00
K. Lange
90a4dd678d Ignore line feeds and indentation in some contexts 2021-01-04 09:49:56 +09:00
K. Lange
132542c6ab allow 'elif' for Python compatibility 2021-01-04 09:13:39 +09:00
K. Lange
3415fd4e73 from foo import bar as baz 2021-01-04 07:48:56 +09:00
K. Lange
8ef070bf94 Support 'from foo import bar, baz' 2021-01-04 07:47:05 +09:00
K. Lange
d1d6a7a3fe 'let' should support multiple comma-separated declarations 2021-01-04 07:40:29 +09:00
K. Lange
aa1c0c8e93 Support 'import foo as bar' 2021-01-04 07:39:00 +09:00