@cortex-js/compute-engine 0.4.0 → 0.4.3
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.
- package/README.md +2 -2
- package/dist/compute-engine.esm.js +22846 -16608
- package/dist/compute-engine.js +23518 -17282
- package/dist/compute-engine.min.esm.js +2 -7
- package/dist/compute-engine.min.js +2 -7
- package/dist/math-json.esm.js +4337 -10529
- package/dist/math-json.js +4354 -10532
- package/dist/math-json.min.esm.js +2 -7
- package/dist/math-json.min.js +2 -7
- package/dist/types/common/grapheme-splitter.d.ts +1 -1
- package/dist/types/common/signals.d.ts +90 -0
- package/dist/types/compute-engine/assume.d.ts +21 -0
- package/dist/types/compute-engine/boxed-expression/abstract-boxed-expression.d.ts +107 -0
- package/dist/types/compute-engine/boxed-expression/box.d.ts +56 -0
- package/dist/types/compute-engine/boxed-expression/boxed-dictionary.d.ts +39 -0
- package/dist/types/compute-engine/boxed-expression/boxed-domain.d.ts +8 -0
- package/dist/types/compute-engine/boxed-expression/boxed-function-definition.d.ts +2 -0
- package/dist/types/compute-engine/boxed-expression/boxed-function.d.ts +93 -0
- package/dist/types/compute-engine/boxed-expression/boxed-number.d.ts +83 -0
- package/dist/types/compute-engine/boxed-expression/boxed-patterns.d.ts +21 -0
- package/dist/types/compute-engine/boxed-expression/boxed-string.d.ts +23 -0
- package/dist/types/compute-engine/boxed-expression/boxed-symbol-definition.d.ts +98 -0
- package/dist/types/compute-engine/boxed-expression/boxed-symbol.d.ts +74 -0
- package/dist/types/compute-engine/boxed-expression/expression-map.d.ts +12 -0
- package/dist/types/compute-engine/boxed-expression/order.d.ts +52 -0
- package/dist/types/compute-engine/boxed-expression/serialize.d.ts +15 -0
- package/dist/types/compute-engine/boxed-expression/utils.d.ts +37 -0
- package/dist/types/compute-engine/compute-engine.d.ts +252 -0
- package/dist/types/compute-engine/cost-function.d.ts +3 -0
- package/dist/types/compute-engine/dictionary/arithmetic-add.d.ts +11 -0
- package/dist/types/compute-engine/dictionary/arithmetic-divide.d.ts +9 -0
- package/dist/types/compute-engine/dictionary/arithmetic-multiply.d.ts +17 -0
- package/dist/types/compute-engine/dictionary/arithmetic-power.d.ts +9 -0
- package/dist/types/compute-engine/dictionary/arithmetic.d.ts +2 -12
- package/dist/types/compute-engine/dictionary/collections.d.ts +2 -0
- package/dist/types/compute-engine/dictionary/core.d.ts +2 -0
- package/dist/types/compute-engine/dictionary/dictionary.d.ts +26 -0
- package/dist/types/compute-engine/dictionary/logic.d.ts +2 -0
- package/dist/types/compute-engine/dictionary/polynomials.d.ts +2 -0
- package/dist/types/compute-engine/dictionary/relational-operator.d.ts +2 -0
- package/dist/types/compute-engine/dictionary/sets.d.ts +2 -0
- package/dist/types/compute-engine/dictionary/trigonometry.d.ts +2 -0
- package/dist/types/compute-engine/domain-utils.d.ts +30 -0
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-algebra.d.ts +2 -0
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-arithmetic.d.ts +2 -0
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-calculus.d.ts +2 -0
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-core.d.ts +4 -0
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-inequalities.d.ts +2 -0
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-logic.d.ts +2 -0
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-other.d.ts +2 -0
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-sets.d.ts +2 -0
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-symbols.d.ts +2 -0
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-trigonometry.d.ts +2 -0
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions.d.ts +57 -0
- package/dist/types/compute-engine/latex-syntax/latex-syntax.d.ts +23 -0
- package/dist/types/compute-engine/latex-syntax/parse.d.ts +198 -0
- package/dist/types/compute-engine/latex-syntax/public.d.ts +550 -0
- package/dist/types/{common → compute-engine/latex-syntax}/serialize-number.d.ts +2 -3
- package/dist/types/{latex-syntax → compute-engine/latex-syntax}/serializer-style.d.ts +2 -1
- package/dist/types/compute-engine/latex-syntax/serializer.d.ts +43 -0
- package/dist/types/{latex-syntax/core → compute-engine/latex-syntax}/tokenizer.d.ts +2 -2
- package/dist/types/compute-engine/numerics/numeric-complex.d.ts +3 -0
- package/dist/types/compute-engine/numerics/numeric-decimal.d.ts +12 -0
- package/dist/types/compute-engine/numerics/numeric.d.ts +35 -0
- package/dist/types/compute-engine/numerics/primes.d.ts +2 -0
- package/dist/types/compute-engine/public.d.ts +1076 -434
- package/dist/types/compute-engine/rules.d.ts +18 -0
- package/dist/types/compute-engine/simplify-rules.d.ts +17 -0
- package/dist/types/compute-engine/symbolic/expand.d.ts +11 -0
- package/dist/types/compute-engine/symbolic/flatten.d.ts +7 -0
- package/dist/types/compute-engine/symbolic/negate.d.ts +12 -0
- package/dist/types/compute-engine/symbolic/polynomials.d.ts +52 -0
- package/dist/types/compute-engine/symbolic/product.d.ts +45 -0
- package/dist/types/compute-engine/symbolic/sum.d.ts +25 -0
- package/dist/types/compute-engine/symbolic/utils.d.ts +47 -0
- package/dist/types/compute-engine.d.ts +3 -0
- package/dist/types/math-json/math-json-format.d.ts +101 -0
- package/dist/types/math-json/utils.d.ts +97 -0
- package/dist/types/math-json.d.ts +5 -3
- package/package.json +39 -36
- package/dist/types/common/utils.d.ts +0 -153
- package/dist/types/compute-engine/expression-map.d.ts +0 -11
- package/dist/types/compute-engine/numeric-complex.d.ts +0 -2
- package/dist/types/compute-engine/numeric-decimal.d.ts +0 -12
- package/dist/types/compute-engine/numeric.d.ts +0 -21
- package/dist/types/compute-engine/patterns.d.ts +0 -22
- package/dist/types/compute-engine/predicates.d.ts +0 -42
- package/dist/types/compute-engine/utils.d.ts +0 -15
- package/dist/types/latex-syntax/definitions-algebra.d.ts +0 -2
- package/dist/types/latex-syntax/definitions-arithmetic.d.ts +0 -3
- package/dist/types/latex-syntax/definitions-calculus.d.ts +0 -2
- package/dist/types/latex-syntax/definitions-core.d.ts +0 -3
- package/dist/types/latex-syntax/definitions-inequalities.d.ts +0 -2
- package/dist/types/latex-syntax/definitions-other.d.ts +0 -3
- package/dist/types/latex-syntax/definitions-sets.d.ts +0 -2
- package/dist/types/latex-syntax/definitions-symbols.d.ts +0 -3
- package/dist/types/latex-syntax/definitions-trigonometry.d.ts +0 -3
- package/dist/types/latex-syntax/definitions.d.ts +0 -40
- package/dist/types/latex-syntax/latex-syntax.d.ts +0 -27
- package/dist/types/latex-syntax/parse.d.ts +0 -138
- package/dist/types/latex-syntax/public.d.ts +0 -455
- package/dist/types/latex-syntax/serializer.d.ts +0 -26
- package/dist/types/latex-syntax/utils.d.ts +0 -10
- package/dist/types/public.d.ts +0 -163
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/* 0.4.3 */
|
|
2
|
+
import { WarningSignal } from '../../../common/signals';
|
|
3
|
+
export declare type CommonEntry = {
|
|
4
|
+
name?: string;
|
|
5
|
+
serialize: SerializeHandler | LatexString;
|
|
6
|
+
};
|
|
7
|
+
export declare type SymbolEntry = CommonEntry & {
|
|
8
|
+
kind: 'symbol';
|
|
9
|
+
precedence: number;
|
|
10
|
+
arguments: 'group' | 'implicit' | '';
|
|
11
|
+
optionalLatexArg: number;
|
|
12
|
+
requiredLatexArg: number;
|
|
13
|
+
parse: SymbolParseHandler;
|
|
14
|
+
};
|
|
15
|
+
export declare type MatchfixEntry = CommonEntry & {
|
|
16
|
+
kind: 'matchfix';
|
|
17
|
+
openDelimiter: Delimiter | LatexToken[];
|
|
18
|
+
closeDelimiter: Delimiter | LatexToken[];
|
|
19
|
+
parse: MatchfixParseHandler;
|
|
20
|
+
};
|
|
21
|
+
export declare type InfixEntry = CommonEntry & {
|
|
22
|
+
kind: 'infix';
|
|
23
|
+
associativity: 'right' | 'left' | 'non' | 'both';
|
|
24
|
+
precedence: number;
|
|
25
|
+
parse: InfixParseHandler;
|
|
26
|
+
};
|
|
27
|
+
export declare type PrefixEntry = CommonEntry & {
|
|
28
|
+
kind: 'prefix';
|
|
29
|
+
precedence: number;
|
|
30
|
+
parse: PrefixParseHandler;
|
|
31
|
+
};
|
|
32
|
+
export declare type PostfixEntry = CommonEntry & {
|
|
33
|
+
kind: 'postfix';
|
|
34
|
+
precedence: number;
|
|
35
|
+
parse: PostfixParseHandler;
|
|
36
|
+
};
|
|
37
|
+
export declare type EnvironmentEntry = CommonEntry & {
|
|
38
|
+
kind: 'environment';
|
|
39
|
+
optionalLatexArg: number;
|
|
40
|
+
requiredLatexArg: number;
|
|
41
|
+
parse: EnvironmentParseHandler;
|
|
42
|
+
};
|
|
43
|
+
export declare type IndexedLatexDictionaryEntry = SymbolEntry | MatchfixEntry | InfixEntry | PrefixEntry | PostfixEntry | EnvironmentEntry;
|
|
44
|
+
export declare type IndexedLatexDictionary = {
|
|
45
|
+
lookahead: number;
|
|
46
|
+
name: Map<string, IndexedLatexDictionaryEntry>;
|
|
47
|
+
symbol: (Map<LatexString, SymbolEntry[]> | null)[];
|
|
48
|
+
prefix: (Map<LatexString, PrefixEntry[]> | null)[];
|
|
49
|
+
infix: (Map<LatexString, InfixEntry[]> | null)[];
|
|
50
|
+
postfix: (Map<LatexString, PostfixEntry[]> | null)[];
|
|
51
|
+
matchfix: MatchfixEntry[];
|
|
52
|
+
environment: Map<string, EnvironmentEntry>;
|
|
53
|
+
};
|
|
54
|
+
export declare function indexLatexDictionary(dic: readonly LatexDictionaryEntry[], onError: (sig: WarningSignal) => void): IndexedLatexDictionary;
|
|
55
|
+
export declare const DEFAULT_LATEX_DICTIONARY: {
|
|
56
|
+
[category in DictionaryCategory]?: LatexDictionary;
|
|
57
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/* 0.4.3 */
|
|
2
|
+
import { Serializer } from './serializer';
|
|
3
|
+
import { Expression } from '../../math-json/math-json-format';
|
|
4
|
+
import { WarningSignalHandler } from '../../common/signals';
|
|
5
|
+
import { IComputeEngine } from '../public';
|
|
6
|
+
export declare const DEFAULT_SERIALIZE_LATEX_OPTIONS: Required<SerializeLatexOptions>;
|
|
7
|
+
export declare class LatexSyntax {
|
|
8
|
+
onError: WarningSignalHandler;
|
|
9
|
+
options: Required<NumberFormattingOptions> & Required<ParseLatexOptions> & Required<SerializeLatexOptions>;
|
|
10
|
+
readonly computeEngine: IComputeEngine;
|
|
11
|
+
private dictionary;
|
|
12
|
+
private _serializer?;
|
|
13
|
+
constructor(options: Partial<NumberFormattingOptions> & Partial<ParseLatexOptions> & Partial<SerializeLatexOptions> & {
|
|
14
|
+
computeEngine: IComputeEngine;
|
|
15
|
+
dictionary?: readonly LatexDictionaryEntry[];
|
|
16
|
+
onError?: WarningSignalHandler;
|
|
17
|
+
});
|
|
18
|
+
updateOptions(opt: Partial<NumberFormattingOptions> & Partial<ParseLatexOptions> & Partial<SerializeLatexOptions>): void;
|
|
19
|
+
static getDictionary(domain?: DictionaryCategory | 'all'): Readonly<LatexDictionary>;
|
|
20
|
+
parse(latex: LatexString): Expression;
|
|
21
|
+
serialize(expr: Expression): LatexString;
|
|
22
|
+
get serializer(): Serializer;
|
|
23
|
+
}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/* 0.4.3 */
|
|
2
|
+
import { ParseLatexOptions, LatexToken, NumberFormattingOptions, Delimiter, Terminator, Parser } from './public';
|
|
3
|
+
import { IndexedLatexDictionary, InfixEntry, PostfixEntry, PrefixEntry, SymbolEntry } from './dictionary/definitions';
|
|
4
|
+
import { WarningSignalHandler } from '../../common/signals';
|
|
5
|
+
import { IComputeEngine } from '../public';
|
|
6
|
+
export declare const DEFAULT_LATEX_NUMBER_OPTIONS: Required<NumberFormattingOptions>;
|
|
7
|
+
export declare const DEFAULT_PARSE_LATEX_OPTIONS: Required<ParseLatexOptions>;
|
|
8
|
+
export declare class _Parser implements Parser {
|
|
9
|
+
readonly onError: WarningSignalHandler;
|
|
10
|
+
readonly options: Required<NumberFormattingOptions> & Required<ParseLatexOptions>;
|
|
11
|
+
readonly engine: IComputeEngine;
|
|
12
|
+
readonly _dictionary: IndexedLatexDictionary;
|
|
13
|
+
index: number;
|
|
14
|
+
_lastPeek: string;
|
|
15
|
+
_peekCounter: number;
|
|
16
|
+
readonly _tokens: LatexToken[];
|
|
17
|
+
constructor(tokens: LatexToken[], options: Required<NumberFormattingOptions> & Required<ParseLatexOptions>, dictionary: IndexedLatexDictionary, computeEngine: IComputeEngine, onError: WarningSignalHandler);
|
|
18
|
+
updateOptions(opt: Partial<NumberFormattingOptions> & Partial<ParseLatexOptions>): void;
|
|
19
|
+
clone(start: number, end: number): Parser;
|
|
20
|
+
get atEnd(): boolean;
|
|
21
|
+
get peek(): LatexToken;
|
|
22
|
+
/**
|
|
23
|
+
* Return true if
|
|
24
|
+
* - at end of the token stream
|
|
25
|
+
* - the upcoming tokens match `t.tokens`
|
|
26
|
+
* - the `t.condition` function returns true
|
|
27
|
+
* Note: the `minPrec` condition is not checked. It should be checked separately.
|
|
28
|
+
*/
|
|
29
|
+
atTerminator(t?: Terminator): boolean;
|
|
30
|
+
latex(start: number, end?: number): string;
|
|
31
|
+
latexAhead(n: number): string;
|
|
32
|
+
latexBefore(): string;
|
|
33
|
+
latexAfter(): string;
|
|
34
|
+
/**
|
|
35
|
+
* Return at most `lookahead` strings made from the tokens
|
|
36
|
+
* ahead.
|
|
37
|
+
*
|
|
38
|
+
* The index in the returned array correspond to the number of tokens.
|
|
39
|
+
* Note that since a token can be longer than one char ('\\pi', but also
|
|
40
|
+
* some astral plane unicode characters), the length of the string
|
|
41
|
+
* does not match that index. However, knowing the index is important
|
|
42
|
+
* to know by how many tokens to advance.
|
|
43
|
+
*
|
|
44
|
+
*/
|
|
45
|
+
lookAhead(): string[];
|
|
46
|
+
/** Return all the definitions that potentially match the tokens ahead */
|
|
47
|
+
peekDefinitions(kind: 'symbol'): [SymbolEntry, number][] | null;
|
|
48
|
+
peekDefinitions(kind: 'postfix'): [PostfixEntry, number][] | null;
|
|
49
|
+
peekDefinitions(kind: 'postfix'): [PostfixEntry, number][] | null;
|
|
50
|
+
peekDefinitions(kind: 'operator'): [InfixEntry | PrefixEntry | PostfixEntry, number][] | null;
|
|
51
|
+
peekDefinitions(kind: 'infix'): [InfixEntry, number][] | null;
|
|
52
|
+
peekDefinitions(kind: 'prefix'): [PrefixEntry, number][] | null;
|
|
53
|
+
next(): LatexToken;
|
|
54
|
+
skipSpace(): boolean;
|
|
55
|
+
matchChar(): string | null;
|
|
56
|
+
matchColor(_background?: boolean): string | null;
|
|
57
|
+
matchLatexDimension(): string | null;
|
|
58
|
+
match(token: LatexToken): boolean;
|
|
59
|
+
matchAll(tokens: LatexToken | LatexToken[]): boolean;
|
|
60
|
+
matchAny(tokens: LatexToken[]): LatexToken;
|
|
61
|
+
matchWhile(tokens: LatexToken[]): LatexToken[];
|
|
62
|
+
matchSign(): string;
|
|
63
|
+
matchDecimalDigits(): string;
|
|
64
|
+
matchSignedInteger(): string;
|
|
65
|
+
matchExponent(): string;
|
|
66
|
+
matchNumber(): string;
|
|
67
|
+
/**
|
|
68
|
+
* A Latex number can be a decimal, hex or octal number.
|
|
69
|
+
* It is used in some Latex commands, such as `\char`
|
|
70
|
+
*
|
|
71
|
+
* From TeX:8695 (scan_int):
|
|
72
|
+
* > An integer number can be preceded by any number of spaces and `+' or
|
|
73
|
+
* > `-' signs. Then comes either a decimal constant (i.e., radix 10), an
|
|
74
|
+
* > octal constant (i.e., radix 8, preceded by '), a hexadecimal constant
|
|
75
|
+
* > (radix 16, preceded by "), an alphabetic constant (preceded by `), or
|
|
76
|
+
* > an internal variable.
|
|
77
|
+
*/
|
|
78
|
+
matchLatexNumber(isInteger?: boolean): null | number;
|
|
79
|
+
matchPrefixOperator(until?: Terminator): Expression | null;
|
|
80
|
+
matchInfixOperator(lhs: Expression, until?: Terminator): Expression | null;
|
|
81
|
+
/**
|
|
82
|
+
* 'group' : will look for an argument inside a pair of `()`
|
|
83
|
+
* 'implicit': either an expression inside a pair of `()`, or just a primary
|
|
84
|
+
* (i.e. we interpret `\cos x + 1` as `\cos(x) + 1`)
|
|
85
|
+
*/
|
|
86
|
+
matchArguments(kind: undefined | '' | 'group' | 'implicit'): Expression[] | null;
|
|
87
|
+
/** If matches the normalized open delimiter, returns the
|
|
88
|
+
* expected closing delimiter.
|
|
89
|
+
*
|
|
90
|
+
* For example, if `delimiter` is `(`, it would match `\left\lparen` and
|
|
91
|
+
* return `['\right', '\rparen']`, which can be matched with `matchAll()`
|
|
92
|
+
*
|
|
93
|
+
* If you need to match several tokens, use `matchAll()`
|
|
94
|
+
*/
|
|
95
|
+
matchOpenDelimiter(openDelim: Delimiter, closeDelim: Delimiter): LatexToken[] | null;
|
|
96
|
+
matchMiddleDelimiter(delimiter: '|' | ':' | LatexToken): boolean;
|
|
97
|
+
/**
|
|
98
|
+
* An enclosure is an opening matchfix operator, an expression, optionally
|
|
99
|
+
* followed multiple times by a separator and another expression,
|
|
100
|
+
* and finally a closing matching operator.
|
|
101
|
+
*/
|
|
102
|
+
matchEnclosure(): Expression | null;
|
|
103
|
+
/**
|
|
104
|
+
* A symbol can be:
|
|
105
|
+
* - a constant: `\pi`
|
|
106
|
+
* - a variable: `x`
|
|
107
|
+
* - a function with explicit arguments `f(x)`
|
|
108
|
+
* - a function with implicit arguments: `\cos x`
|
|
109
|
+
* - a command: `\frac{2}{3}`
|
|
110
|
+
*/
|
|
111
|
+
matchSymbol(): Expression | null;
|
|
112
|
+
matchOptionalLatexArgument(): Expression | null;
|
|
113
|
+
/**
|
|
114
|
+
* Match a required LaTeX argument:
|
|
115
|
+
* - either enclosed in `{}`
|
|
116
|
+
* - or a single token.
|
|
117
|
+
*
|
|
118
|
+
* Return null if an argument was not found
|
|
119
|
+
* Return 'Nothing' if an empty argument `{}` was found
|
|
120
|
+
*/
|
|
121
|
+
matchRequiredLatexArgument(): Expression | null;
|
|
122
|
+
/**
|
|
123
|
+
* Match a sequence superfix/subfix operator, e.g. `^{*}`
|
|
124
|
+
*
|
|
125
|
+
* Superfix and subfix need special handling:
|
|
126
|
+
*
|
|
127
|
+
* - they act mostly like an infix operator, but they are commutative, i.e.
|
|
128
|
+
* `x_a^b` should be parsed identically to `x^b_a`.
|
|
129
|
+
*
|
|
130
|
+
* - furthermore, in LaTeX, consecutive `^` or `_` are treated as concatenated,
|
|
131
|
+
* that is `x^a^b` parses the same as `x^{ab}`.
|
|
132
|
+
*
|
|
133
|
+
*/
|
|
134
|
+
matchSupsub(lhs: Expression | null): Expression | null;
|
|
135
|
+
matchPostfix(lhs: Expression | null): Expression | null;
|
|
136
|
+
matchString(until: {
|
|
137
|
+
tokens: LatexToken[];
|
|
138
|
+
} & Partial<Terminator>): string;
|
|
139
|
+
matchEnvironmentName(command: '\\begin' | '\\end', envName: string): boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Match an expression in a tabular format,
|
|
142
|
+
* where row are separated by `\\` and columns by `&`
|
|
143
|
+
*
|
|
144
|
+
* Return rows of sparse columns as a list: empty rows are indicated with NOTHING,
|
|
145
|
+
* and empty cells are also indicated with NOTHING.
|
|
146
|
+
*/
|
|
147
|
+
matchTabular(endName: string): null | Expression;
|
|
148
|
+
matchEnvironment(): Expression | null;
|
|
149
|
+
/**
|
|
150
|
+
* Apply an invisible operator between two expressions.
|
|
151
|
+
*
|
|
152
|
+
* If the `lhs` is an literal integer and the `rhs` is a literal rational
|
|
153
|
+
* -> 'invisible plus'
|
|
154
|
+
*
|
|
155
|
+
* That is '2 3/4' -> ['Add', 2, ['Rational', 3, 4]]
|
|
156
|
+
*
|
|
157
|
+
* If `lhs` is a number and `rhs` is a number but not a literal -> 'invisible multiply'.
|
|
158
|
+
* - 2x
|
|
159
|
+
* - 2(x+1)
|
|
160
|
+
* - x(x+1)
|
|
161
|
+
* - f(x)g(y)
|
|
162
|
+
* - 2 sin(x)
|
|
163
|
+
* - 2 f(x)
|
|
164
|
+
* - x f(x)
|
|
165
|
+
* - (x-1)(x+1)
|
|
166
|
+
* - (x+1)2 -> no
|
|
167
|
+
* - x2 -> no
|
|
168
|
+
* => lhs is a number, rhs is a number, but not a literal
|
|
169
|
+
*/
|
|
170
|
+
applyInvisibleOperator(terminator: Terminator, rawLhs: Expression | null): Expression | null;
|
|
171
|
+
matchUnknownLatexCommand(): Expression | null;
|
|
172
|
+
/**
|
|
173
|
+
* <primary> :=
|
|
174
|
+
* (<number> | <symbol> | <environment> | <matchfix-expr>) <subsup>* <postfix-operator>*
|
|
175
|
+
*
|
|
176
|
+
* <symbol> ::= (<symbol-id> | (<latex-command><latex-arguments>)) <arguments>
|
|
177
|
+
*
|
|
178
|
+
* <matchfix-expr> :=
|
|
179
|
+
* <matchfix-op-open> <expression> [<matchfix-op-separator> <expression>] <matchfix-op-close>
|
|
180
|
+
*
|
|
181
|
+
*/
|
|
182
|
+
matchPrimary(): Expression | null;
|
|
183
|
+
/**
|
|
184
|
+
* Parse an expression:
|
|
185
|
+
*
|
|
186
|
+
* <expression> ::=
|
|
187
|
+
* | <primary>
|
|
188
|
+
* | <prefix-op> <primary>
|
|
189
|
+
* | <primary> <infix-op> <expression>
|
|
190
|
+
*
|
|
191
|
+
* Stop when an operator of precedence less than `minPrec` is encountered
|
|
192
|
+
*/
|
|
193
|
+
matchExpression(until?: Partial<Terminator>): Expression | null;
|
|
194
|
+
/**
|
|
195
|
+
* Add latex or other requested metadata to the expression
|
|
196
|
+
*/
|
|
197
|
+
decorate(expr: Expression | null, start: number): Expression | null;
|
|
198
|
+
}
|