-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
135 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...arser/snapshots/enderpy_python_parser__parser__parser__tests__one_liners@lists.py-11.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
...arser/snapshots/enderpy_python_parser__parser__parser__tests__one_liners@lists.py-12.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
--- | ||
source: parser/src/parser/parser.rs | ||
description: "[a for a in b if c for d in e]\n" | ||
input_file: parser/test_data/inputs/one_liners/lists.py | ||
--- | ||
Module { | ||
node: Node { | ||
start: 0, | ||
end: 31, | ||
}, | ||
body: [ | ||
ExpressionStatement( | ||
ListComp( | ||
ListComp { | ||
node: Node { | ||
start: 0, | ||
end: 30, | ||
}, | ||
element: Name( | ||
Name { | ||
node: Node { | ||
start: 1, | ||
end: 2, | ||
}, | ||
id: "a", | ||
}, | ||
), | ||
generators: [ | ||
Comprehension { | ||
node: Node { | ||
start: 3, | ||
end: 18, | ||
}, | ||
target: Name( | ||
Name { | ||
node: Node { | ||
start: 7, | ||
end: 8, | ||
}, | ||
id: "a", | ||
}, | ||
), | ||
iter: Name( | ||
Name { | ||
node: Node { | ||
start: 12, | ||
end: 13, | ||
}, | ||
id: "b", | ||
}, | ||
), | ||
ifs: [ | ||
Name( | ||
Name { | ||
node: Node { | ||
start: 17, | ||
end: 18, | ||
}, | ||
id: "c", | ||
}, | ||
), | ||
], | ||
is_async: false, | ||
}, | ||
Comprehension { | ||
node: Node { | ||
start: 19, | ||
end: 29, | ||
}, | ||
target: Name( | ||
Name { | ||
node: Node { | ||
start: 23, | ||
end: 24, | ||
}, | ||
id: "d", | ||
}, | ||
), | ||
iter: Name( | ||
Name { | ||
node: Node { | ||
start: 28, | ||
end: 29, | ||
}, | ||
id: "e", | ||
}, | ||
), | ||
ifs: [], | ||
is_async: false, | ||
}, | ||
], | ||
}, | ||
), | ||
), | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,3 +28,5 @@ | |
[a for a in b if c if d] | ||
|
||
[a for a in b for c in d] | ||
|
||
[a for a in b if c for d in e] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
use enderpy_python_parser::ParsingError; | ||
use miette::{Diagnostic, SourceSpan}; | ||
use thiserror::Error; | ||
|
||
#[derive(Error, Diagnostic, Debug)] | ||
pub enum BuildError { | ||
#[error(transparent)] | ||
#[diagnostic(code(builder::io_error))] | ||
IoError(#[from] std::io::Error), | ||
|
||
#[error("Invalid syntax")] | ||
#[diagnostic(code(builder::invalid_syntax))] | ||
TypeError { | ||
path: String, | ||
msg: String, | ||
line: u32, | ||
#[help] | ||
advice: String, | ||
#[label("span")] | ||
span: SourceSpan, | ||
}, | ||
|
||
#[error(transparent)] | ||
// Use `#[diagnostic(transparent)]` to wrap another [`Diagnostic`]. You won't see labels otherwise | ||
#[diagnostic(transparent)] | ||
ParsingError(#[from] ParsingError), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,4 @@ pub mod build; | |
pub mod project; | ||
pub mod semantic_analyzer; | ||
pub mod settings; | ||
pub mod errors; |