MCPcopy Index your code
hub / github.com/TruthHun/BookStack / parseExpression

Method parseExpression

static/katex/katex.mjs:14976–15014  ·  view source on GitHub ↗
(breakOnInfix, breakOnTokenText)

Source from the content-addressed store, hash-verified

14974 }
14975
14976 parseExpression(breakOnInfix, breakOnTokenText) {
14977 const body = []; // Keep adding atoms to the body until we can't parse any more atoms (either
14978 // we reached the end, a }, or a \right)
14979
14980 while (true) {
14981 // Ignore spaces in math mode
14982 if (this.mode === "math") {
14983 this.consumeSpaces();
14984 }
14985
14986 const lex = this.nextToken;
14987
14988 if (Parser.endOfExpression.indexOf(lex.text) !== -1) {
14989 break;
14990 }
14991
14992 if (breakOnTokenText && lex.text === breakOnTokenText) {
14993 break;
14994 }
14995
14996 if (breakOnInfix && functions[lex.text] && functions[lex.text].infix) {
14997 break;
14998 }
14999
15000 const atom = this.parseAtom(breakOnTokenText);
15001
15002 if (!atom) {
15003 break;
15004 }
15005
15006 body.push(atom);
15007 }
15008
15009 if (this.mode === "text") {
15010 this.formLigatures(body);
15011 }
15012
15013 return this.handleInfixNodes(body);
15014 }
15015 /**
15016 * Rewrites infix operators such as \over with corresponding commands such
15017 * as \frac.

Callers 9

parseMethod · 0.95
parseGroupMethod · 0.95
katex.jsFile · 0.80
parseArrayFunction · 0.80
handlerFunction · 0.80
katex.mjsFile · 0.80
parseArrayFunction · 0.80
katex.min.jsFile · 0.80
urFunction · 0.80

Calls 4

consumeSpacesMethod · 0.95
parseAtomMethod · 0.95
formLigaturesMethod · 0.95
handleInfixNodesMethod · 0.95

Tested by

no test coverage detected