Struct glsl_lang_lexer::ParseContext
source · pub struct ParseContext { /* private fields */ }
Expand description
Parsing context
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
source§fn eq(&self, other: &ParseContext) -> bool
fn eq(&self, other: &ParseContext) -> bool
self
and other
values to be equal, and is used
by ==
.