A MoonBit parser for KaTeX, lexing and parsing LaTeX math expressions with macro expansion
pub(all) suberror ParseFailure {
UnexpectedCharacter(message~ : String, loc~ : SourceLocation?)
ExpectedToken(expected~ : String, actual~ : Diagnostic)
UndefinedControlSequence(name~ : String, loc~ : SourceLocation?)
InvalidArgument(message~ : String, loc~ : SourceLocation?)
DoubleSuperscript(loc~ : SourceLocation?)
DoubleSubscript(loc~ : SourceLocation?)
ExpectedGroupAfter(symbol~ : String, loc~ : SourceLocation?)
FunctionNotAllowed(func_name~ : String, context~ : String, loc~ : SourceLocation?)
MissingFunctionHandler(func_name~ : String, loc~ : SourceLocation?)
TooManyExpansions(limit~ : Int)
InternalInvariant(message~ : String)
} derive(Eq, ToJson, Debug)pub(all) enum ParseNode {
Internal(mode~ : Mode)
Raw(mode~ : Mode, string~ : String)
ColorToken(mode~ : Mode, color~ : String)
Size(mode~ : Mode, value~ : Measurement, is_blank~ : Bool)
Url(mode~ : Mode, url~ : String)
Styling(mode~ : Mode, body~ : Array[ParseNode], style~ : StyleLevel, reset_font~ : Bool)
Sqrt(mode~ : Mode, body~ : ParseNode, index~ : ParseNode?)
Infix(mode~ : Mode, replace_with~ : String, size~ : Measurement?, loc~ : SourceLocation?)
GenFrac(mode~ : Mode, numer~ : ParseNode, denom~ : ParseNode, continued~ : Bool, has_bar_line~ : Bool, bar_size~ : Measurement?, left_delim~ : String?, right_delim~ : String?)
Text(mode~ : Mode, body~ : Array[ParseNode], font~ : String)
Font(mode~ : Mode, font~ : String, body~ : ParseNode)
MClass(mode~ : Mode, mclass~ : AtomFamily, body~ : Array[ParseNode], is_character_box~ : Bool)
Op(mode~ : Mode, limits~ : Bool, always_handle_sup_sub~ : Bool, parent_is_sup_sub~ : Bool, suppress_base_shift~ : Bool, content~ : OperatorContent)
OperatorName(mode~ : Mode, body~ : Array[ParseNode], always_handle_sup_sub~ : Bool, limits~ : Bool, parent_is_sup_sub~ : Bool)
Overline(mode~ : Mode, body~ : ParseNode)
Underline(mode~ : Mode, body~ : ParseNode)
Smash(mode~ : Mode, body~ : ParseNode, smash_height~ : Bool, smash_depth~ : Bool)
Phantom(mode~ : Mode, body~ : Array[ParseNode])
VPhantom(mode~ : Mode, body~ : ParseNode)
Pmb(mode~ : Mode, mclass~ : AtomFamily, body~ : Array[ParseNode])
VCenter(mode~ : Mode, body~ : ParseNode)
Rule(mode~ : Mode, shift~ : Measurement?, width~ : Measurement, height~ : Measurement)
RaiseBox(mode~ : Mode, dy~ : Measurement, body~ : ParseNode)
HBox(mode~ : Mode, body~ : Array[ParseNode])
Lap(mode~ : Mode, alignment~ : LapAlignment, body~ : ParseNode)
MathChoice(mode~ : Mode, display~ : Array[ParseNode], text~ : Array[ParseNode], script~ : Array[ParseNode], scriptscript~ : Array[ParseNode])
Sizing(mode~ : Mode, size~ : Int, body~ : Array[ParseNode])
HorizBrace(mode~ : Mode, label~ : String, is_over~ : Bool, base~ : ParseNode)
XArrow(mode~ : Mode, label~ : String, body~ : ParseNode, below~ : ParseNode?)
AccentUnder(mode~ : Mode, label~ : String, base~ : ParseNode)
DelimSizing(mode~ : Mode, size~ : Int, mclass~ : AtomFamily, delim~ : String)
LeftRightRight(mode~ : Mode, delim~ : String, color~ : String?)
LeftRight(mode~ : Mode, body~ : Array[ParseNode], left~ : String, right~ : String, right_color~ : String?)
Middle(mode~ : Mode, delim~ : String)
Kern(mode~ : Mode, dimension~ : Measurement)
Enclose(mode~ : Mode, body~ : ParseNode, label~ : String, background_color~ : String?, border_color~ : String?)
Href(mode~ : Mode, href~ : String, body~ : Array[ParseNode])
Html(mode~ : Mode, attributes~ : Map[String, String], body~ : Array[ParseNode])
IncludeGraphics(mode~ : Mode, alt~ : String, width~ : Measurement, height~ : Measurement, totalheight~ : Measurement, src~ : String)
Tag(mode~ : Mode, body~ : Array[ParseNode], tag~ : Array[ParseNode])
Array(mode~ : Mode, body~ : Array[Array[ParseNode]], add_jot~ : Bool, array_stretch~ : Double, columns~ : Array[ArrayColumn]?, row_gaps~ : Array[Measurement?], hskip_before_and_after~ : Bool, hlines_before_row~ : Array[Array[Bool]], column_separation_type~ : ColumnSeparationType?, tags~ : Array[Array[ParseNode]?]?, auto_tags~ : Array[Bool]?, leqno~ : Bool)
EnvironmentEnd(mode~ : Mode, name~ : String)
CdLabel(mode~ : Mode, side~ : String, label~ : ParseNode)
CdParent(mode~ : Mode, fragment~ : ParseNode)
Cr(mode~ : Mode, new_line~ : Bool, size~ : Measurement?)
HtmlMathML(mode~ : Mode, html~ : Array[ParseNode], mathml~ : Array[ParseNode])
OrdGroup(mode~ : Mode, loc~ : SourceLocation?, body~ : Array[ParseNode], semisimple~ : Bool)
SupSub(mode~ : Mode, base~ : ParseNode?, sup~ : ParseNode?, sub~ : ParseNode?)
TextOrd(mode~ : Mode, loc~ : SourceLocation?, text~ : String)
MathOrd(mode~ : Mode, loc~ : SourceLocation?, text~ : String)
Spacing(mode~ : Mode, loc~ : SourceLocation?, text~ : String)
AccentToken(mode~ : Mode, loc~ : SourceLocation?, text~ : String)
OperatorToken(mode~ : Mode, loc~ : SourceLocation?, text~ : String)
Accent(mode~ : Mode, loc~ : SourceLocation?, label~ : String, is_stretchy~ : Bool, is_shifty~ : Bool, base~ : ParseNode)
Verb(mode~ : Mode, loc~ : SourceLocation?, body~ : String, star~ : Bool)
Atom(mode~ : Mode, loc~ : SourceLocation?, family~ : AtomFamily, text~ : String)
Color(mode~ : Mode, color~ : String, body~ : Array[ParseNode])
} derive(Eq, ToJson, Debug)pub struct Settings {
throw_on_error : Bool
display_mode : Bool
leqno : Bool
error_color : String
color_is_text_color : Bool
max_expand : Int
global_group : Bool
macros : Map[String, String]
macro_store : Macros?
strict : Strictness
strict_warning_handler : (String) -> Unit?
trust : TrustPolicy
}fn Settings::make(throw_on_error? : Bool, display_mode? : Bool, leqno? : Bool, error_color? : String, color_is_text_color? : Bool, max_expand? : Int, global_group? : Bool, macros? : Map[String, String], macro_store? : Macros, strict? : Strictness, strict_warning_handler? : (String) -> Unit, trust? : TrustPolicy) -> Settingspub(all) enum Strictness {
Ignore
Warn
Error
Callback((String, String, SourceLocation?) -> StrictResponse raise ParseFailure)
}pub(all) enum TrustContext {
UrlTrust(command~ : String, url~ : String, protocol~ : String?)
HtmlClass(class~ : String)
HtmlId(id~ : String)
HtmlStyle(style~ : String)
HtmlData(attributes~ : Map[String, String])
}fn unicode_font_character(font : String, char : String) -> String?fn unicode_symbol(name : String) -> String?A MoonBit parser for KaTeX, lexing and parsing LaTeX math expressions with macro expansion