sway_ast::keywords

Trait Token

Source
pub trait Token: Spanned + Sized {
    const PUNCT_KINDS: &'static [PunctKind];
    const NOT_FOLLOWED_BY: &'static [PunctKind];
    const AS_STR: &'static str;

    // Required methods
    fn new(span: Span) -> Self;
    fn ident(&self) -> Ident;
}
Expand description

The type is a token.

Required Associated Constants§

Source

const PUNCT_KINDS: &'static [PunctKind]

The sequence of punctuations that make up the token.

Source

const NOT_FOLLOWED_BY: &'static [PunctKind]

Punctuations that will not follow the token.

Source

const AS_STR: &'static str

What the string representation of the token is when lexing.

Required Methods§

Source

fn new(span: Span) -> Self

Creates the token from the given span.

Source

fn ident(&self) -> Ident

Returns an identifier for this token.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl Token for AddEqToken

Source§

const PUNCT_KINDS: &'static [PunctKind]

Source§

const NOT_FOLLOWED_BY: &'static [PunctKind]

Source§

const AS_STR: &'static str = "+="

Source§

impl Token for AddToken

Source§

const PUNCT_KINDS: &'static [PunctKind]

Source§

const NOT_FOLLOWED_BY: &'static [PunctKind]

Source§

const AS_STR: &'static str = "+"

Source§

impl Token for AmpersandToken

Source§

const PUNCT_KINDS: &'static [PunctKind]

Source§

const NOT_FOLLOWED_BY: &'static [PunctKind]

Source§

const AS_STR: &'static str = "&"

Source§

impl Token for BangEqToken

Source§

const PUNCT_KINDS: &'static [PunctKind]

Source§

const NOT_FOLLOWED_BY: &'static [PunctKind]

Source§

const AS_STR: &'static str = "!="

Source§

impl Token for BangToken

Source§

const PUNCT_KINDS: &'static [PunctKind]

Source§

const NOT_FOLLOWED_BY: &'static [PunctKind]

Source§

const AS_STR: &'static str = "!"

Source§

impl Token for CaretToken

Source§

const PUNCT_KINDS: &'static [PunctKind]

Source§

const NOT_FOLLOWED_BY: &'static [PunctKind]

Source§

const AS_STR: &'static str = "^"

Source§

impl Token for CloseAngleBracketToken

Source§

const PUNCT_KINDS: &'static [PunctKind]

Source§

const NOT_FOLLOWED_BY: &'static [PunctKind]

Source§

const AS_STR: &'static str = ">"

Source§

impl Token for ColonToken

Source§

const PUNCT_KINDS: &'static [PunctKind]

Source§

const NOT_FOLLOWED_BY: &'static [PunctKind]

Source§

const AS_STR: &'static str = ":"

Source§

impl Token for CommaToken

Source§

const PUNCT_KINDS: &'static [PunctKind]

Source§

const NOT_FOLLOWED_BY: &'static [PunctKind]

Source§

const AS_STR: &'static str = ","

Source§

impl Token for DivEqToken

Source§

const PUNCT_KINDS: &'static [PunctKind]

Source§

const NOT_FOLLOWED_BY: &'static [PunctKind]

Source§

const AS_STR: &'static str = "/="

Source§

impl Token for DotToken

Source§

const PUNCT_KINDS: &'static [PunctKind]

Source§

const NOT_FOLLOWED_BY: &'static [PunctKind]

Source§

const AS_STR: &'static str = "."

Source§

impl Token for DoubleAmpersandToken

Source§

const PUNCT_KINDS: &'static [PunctKind]

Source§

const NOT_FOLLOWED_BY: &'static [PunctKind]

Source§

const AS_STR: &'static str = "&&"

Source§

impl Token for DoubleColonToken

Source§

const PUNCT_KINDS: &'static [PunctKind]

Source§

const NOT_FOLLOWED_BY: &'static [PunctKind]

Source§

const AS_STR: &'static str = "::"

Source§

impl Token for DoubleDotToken

Source§

const PUNCT_KINDS: &'static [PunctKind]

Source§

const NOT_FOLLOWED_BY: &'static [PunctKind]

Source§

const AS_STR: &'static str = ".."

Source§

impl Token for DoubleEqToken

Source§

const PUNCT_KINDS: &'static [PunctKind]

Source§

const NOT_FOLLOWED_BY: &'static [PunctKind]

Source§

const AS_STR: &'static str = "=="

Source§

impl Token for DoublePipeToken

Source§

const PUNCT_KINDS: &'static [PunctKind]

Source§

const NOT_FOLLOWED_BY: &'static [PunctKind]

Source§

const AS_STR: &'static str = "||"

Source§

impl Token for DoubleStarToken

Source§

const PUNCT_KINDS: &'static [PunctKind]

Source§

const NOT_FOLLOWED_BY: &'static [PunctKind]

Source§

const AS_STR: &'static str = "**"

Source§

impl Token for EqToken

Source§

const PUNCT_KINDS: &'static [PunctKind]

Source§

const NOT_FOLLOWED_BY: &'static [PunctKind]

Source§

const AS_STR: &'static str = "="

Source§

impl Token for FatRightArrowToken

Source§

const PUNCT_KINDS: &'static [PunctKind]

Source§

const NOT_FOLLOWED_BY: &'static [PunctKind]

Source§

const AS_STR: &'static str = "=>"

Source§

impl Token for ForwardSlashToken

Source§

const PUNCT_KINDS: &'static [PunctKind]

Source§

const NOT_FOLLOWED_BY: &'static [PunctKind]

Source§

const AS_STR: &'static str = "/"

Source§

impl Token for GreaterThanEqToken

Source§

const PUNCT_KINDS: &'static [PunctKind]

Source§

const NOT_FOLLOWED_BY: &'static [PunctKind]

Source§

const AS_STR: &'static str = ">="

Source§

impl Token for GreaterThanToken

Source§

const PUNCT_KINDS: &'static [PunctKind]

Source§

const NOT_FOLLOWED_BY: &'static [PunctKind]

Source§

const AS_STR: &'static str = ">"

Source§

impl Token for HashBangToken

Source§

const PUNCT_KINDS: &'static [PunctKind]

Source§

const NOT_FOLLOWED_BY: &'static [PunctKind]

Source§

const AS_STR: &'static str = "#!"

Source§

impl Token for HashToken

Source§

const PUNCT_KINDS: &'static [PunctKind]

Source§

const NOT_FOLLOWED_BY: &'static [PunctKind]

Source§

const AS_STR: &'static str = "#"

Source§

impl Token for LessThanEqToken

Source§

const PUNCT_KINDS: &'static [PunctKind]

Source§

const NOT_FOLLOWED_BY: &'static [PunctKind]

Source§

const AS_STR: &'static str = "<="

Source§

impl Token for LessThanToken

Source§

const PUNCT_KINDS: &'static [PunctKind]

Source§

const NOT_FOLLOWED_BY: &'static [PunctKind]

Source§

const AS_STR: &'static str = "<"

Source§

impl Token for OpenAngleBracketToken

Source§

const PUNCT_KINDS: &'static [PunctKind]

Source§

const NOT_FOLLOWED_BY: &'static [PunctKind]

Source§

const AS_STR: &'static str = "<"

Source§

impl Token for PercentToken

Source§

const PUNCT_KINDS: &'static [PunctKind]

Source§

const NOT_FOLLOWED_BY: &'static [PunctKind]

Source§

const AS_STR: &'static str = "%"

Source§

impl Token for PipeToken

Source§

const PUNCT_KINDS: &'static [PunctKind]

Source§

const NOT_FOLLOWED_BY: &'static [PunctKind]

Source§

const AS_STR: &'static str = "|"

Source§

impl Token for RightArrowToken

Source§

const PUNCT_KINDS: &'static [PunctKind]

Source§

const NOT_FOLLOWED_BY: &'static [PunctKind]

Source§

const AS_STR: &'static str = "->"

Source§

impl Token for SemicolonToken

Source§

const PUNCT_KINDS: &'static [PunctKind]

Source§

const NOT_FOLLOWED_BY: &'static [PunctKind]

Source§

const AS_STR: &'static str = ";"

Source§

impl Token for ShlEqToken

Source§

const PUNCT_KINDS: &'static [PunctKind]

Source§

const NOT_FOLLOWED_BY: &'static [PunctKind]

Source§

const AS_STR: &'static str = "<<="

Source§

impl Token for ShlToken

Source§

const PUNCT_KINDS: &'static [PunctKind]

Source§

const NOT_FOLLOWED_BY: &'static [PunctKind]

Source§

const AS_STR: &'static str = "<<"

Source§

impl Token for ShrEqToken

Source§

const PUNCT_KINDS: &'static [PunctKind]

Source§

const NOT_FOLLOWED_BY: &'static [PunctKind]

Source§

const AS_STR: &'static str = ">>="

Source§

impl Token for ShrToken

Source§

const PUNCT_KINDS: &'static [PunctKind]

Source§

const NOT_FOLLOWED_BY: &'static [PunctKind]

Source§

const AS_STR: &'static str = ">>"

Source§

impl Token for StarEqToken

Source§

const PUNCT_KINDS: &'static [PunctKind]

Source§

const NOT_FOLLOWED_BY: &'static [PunctKind]

Source§

const AS_STR: &'static str = "*="

Source§

impl Token for StarToken

Source§

const PUNCT_KINDS: &'static [PunctKind]

Source§

const NOT_FOLLOWED_BY: &'static [PunctKind]

Source§

const AS_STR: &'static str = "*"

Source§

impl Token for SubEqToken

Source§

const PUNCT_KINDS: &'static [PunctKind]

Source§

const NOT_FOLLOWED_BY: &'static [PunctKind]

Source§

const AS_STR: &'static str = "-="

Source§

impl Token for SubToken

Source§

const PUNCT_KINDS: &'static [PunctKind]

Source§

const NOT_FOLLOWED_BY: &'static [PunctKind]

Source§

const AS_STR: &'static str = "-"

Source§

impl Token for UnderscoreToken

Source§

const PUNCT_KINDS: &'static [PunctKind]

Source§

const NOT_FOLLOWED_BY: &'static [PunctKind]

Source§

const AS_STR: &'static str = "_"