@cortex-js/compute-engine 0.31.0 → 0.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/package.json +1 -1
  2. package/dist/compute-engine.esm.js +0 -41311
  3. package/dist/compute-engine.min.esm.js +0 -125
  4. package/dist/compute-engine.min.umd.js +0 -127
  5. package/dist/compute-engine.umd.js +0 -41336
  6. package/dist/math-json.esm.js +0 -130
  7. package/dist/math-json.min.esm.js +0 -130
  8. package/dist/math-json.min.umd.js +0 -4
  9. package/dist/math-json.umd.js +0 -155
  10. package/dist/types/common/ansi-codes.d.ts +0 -41
  11. package/dist/types/common/configuration-change.d.ts +0 -28
  12. package/dist/types/common/fuzzy-string-match.d.ts +0 -2
  13. package/dist/types/common/grapheme-splitter.d.ts +0 -15
  14. package/dist/types/common/interruptible.d.ts +0 -20
  15. package/dist/types/common/one-of.d.ts +0 -10
  16. package/dist/types/common/signals.d.ts +0 -96
  17. package/dist/types/common/type/ast-nodes.d.ts +0 -146
  18. package/dist/types/common/type/boxed-type.d.ts +0 -30
  19. package/dist/types/common/type/lexer.d.ts +0 -51
  20. package/dist/types/common/type/parse.d.ts +0 -211
  21. package/dist/types/common/type/parser.d.ts +0 -45
  22. package/dist/types/common/type/primitive.d.ts +0 -10
  23. package/dist/types/common/type/serialize.d.ts +0 -2
  24. package/dist/types/common/type/subtype.d.ts +0 -6
  25. package/dist/types/common/type/type-builder.d.ts +0 -32
  26. package/dist/types/common/type/types.d.ts +0 -300
  27. package/dist/types/common/type/utils.d.ts +0 -36
  28. package/dist/types/common/utils.d.ts +0 -23
  29. package/dist/types/compute-engine/assume.d.ts +0 -26
  30. package/dist/types/compute-engine/boxed-expression/abstract-boxed-expression.d.ts +0 -165
  31. package/dist/types/compute-engine/boxed-expression/apply.d.ts +0 -5
  32. package/dist/types/compute-engine/boxed-expression/arithmetic-add.d.ts +0 -16
  33. package/dist/types/compute-engine/boxed-expression/arithmetic-mul-div.d.ts +0 -27
  34. package/dist/types/compute-engine/boxed-expression/arithmetic-power.d.ts +0 -38
  35. package/dist/types/compute-engine/boxed-expression/ascii-math.d.ts +0 -11
  36. package/dist/types/compute-engine/boxed-expression/box.d.ts +0 -47
  37. package/dist/types/compute-engine/boxed-expression/boxed-dictionary.d.ts +0 -44
  38. package/dist/types/compute-engine/boxed-expression/boxed-function.d.ts +0 -136
  39. package/dist/types/compute-engine/boxed-expression/boxed-number.d.ts +0 -103
  40. package/dist/types/compute-engine/boxed-expression/boxed-operator-definition.d.ts +0 -53
  41. package/dist/types/compute-engine/boxed-expression/boxed-patterns.d.ts +0 -107
  42. package/dist/types/compute-engine/boxed-expression/boxed-string.d.ts +0 -27
  43. package/dist/types/compute-engine/boxed-expression/boxed-symbol.d.ts +0 -170
  44. package/dist/types/compute-engine/boxed-expression/boxed-tensor.d.ts +0 -83
  45. package/dist/types/compute-engine/boxed-expression/boxed-value-definition.d.ts +0 -46
  46. package/dist/types/compute-engine/boxed-expression/cache.d.ts +0 -7
  47. package/dist/types/compute-engine/boxed-expression/canonical-utils.d.ts +0 -5
  48. package/dist/types/compute-engine/boxed-expression/canonical.d.ts +0 -2
  49. package/dist/types/compute-engine/boxed-expression/compare.d.ts +0 -13
  50. package/dist/types/compute-engine/boxed-expression/expand.d.ts +0 -20
  51. package/dist/types/compute-engine/boxed-expression/expression-map.d.ts +0 -12
  52. package/dist/types/compute-engine/boxed-expression/factor.d.ts +0 -10
  53. package/dist/types/compute-engine/boxed-expression/flatten.d.ts +0 -25
  54. package/dist/types/compute-engine/boxed-expression/hold.d.ts +0 -10
  55. package/dist/types/compute-engine/boxed-expression/match.d.ts +0 -19
  56. package/dist/types/compute-engine/boxed-expression/negate.d.ts +0 -11
  57. package/dist/types/compute-engine/boxed-expression/numerics.d.ts +0 -34
  58. package/dist/types/compute-engine/boxed-expression/order.d.ts +0 -71
  59. package/dist/types/compute-engine/boxed-expression/polynomials.d.ts +0 -105
  60. package/dist/types/compute-engine/boxed-expression/product.d.ts +0 -66
  61. package/dist/types/compute-engine/boxed-expression/rules.d.ts +0 -129
  62. package/dist/types/compute-engine/boxed-expression/serialize.d.ts +0 -3
  63. package/dist/types/compute-engine/boxed-expression/sgn.d.ts +0 -46
  64. package/dist/types/compute-engine/boxed-expression/simplify.d.ts +0 -6
  65. package/dist/types/compute-engine/boxed-expression/solve.d.ts +0 -20
  66. package/dist/types/compute-engine/boxed-expression/terms.d.ts +0 -10
  67. package/dist/types/compute-engine/boxed-expression/trigonometry.d.ts +0 -9
  68. package/dist/types/compute-engine/boxed-expression/utils.d.ts +0 -64
  69. package/dist/types/compute-engine/boxed-expression/validate.d.ts +0 -58
  70. package/dist/types/compute-engine/collection-utils.d.ts +0 -35
  71. package/dist/types/compute-engine/compilation/base-compiler.d.ts +0 -31
  72. package/dist/types/compute-engine/compilation/javascript-target.d.ts +0 -68
  73. package/dist/types/compute-engine/compilation/types.d.ts +0 -83
  74. package/dist/types/compute-engine/cost-function.d.ts +0 -13
  75. package/dist/types/compute-engine/function-utils.d.ts +0 -120
  76. package/dist/types/compute-engine/global-types.d.ts +0 -2930
  77. package/dist/types/compute-engine/index.d.ts +0 -660
  78. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-algebra.d.ts +0 -2
  79. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-arithmetic.d.ts +0 -2
  80. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-calculus.d.ts +0 -2
  81. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-complex.d.ts +0 -2
  82. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-core.d.ts +0 -27
  83. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-linear-algebra.d.ts +0 -2
  84. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-logic.d.ts +0 -2
  85. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-other.d.ts +0 -2
  86. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-relational-operators.d.ts +0 -2
  87. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-sets.d.ts +0 -2
  88. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-statistics.d.ts +0 -2
  89. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-symbols.d.ts +0 -3
  90. package/dist/types/compute-engine/latex-syntax/dictionary/definitions-trigonometry.d.ts +0 -2
  91. package/dist/types/compute-engine/latex-syntax/dictionary/definitions.d.ts +0 -88
  92. package/dist/types/compute-engine/latex-syntax/parse-symbol.d.ts +0 -21
  93. package/dist/types/compute-engine/latex-syntax/parse.d.ts +0 -303
  94. package/dist/types/compute-engine/latex-syntax/serialize-number.d.ts +0 -29
  95. package/dist/types/compute-engine/latex-syntax/serializer-style.d.ts +0 -10
  96. package/dist/types/compute-engine/latex-syntax/serializer.d.ts +0 -37
  97. package/dist/types/compute-engine/latex-syntax/tokenizer.d.ts +0 -18
  98. package/dist/types/compute-engine/latex-syntax/types.d.ts +0 -845
  99. package/dist/types/compute-engine/latex-syntax/utils.d.ts +0 -5
  100. package/dist/types/compute-engine/library/arithmetic.d.ts +0 -4
  101. package/dist/types/compute-engine/library/calculus.d.ts +0 -2
  102. package/dist/types/compute-engine/library/collections.d.ts +0 -27
  103. package/dist/types/compute-engine/library/combinatorics.d.ts +0 -2
  104. package/dist/types/compute-engine/library/complex.d.ts +0 -2
  105. package/dist/types/compute-engine/library/control-structures.d.ts +0 -2
  106. package/dist/types/compute-engine/library/core.d.ts +0 -2
  107. package/dist/types/compute-engine/library/invisible-operator.d.ts +0 -4
  108. package/dist/types/compute-engine/library/library.d.ts +0 -17
  109. package/dist/types/compute-engine/library/linear-algebra.d.ts +0 -2
  110. package/dist/types/compute-engine/library/logic.d.ts +0 -6
  111. package/dist/types/compute-engine/library/number-theory.d.ts +0 -2
  112. package/dist/types/compute-engine/library/polynomials.d.ts +0 -2
  113. package/dist/types/compute-engine/library/random-expression.d.ts +0 -2
  114. package/dist/types/compute-engine/library/relational-operator.d.ts +0 -2
  115. package/dist/types/compute-engine/library/sets.d.ts +0 -2
  116. package/dist/types/compute-engine/library/statistics.d.ts +0 -2
  117. package/dist/types/compute-engine/library/trigonometry.d.ts +0 -2
  118. package/dist/types/compute-engine/library/utils.d.ts +0 -77
  119. package/dist/types/compute-engine/numeric-value/big-numeric-value.d.ts +0 -57
  120. package/dist/types/compute-engine/numeric-value/exact-numeric-value.d.ts +0 -75
  121. package/dist/types/compute-engine/numeric-value/machine-numeric-value.d.ts +0 -56
  122. package/dist/types/compute-engine/numeric-value/types.d.ts +0 -116
  123. package/dist/types/compute-engine/numerics/bigint.d.ts +0 -2
  124. package/dist/types/compute-engine/numerics/expression.d.ts +0 -4
  125. package/dist/types/compute-engine/numerics/interval.d.ts +0 -12
  126. package/dist/types/compute-engine/numerics/monte-carlo.d.ts +0 -4
  127. package/dist/types/compute-engine/numerics/numeric-bigint.d.ts +0 -18
  128. package/dist/types/compute-engine/numerics/numeric-bignum.d.ts +0 -9
  129. package/dist/types/compute-engine/numerics/numeric-complex.d.ts +0 -3
  130. package/dist/types/compute-engine/numerics/numeric.d.ts +0 -60
  131. package/dist/types/compute-engine/numerics/primes.d.ts +0 -7
  132. package/dist/types/compute-engine/numerics/rationals.d.ts +0 -43
  133. package/dist/types/compute-engine/numerics/richardson.d.ts +0 -80
  134. package/dist/types/compute-engine/numerics/special-functions.d.ts +0 -28
  135. package/dist/types/compute-engine/numerics/statistics.d.ts +0 -24
  136. package/dist/types/compute-engine/numerics/strings.d.ts +0 -2
  137. package/dist/types/compute-engine/numerics/types.d.ts +0 -30
  138. package/dist/types/compute-engine/symbolic/antiderivative.d.ts +0 -3
  139. package/dist/types/compute-engine/symbolic/derivative.d.ts +0 -18
  140. package/dist/types/compute-engine/symbolic/distribute.d.ts +0 -5
  141. package/dist/types/compute-engine/symbolic/simplify-rules.d.ts +0 -27
  142. package/dist/types/compute-engine/tensor/tensor-fields.d.ts +0 -128
  143. package/dist/types/compute-engine/tensor/tensors.d.ts +0 -93
  144. package/dist/types/compute-engine/types.d.ts +0 -8
  145. package/dist/types/compute-engine.d.ts +0 -3
  146. package/dist/types/math-json/symbols.d.ts +0 -11
  147. package/dist/types/math-json/types.d.ts +0 -122
  148. package/dist/types/math-json/utils.d.ts +0 -87
  149. package/dist/types/math-json.d.ts +0 -3
@@ -1,845 +0,0 @@
1
- /* 0.31.0 */
2
- import type { Expression, MathJsonSymbol } from '../../math-json/types';
3
- import { BoxedType, TypeString } from '../types';
4
- import type { IndexedLatexDictionary, IndexedLatexDictionaryEntry } from './dictionary/definitions';
5
- export type SymbolTable = {
6
- parent: SymbolTable | null;
7
- ids: {
8
- [id: MathJsonSymbol]: BoxedType;
9
- };
10
- };
11
- /**
12
- * A `LatexToken` is a token as returned by `Parser.peek`.
13
- *
14
- * It can be one of the indicated tokens, or a string that starts with a
15
- * `\` for LaTeX commands, or a LaTeX character which includes digits,
16
- * letters and punctuation.
17
- *
18
- * @category Latex Parsing and Serialization
19
- */
20
- export type LatexToken = string | '<{>' | '<}>' | '<space>' | '<$>' | '<$$>';
21
- /** A LatexString is a regular string of LaTeX, for example:
22
- * `\frac{\pi}{2}`
23
- *
24
- * @category Latex Parsing and Serialization
25
- */
26
- export type LatexString = string;
27
- /**
28
- * Open and close delimiters that can be used with {@linkcode MatchfixEntry}
29
- * record to define new LaTeX dictionary entries.
30
- *
31
- * @category Latex Parsing and Serialization
32
- */
33
- export type Delimiter = '.' | ')' | '(' | ']' | '[' | '{' /** \lbrace */ | '}' /** \rbrace */ | '<' /** \langle */ | '>' /** \rangle */ | '|' | '||' | '\\lceil' | '\\rceil' | '\\lfloor' | '\\rfloor' | '\\llbracket' | '\\rrbracket';
34
- /** @category Latex Parsing and Serialization */
35
- export type DelimiterScale = 'normal' | 'scaled' | 'big' | 'none';
36
- /**
37
- * @category Latex Parsing and Serialization
38
- */
39
- export type LibraryCategory = 'algebra' | 'arithmetic' | 'calculus' | 'collections' | 'control-structures' | 'combinatorics' | 'complex' | 'core' | 'data-structures' | 'dimensions' | 'domains' | 'linear-algebra' | 'logic' | 'number-theory' | 'numeric' | 'other' | 'physics' | 'polynomials' | 'relop' | 'sets' | 'statistics' | 'styling' | 'symbols' | 'trigonometry' | 'units';
40
- /**
41
- *
42
- * :::info[THEORY OF OPERATIONS]
43
- *
44
- * The precedence of an operator is a number that indicates the order in which
45
- * operators are applied.
46
- *
47
- * For example, in `1 + 2 * 3`, the `*` operator has a **higher** precedence
48
- * than the `+` operator, so it is applied first.
49
- *
50
- * The precedence range from 0 to 1000. The larger the number, the higher the
51
- * precedence, the more "binding" the operator is.
52
- *
53
- * Here are some rough ranges for the precedence:
54
- *
55
- * - 800: prefix and postfix operators: `\lnot` etc...
56
- * - `POSTFIX_PRECEDENCE` = 810: `!`, `'`
57
- * - 700: some arithmetic operators
58
- * - `EXPONENTIATION_PRECEDENCE` = 700: `^`
59
- * - 600: some binary operators
60
- * - `DIVISION_PRECEDENCE` = 600: `\div`
61
- * - 500: not used
62
- * - 400: not used
63
- * - 300: some logic and arithmetic operators:
64
- * `\land`, `\lor`, `\times`, etc...
65
- * - `MULTIPLICATION_PRECEDENCE` = 390: `\times`
66
- * - 200: arithmetic operators, inequalities:
67
- * - `ADDITION_PRECEDENCE` = 275: `+` `-`
68
- * - `ARROW_PRECEDENCE` = 270: `\to` `\rightarrow`
69
- * - `ASSIGNMENT_PRECEDENCE` = 260: `:=`
70
- * - `COMPARISON_PRECEDENCE` = 245: `\lt` `\gt`
71
- * - 241: `\leq`
72
- * - 100: not used
73
- * - 0: `,`, `;`, etc...
74
- *
75
- * Some constants are defined below for common precedence values.
76
- *
77
- *
78
- * **Note**: MathML defines
79
- * [some operator precedence](https://www.w3.org/TR/2009/WD-MathML3-20090924/appendixc.html),
80
- * but it has some issues and inconsistencies. However,
81
- * whenever possible we adopted the MathML precedence.
82
- *
83
- * The JavaScript operator precedence is documented
84
- * [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_precedence).
85
- *
86
- * :::
87
- *
88
- * @category Latex Parsing and Serialization
89
- */
90
- export type Precedence = number;
91
- /** @hidden */
92
- export declare const COMPARISON_PRECEDENCE: Precedence;
93
- /** @hidden */
94
- export declare const ASSIGNMENT_PRECEDENCE: Precedence;
95
- /** @hidden */
96
- export declare const ARROW_PRECEDENCE: Precedence;
97
- /** @hidden */
98
- export declare const ADDITION_PRECEDENCE: Precedence;
99
- /** @hidden */
100
- export declare const MULTIPLICATION_PRECEDENCE: Precedence;
101
- /** @hidden */
102
- export declare const DIVISION_PRECEDENCE: Precedence;
103
- /** @hidden */
104
- export declare const INVISIBLE_OP_PRECEDENCE: Precedence;
105
- /** @hidden */
106
- export declare const EXPONENTIATION_PRECEDENCE: Precedence;
107
- /** @hidden */
108
- export declare const POSTFIX_PRECEDENCE: Precedence;
109
- /**
110
- * This indicates a condition under which parsing should stop:
111
- * - an operator of a precedence higher than specified has been encountered
112
- * - the last token has been reached
113
- * - or if a condition is provided, the condition returns true
114
- *
115
- * @category Latex Parsing and Serialization
116
- */
117
- export type Terminator = {
118
- minPrec: Precedence;
119
- condition?: (parser: Parser) => boolean;
120
- };
121
- /**
122
- * **Custom parsing handler.**
123
- *
124
- * When this handler is invoked the parser points right after the LaTeX
125
- * fragment that triggered it.
126
- *
127
- * Tokens can be consumed with `parser.nextToken()` and other parser methods
128
- * such as `parser.parseGroup()`, `parser.parseOptionalGroup()`, etc...
129
- *
130
- * If it was in an infix or postfix context, `lhs` will represent the
131
- * left-hand side argument. In a prefix or matchfix context, `lhs` is `null`.
132
- *
133
- * In a superfix (`^`) or subfix (`_`) context (that is if the first token of
134
- * the trigger is `^` or `_`), `lhs` is `["Superscript", lhs, rhs]`
135
- * and `["Subscript", lhs, rhs]`, respectively.
136
- *
137
- * The handler should return `null` if the tokens could not be parsed
138
- * (didn't match the syntax that was expected), or the matching expression
139
- * otherwise.
140
- *
141
- * If the tokens were parsed but should be ignored, the handler should
142
- * return `Nothing`.
143
- *
144
- * @category Latex Parsing and Serialization
145
- */
146
- export type ParseHandler = ExpressionParseHandler | SymbolParseHandler | FunctionParseHandler | EnvironmentParseHandler | PostfixParseHandler | InfixParseHandler | MatchfixParseHandler;
147
- /**
148
- * @category Latex Parsing and Serialization
149
- */
150
- export type ExpressionParseHandler = (parser: Parser, until?: Readonly<Terminator>) => Expression | null;
151
- /**
152
- * @category Latex Parsing and Serialization
153
- */
154
- export type PrefixParseHandler = (parser: Parser, until?: Readonly<Terminator>) => Expression | null;
155
- /**
156
- * @category Latex Parsing and Serialization
157
- */
158
- export type SymbolParseHandler = (parser: Parser, until?: Readonly<Terminator>) => Expression | null;
159
- /**
160
- * @category Latex Parsing and Serialization
161
- */
162
- export type FunctionParseHandler = (parser: Parser, until?: Readonly<Terminator>) => Expression | null;
163
- /**
164
- * @category Latex Parsing and Serialization
165
- */
166
- export type EnvironmentParseHandler = (parser: Parser, until?: Readonly<Terminator>) => Expression | null;
167
- /**
168
- * @category Latex Parsing and Serialization
169
- */
170
- export type PostfixParseHandler = (parser: Parser, lhs: Expression, until?: Readonly<Terminator>) => Expression | null;
171
- /**
172
- * @category Latex Parsing and Serialization
173
- */
174
- export type InfixParseHandler = (parser: Parser, lhs: Expression, until: Readonly<Terminator>) => Expression | null;
175
- /**
176
- * @category Latex Parsing and Serialization
177
- */
178
- export type MatchfixParseHandler = (parser: Parser, body: Expression) => Expression | null;
179
- /**
180
- * @category Latex Parsing and Serialization
181
- */
182
- export type LatexArgumentType = '{expression}' /** A required math mode expression */ | '[expression]' /** An optional math mode expression */ | '{text}' /** A required expression in text mode */ | '[text]' /** An optional expression in text mode */ | '{unit}' /** A required unit expression, e.g. `3em` */ | '[unit]' /** An optional unit expression, e.g. `3em` */ | '{glue}' /** A required glue expression, e.g. `25 mu plus 3em ` */ | '[glue]' /** An optional glue expression, e.g. `25 mu plus 3em ` */ | '{string}' /** A required text string, terminated by a non-literal token */ | '[string]' /** An optional text string, terminated by a non-literal token */ | '{color}' /** A required color expression, e.g. `red` or `#00ff00` */ | '[color]'; /** An optional color expression, e.g. `red` or `#00ff00` */
183
- /**
184
- * A trigger is the set of tokens that will make an entry in the
185
- * LaTeX dictionary eligible to parse the stream and generate an expression.
186
- * If the trigger matches, the `parse` handler is called, if available.
187
- *
188
- * The trigger can be specified either as a LaTeX string (`latexTrigger`) or
189
- * as an symbol (`symbolTrigger`). A symbol match several
190
- * LaTeX expressions that are equivalent, for example `\operatorname{gcd}` or
191
- * `\mathbin{gcd}`, match the `"gcd"` symbol
192
- *
193
- * `matchfix` operators use `openTrigger` and `closeTrigger` instead.
194
- *
195
- * @category Latex Parsing and Serialization
196
- */
197
- export type Trigger = {
198
- latexTrigger?: LatexString | LatexToken[];
199
- symbolTrigger?: MathJsonSymbol;
200
- };
201
- /**
202
- * Maps a string of LaTeX tokens to a function or symbol and vice-versa.
203
- * @category Latex Parsing and Serialization
204
- */
205
- export type BaseEntry = {
206
- /**
207
- * Map a MathJSON symbol to this entry.
208
- *
209
- * Each entry should have at least a `name` or a `parse` handler.
210
- *
211
- * An entry with no `name` cannot be serialized: the `name` is used to map
212
- * a MathJSON function or symbol name to the appropriate entry for
213
- * serializing.
214
- *
215
- * However, an entry with no `name` can be used to define a synonym (for
216
- * example for the symbol `\varnothing` which is a synonym for `\emptyset`).
217
- *
218
- * If no `parse` handler is provided, only the trigger is used to select this
219
- * entry. Otherwise, if the trigger of the entry matches the current
220
- * token, the `parse` handler is invoked.
221
- */
222
- name?: MathJsonSymbol;
223
- /**
224
- * Transform an expression into a LaTeX string.
225
- * If no `serialize` handler is provided, the trigger is used.
226
- */
227
- serialize?: LatexString | SerializeHandler;
228
- };
229
- /**
230
- * @category Latex Parsing and Serialization
231
- */
232
- export type DefaultEntry = BaseEntry & Trigger & {
233
- parse?: Expression | ExpressionParseHandler;
234
- };
235
- /**
236
- * @category Latex Parsing and Serialization
237
- */
238
- export type ExpressionEntry = BaseEntry & Trigger & {
239
- kind: 'expression';
240
- parse?: Expression | ExpressionParseHandler;
241
- precedence?: Precedence;
242
- };
243
- /**
244
- * @category Latex Parsing and Serialization
245
- */
246
- export type MatchfixEntry = BaseEntry & {
247
- kind: 'matchfix';
248
- /**
249
- * If `kind` is `'matchfix'`: the `openTrigger` and `closeTrigger`
250
- * properties are required.
251
- */
252
- openTrigger: Delimiter | LatexToken[];
253
- closeTrigger: Delimiter | LatexToken[];
254
- /** When invoked, the parser is pointing after the close delimiter.
255
- * The argument of the handler is the body, i.e. the content between
256
- * the open delimiter and the close delimiter.
257
- */
258
- parse?: MatchfixParseHandler;
259
- };
260
- /**
261
- * @category Latex Parsing and Serialization
262
- */
263
- export type InfixEntry = BaseEntry & Trigger & {
264
- /**
265
- * Infix position, with an operand before and an operand after: `a ⊛ b`.
266
- *
267
- * Example: `+`, `\times`.
268
- */
269
- kind: 'infix';
270
- /**
271
- * - **`none`**: a ? b ? c -> syntax error
272
- * - **`any`**: a + b + c -> +(a, b, c)
273
- * - **`left`**: a / b / c -> /(/(a, b), c)
274
- * - **`right`**: a = b = c -> =(a, =(b, c))
275
- *
276
- * - `any`-associative operators have an unlimited number of arguments
277
- * - `left`, `right` or `none` associative operators have two arguments
278
- *
279
- */
280
- associativity?: 'right' | 'left' | 'none' | 'any';
281
- precedence?: Precedence;
282
- parse?: string | InfixParseHandler;
283
- };
284
- /**
285
- * @category Latex Parsing and Serialization
286
- */
287
- export type PostfixEntry = BaseEntry & Trigger & {
288
- /**
289
- * Postfix position, with an operand before: `a ⊛`
290
- *
291
- * Example: `!`.
292
- */
293
- kind: 'postfix';
294
- precedence?: Precedence;
295
- parse?: string | PostfixParseHandler;
296
- };
297
- /**
298
- * @category Latex Parsing and Serialization
299
- */
300
- export type PrefixEntry = BaseEntry & Trigger & {
301
- /**
302
- * Prefix position, with an operand after: `⊛ a`
303
- *
304
- * Example: `-`, `\not`.
305
- */
306
- kind: 'prefix';
307
- precedence: Precedence;
308
- parse?: string | PrefixParseHandler;
309
- };
310
- /**
311
- * A LaTeX dictionary entry for an environment, that is a LaTeX
312
- * construct using `\begin{...}...\end{...}`.
313
- * @category Latex Parsing and Serialization
314
- */
315
- export type EnvironmentEntry = BaseEntry & {
316
- kind: 'environment';
317
- parse: EnvironmentParseHandler;
318
- symbolTrigger: MathJsonSymbol;
319
- };
320
- /**
321
- * @category Latex Parsing and Serialization
322
- */
323
- export type SymbolEntry = BaseEntry & Trigger & {
324
- kind: 'symbol';
325
- /** Used for appropriate wrapping (i.e. when to surround it with parens) */
326
- precedence?: Precedence;
327
- parse: Expression | SymbolParseHandler;
328
- };
329
- /**
330
- * A function is a symbol followed by:
331
- * - some postfix operators such as `\prime`
332
- * - an optional list of arguments in an enclosure (parentheses)
333
- *
334
- * For more complex situations, for example implicit arguments or
335
- * inverse functions postfix (i.e. ^{-1}), use a custom parse handler with a
336
- * entry of kind `expression`.
337
- * @category Latex Parsing and Serialization
338
- */
339
- export type FunctionEntry = BaseEntry & Trigger & {
340
- kind: 'function';
341
- parse?: Expression | FunctionParseHandler;
342
- };
343
- /**
344
- *
345
- * A dictionary entry is a record that maps a LaTeX token or string of tokens
346
- * ( a trigger) to a MathJSON expression or to a parsing handler.
347
- *
348
- * Set the {@linkcode ComputeEngine.latexDictionary} property to an array of
349
- * dictionary entries to define custom LaTeX parsing and serialization.
350
- *
351
- * @category Latex Parsing and Serialization
352
- *
353
- */
354
- export type LatexDictionaryEntry = OneOf<[
355
- ExpressionEntry | MatchfixEntry | InfixEntry | PostfixEntry | PrefixEntry | SymbolEntry | FunctionEntry | EnvironmentEntry | DefaultEntry
356
- ]>;
357
- /** @internal */
358
- export declare function isExpressionEntry(entry: LatexDictionaryEntry): entry is ExpressionEntry;
359
- /** @internal */
360
- export declare function isSymbolEntry(entry: LatexDictionaryEntry): entry is SymbolEntry;
361
- /** @internal */
362
- export declare function isFunctionEntry(entry: LatexDictionaryEntry): entry is FunctionEntry;
363
- /** @internal */
364
- export declare function isMatchfixEntry(entry: LatexDictionaryEntry): entry is MatchfixEntry;
365
- /** @internal */
366
- export declare function isInfixEntry(entry: LatexDictionaryEntry): entry is InfixEntry;
367
- /** @internal */
368
- export declare function isPrefixEntry(entry: LatexDictionaryEntry): entry is PrefixEntry;
369
- /** @internal */
370
- export declare function isPostfixEntry(entry: LatexDictionaryEntry): entry is PostfixEntry;
371
- /** @internal */
372
- export declare function isEnvironmentEntry(entry: LatexDictionaryEntry): entry is EnvironmentEntry;
373
- /**
374
- * A LaTeX dictionary is a collection of LaTeX dictionary entries.
375
- *
376
- * Each entry in the dictionary indicates how to parse and serialize a
377
- * particular LaTeX token or string of tokens.
378
- *
379
- * @category Latex Parsing and Serialization
380
- * @internal
381
- */
382
- export type LatexDictionary = ReadonlyArray<Partial<LatexDictionaryEntry>>;
383
- /**
384
- * These options control how numbers are parsed and serialized.
385
- * @category Serialization
386
- */
387
- export type NumberFormat = {
388
- positiveInfinity: LatexString;
389
- negativeInfinity: LatexString;
390
- notANumber: LatexString;
391
- imaginaryUnit: LatexString;
392
- /**
393
- * A string representing the decimal separator, the string separating
394
- * the whole portion of a number from the fractional portion, i.e.
395
- * the "." in "3.1415".
396
- *
397
- * Some countries use a comma rather than a dot. In this case it is
398
- * recommended to use `"{,}"` as the separator: the surrounding brackets
399
- * ensure there is no additional gap after the comma.
400
- *
401
- * **Default**: `"."`
402
- */
403
- decimalSeparator: LatexString;
404
- /**
405
- * A string representing the separator between groups of digits,
406
- * to make numbers with many digits easier to read.
407
- *
408
- * If a single string is provided, it is used to group digits in the
409
- * whole and the fractional part of the number. If two strings are provided,
410
- * the first is used for the whole part and the second for the fractional
411
- * part.
412
- *
413
- * Caution: some values may lead to unexpected results.
414
- *
415
- * For example, if the `digitGroupSeparator` is `,` (comma) the expression
416
- * `\operatorname{Hypot}(1,2)` will parse as `["Hypot", 1.2]` rather than
417
- * `["Hypot", 1, 2]`. You can however use `{,}` which will avoid this issue
418
- * and display with correct spacing.
419
- *
420
- * **Default**: `"\\,"` (thin space, 3/18mu) (Resolution 7 of the 1948 CGPM)
421
- */
422
- digitGroupSeparator: LatexString | [LatexString, LatexString];
423
- /**
424
- * Maximum length of digits between digit group separators.
425
- *
426
- * If a single number is provided, it is used for the whole and the fractional
427
- * part of the number. If two numbers are provided, the first is used for the
428
- * whole part and the second for the fractional part.
429
- *
430
- * If '`"lakh"`' is provided, the number is grouped in groups of 2 digits,
431
- * except for the last group which has 3 digits. For example: `1,00,00,000`.
432
- *
433
- *
434
- * **Default**: `3`
435
- */
436
- digitGroup: 'lakh' | number | [number | 'lakh', number];
437
- exponentProduct: LatexString;
438
- beginExponentMarker: LatexString;
439
- endExponentMarker: LatexString;
440
- truncationMarker: LatexString;
441
- repeatingDecimal: 'auto' | 'vinculum' | 'dots' | 'parentheses' | 'arc' | 'none';
442
- };
443
- /** @category Serialization */
444
- export type NumberSerializationFormat = NumberFormat & {
445
- /**
446
- * The maximum number of significant digits in serialized numbers.
447
- * - `"max"`: all availabe digits are serialized.
448
- * - `"auto"`: use the same precision as the compute engine.
449
- *
450
- * Default: `"auto"`
451
- */
452
- fractionalDigits: 'auto' | 'max' | number;
453
- notation: 'auto' | 'engineering' | 'scientific' | 'adaptiveScientific';
454
- avoidExponentsInRange: undefined | null | [negativeExponent: number, positiveExponent: number];
455
- };
456
- /**
457
- *
458
- * The LaTeX parsing options can be used with the `ce.parse()` method.
459
- *
460
- * @category Latex Parsing and Serialization
461
- */
462
- export type ParseLatexOptions = NumberFormat & {
463
- /**
464
- * If true, ignore space characters in math mode.
465
- *
466
- * **Default**: `true`
467
- *
468
- */
469
- skipSpace: boolean;
470
- /**
471
- * When parsing a decimal number, e.g. `3.1415`:
472
- *
473
- * - `"auto"` or `"decimal"`: if a decimal number, parse it as an approximate
474
- * decimal number with a whole part and a fractional part
475
- * - `"rational"`: if a decimal number, parse it as an exact rational number
476
- * with a numerator and a denominator. If not a decimal number, parse
477
- * it as a regular number.
478
- * - `"never"`: do not parse numbers, instead return each token making up
479
- * the number (minus sign, digits, decimal marker, etc...).
480
- *
481
- * Note: if the number includes repeating digits (e.g. `1.33(333)`),
482
- * it will be parsed as a decimal number even if this setting is `"rational"`.
483
- *
484
- * **Default**: `"auto"`
485
- *
486
- */
487
- parseNumbers: 'auto' | 'rational' | 'decimal' | 'never';
488
- /**
489
- * This handler is invoked when the parser encounters a
490
- * that has not yet been declared.
491
- *
492
- * The `symbol` argument is a [valid symbol](/math-json/#symbols).
493
- *
494
- */
495
- getSymbolType: (symbol: MathJsonSymbol) => BoxedType;
496
- /** This handler is invoked when the parser encounters an unexpected token.
497
- *
498
- * The `lhs` argument is the left-hand side of the token, if any.
499
- *
500
- * The handler can access the unexpected token with `parser.peek`. If
501
- * it is a token that should be recognized, the handler can consume it
502
- * by calling `parser.nextToken()`.
503
- *
504
- * The handler should return an expression or `null` if the token is not
505
- * recognized.
506
- */
507
- parseUnexpectedToken: (lhs: Expression | null, parser: Parser) => Expression | null;
508
- /**
509
- * If true, the expression will be decorated with the LaTeX
510
- * fragments corresponding to each elements of the expression.
511
- *
512
- * The top-level expression, that is the one returned by `parse()`, will
513
- * include the verbatim LaTeX input that was parsed. The sub-expressions
514
- * may contain a slightly different LaTeX, for example with consecutive spaces
515
- * replaced by one, with comments removed and with some low-level LaTeX
516
- * commands replaced, for example `\egroup` and `\bgroup`.
517
- *
518
- * **Default:** `false`
519
- */
520
- preserveLatex: boolean;
521
- };
522
- /**
523
- *
524
- * The expected format of numbers in the LaTeX string can be specified with
525
- * the `ce.parse()` method.
526
- *
527
- * @category Latex Parsing and Serialization
528
- */
529
- /**
530
- * An instance of `Parser` is provided to the `parse` handlers of custom
531
- * LaTeX dictionary entries.
532
- *
533
- * @category Latex Parsing and Serialization
534
- */
535
- export interface Parser {
536
- readonly options: Required<ParseLatexOptions>;
537
- getSymbolType(id: MathJsonSymbol): BoxedType;
538
- pushSymbolTable(): void;
539
- popSymbolTable(): void;
540
- addSymbol(id: MathJsonSymbol, type: BoxedType | TypeString): void;
541
- /** The index of the current token */
542
- index: number;
543
- /** True if the last token has been reached.
544
- * Consider also `atTerminator()`.
545
- */
546
- readonly atEnd: boolean;
547
- /** Return true if the terminator condition is met or if the last token
548
- * has been reached.
549
- */
550
- atTerminator(t: Terminator | undefined): boolean;
551
- /** Return the next token, without advancing the index */
552
- readonly peek: LatexToken;
553
- /** Return the next token and advance the index */
554
- nextToken(): LatexToken;
555
- /** Return a string representation of the expression
556
- * between `start` and `end` (default: the whole expression)
557
- *
558
- *
559
- */
560
- latex(start: number, end?: number): string;
561
- /** Return an error expression with the specified code and arguments */
562
- error(code: string | [string, ...Expression[]], fromToken: number): Expression;
563
- /** If there are any space, advance the index until a non-space is encountered */
564
- skipSpace(): boolean;
565
- /** Skip over "visual space" which
566
- includes space tokens, empty groups `{}`, and commands such as `\,` and `\!` */
567
- skipVisualSpace(): void;
568
- /** If the next token matches the target advance and return true. Otherwise
569
- * return false
570
- */
571
- match(token: LatexToken): boolean;
572
- /** Return true if the next tokens match the argument, an array of tokens, or null otherwise
573
- */
574
- matchAll(tokens: LatexToken[]): boolean;
575
- /** Return the next token if it matches any of the token in the argument or null otherwise
576
- */
577
- matchAny(tokens: LatexToken[]): LatexToken;
578
- /** If the next token is a character, return it and advance the index
579
- * This includes plain characters (e.g. 'a', '+'...), characters
580
- * defined in hex (^^ and ^^^^), the `\char` and `\unicode` command.
581
- */
582
- parseChar(): string | null;
583
- /**
584
- * Parse an expression in a LaTeX group enclosed in curly brackets `{}`.
585
- * These are often used as arguments to LaTeX commands, for example
586
- * `\frac{1}{2}`.
587
- *
588
- * Return `null` if none was found
589
- * Return `Nothing` if an empty group `{}` was found
590
- */
591
- parseGroup(): Expression | null;
592
- /**
593
- * Some LaTeX commands (but not all) can accept arguments as single
594
- * tokens (i.e. without braces), for example `^2`, `\sqrt3` or `\frac12`
595
- *
596
- * This argument will usually be a single token, but can be a sequence of
597
- * tokens (e.g. `\sqrt\frac12` or `\sqrt\operatorname{speed}`).
598
- *
599
- * The following tokens are excluded from consideration in order to fail
600
- * early when encountering a likely syntax error, for example `x^(2)`
601
- * instead of `x^{2}`. With `(` in the list of excluded tokens, the
602
- * match will fail and the error can be recovered.
603
- *
604
- * The excluded tokens include `!"#$%&(),/;:?@[]`|~", `\left`, `\bigl`, etc...
605
- */
606
- parseToken(): Expression | null;
607
- /**
608
- * Parse an expression enclosed in a LaTeX optional group enclosed in square brackets `[]`.
609
- *
610
- * Return `null` if none was found.
611
- */
612
- parseOptionalGroup(): Expression | null;
613
- /** Parse an enclosure (open paren/close paren, etc..) and return the expression inside the enclosure */
614
- parseEnclosure(): Expression | null;
615
- /**
616
- * Some LaTeX commands have arguments that are not interpreted as
617
- * expressions, but as strings. For example, `\begin{array}{ccc}` (both
618
- * `array` and `ccc` are strings), `\color{red}` or `\operatorname{lim sup}`.
619
- *
620
- * If the next token is the start of a group (`{`), return the content
621
- * of the group as a string. This may include white space, and it may need
622
- * to be trimmed at the start and end of the string.
623
- *
624
- * LaTeX commands are typically not allowed inside a string group (for example,
625
- * `\alpha` would result in an error), but we do not enforce this.
626
- *
627
- * If `optional` is true, this should be an optional group in square brackets
628
- * otherwise it is a regular group in braces.
629
- */
630
- parseStringGroup(optional?: boolean): string | null;
631
- /**
632
- * A symbol can be:
633
- * - a single-letter symbol: `x`
634
- * - a single LaTeX command: `\pi`
635
- * - a multi-letter symbol: `\operatorname{speed}`
636
- */
637
- parseSymbol(until?: Partial<Terminator>): Expression | null;
638
- /**
639
- * Parse an expression in a tabular format, where rows are separated by `\\`
640
- * and columns by `&`.
641
- *
642
- * Return rows of sparse columns: empty rows are indicated with `Nothing`,
643
- * and empty cells are also indicated with `Nothing`.
644
- */
645
- parseTabular(): null | Expression[][];
646
- /**
647
- * Parse an argument list, for example: `(12, x+1)` or `\left(x\right)`
648
- *
649
- * - 'enclosure' : will look for arguments inside an enclosure
650
- * (an open/close fence) (**default**)
651
- * - 'implicit': either an expression inside a pair of `()`, or just a primary
652
- * (i.e. we interpret `\cos x + 1` as `\cos(x) + 1`)
653
- *
654
- * Return an array of expressions, one for each argument, or `null` if no
655
- * argument was found.
656
- */
657
- parseArguments(kind?: 'implicit' | 'enclosure', until?: Terminator): ReadonlyArray<Expression> | null;
658
- /**
659
- * Parse a postfix operator, such as `'` or `!`.
660
- *
661
- * Prefix, infix and matchfix operators are handled by `parseExpression()`
662
- *
663
- */
664
- parsePostfixOperator(lhs: Expression | null, until?: Partial<Terminator>): Expression | null;
665
- /**
666
- * Parse an expression:
667
- *
668
- * ```
669
- * <expression> ::=
670
- * | <primary> ( <infix-op> <expression> )?
671
- * | <prefix-op> <expression>
672
- *
673
- * <primary> :=
674
- * (<number> | <symbol> | <function-call> | <matchfix-expr>)
675
- * (<subsup> | <postfix-operator>)*
676
- *
677
- * <matchfix-expr> :=
678
- * <matchfix-op-open> <expression> <matchfix-op-close>
679
- *
680
- * <function-call> ::=
681
- * | <function><matchfix-op-group-open><expression>[',' <expression>]<matchfix-op-group-close>
682
- * ```
683
- *
684
- * This is the top-level parsing entry point.
685
- *
686
- * Stop when an operator of precedence less than `until.minPrec`
687
- * or the sequence of tokens `until.tokens` is encountered
688
- *
689
- * `until` is `{ minPrec:0 }` by default.
690
- */
691
- parseExpression(until?: Partial<Terminator>): Expression | null;
692
- /**
693
- * Parse a number.
694
- */
695
- parseNumber(): Expression | null;
696
- /**
697
- * Boundaries are used to detect the end of an expression.
698
- *
699
- * They are used for unusual syntactic constructs, for example
700
- * `\int \sin x dx` where the `dx` is not an argument to the `\sin`
701
- * function, but a boundary of the integral.
702
- *
703
- * They are also useful when handling syntax errors and recovery.
704
- *
705
- * For example, `\begin{bmatrix} 1 & 2 { \end{bmatrix}` has an
706
- * extraneous `{`, but the parser will attempt to recover and continue
707
- * parsing when it encounters the `\end{bmatrix}` boundary.
708
- */
709
- addBoundary(boundary: LatexToken[]): void;
710
- removeBoundary(): void;
711
- get atBoundary(): boolean;
712
- matchBoundary(): boolean;
713
- boundaryError(msg: string | [string, ...Expression[]]): Expression;
714
- }
715
- /**
716
- *
717
- * The LaTeX serialization options can used with the `expr.toLatex()` method.
718
- *
719
- * @category Latex Parsing and Serialization
720
- */
721
- export type SerializeLatexOptions = NumberSerializationFormat & {
722
- /**
723
- * If true, prettify the LaTeX output.
724
- *
725
- * For example, render `\frac{a}{b}\frac{c}{d}` as `\frac{ac}{bd}`
726
- *
727
- */
728
- prettify: boolean;
729
- /**
730
- * Controls the materialization of the lazy collections.
731
- *
732
- * - If `true`, lazy collections are materialized, i.e. it is rendered as a
733
- * LaTeX expression with all its elements.
734
- * - If `false`, the expression is not materialized, i.e. it is
735
- * rendered as a LaTeX command with its arguments.
736
- * - If a number is provided, it is the maximum number of elements
737
- * that will be materialized.
738
- * - If a pair of numbers is provided, it is the number of elements
739
- * of the head and the tail that will be materialized, respectively.
740
- */
741
- materialization: boolean | number | [number, number];
742
- /**
743
- * LaTeX string used to render an invisible multiply, e.g. in '2x'.
744
- *
745
- * If empty, both operands are concatenated, i.e. `2x`.
746
- *
747
- * Use `\cdot` to insert a `\cdot` operator between them, i.e. `2 \cdot x`.
748
- *
749
- * Empty by default.
750
- */
751
- invisibleMultiply: LatexString;
752
- /**
753
- * LaTeX string used to render [mixed numbers](https://en.wikipedia.org/wiki/Fraction#Mixed_numbers) e.g. '1 3/4'.
754
- *
755
- * Leave it empty to join the main number and the fraction, i.e. render it
756
- * as `1\frac{3}{4}`.
757
- *
758
- * Use `+` to insert an explicit `+` operator between them,
759
- * i.e. `1+\frac{3}{4}`
760
- *
761
- * Empty by default.
762
- */
763
- invisiblePlus: LatexString;
764
- /**
765
- * LaTeX string used to render an explicit multiply operator.
766
- *
767
- * For example, `\times`, `\cdot`, etc...
768
- *
769
- * Default: `\times`
770
- */
771
- multiply: LatexString;
772
- /**
773
- * Serialize the expression `["Error", "'missing'"]`, with this LaTeX string
774
- *
775
- */
776
- missingSymbol: LatexString;
777
- applyFunctionStyle: (expr: Expression, level: number) => DelimiterScale;
778
- groupStyle: (expr: Expression, level: number) => DelimiterScale;
779
- rootStyle: (expr: Expression, level: number) => 'radical' | 'quotient' | 'solidus';
780
- fractionStyle: (expr: Expression, level: number) => 'quotient' | 'block-quotient' | 'inline-quotient' | 'inline-solidus' | 'nice-solidus' | 'reciprocal' | 'factor';
781
- logicStyle: (expr: Expression, level: number) => 'word' | 'boolean' | 'uppercase-word' | 'punctuation';
782
- powerStyle: (expr: Expression, level: number) => 'root' | 'solidus' | 'quotient';
783
- numericSetStyle: (expr: Expression, level: number) => 'compact' | 'regular' | 'interval' | 'set-builder';
784
- };
785
- /**
786
- *
787
- * An instance of `Serializer` is provided to the `serialize` handlers of custom
788
- * LaTeX dictionary entries.
789
- *
790
- * @category Latex Parsing and Serialization
791
- *
792
- */
793
- export interface Serializer {
794
- readonly options: Required<SerializeLatexOptions>;
795
- readonly dictionary: IndexedLatexDictionary;
796
- /** "depth" of the expression:
797
- * - 0 for the root
798
- * - 1 for a subexpression of the root
799
- * - 2 for subexpressions of the subexpressions of the root
800
- * - etc...
801
- *
802
- * This allows the serialized LaTeX to vary depending on the depth of the
803
- * expression.
804
- *
805
- * For example use `\Bigl(` for the top level, and `\bigl(` or `(` for others.
806
- */
807
- level: number;
808
- /** Output a LaTeX string representing the expression */
809
- serialize: (expr: Expression | null | undefined) => string;
810
- serializeFunction(expr: Expression, def?: IndexedLatexDictionaryEntry): LatexString;
811
- serializeSymbol(expr: Expression): LatexString;
812
- /** Output `s` surrounded by delimiters.
813
- *
814
- * If `delimiters` is not specified, use `()`
815
- *
816
- */
817
- wrapString(s: LatexString, style: DelimiterScale, delimiters?: string): LatexString;
818
- /** A string with the arguments of expr fenced appropriately and separated by
819
- * commas.
820
- */
821
- wrapArguments(expr: Expression): LatexString;
822
- /** Add a group fence around the expression if it is
823
- * an operator of precedence less than or equal to `prec`.
824
- */
825
- wrap: (expr: Expression | null | undefined, prec?: number) => LatexString;
826
- /** Add a group fence around the expression if it is
827
- * short (not a function)
828
- */
829
- wrapShort(expr: Expression | null | undefined): LatexString;
830
- /** Styles */
831
- applyFunctionStyle: (expr: Expression, level: number) => DelimiterScale;
832
- groupStyle: (expr: Expression, level: number) => DelimiterScale;
833
- rootStyle: (expr: Expression, level: number) => 'radical' | 'quotient' | 'solidus';
834
- fractionStyle: (expr: Expression, level: number) => 'quotient' | 'block-quotient' | 'inline-quotient' | 'inline-solidus' | 'nice-solidus' | 'reciprocal' | 'factor';
835
- logicStyle: (expr: Expression, level: number) => 'word' | 'boolean' | 'uppercase-word' | 'punctuation';
836
- powerStyle: (expr: Expression, level: number) => 'root' | 'solidus' | 'quotient';
837
- numericSetStyle: (expr: Expression, level: number) => 'compact' | 'regular' | 'interval' | 'set-builder';
838
- }
839
- /** The `serialize` handler of a custom LaTeX dictionary entry can be
840
- * a function of this type.
841
- *
842
- * @category Latex Parsing and Serialization
843
- *
844
- */
845
- export type SerializeHandler = (serializer: Serializer, expr: Expression) => string;