mirror of
https://github.com/RustPython/Parser.git
synced 2025-07-19 11:05:45 +00:00
integrate ast::Location into compilre-core::Location
This commit is contained in:
parent
bfac0355dc
commit
904fc477f1
8 changed files with 21 additions and 83 deletions
|
@ -1,12 +1,9 @@
|
|||
//! Define internal parse error types
|
||||
//! The goal is to provide a matching and a safe error API, maksing errors from LALR
|
||||
|
||||
use crate::{ast::Location, token::Tok};
|
||||
use lalrpop_util::ParseError as LalrpopError;
|
||||
|
||||
use crate::ast::Location;
|
||||
use crate::token::Tok;
|
||||
|
||||
use std::error::Error;
|
||||
use std::fmt;
|
||||
use std::{error::Error, fmt};
|
||||
|
||||
/// Represents an error during lexical scanning.
|
||||
#[derive(Debug, PartialEq)]
|
||||
|
@ -186,7 +183,7 @@ impl ParseError {
|
|||
|
||||
impl fmt::Display for ParseError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "{} at {}", self.error, self.location)
|
||||
self.location.fmt_with(f, &self.error)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
use ahash::RandomState;
|
||||
use std::collections::HashSet;
|
||||
|
||||
use crate::ast;
|
||||
use crate::error::{LexicalError, LexicalErrorType};
|
||||
use ahash::RandomState;
|
||||
use std::collections::HashSet;
|
||||
|
||||
pub struct ArgumentList {
|
||||
pub args: Vec<ast::Expr>,
|
||||
|
|
|
@ -5,13 +5,9 @@
|
|||
//! parse a whole program, a single statement, or a single
|
||||
//! expression.
|
||||
|
||||
use std::iter;
|
||||
|
||||
use crate::ast;
|
||||
use crate::error::ParseError;
|
||||
use crate::lexer;
|
||||
pub use crate::mode::Mode;
|
||||
use crate::python;
|
||||
use crate::{ast, error::ParseError, lexer, python};
|
||||
use std::iter;
|
||||
|
||||
/*
|
||||
* Parse python code.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue