Struct sourcemap::Token
[−]
[src]
pub struct Token<'a> { /* fields omitted */ }
Represents a token from a sourcemap
Methods
impl<'a> Token<'a>
[src]
fn get_dst_line(&self) -> u32
get the destination (minified) line number
fn get_dst_col(&self) -> u32
get the destination (minified) column number
fn get_dst(&self) -> (u32, u32)
get the destination line and column
fn get_src_line(&self) -> u32
get the source line number
fn get_src_col(&self) -> u32
get the source column number
fn get_src(&self) -> (u32, u32)
get the source line and column
fn get_src_id(&self) -> u32
Return the source ID of the token
fn get_source(&self) -> Option<&'a str>
get the source if it exists as string
fn has_source(&self) -> bool
Is there a source for this token?
fn get_name(&self) -> Option<&'a str>
get the name if it exists as string
fn has_name(&self) -> bool
returns true
if a name exists, false
otherwise
fn get_name_id(&self) -> u32
Return the name ID of the token
fn get_minified_name<'b>(&self, source: &'b str) -> Option<&'b str>
Given some minified source this returns the most likely minified name.
Note that this scans for identifiers in the source file so in some cases it can happen that values are returned that are not actually names. For instance a token that points to a keyword will return the keyword. This is done because it is not always possible to tell keywords from non keywords without parsing the entire source.
fn to_tuple(&self) -> (&'a str, u32, u32, Option<&'a str>)
Converts the token into a debug tuple in the form
(source, src_line, src_col, name)
fn get_raw_token(&self) -> RawToken
Get the underlying raw token
Trait Implementations
impl<'a> Copy for Token<'a>
[src]
impl<'a> Clone for Token<'a>
[src]
fn clone(&self) -> Token<'a>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<'a> PartialEq for Token<'a>
[src]
fn eq(&self, other: &Token) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0
This method tests for !=
.
impl<'a> Eq for Token<'a>
[src]
impl<'a> PartialOrd for Token<'a>
[src]
fn partial_cmp(&self, other: &Token) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<'a> Ord for Token<'a>
[src]
fn cmp(&self, other: &Token) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
ord_max_min
)Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
ord_max_min
)Compares and returns the minimum of two values. Read more