// Copyright (c) 2009-2022 The MathJax Consortium// SPDX-License-Identifier: Apache-2.0// Sources: ts/input/tex/base/BaseMethods.ts, TexParser.ts, FilterUtil.ts.package teximportfunc ( *parser) ( string) ([]*mml.Node, error) { , := .readUpTo(, "\\over")if != nil {returnnil, } , := .parseChild()if != nil {returnnil, }// ParseArg uses GetNext's JavaScript whitespace before capturing its // one argument. Keep this boundary independent of ordinary tokenization.for .pos < len(.source) && internalTextSpace(.peekRune()) { .consumeRune() } , , := .readArgumentAtCursor(, false)if != nil {returnnil, } , := .parseChild()if != nil {returnnil, }// BuildRel creates munderover(base, null, top). FilterUtil.cleanSubSup // reduces that absent under-script to mover; construct the same final // shape, without Overset's accent or movable-limit adjustments.return []*mml.Node{texAtom(node("mover", , ), mml.TeXClassRel)}, nil}// readUpTo ports TexParser.GetUpTo's lexical control-sequence search. Braces// protect the terminator; macros and comments are not expanded or interpreted// until ParseUpTo creates the independent child parser for the captured text.func ( *parser) (, string) (string, error) { := func() {for .pos < len(.source) && internalTextSpace(.peekRune()) { .consumeRune() } } () , := .pos, 0for .pos < len(.source) { := .pos ()if .pos >= len(.source) {break } := string(.consumeRune())switch {case"\\": += .readControlSequence()case"{": ++case"}":if == 0 {return"", texError("ExtraCloseLooking", "Extra close brace while looking for %s", ) } -- }if == 0 && == {return .source[:], nil } }return"", texError("TokenNotFoundForCommand", "Could not find %s for \\%s", , )}
The pages are generated with Goldsv0.8.7. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.