mirror of
				https://github.com/astral-sh/ruff.git
				synced 2025-11-04 05:34:54 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			53 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			53 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
---
 | 
						|
source: crates/ruff_python_parser/tests/fixtures.rs
 | 
						|
input_file: crates/ruff_python_parser/resources/invalid/expressions/unary.py
 | 
						|
snapshot_kind: text
 | 
						|
---
 | 
						|
## AST
 | 
						|
 | 
						|
```
 | 
						|
Module(
 | 
						|
    ModModule {
 | 
						|
        range: 0..10,
 | 
						|
        body: [
 | 
						|
            Expr(
 | 
						|
                StmtExpr {
 | 
						|
                    range: 0..5,
 | 
						|
                    value: UnaryOp(
 | 
						|
                        ExprUnaryOp {
 | 
						|
                            range: 0..5,
 | 
						|
                            op: Not,
 | 
						|
                            operand: Name(
 | 
						|
                                ExprName {
 | 
						|
                                    range: 4..5,
 | 
						|
                                    id: Name("x"),
 | 
						|
                                    ctx: Load,
 | 
						|
                                },
 | 
						|
                            ),
 | 
						|
                        },
 | 
						|
                    ),
 | 
						|
                },
 | 
						|
            ),
 | 
						|
            Expr(
 | 
						|
                StmtExpr {
 | 
						|
                    range: 9..10,
 | 
						|
                    value: NumberLiteral(
 | 
						|
                        ExprNumberLiteral {
 | 
						|
                            range: 9..10,
 | 
						|
                            value: Int(
 | 
						|
                                1,
 | 
						|
                            ),
 | 
						|
                        },
 | 
						|
                    ),
 | 
						|
                },
 | 
						|
            ),
 | 
						|
        ],
 | 
						|
    },
 | 
						|
)
 | 
						|
```
 | 
						|
## Errors
 | 
						|
 | 
						|
  |
 | 
						|
1 | not x := 1
 | 
						|
  |       ^^ Syntax Error: Expected a statement
 | 
						|
  |
 |