Commit Graph

137 Commits

Author SHA1 Message Date
Joey Hain
114d9df1d1 Allow attributes to be used as decorators 2019-02-16 19:43:25 -08:00
Joey Hain
134c3b94a5 support format specs in f-strings 2019-02-15 18:18:44 -08:00
Joey Hain
5968c4d922 convert f-string parser to state machine 2019-02-15 18:14:33 -08:00
Joey Hain
fb4d55bd8f Fix f-string edge case and add more tests 2019-02-14 18:46:23 -08:00
Joey Hain
bc4e48ae61 Fix tests 2019-02-13 23:32:55 -08:00
Joey Hain
4ca3d3b507 Merge remote-tracking branch 'upstream/master' into fstrings 2019-02-13 23:16:40 -08:00
Joey Hain
a97e05a164 Add missing semicolon to Bytes rule 2019-02-13 23:11:54 -08:00
Joey Hain
7d743de43f fix another edge case 2019-02-13 22:28:16 -08:00
Windel Bouwman
33d272f795 Merge pull request #464 from holygits/internal-error-types
Introduce Parser and Compiler Errors
2019-02-14 07:07:21 +01:00
Joey Hain
400ad80b64 fstrings 2019-02-13 21:59:21 -08:00
holygits
570b28439a Fix tests 2019-02-14 12:31:20 +13:00
holygits
4453c3e561 Create error types for parser and compiler
Pass through locations and tokens in ParseError
2019-02-14 10:21:21 +13:00
Adrian Wielgosik
7dfb0728fd Change lambda parsing to be closer to Python grammar. Fixes #427 2019-02-13 21:01:13 +01:00
Tommaso Thea Cioni
8ffd4c5e56 Fixed #402. (#414)
Raise syntax error rather than panicking on expected closing bracket. 

* Fixed #402.
2019-02-09 18:10:40 +00:00
klemens
79a7e5e42b spelling fixes 2019-02-09 12:00:46 +01:00
Windel Bouwman
2b22cd443e Implement clippy thoughts into rustpython_parser 2019-02-04 18:18:40 +01:00
Windel Bouwman
caac5a34d5 Merge branch 'master' into tuple_add 2019-02-04 08:05:07 +01:00
Takanori Ishibashi
334d78704a distuingish -> distinguish 2019-02-03 21:41:04 +09:00
ben
b13b4741ad Add tuple.__add__. Also stop rustfmt from trying to format generated parser. 2019-02-02 17:40:17 +13:00
Gitea
9468b657d2 Run cargo fmt. 2018-12-16 17:40:25 -05:00
Gitea
c74cd90d8e Handle mixed spaces and tabs.
This allows the parser to handle tabs and spaces. Currently it
requires that spaces come after any tabs, which is slightly more
strict than python3. It also requires that neighboring indentation
levels have either both more spaces and tabs or less spaces and
tabs so that tab size can't make perception of indentation
differ from what the parser interprets.

I didn't opt to implement PartialOrd on IndentationLevel because I
wasn't sure that the comparison logic would meet the logical
requirements for that trait. One could easily switch to having it
implement PartialOrd though. This would necessitate switching to
manually implementing PartialEq so that it's behavior 'matches'.
It's unclear from the docs what 'matches' exactly means so for
now I'm avoiding implementing the traits.
2018-12-16 17:11:37 -05:00
Windel Bouwman
99af466a88 Move max function test cases to snippet dir. Implement key and default argument on max function. 2018-11-07 17:26:18 +01:00
Windel Bouwman
5ffb20b26e Add builtin oct function. Add weakref.ref class. 2018-11-04 12:07:53 +01:00
Windel Bouwman
9364902768 Add tilde unary operator in syntax. 2018-11-04 09:30:13 +01:00
Windel Bouwman
17fc5a2345 Implemented hexadecimal, octal and binary literals. Also use bigint in the lexer to store big integer literals. 2018-11-04 09:00:44 +01:00
Windel Bouwman
079905277b Add time module and improve lexer handling of numeric constants 2018-11-03 15:12:12 +01:00
Windel Bouwman
b7a0b0f2f3 Removal of ToRust trait to prevent incorrect str representation 2018-11-02 20:27:05 +01:00
Windel Bouwman
1e3b45ee0d Add complex basic type 2018-10-29 21:55:58 +01:00
Windel Bouwman
5053d6d167 Add bytes literal support. 2018-10-28 21:15:46 +01:00
Windel Bouwman
4187a6ee39 Add support for star expanded argument in list and tuple constructions. 2018-10-28 14:16:11 +01:00
Windel Bouwman
1f30693718 Allow unpack in assignment of list as well as trailing comma for 1 sized tuples 2018-10-28 00:26:24 +02:00
Windel Bouwman
a3a427c252 Add 'yield from' syntax 2018-10-27 17:05:22 +02:00
Windel Bouwman
29ce0cf2e7 Add support for if-filters in list comprehensions. 2018-10-27 11:35:46 +02:00
Windel Bouwman
b03dd623c7 Add raw strings to lexer. Add line break continuation to lexer. 2018-10-27 10:30:11 +02:00
Windel Bouwman
09e2c027cd Extend ast module with more nodes. Test send method on generators. 2018-10-24 16:02:59 +02:00
Windel Bouwman
babb8ed2f0 Deleted comparison based on objectkind 2018-10-24 12:02:16 +02:00
Windel Bouwman
acefe3841e Add initial generator builtin type 2018-10-23 21:27:40 +02:00
Windel Bouwman
1222830678 Implement star arg on left hand side of assignment. 2018-10-22 21:52:06 +02:00
Windel Bouwman
f59f8a9567 Add support for *args and **kwargs in functions. 2018-10-21 20:48:08 +02:00
Windel Bouwman
940c41bda8 Reduce lalrpop generated code size by about half. Relates to issue #173. 2018-10-21 16:01:39 +02:00
Windel Bouwman
bc23e60962 Add generator expression syntax 2018-10-20 12:16:18 +02:00
Windel Bouwman
ae768c7fe6 Add parsing for star arg parameters. 2018-10-20 11:47:23 +02:00
Windel Bouwman
e92ba94c61 Modify ast regarding keyword arguments. 2018-10-19 22:45:24 +02:00
Windel Bouwman
8f3e1a3b25 Add error handling to compiler. 2018-10-19 20:51:50 +02:00
Windel Bouwman
7e45d0b8b4 Add del statement 2018-10-19 18:41:44 +02:00
Windel Bouwman
e334941728 Removal of Clone trait on ast nodes. Should reduce codesize somewhat. 2018-10-17 22:04:02 +02:00
Windel Bouwman
5707548436 Add set.add method 2018-10-17 21:08:46 +02:00
Windel Bouwman
96d35ad4f9 Generalize comprehensions for list, dict and set. 2018-10-17 20:10:26 +02:00
Windel Bouwman
a450c0e3da Add builtin type set 2018-10-17 17:14:46 +02:00
Windel Bouwman
c9aa103cce Change target of for loops into single expression. 2018-10-17 13:12:04 +02:00