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

fix: properly lex imports in OPL #1041

Merged
merged 1 commit into from
Sep 30, 2022
Merged

fix: properly lex imports in OPL #1041

merged 1 commit into from
Sep 30, 2022

Conversation

hperl
Copy link
Collaborator

@hperl hperl commented Sep 29, 2022

Related issue(s)

Closes #1040

Checklist

  • I have read the contributing guidelines.
  • I have referenced an issue containing the design document if my change
    introduces a new feature.
  • I am following the
    contributing code guidelines.
  • I have read the security policy.
  • I confirm that this pull request does not address a security
    vulnerability. If this pull request addresses a security vulnerability, I
    confirm that I got the approval (please contact
    [email protected]) from the maintainers to push
    the changes.
  • I have added tests that prove my fix is effective or that my feature
    works.
  • I have added or changed the documentation.

Further Comments

@hperl hperl requested a review from zepatrik as a code owner September 29, 2022 12:08
@hperl hperl self-assigned this Sep 29, 2022
Copy link
Member

@zepatrik zepatrik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So are imports now considered string literals, but their value is not used? Don't really understand how this works now 😅

internal/schema/lexer.go Outdated Show resolved Hide resolved
@hperl
Copy link
Collaborator Author

hperl commented Sep 30, 2022

So are imports now considered string literals, but their value is not used? Don't really understand how this works now sweat_smile

In the lexing phase, we just want to generate a token stream from the input. So import { Foo, Bar, Baz } from '@ory/keto-namespace-types' becomes this:

[
  "'import'",
  "{",
  "'Foo'",
  ",",
  "'Bar'",
  ",",
  "'Baz'",
  "}",
  "'from'",
  "'@ory/keto-...'",
  "EOF"
]

In the parsing phase, this stream will be complete ignored because we just skip until we find a class keyword.

@hperl hperl requested a review from zepatrik September 30, 2022 11:24
@zepatrik zepatrik merged commit 26944e9 into master Sep 30, 2022
@zepatrik zepatrik deleted the opl-lex-import branch September 30, 2022 12:08
@EvanBarbour3 EvanBarbour3 mentioned this pull request Oct 4, 2022
6 tasks
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.

Ory Permission Language files need not to have imports to @ory/keto-namespace-types
2 participants