@1771technologies/lytenyte-pro
Version:
Blazingly fast headless React data grid with 100s of features.
27 lines (26 loc) • 943 B
JavaScript
import { current, advance, expect } from "./parser-context.js";
import { parsePrimary } from "./parse-primary.js";
import { parseExpression } from "./parse-expression.js";
export function parsePipeTransform(ctx) {
let node = parsePrimary(ctx);
if (current(ctx).type === "Punctuation" && current(ctx).value === "(") {
advance(ctx);
const args = [];
while (!(current(ctx).type === "Punctuation" && current(ctx).value === ")")) {
if (args.length > 0)
expect(ctx, "Punctuation", ",");
if (current(ctx).type === "Punctuation" && current(ctx).value === ")")
break;
args.push(parseExpression(ctx, 0));
}
const end = expect(ctx, "Punctuation", ")").end;
node = {
type: "CallExpression",
callee: node,
args,
start: node.start,
end,
};
}
return node;
}