fml 0.6.8

Friendly Markup Language
Documentation
// #[macro_use]
// pub mod macros;
// TODO: uncomment once migration to winnow finishes
#[cfg(test)]
mod tests;

// <Modules and reexports>
pub mod functions;
pub use functions::parse;
// Deprecating so that end users dont have to manually include chumsky traits if they dont need to
#[deprecated(note = "deprecated export in favor of fml::parse abstraction")]
pub use functions::parser;
// </Modules and reexports>

// <use>
use std::fmt::Debug;
use winnow::Stateful;
// </use>

// <Attributes>
const ESCAPABLE_TOKENS: &[char] = &[
    '\\', '*', '%', '_', '~', '|', '$', '[', ']', '(', ')', '<', '>', '{', '}', '`', '-', '#', '^',
];

/// Global state shared between parsing functions
#[derive(Debug, Clone, Copy)]
struct State {
    /// States whether the cursor should interpret is position as the Start-of-Line or not.
    is_sol: bool,
    /// States whether the cursor is already inside of a heading.
    /// This gets temporarily overridden by Quotes.
    is_in_heading: bool,
    /// For prevention of hyperlink nesting.
    is_in_hyperlink: bool,
    /// Prevents nesting (sup&sub)scripts
    is_in_script: bool,
}
impl Default for State {
    fn default() -> Self {
        Self {
            is_sol: true,
            is_in_heading: false,
            is_in_hyperlink: false,
            is_in_script: false,
        }
    }
}

/// Input for parsers. Bool symbolises newline
type Stream<'i> = Stateful<&'i str, State>;