Skip to content

Commit f1b156d

Browse files
committed
Merge branch 'master' into store-rcs-in-stored-vm
2 parents 6361380 + 9a3b731 commit f1b156d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+2538
-1997
lines changed

Cargo.lock

Lines changed: 13 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,10 @@ The code style used is the default rustfmt codestyle. Please format your code ac
201201

202202
Chat with us on [gitter][gitter].
203203

204+
# Code of conduct
205+
206+
Our code of conduct [can be found here](code-of-conduct.md).
207+
204208
# Credit
205209

206210
The initial work was based on [windelbouwman/rspython](https://github.com/windelbouwman/rspython) and [shinglyu/RustPython](https://github.com/shinglyu/RustPython)

code-of-conduct.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to making participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, sex characteristics, gender identity and expression,
9+
level of experience, education, socio-economic status, nationality, personal
10+
appearance, race, religion, or sexual identity and orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or
41+
reject comments, commits, code, wiki edits, issues, and other contributions
42+
that are not aligned to this Code of Conduct, or to ban temporarily or
43+
permanently any contributor for other behaviors that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies both within project spaces and in public spaces
49+
when an individual is representing the project or its community. Examples of
50+
representing a project or community include using an official project e-mail
51+
address, posting via an official social media account, or acting as an appointed
52+
representative at an online or offline event. Representation of a project may be
53+
further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting the project team at windel.bouwman@gmail.com. All
59+
complaints will be reviewed and investigated and will result in a response that
60+
is deemed necessary and appropriate to the circumstances. The project team is
61+
obligated to maintain confidentiality with regard to the reporter of an incident.
62+
Further details of specific enforcement policies may be posted separately.
63+
64+
Project maintainers who do not follow or enforce the Code of Conduct in good
65+
faith may face temporary or permanent repercussions as determined by other
66+
members of the project's leadership.
67+
68+
## Attribution
69+
70+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72+
73+
[homepage]: https://www.contributor-covenant.org
74+
75+
For answers to common questions about this code of conduct, see
76+
https://www.contributor-covenant.org/faq
77+

parser/src/ast.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ pub enum Statement {
122122
// docstring: String,
123123
body: Vec<LocatedStatement>,
124124
decorator_list: Vec<Expression>,
125+
returns: Option<Expression>,
125126
},
126127
}
127128

@@ -217,6 +218,7 @@ pub enum Expression {
217218
True,
218219
False,
219220
None,
221+
Ellipsis,
220222
}
221223

222224
impl Expression {
@@ -259,6 +261,7 @@ impl Expression {
259261
Lambda { .. } => "lambda",
260262
IfExpression { .. } => "conditional expression",
261263
True | False | None => "keyword",
264+
Ellipsis => "ellipsis",
262265
}
263266
}
264267
}
@@ -269,14 +272,20 @@ impl Expression {
269272
*/
270273
#[derive(Debug, PartialEq, Default)]
271274
pub struct Parameters {
272-
pub args: Vec<String>,
273-
pub kwonlyargs: Vec<String>,
274-
pub vararg: Option<Option<String>>, // Optionally we handle optionally named '*args' or '*'
275-
pub kwarg: Option<Option<String>>,
275+
pub args: Vec<Parameter>,
276+
pub kwonlyargs: Vec<Parameter>,
277+
pub vararg: Option<Option<Parameter>>, // Optionally we handle optionally named '*args' or '*'
278+
pub kwarg: Option<Option<Parameter>>,
276279
pub defaults: Vec<Expression>,
277280
pub kw_defaults: Vec<Option<Expression>>,
278281
}
279282

283+
#[derive(Debug, PartialEq, Default)]
284+
pub struct Parameter {
285+
pub arg: String,
286+
pub annotation: Option<Box<Expression>>,
287+
}
288+
280289
#[derive(Debug, PartialEq)]
281290
pub enum ComprehensionKind {
282291
GeneratorExpression { element: Expression },

parser/src/lexer.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -993,8 +993,15 @@ where
993993
Some('.') => {
994994
let tok_start = self.get_pos();
995995
self.next_char();
996-
let tok_end = self.get_pos();
997-
return Some(Ok((tok_start, Tok::Dot, tok_end)));
996+
if let (Some('.'), Some('.')) = (&self.chr0, &self.chr1) {
997+
self.next_char();
998+
self.next_char();
999+
let tok_end = self.get_pos();
1000+
return Some(Ok((tok_start, Tok::Ellipsis, tok_end)));
1001+
} else {
1002+
let tok_end = self.get_pos();
1003+
return Some(Ok((tok_start, Tok::Dot, tok_end)));
1004+
}
9981005
}
9991006
Some('\n') => {
10001007
let tok_start = self.get_pos();

parser/src/parser.rs

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,16 @@ mod tests {
244244
node: ast::Statement::Expression {
245245
expression: ast::Expression::Lambda {
246246
args: ast::Parameters {
247-
args: vec![String::from("x"), String::from("y")],
247+
args: vec![
248+
ast::Parameter {
249+
arg: String::from("x"),
250+
annotation: None,
251+
},
252+
ast::Parameter {
253+
arg: String::from("y"),
254+
annotation: None,
255+
}
256+
],
248257
kwonlyargs: vec![],
249258
vararg: None,
250259
kwarg: None,
@@ -330,7 +339,10 @@ mod tests {
330339
node: ast::Statement::FunctionDef {
331340
name: String::from("__init__"),
332341
args: ast::Parameters {
333-
args: vec![String::from("self")],
342+
args: vec![ast::Parameter {
343+
arg: String::from("self"),
344+
annotation: None,
345+
}],
334346
kwonlyargs: vec![],
335347
vararg: None,
336348
kwarg: None,
@@ -342,14 +354,24 @@ mod tests {
342354
node: ast::Statement::Pass,
343355
}],
344356
decorator_list: vec![],
357+
returns: None,
345358
}
346359
},
347360
ast::LocatedStatement {
348361
location: ast::Location::new(4, 2),
349362
node: ast::Statement::FunctionDef {
350363
name: String::from("method_with_default"),
351364
args: ast::Parameters {
352-
args: vec![String::from("self"), String::from("arg"),],
365+
args: vec![
366+
ast::Parameter {
367+
arg: String::from("self"),
368+
annotation: None,
369+
},
370+
ast::Parameter {
371+
arg: String::from("arg"),
372+
annotation: None,
373+
}
374+
],
353375
kwonlyargs: vec![],
354376
vararg: None,
355377
kwarg: None,
@@ -365,6 +387,7 @@ mod tests {
365387
node: ast::Statement::Pass,
366388
}],
367389
decorator_list: vec![],
390+
returns: None,
368391
}
369392
}
370393
],

0 commit comments

Comments
 (0)