Skip to content

Commit cca7068

Browse files
committed
arch(DX) parse type
1 parent 8f9de6e commit cca7068

File tree

4 files changed

+233
-253
lines changed

4 files changed

+233
-253
lines changed

src/compute-engine/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,6 +1380,14 @@ export class ComputeEngine implements IComputeEngine {
13801380
* Uses the engine's symbol definitions for accurate parsing
13811381
* (e.g., recognizing `f` as a function).
13821382
*/
1383+
parse(
1384+
latex: string,
1385+
options?: Partial<ParseLatexOptions> & { form?: FormOption }
1386+
): Expression;
1387+
parse(
1388+
latex: string | null,
1389+
options?: Partial<ParseLatexOptions> & { form?: FormOption }
1390+
): Expression | null;
13831391
parse(
13841392
latex: string | null,
13851393
options?: Partial<ParseLatexOptions> & { form?: FormOption }

src/compute-engine/types-engine.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,10 @@ export interface IComputeEngine {
185185
* This is a convenience method equivalent to `ce.expr(parse(latex))`,
186186
* but uses the engine's symbol definitions for better parsing accuracy.
187187
*/
188+
parse(
189+
latex: string,
190+
options?: Partial<ParseLatexOptions> & { form?: FormOption }
191+
): Expression;
188192
parse(
189193
latex: string | null,
190194
options?: Partial<ParseLatexOptions> & { form?: FormOption }

test/compute-engine/latex-syntax/parsing.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ describe('NON-STRICT MODE (Math-ASCII/Typst-like syntax)', () => {
568568
});
569569

570570
test('sin^2(x) + cos^2(x) identity', () => {
571-
const a = ce.parse('sin^2(x) + cos^2(x)', { strict: false });
571+
const a = ce.parse('sin^2(x) + cos^2(x)', { strict: false })!;
572572
expect(a.isEqual(1)).toBe(true);
573573
});
574574
});

0 commit comments

Comments
 (0)