Commit Graph

1690 Commits

Author SHA1 Message Date
Daniel Watkins
47c9a9c66a Remove unused import 2018-08-10 10:09:37 -04:00
Windel Bouwman
816038c166 Merge pull request #54 from OddBloke/import
Implement complex import handling
2018-08-10 15:40:28 +02:00
Windel Bouwman
a7f1830fe7 Merge pull request #50 from OddBloke/triple_quotes
Implement triple-quotes for strings
2018-08-10 15:36:24 +02: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
Daniel Watkins
c9738a0cd1 Ensure snippet tests can import other snippets 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
Daniel Watkins
24848a99f9 Merge pull request #52 from cthulahoops/classes
Classes
2018-08-09 10:06:46 -04:00
Adam Kelly
339189aff4 Remove special Type type. Type is just a class. 2018-08-09 08:58:36 +01:00
Adam Kelly
aa1207adcf Snippet to test out class definition. 2018-08-09 07:55:52 +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
Adam Kelly
402230684f Add support for parsing classes to ast. 2018-08-09 07:41:33 +01:00
Daniel Watkins
3861fd898e Implement triple-quotes for strings
This fixes #33.
2018-08-08 23:36:32 -04:00
Windel Bouwman
dc5563916b Merge pull request #49 from OddBloke/str_seq
Unify string and sequence slicing operations
2018-08-08 21:22:20 +02: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
Windel Bouwman
d47dcdf071 Merge pull request #48 from OddBloke/slice
Complete unification of tuple and list implementations
2018-08-08 18:04:27 +02: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
0c097f011e Merge pull request #45 from OddBloke/dict
Implement no-arg dict builtin and len() for dicts
2018-08-07 21:26:56 -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
Daniel Watkins
dbd65071fe Implement stepped slicing for tuples 2018-08-06 15:02:43 -04:00
Daniel Watkins
a0844f1f39 Refactor list slicing out to separate function 2018-08-06 10:56:52 -04:00
Windel Bouwman
a40ef57ba4 Merge pull request #41 from OddBloke/function_args
Allow Tests in function arguments (rather than just Expressions)
2018-08-06 16:48:35 +02:00
Windel Bouwman
45d3d74776 Merge pull request #40 from OddBloke/slice
Implement (positive) stepped slicing for lists
2018-08-06 16:48:04 +02:00
Windel Bouwman
3575b2785c Merge pull request #43 from OddBloke/tuple_comparison
Enable tuple comparison
2018-08-06 16:46:19 +02:00
Windel Bouwman
19d06c4099 Merge pull request #42 from OddBloke/single_element_tuples
Single element tuples
2018-08-06 16:45:07 +02:00
Daniel Watkins
de70b8b881 Another couple of trivial warning fixes 2018-08-05 23:04:18 -04:00
Daniel Watkins
cca039b337 Add tuple comparison test to tuple snippet test 2018-08-05 16:55:07 -04:00
Daniel Watkins
15d4664477 Enable tuple comparison
Tuples and lists have the same internal representation, so we can just
reuse the existing list comparison logic.

This fixes #38.
2018-08-05 16:52:21 -04:00
Daniel Watkins
d5ce48535d Format single-element tuple string representations correctly
(i.e. with a trailing comma within the parentheses)
2018-08-05 16:47:44 -04:00
Daniel Watkins
36f6fb2733 Support creation of single-element tuples
This fixes #37
2018-08-05 16:41:20 -04:00
Daniel Watkins
c8a0b04b2d Allow Tests in function arguments (rather than just Expressions)
This fixes #39
2018-08-05 16:24:32 -04:00
Daniel Watkins
8a0b75d591 Implement (positive) stepped slicing for lists 2018-08-05 15:48:08 -04:00
Daniel Watkins
5b17ccb4f4 Merge pull request #36 from RustPython/fix_warnings
Fix some warnings
2018-08-05 15:06:59 -04:00
Daniel Watkins
99de3d6ef6 Fix some unused name warnings 2018-08-05 14:59:32 -04:00