Daniel Watkins
ad0d03b7cf
Fix and expand function parsing Rust tests
2018-08-31 16:23:25 -04:00
Daniel Watkins
b4662925b7
Naively parse keyword arguments
...
This doesn't enforce ordering of non-keyword and keyword arguments, and
doesn't actually use the keywords (the arguments will still be passed
through in order as positional).
2018-08-31 15:46:07 -04:00
Daniel Watkins
cb173c1fa8
Update and expand Rust tests for function parsing
2018-08-29 08:58:20 -04:00
Daniel Watkins
85d2dd2997
Add support for default argument syntax
...
The enforcement of the ordering of default/non-default arguments happens
in the compiling step, but should perhaps eventually be pushed back in
to the parsing phase.
2018-08-29 08:58:20 -04:00
Daniel Watkins
2cecd362fe
Add support for defaults to bytecode, compiler and VM
2018-08-29 08:58:20 -04:00
Windel Bouwman
3f7986c811
Address review comments
2018-08-26 22:01:00 +02:00
Windel Bouwman
96ee1cce60
Add filename and row to traceback
2018-08-26 12:17:16 +02:00
Daniel Watkins
159a524f3f
Don't double-count newlines in comments
...
lex_comment doesn't consume the newlines, (correctly) leaving them to
the regular newline parsing. As such, it shouldn't call self.new_line,
or we end up double-counting lines.
2018-08-25 10:54:31 -04:00
Windel Bouwman
6aa9c01180
Merge branch 'master' of https://github.com/RustPython/RustPython into exceptions
2018-08-25 10:18:51 +02:00
Windel Bouwman
882606ba1a
Move exceptions to own struct
2018-08-25 10:11:21 +02:00
Daniel Watkins
a06044dc6b
Reject newlines in single-quoted strings
2018-08-25 00:21:37 -04:00
Daniel Watkins
367806f845
Increment lexer row count for newlines in strings
2018-08-25 00:20:03 -04:00
Adam Kelly
046e5e9c60
Add unary not support to parser.
2018-08-24 18:23:05 +01:00
Windel Bouwman
04b786f0f3
Add try except to compiler
2018-08-22 21:42:18 +02:00
Windel Bouwman
583818378b
Add BaseException class
2018-08-22 20:29:47 +02:00
Windel Bouwman
c2550ad3f1
Introduce LocatedStatement after idea from review
2018-08-22 17:49:07 +02:00
Windel Bouwman
4897e10714
Add location to statement ast type
2018-08-22 16:18:47 +02:00
Windel Bouwman
f6edf876fd
Some formatting
2018-08-22 13:08:07 +02:00
Windel Bouwman
3d9b2360e3
Add row and column info to lexer
2018-08-22 12:14:37 +02:00
Windel Bouwman
17a952dbf1
fix #34
2018-08-20 22:06:01 +02:00
Windel Bouwman
823730f023
Fix cast test snippet
2018-08-20 21:37:21 +02:00
Windel Bouwman
15e274210f
Add float type
2018-08-20 21:22:14 +02:00
Adam Kelly
a9c3349943
Specify bases in normal class definitions.
2018-08-19 20:55:37 +01:00
Daniel Watkins
19c9db2375
Parse trailing commas in lists/dicts
2018-08-11 23:37:01 -04:00
Daniel Watkins
2a90df80c8
Run cargo fmt to format the entire project
2018-08-10 20:23:15 -04:00
Daniel Watkins
76a19d35be
Move lexer::lex_source in to tests module
...
That's the only place it is used; this fixes a warning.
2018-08-10 17:10:42 -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
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
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
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
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
Windel Bouwman
fcf3518f4a
Merge pull request #30 from OddBloke/nums_in_funcs
...
Include numbers in valid identifier characters
2018-08-04 23:01:01 +02:00
Daniel Watkins
3e56bc1d60
Include numbers in valid identifier characters
...
Fixes #27 .
2018-08-04 16:00:15 -04:00
Adam Kelly
c6ef62ceac
Improved interpreter using compile single and with multiline input.
2018-08-04 20:47:34 +01:00
Adam Kelly
a9afa76438
Test that an empty line parses.
2018-08-04 20:47:34 +01:00
Daniel Watkins
862442b635
Simplify the conversion of missing slice parts to None
2018-08-03 20:55:18 -04:00
Daniel Watkins
73b2d07578
Support parsing steps in slice syntax
2018-08-03 20:55:18 -04:00
Daniel Watkins
43fafa5102
Enable semi-colon separated statements
...
For example, `cargo run -- -c 'print("a"); print("b")'`.
2018-07-31 16:33:27 -04:00
Windel Bouwman
099595bf17
Merge pull request #15 from wulmer/feature/windows-and-mac-eol-characters
...
Add support for Windows/Mac EOL characters in lexer
2018-07-29 17:15:49 +02:00
Adam Kelly
e79ec8e4cb
Suppress unused variable warnings.
2018-07-29 09:06:56 +01:00
Adam Kelly
12a3ff5e7e
Deal with warnings for Ellipsis and Rarrow
2018-07-29 09:06:56 +01:00
Ulmer Wolfgang (CR/AEE3)
d168156375
Add support for Windows/Mac EOL characters in lexer
2018-07-28 22:00:46 +01:00
Adam Kelly
976c1f4340
Update lexer and parser to support lambdas.
2018-07-28 10:09:08 +01:00
Adam Kelly
a6785c8d72
Add support for a escape sequence in string literals to lexer.
...
(\u, \x and octals not supported.)
2018-07-27 10:43:48 +01:00
Windel Bouwman
e7cc6b1786
Add else clause to for loop
2018-07-24 22:30:45 +02:00