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() -> ParseContext
pub fn new_with_comments() -> ParseContext
Create a new parsing context from this options object, with comment parsing enabled
Sourcepub fn new_with_policy(policy: impl TypeTablePolicy + 'static) -> ParseContext
pub fn new_with_policy(policy: impl TypeTablePolicy + 'static) -> ParseContext
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,
) -> ParseContext
pub fn new_with_comments_and_policy( policy: impl TypeTablePolicy + 'static, ) -> ParseContext
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) -> ParseContext
pub fn new_with_context(context: ParseContextData) -> ParseContext
Create a new parsing context from this options object and pre-existing context data
Sourcepub fn clone_inner(&self) -> ParseContext
pub fn clone_inner(&self) -> ParseContext
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: Node<IdentifierData>) -> Node<TypeNameData>
pub fn add_type_name(&self, name: Node<IdentifierData>) -> Node<TypeNameData>
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: &Node<IdentifierData>,
ctx: IdentifierContext,
)
pub fn new_identifier( &self, name: &Node<IdentifierData>, 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: Node<CommentData>)
pub fn add_comment(&self, comment: Node<CommentData>)
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 more