Skip to content

Define shared LaTeX tokens and text/math mode transitions #296

Open

Description

@Happypig375

CSharpMath.Atom.LaTeXParser and CSharpMath.Rendering.Text.TextLaTeXParser currently scan control sequences, braces, whitespace, and math delimiters independently. Define the internal lexical and parser-mode contract that both can consume before attempting a behavioral migration.

Scope:

  • Define shared token kinds with source spans for control words/symbols, groups, whitespace, raw text, $, and $$ boundaries.
  • Define explicit math/text mode transitions and a stack discipline for nested groups.
  • Preserve current public parser and painter entry points; this issue is an internal architecture seam, not a package merge.
  • Do not bundle the global-settings redesign into this work.

Acceptance criteria:

  • Shared token/mode-transition code is consumed by focused tests for both parser contexts.
  • Escaped dollars, braces, control-word termination, nested groups, and math-to-text-to-math transitions retain exact source positions.
  • Malformed or unmatched delimiters produce deterministic errors without leaking parser state.
  • Existing math and text parser suites remain green with no public API break.

Parent epic: #58.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area/ParsingLaTeX tokenization, parsing, commands, and serialization.Type/EnhancementA concrete change to CSharpMath behavior or capability.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions