mirror of
https://github.com/RustPython/Parser.git
synced 2025-07-15 09:05:25 +00:00
numerous refactoring
- Split parser core and compiler core. Fix #14 - AST int type to `u32` - Updated asdl_rs.py and update_asdl.sh fix #6 - Use `ruff_python_ast::SourceLocation` for Python source location. Deleted our own Location. - Renamed ast::Located to ast::Attributed to distinguish terms for TextSize and SourceLocation - `ast::<Node>`s for TextSize located ast. `ast::located::<Node>` for Python source located ast. - And also strictly renaming `located` to refer only python location related interfaces. - `SourceLocator` to convert locations. - New `source-code` features of to disable python locations when unnecessary. - Also including fully merging https://github.com/astral-sh/RustPython/pull/4 closes #9
This commit is contained in:
parent
09a6afdd04
commit
a3d9d8cb14
29 changed files with 9737 additions and 12000 deletions
|
@ -1,7 +1,5 @@
|
|||
use crate::{
|
||||
Arg, Arguments, Boolop, Cmpop, Comprehension, Constant, ConversionFlag, Expr, ExprKind,
|
||||
Operator,
|
||||
};
|
||||
use crate::ConversionFlag;
|
||||
use crate::{Arg, Arguments, Boolop, Cmpop, Comprehension, Constant, Expr, ExprKind, Operator};
|
||||
use std::fmt;
|
||||
|
||||
mod precedence {
|
||||
|
@ -452,7 +450,7 @@ impl<'a> Unparser<'a> {
|
|||
fn unparse_formatted<U>(
|
||||
&mut self,
|
||||
val: &Expr<U>,
|
||||
conversion: usize,
|
||||
conversion: u32,
|
||||
spec: Option<&Expr<U>>,
|
||||
) -> fmt::Result {
|
||||
let buffered = to_string_fmt(|f| Unparser::new(f).unparse_expr(val, precedence::TEST + 1));
|
||||
|
@ -466,7 +464,7 @@ impl<'a> Unparser<'a> {
|
|||
self.p(&buffered)?;
|
||||
drop(buffered);
|
||||
|
||||
if conversion != ConversionFlag::None as usize {
|
||||
if conversion != ConversionFlag::None as u32 {
|
||||
self.p("!")?;
|
||||
let buf = &[conversion as u8];
|
||||
let c = std::str::from_utf8(buf).unwrap();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue