mirror of
https://github.com/RustPython/Parser.git
synced 2025-08-31 23:57:57 +00:00
Give identifier and int ast types
This commit is contained in:
parent
d495cd9129
commit
455bcc01a0
88 changed files with 3288 additions and 2300 deletions
|
@ -1,5 +1,5 @@
|
|||
use crate::attributed::Attributed;
|
||||
use rustpython_parser_core::source_code::{SourceLocator, SourceRange};
|
||||
use crate::builtin::Attributed;
|
||||
use rustpython_parser_core::source_code::{SourceLocation, SourceLocator, SourceRange};
|
||||
|
||||
impl crate::fold::Fold<()> for SourceLocator<'_> {
|
||||
type TargetU = SourceRange;
|
||||
|
@ -23,3 +23,17 @@ impl crate::fold::Fold<()> for SourceLocator<'_> {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Attributed<T, SourceRange> {
|
||||
/// Returns the absolute start position of the node from the beginning of the document.
|
||||
#[inline]
|
||||
pub const fn location(&self) -> SourceLocation {
|
||||
self.custom.start
|
||||
}
|
||||
|
||||
/// Returns the absolute position at which the node ends in the source document.
|
||||
#[inline]
|
||||
pub const fn end_location(&self) -> Option<SourceLocation> {
|
||||
self.custom.end
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue