Windel Bouwman
6444b50a44
Add getattr and hasattr builtins
2018-08-14 23:39:47 +02:00
Windel Bouwman
c9816c37de
Fix append snippet
2018-08-14 22:44:55 +02:00
Windel Bouwman
919b7f631d
Add reverse function to list
2018-08-14 22:01:40 +02:00
Windel Bouwman
34bba7a257
Borrow list object mutably and append item
2018-08-14 21:52:00 +02:00
Windel Bouwman
4ada085234
Format code properly and try to implement append function
2018-08-14 21:21:47 +02:00
Windel Bouwman
51acd6c4b5
Register append function to list type
2018-08-14 20:56:14 +02:00
Adam Kelly
c83f548d92
There is only one none.
2018-08-12 20:20:56 +01:00
Adam Kelly
3a6649ddeb
Use standard method machinary to call __init__.
2018-08-12 18:57:56 +01:00
Adam Kelly
4b52f72316
load_attr to use class based attribute getting.
2018-08-12 18:57:56 +01:00
Adam Kelly
0597cff6c6
Add has_attr to AttributeProtocol.
2018-08-12 18:27:03 +01:00
Adam Kelly
6889b34515
Add Type Protocol.
2018-08-12 18:27:03 +01:00
Adam Kelly
43011d3a9c
Create functions with type of function class.
2018-08-12 18:27:03 +01:00
Adam Kelly
cb3bd23cb1
Add modules for class and function objects.
2018-08-12 18:27:03 +01:00
Daniel Watkins
2a90df80c8
Run cargo fmt to format the entire project
2018-08-10 20:23:15 -04:00
Daniel Watkins
a9653931b7
Fix warnings emitted during cargo test
2018-08-10 17:13:27 -04:00
Daniel Watkins
0b5248827b
Allow TryExcept to be dead code (for now)
...
TryExcept is referenced by code, so I don't want to rename it, but it's
never constructed so it still produces a warning.
2018-08-10 16:32:11 -04:00
Daniel Watkins
ede4533349
Rename objdict::_set_item as it is unused
2018-08-10 16:32:11 -04:00
Daniel Watkins
f879fd9b43
Rename objlist::append as it is unused
2018-08-10 16:32:11 -04:00
Daniel Watkins
a15007f10d
Remove the unused and empy objint::add function
2018-08-10 16:32:11 -04:00
Daniel Watkins
340d90a3f9
Refactor push_code_object to push_new_code_object
...
The argument wasn't being used by the current implementation, so drop
it.
2018-08-10 16:32:11 -04:00
Daniel Watkins
d8d9eb8087
Silence a variety of unused argument warnings
2018-08-10 16:32:11 -04:00
Daniel Watkins
20737f77ac
Remove duplicated match arm from PyObject::eq
2018-08-10 16:32:11 -04:00
Daniel Watkins
d8cd5a3361
Enforce zero arguments to locals
2018-08-10 16:31:13 -04:00
Daniel Watkins
976a3f7a03
Remove unused VirtualMachine.call function
2018-08-10 12:34:01 -04:00
Daniel Watkins
aba1daf674
Remove unused import (and rustfmt all imports) in vm.rs
2018-08-10 12:32:53 -04:00
Daniel Watkins
47c9a9c66a
Remove unused import
2018-08-10 10:09:37 -04:00
Daniel Watkins
a7428e3808
Implement complex import handling
...
This expands import parsing and handling to implement a variety of
import cases:
* `import x as y`
* `import x, y`
* `from x import y`
* `from x import y, z`
* `from x import y as z, a as b`
This fixes #51 .
2018-08-09 17:14:08 -04:00
Adam Kelly
2e165efbb6
Propagate exceptions raised in init.
2018-08-09 18:56:38 +01:00
Daniel Watkins
3e07540afc
Remove unused "use" from objstr
2018-08-09 11:19:37 -04:00
Adam Kelly
339189aff4
Remove special Type type. Type is just a class.
2018-08-09 08:58:36 +01:00
Adam Kelly
9df841b38b
Set and retrieve attributes on instances.
2018-08-09 07:55:52 +01:00
Adam Kelly
13313e44e8
Add support creating instances of objects.
2018-08-09 07:55:52 +01:00
Adam Kelly
ccfbe6c4ff
Ability to define classes.
2018-08-09 07:51:26 +01:00
Daniel Watkins
98883b7266
Move more slice functions in to PySliceableSequence
2018-08-08 12:44:51 -04:00
Daniel Watkins
d9cd236e71
Unify string and sequence slicing operations
2018-08-08 12:44:51 -04:00
Daniel Watkins
4227a7c4dd
Refactor string slicing to mirror sequence slicing
2018-08-08 12:44:51 -04:00
Daniel Watkins
8c24461f31
Start using objsequence::get_pos for strings
2018-08-08 12:44:51 -04:00
Daniel Watkins
87476b003d
Generalise objsequence::get_pos
...
get_pos only uses the length of the sequence, so to make it possible to
use it for more types, change it to accept the length as a parameter.
2018-08-08 12:44:51 -04:00
Daniel Watkins
086dc127f2
Handle slice ends greater than sequence length
...
This is already handled for the string case, so borrow that logic (and
add an explanatory comment where it was borrowed from).
2018-08-08 09:19:04 -04:00
Daniel Watkins
4e0c285741
Use more descriptive variable names in objsequence::get_item
2018-08-08 09:19:04 -04:00
Daniel Watkins
225f296018
Refactor objlist and objtuple get_item in to objsequence
2018-08-08 09:19:04 -04:00
Windel Bouwman
1a1bd40e2e
Add list and tuple as builtin symbol
2018-08-08 14:47:54 +02:00
Windel Bouwman
ac44f8b8ed
Merge pull request #47 from OddBloke/dict
...
Implement simple dict literals
2018-08-08 14:28:50 +02:00
Windel Bouwman
f338a15d38
Merge pull request #44 from OddBloke/slice
...
Implement stepped slicing for tuples
2018-08-08 14:25:49 +02:00
Daniel Watkins
d1acf5e7db
Implement simple dict literals
2018-08-07 23:49:42 -04:00
Daniel Watkins
1b259d5d61
Implement 0-size dict literal
2018-08-07 23:49:42 -04:00
Daniel Watkins
78447bb4f4
Implement no-arg dict builtin
2018-08-07 20:23:58 -04:00
Daniel Watkins
99ccc97907
Implement len() for dicts
2018-08-07 20:22:17 -04:00
Daniel Watkins
da55a6addb
Refactor shared list/tuple functions to objsequence.rs
2018-08-06 15:08:45 -04:00
Daniel Watkins
5dad8b2c54
Remove duplicated get_pos function on objtuple
2018-08-06 15:03:45 -04:00