MCPcopy Create free account
hub / github.com/devflowinc/trieve / parseInlineExpression

Method parseInlineExpression

pdf2md/server/static/viewer.mjs:2666–2712  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2664 throw new SyntaxError("Unclosed placeable");
2665 }
2666 function parseInlineExpression() {
2667 if (source[cursor] === "{") {
2668 return parsePlaceable();
2669 }
2670 if (test(RE_REFERENCE)) {
2671 let [, sigil, name, attr = null] = match(RE_REFERENCE);
2672 if (sigil === "$") {
2673 return {
2674 type: "var",
2675 name
2676 };
2677 }
2678 if (consumeToken(TOKEN_PAREN_OPEN)) {
2679 let args = parseArguments();
2680 if (sigil === "-") {
2681 return {
2682 type: "term",
2683 name,
2684 attr,
2685 args
2686 };
2687 }
2688 if (RE_FUNCTION_NAME.test(name)) {
2689 return {
2690 type: "func",
2691 name,
2692 args
2693 };
2694 }
2695 throw new SyntaxError("Function names must be all upper-case");
2696 }
2697 if (sigil === "-") {
2698 return {
2699 type: "term",
2700 name,
2701 attr,
2702 args: []
2703 };
2704 }
2705 return {
2706 type: "mesg",
2707 name,
2708 attr
2709 };
2710 }
2711 return parseLiteral();
2712 }
2713 function parseArguments() {
2714 let args = [];
2715 while (true) {

Callers

nothing calls this directly

Calls 3

testFunction · 0.85
testMethod · 0.80
matchFunction · 0.70

Tested by

no test coverage detected