Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Context extraction #43

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Context extraction #43

wants to merge 4 commits into from

Conversation

nikku
Copy link
Owner

@nikku nikku commented Oct 18, 2024

Which issue does this PR address?

This PR attempts to recognize the special context(entries) function, creating a context from a list of entries:

Closes #40


Some uses of context attached that are not recognized today, but would be on proper context extraction:

context([
  { key: "b+", value: { c-: 1} }
]).b+.c-
{
  entries: [
    {
      "key": "a + b",
      "value": 1
    },
    {
      "key": "b--",
      "value": 2
    }
  ],
  ctx: context(entries),
  value: ctx.a + b + ctx.b--
}
{
  dynamicEntry: {
    "key": "a + b",
    "value": {
      d-e: 1000
    }
  },
  entries: [
    dynamicEntry
  ],
  ctx: context(entries),
  value: ctx.a+b.d-e
}
{
  dynamicKey: "a + b",
  dynamicValue: {
    d-e: 1000
  },
  entries: [
    {
      "key": dynamicKey,
      "value": dynamicValue
    }
  ],
  ctx: context(entries),
  value: ctx.a + b.d-e
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

context() built-in is not properly handled
1 participant