mirror of
https://github.com/borbann-platform/end-of-semester-report.git
synced 2025-12-19 06:44:03 +01:00
28 lines
985 B
JavaScript
28 lines
985 B
JavaScript
import { match } from "@unified-latex/unified-latex-util-match";
|
|
import { decorateArrayForPegjs, AlignEnvironmentPegParser } from "@unified-latex/unified-latex-util-pegjs";
|
|
function createMatchers(rowSepMacros, colSep) {
|
|
const isRowSep = match.createMacroMatcher(rowSepMacros);
|
|
return {
|
|
isRowSep,
|
|
isColSep: (node) => colSep.some((sep) => match.string(node, sep)),
|
|
isWhitespace: (node) => match.whitespace(node),
|
|
isSameLineComment: (node) => match.comment(node) && node.sameline,
|
|
isOwnLineComment: (node) => match.comment(node) && !node.sameline
|
|
};
|
|
}
|
|
function parseAlignEnvironment(ast, colSep = ["&"], rowSepMacros = ["\\", "hline", "cr"]) {
|
|
if (!Array.isArray(ast)) {
|
|
throw new Error("You must pass an array of nodes");
|
|
}
|
|
ast = decorateArrayForPegjs([...ast]);
|
|
return AlignEnvironmentPegParser.parse(
|
|
ast,
|
|
createMatchers(rowSepMacros, colSep)
|
|
);
|
|
}
|
|
export {
|
|
createMatchers,
|
|
parseAlignEnvironment
|
|
};
|
|
//# sourceMappingURL=index.js.map
|