Struct as3_parser::compilation_unit::Location
source · pub struct Location { /* private fields */ }
Expand description
Represents a source location. This location includes spanning lines and columns and the reference compilation unit.
Implementations§
source§impl Location
impl Location
sourcepub fn with_offsets(
compilation_unit: &Rc<CompilationUnit>,
first_offset: usize,
last_offset: usize
) -> Self
pub fn with_offsets( compilation_unit: &Rc<CompilationUnit>, first_offset: usize, last_offset: usize ) -> Self
Builds a location.
sourcepub fn with_offset(
compilation_unit: &Rc<CompilationUnit>,
offset: usize
) -> Self
pub fn with_offset( compilation_unit: &Rc<CompilationUnit>, offset: usize ) -> Self
Builds a location.
sourcepub fn combine_with(&self, other: Location) -> Self
pub fn combine_with(&self, other: Location) -> Self
Build a location by combining two locations. self
serves as the first location, while other
serves as the
last location.
sourcepub fn combine_with_start_of(&self, other: Location) -> Self
pub fn combine_with_start_of(&self, other: Location) -> Self
Build a location by combining two locations. self
serves as the first location, while the first column and first line
of other
serve as the last location.
sourcepub fn compilation_unit(&self) -> Rc<CompilationUnit>
pub fn compilation_unit(&self) -> Rc<CompilationUnit>
The compilation unit that this location belongs to.
sourcepub fn first_line_number(&self) -> usize
pub fn first_line_number(&self) -> usize
First line number, counted from one.
sourcepub fn last_line_number(&self) -> usize
pub fn last_line_number(&self) -> usize
Last line number, counted from one.
pub fn first_offset(&self) -> usize
pub fn last_offset(&self) -> usize
sourcepub fn first_column(&self) -> usize
pub fn first_column(&self) -> usize
Zero based first column of the location in code points.
sourcepub fn last_column(&self) -> usize
pub fn last_column(&self) -> usize
Zero based last column of the location in code points.
pub fn character_count(&self) -> usize
sourcepub fn line_break(&self, other: &Self) -> bool
pub fn line_break(&self, other: &Self) -> bool
Indicates whether a previous location and a next location have a line break in between.
sourcepub fn shift_until_eof(&self, count: usize) -> Location
pub fn shift_until_eof(&self, count: usize) -> Location
Shifts a count of characters off this location until end-of-file.
sourcepub fn shift_whitespace(&self, text: &str) -> Location
pub fn shift_whitespace(&self, text: &str) -> Location
Shifts the count of whitespace characters in a text off this location.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Location
impl<'de> Deserialize<'de> for Location
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl Ord for Location
impl Ord for Location
source§impl PartialEq for Location
impl PartialEq for Location
source§impl PartialOrd for Location
impl PartialOrd for Location
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more