Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/math-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ fn convert(
Ok(output)
}

fn parse<'arena, 'source, 'config>(
fn parse<'config, 'source, 'arena>(
latex: &'source str,
arena: &'arena Arena,
cmd_cfg: Option<&'config CommandConfig>,
Expand Down
15 changes: 7 additions & 8 deletions crates/math-core/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ use crate::{
token_queue::{MacroArgument, OneOrNone, TokenQueue},
};

pub(crate) struct Parser<'arena, 'source, 'config> {
pub(super) tokens: TokenQueue<'source, 'config>,
pub(crate) struct Parser<'config, 'source, 'arena> {
pub(super) tokens: TokenQueue<'config, 'source>,
pub(super) buffer: Buffer,
pub(super) arena: &'arena Arena,
equation_counter: &'arena mut u16,
label_map: &'arena mut FxHashMap<Box<str>, NonZeroU16>,
state: ParserState<'arena, 'source>,
state: ParserState<'source, 'arena>,
}

struct ParserState<'arena, 'source> {
struct ParserState<'source, 'arena> {
cmd_args: Vec<TokSpan<'source>>,
cmd_arg_offsets: [usize; 9],
transform: Option<MathVariant>,
Expand Down Expand Up @@ -91,7 +91,7 @@ impl ParseAs {

pub(super) type ParseResult<T> = Result<T, Box<LatexError>>;

impl<'arena, 'source, 'config> Parser<'arena, 'source, 'config>
impl<'config, 'source, 'arena> Parser<'config, 'source, 'arena>
where
'config: 'source, // The config will live as long as the source.
'source: 'arena,
Expand Down Expand Up @@ -603,13 +603,12 @@ where
}
}
Token::Genfrac => 'genfrac: {
fn get_delimiter<'cell, 'arena, 'source, 'config>(
parser: &mut Parser<'arena, 'source, 'config>,
fn get_delimiter<'config, 'source, 'arena>(
parser: &mut Parser<'config, 'source, 'arena>,
) -> Result<Option<StretchableOp>, Box<LatexError>>
where
'config: 'source,
'source: 'arena,
'arena: 'cell,
{
let tok = parser.tokens.read_argument(false)?.into_one_or_none()?;
Ok(match tok {
Expand Down
2 changes: 1 addition & 1 deletion crates/math-core/src/text_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::{
token::{EndToken, Mode, TextToken, Token},
};

impl<'arena> Parser<'arena, '_, '_> {
impl<'arena> Parser<'_, '_, 'arena> {
pub(super) fn extract_text(
&mut self,
initial_style: Option<HtmlTextStyle>,
Expand Down
4 changes: 2 additions & 2 deletions crates/math-core/src/token_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::{
};

/// A token queue that allows peeking at the next non-whitespace token.
pub(super) struct TokenQueue<'source, 'config> {
pub(super) struct TokenQueue<'config, 'source> {
pub lexer: Lexer<'config, 'source>,
queue: VecDeque<TokSpan<'source>>,
lexer_is_eoi: bool,
Expand All @@ -17,7 +17,7 @@ pub(super) struct TokenQueue<'source, 'config> {

static EOI_TOK: TokSpan = TokSpan::new(Token::Eoi, Span::zero_width(0));

impl<'source, 'config> TokenQueue<'source, 'config> {
impl<'config, 'source> TokenQueue<'config, 'source> {
pub(super) fn new(lexer: Lexer<'config, 'source>) -> Result<Self, Box<LatexError>> {
let mut tm = TokenQueue {
lexer,
Expand Down
Loading