Struct glsl_lang_lexer::ParseContextData
source · pub struct ParseContextData {
names: Vec<HashSet<SmolStr>>,
comments: Option<CommentList>,
policy: Rc<dyn TypeTablePolicy>,
}
Expand description
Parsing context data
Fields§
§names: Vec<HashSet<SmolStr>>
List of known type names
comments: Option<CommentList>
List of parsed comments (or None
to disable comment parsing)
policy: Rc<dyn TypeTablePolicy>
Implementations§
source§impl ParseContextData
impl ParseContextData
sourcepub fn new() -> Self
pub fn new() -> Self
Create a new ParseContextData object
sourcepub fn with_policy(policy: impl TypeTablePolicy + 'static) -> Self
pub fn with_policy(policy: impl TypeTablePolicy + 'static) -> Self
Create a new ParseContextData object with the given type table policy
§Parameters
policy
: policy object managing the type table
sourcepub fn with_comments() -> Self
pub fn with_comments() -> Self
Create a new ParseContextData object with comments parsing enabled
sourcepub fn with_comments_and_policy(policy: impl TypeTablePolicy + 'static) -> Self
pub fn with_comments_and_policy(policy: impl TypeTablePolicy + 'static) -> Self
Create a new ParseContextData object with comments parsing enabled and the given type table policy
§Parameters
policy
: policy object managing the type table
sourcepub fn comments(&self) -> Option<&CommentList>
pub fn comments(&self) -> Option<&CommentList>
Get the list of comments stored in this parse context
source§impl ParseContextData
impl ParseContextData
sourcepub fn is_type_name(&self, name: &str) -> bool
pub fn is_type_name(&self, name: &str) -> bool
Return true
if the given name is a type name
sourcepub fn add_type_name(&mut self, name: Identifier) -> TypeName
pub fn add_type_name(&mut self, name: Identifier) -> TypeName
Register name
as a new type name
sourcepub fn push_scope(&mut self)
pub fn push_scope(&mut self)
Enter a new nesting level for declarations
sourcepub fn new_identifier(&mut self, name: &Identifier, ctx: IdentifierContext)
pub fn new_identifier(&mut self, name: &Identifier, ctx: IdentifierContext)
Update the context data with a new identifier in a given context
source§impl ParseContextData
impl ParseContextData
sourcepub fn add_comment(&mut self, comment: Comment)
pub fn add_comment(&mut self, comment: Comment)
Add a new comment to the parsed comments list
Trait Implementations§
source§impl Clone for ParseContextData
impl Clone for ParseContextData
source§fn clone(&self) -> ParseContextData
fn clone(&self) -> ParseContextData
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ParseContextData
impl Debug for ParseContextData
source§impl Default for ParseContextData
impl Default for ParseContextData
source§impl From<ParseContextData> for ParseContext
impl From<ParseContextData> for ParseContext
source§fn from(data: ParseContextData) -> Self
fn from(data: ParseContextData) -> Self
Converts to this type from the input type.
source§impl PartialEq for ParseContextData
impl PartialEq for ParseContextData
Auto Trait Implementations§
impl Freeze for ParseContextData
impl !RefUnwindSafe for ParseContextData
impl !Send for ParseContextData
impl !Sync for ParseContextData
impl Unpin for ParseContextData
impl !UnwindSafe for ParseContextData
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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