(breakOnInfix, breakOnTokenText)
| 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. |
no test coverage detected