IndentationManager

Struct IndentationManager 

Source
pub struct IndentationManager {
    pub indent_stack: Vec<usize>,
    pub indentation_style: IndentationStyle,
    pub current_indent: usize,
    pattern_analyzed: bool,
}
Expand description

Indentation manager for tracking YAML indentation levels

Fields§

§indent_stack: Vec<usize>

Stack of indentation levels

§indentation_style: IndentationStyle

Detected indentation style

§current_indent: usize

Current indentation level

§pattern_analyzed: bool

Whether we’ve analyzed the indentation pattern

Implementations§

Source§

impl IndentationManager

Source

pub fn new() -> Self

Create a new indentation manager

Source

pub fn reset(&mut self)

Reset the indentation manager

Source

pub fn push_indent(&mut self, level: usize)

Push a new indentation level

Source

pub fn pop_indent(&mut self) -> Option<usize>

Pop an indentation level

Source

pub fn current_level(&self) -> usize

Get the current indentation level

Source

pub fn is_dedent(&self, column: usize) -> bool

Check if we’re at a dedent position

Source

pub fn is_indent(&self, column: usize) -> bool

Check if we’re at an indent position

Source

pub fn count_dedents(&self, column: usize) -> usize

Count dedent levels needed

Source

pub fn analyze_pattern(&mut self, line: &str) -> IndentationStyle

Analyze indentation pattern from a line

Source

pub fn validate_indentation( &self, column: usize, position: Position, ) -> Result<()>

Validate indentation consistency

Source

pub fn generate_block_ends( &mut self, column: usize, position: Position, ) -> Vec<Token>

Generate BlockEnd tokens for dedentation

Trait Implementations§

Source§

impl Debug for IndentationManager

Source§

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

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

impl Default for IndentationManager

Source§

fn default() -> Self

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

Auto Trait Implementations§

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.