Struct uvls::core::ast::Ast

source ·
struct Ast {
    keywords: Vec<Keyword>,
    namespace: Option<Path>,
    includes: Vec<LanguageLevelDecl>,
    import: Vec<Import>,
    features: Vec<Feature>,
    constraints: Vec<ConstraintDecl>,
    attributes: Vec<Attribute>,
    references: Vec<Reference>,
    groups: Vec<Group>,
    dirs: Vec<Dir>,
    structure: TreeMap,
    index: HashMap<(Symbol, Ustr, SymbolKind), Symbol>,
}
Expand description

Ast container each symbol kind lives in its own vector

Fields§

§keywords: Vec<Keyword>§namespace: Option<Path>§includes: Vec<LanguageLevelDecl>§import: Vec<Import>§features: Vec<Feature>§constraints: Vec<ConstraintDecl>§attributes: Vec<Attribute>§references: Vec<Reference>§groups: Vec<Group>§dirs: Vec<Dir>§structure: TreeMap§index: HashMap<(Symbol, Ustr, SymbolKind), Symbol>

Implementations§

source§

impl Ast

source

pub fn import_prefix(&self, sym: Symbol) -> &[Ustr]

source

fn lookup<F: FnMut(Symbol)>(&self, sym: Symbol, prefix: Ustr, f: F)

call f for each child under sym and prefix

source

fn name(&self, sym: Symbol) -> Option<Ustr>

source

fn lsp_range(&self, sym: Symbol, source: &Rope) -> Option<Range>

source

fn span(&self, sym: Symbol) -> Option<Range<usize>>

source range for a symbol if there is any

source

fn children( &self, sym: Symbol, ) -> impl Iterator<Item = Symbol> + DoubleEndedIterator + '_

source

fn all_imports(&self) -> impl Iterator<Item = Symbol> + DoubleEndedIterator

utility iterators over different elements of interest

source

fn get_import(&self, index: usize) -> Option<&Import>

source

fn all_features(&self) -> impl Iterator<Item = Symbol>

source

fn get_feature(&self, index: usize) -> Option<&Feature>

source

fn containe_feature(&self, name: Ustr) -> bool

source

fn get_attribute(&self, index: usize) -> Option<&Attribute>

source

fn all_attributes(&self) -> impl Iterator<Item = Symbol>

source

fn containe_attribute(&self, name: Ustr) -> bool

source

fn all_references(&self) -> impl Iterator<Item = Symbol>

source

fn all_constraints(&self) -> impl Iterator<Item = Symbol>

source

fn all_lang_lvls(&self) -> impl Iterator<Item = Symbol>

source

fn find(&self, offset: usize) -> Option<Symbol>

Search a symbol by byte offset in O(N)

source

fn find_all_of(&self, current: Symbol, name: Ustr) -> Vec<Symbol>

Trait Implementations§

source§

impl Clone for Ast

source§

fn clone(&self) -> Ast

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Ast

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Ast

source§

fn default() -> Ast

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Ast

§

impl RefUnwindSafe for Ast

§

impl Send for Ast

§

impl Sync for Ast

§

impl Unpin for Ast

§

impl UnwindSafe for Ast

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromRef<T> for T
where T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> Same for T

source§

type Output = T

Should always be Self
§

impl<T> To for T
where T: ?Sized,

§

fn to<T>(self) -> T
where Self: Into<T>,

Converts to T by calling Into<T>::into.
§

fn try_to<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Tries to convert to T by calling TryInto<T>::try_into.
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more