Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Lib/test/test_grammar.py
Original file line number Diff line number Diff line change
Expand Up @@ -1615,8 +1615,6 @@ def test_nested_front():
self.assertEqual(x, [('Boeing', 'Airliner'), ('Boeing', 'Engine'), ('Ford', 'Engine'),
('Macdonalds', 'Cheeseburger')])

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_genexps(self):
# generator expression tests
g = ([x for x in range(10)] for x in range(1))
Expand Down
4 changes: 2 additions & 2 deletions compiler/parser/python.lalrpop
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ Atom: ast::Expr = {
match elt.node {
ast::ExprKind::Starred { .. } => {
Err(LexicalError{
error : LexicalErrorType::OtherError("cannot use starred expression here".to_string()),
error : LexicalErrorType::StarredExpressionError,
location,
}.into())
},
Expand Down Expand Up @@ -1021,7 +1021,7 @@ Atom: ast::Expr = {
},
"(" <location:@L> "**" <e:Expression> ")" =>? {
Err(LexicalError{
error : LexicalErrorType::OtherError("cannot use double starred expression here".to_string()),
error : LexicalErrorType::DoubleStarredExpressionError,
location,
}.into())
},
Expand Down
19 changes: 19 additions & 0 deletions compiler/parser/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ pub enum LexicalErrorType {
TabsAfterSpaces,
DefaultArgumentError,
PositionalArgumentError,
IterableArgumentUnpackingError,
StarredExpressionError,
DoubleStarredExpressionError,
GeneratorExpressionError,
DuplicateKeywordArgumentError,
UnrecognizedToken { tok: char },
FStringError(FStringErrorType),
Expand Down Expand Up @@ -55,6 +59,21 @@ impl fmt::Display for LexicalErrorType {
LexicalErrorType::PositionalArgumentError => {
write!(f, "positional argument follows keyword argument")
}
LexicalErrorType::IterableArgumentUnpackingError => {
write!(
f,
"iterable argument unpacking follows keyword argument unpacking"
)
}
LexicalErrorType::StarredExpressionError => {
write!(f, "cannot use starred expression here")
}
LexicalErrorType::DoubleStarredExpressionError => {
write!(f, "cannot use double starred expression here")
}
LexicalErrorType::GeneratorExpressionError => {
write!(f, "Generator expression must be parenthesized")
}
LexicalErrorType::UnrecognizedToken { tok } => {
write!(f, "Got unexpected token {}", tok)
}
Expand Down
Loading