Struct glsl_lang_lexer::context::ParseContext
source · pub struct ParseContext {
data: Rc<RefCell<ParseContextData>>,
}
Expand description
Parsing context
Fields§
§data: Rc<RefCell<ParseContextData>>
Parsing data
Implementations§
source§impl ParseContext
impl ParseContext
sourcepub fn new() -> ParseContext
pub fn new() -> ParseContext
Create a new parsing context from this options object
sourcepub fn new_with_comments() -> Self
pub fn new_with_comments() -> Self
Create a new parsing context from this options object, with comment parsing enabled
sourcepub fn new_with_policy(policy: impl TypeTablePolicy + 'static) -> Self
pub fn new_with_policy(policy: impl TypeTablePolicy + 'static) -> Self
Create a new parsing context from this options object, with a custom type table policy
sourcepub fn new_with_comments_and_policy(
policy: impl TypeTablePolicy + 'static,
) -> Self
pub fn new_with_comments_and_policy( policy: impl TypeTablePolicy + 'static, ) -> Self
Create a new parsing context from this options object, with a custom type table policy and comment parsing enabled
sourcepub fn new_with_context(context: ParseContextData) -> Self
pub fn new_with_context(context: ParseContextData) -> Self
Create a new parsing context from this options object and pre-existing context data
sourcepub fn clone_inner(&self) -> Self
pub fn clone_inner(&self) -> Self
Clone the parsing data and return the cloned context
sourcepub fn into_data(self) -> Option<ParseContextData>
pub fn into_data(self) -> Option<ParseContextData>
Consume this ParseContext and return its data. Will fail if there are multiple references to this context’s data.
sourcepub fn data(&self) -> Ref<'_, ParseContextData>
pub fn data(&self) -> Ref<'_, ParseContextData>
Obtain a reference to the context’s data
sourcepub fn data_mut(&self) -> RefMut<'_, ParseContextData>
pub fn data_mut(&self) -> RefMut<'_, ParseContextData>
Obtain an exclusive reference to the context’s data
sourcepub fn with_policy(
&self,
policy: impl TypeTablePolicy + 'static,
) -> ParseContext
pub fn with_policy( &self, policy: impl TypeTablePolicy + 'static, ) -> ParseContext
Create a new parse context cloning the given one’s data, but applies the given policy
source§impl ParseContext
impl ParseContext
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(&self, name: Identifier) -> TypeName
pub fn add_type_name(&self, name: Identifier) -> TypeName
Register name
as a new type name
sourcepub fn push_scope(&self)
pub fn push_scope(&self)
Enter a new nesting level for declarations
sourcepub fn new_identifier(&self, name: &Identifier, ctx: IdentifierContext)
pub fn new_identifier(&self, name: &Identifier, ctx: IdentifierContext)
Update the context data with a new identifier in a given context
source§impl ParseContext
impl ParseContext
sourcepub fn has_comments(&self) -> bool
pub fn has_comments(&self) -> bool
Return true
if this parsing context supports comments
sourcepub fn add_comment(&self, comment: Comment)
pub fn add_comment(&self, comment: Comment)
Add a new comment to the parsed comments list
Trait Implementations§
source§impl Clone for ParseContext
impl Clone for ParseContext
source§fn clone(&self) -> ParseContext
fn clone(&self) -> ParseContext
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ParseContext
impl Debug for ParseContext
source§impl Default for ParseContext
impl Default for ParseContext
source§fn default() -> ParseContext
fn default() -> ParseContext
source§impl From<ParseContextData> for ParseContext
impl From<ParseContextData> for ParseContext
source§fn from(data: ParseContextData) -> Self
fn from(data: ParseContextData) -> Self
source§impl PartialEq for ParseContext
impl PartialEq for ParseContext
impl StructuralPartialEq for ParseContext
Auto Trait Implementations§
impl Freeze for ParseContext
impl !RefUnwindSafe for ParseContext
impl !Send for ParseContext
impl !Sync for ParseContext
impl Unpin for ParseContext
impl !UnwindSafe for ParseContext
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
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)
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>
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>
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