mathup
Version:
Easy MathML authoring tool with a quick to write syntax
33 lines (28 loc) • 579 B
JavaScript
/** @type {import("./index.js").Scanner} */
export default function groupSepScanner(
_char,
input,
{ grouping, start },
{ colSep, rowSep },
) {
if (!grouping) {
return null;
}
const colSepEnd = start + colSep.length;
const rowSepEnd = start + rowSep.length;
if (input.slice(start, rowSepEnd) === rowSep) {
return {
type: "sep.row",
value: rowSep,
end: rowSepEnd,
};
}
if (input.slice(start, colSepEnd) === colSep) {
return {
type: "sep.col",
value: colSep,
end: colSepEnd,
};
}
return null;
}