Skip to content

Add functions for parsing and validating access paths#3218

Merged
koesie10 merged 1 commit intomainfrom
koesie10/parse-access-paths
Jan 11, 2024
Merged

Add functions for parsing and validating access paths#3218
koesie10 merged 1 commit intomainfrom
koesie10/parse-access-paths

Conversation

@koesie10
Copy link
Copy Markdown
Member

This adds functions for parsing and validating access paths (such as Argument[foo].Element.Field[foo.Bar.x]) to prepare for future functionality where we're going to be parsing and validating access paths. These functions are not yet used in this PR.

See the description of the access-paths.ts for the reasons for manually parsing the access path rather than simply splitting by . or using a regex.

Example result of parseAccessPathTokens (from the test):

Input: Argument[foo].Element.Field[foo.Bar.x]

Output:

[
  {
    "range": {
      "start": 0,
      "end": 13
    },
    "text": "Argument[foo]"
  },
  {
    "range": {
      "start": 14,
      "end": 21
    },
    "text": "Element"
  },
  {
    "range": {
      "start": 22,
      "end": 38
    },
    "text": "Field[foo.Bar.x]"
  }
]

Checklist

  • CHANGELOG.md has been updated to incorporate all user visible changes made by this pull request.
  • Issues have been created for any UI or other user-facing changes made by this pull request.
  • [Maintainers only] If this pull request makes user-facing changes that require documentation changes, open a corresponding docs pull request in the github/codeql repo and add the ready-for-doc-review label there.

This adds functions for parsing and validating access paths to prepare
for future functionality where we're going to be parsing and validating
access paths.
@koesie10 koesie10 marked this pull request as ready for review January 11, 2024 08:49
@koesie10 koesie10 requested a review from a team as a code owner January 11, 2024 08:49
Copy link
Copy Markdown
Contributor

@shati-patel shati-patel left a comment

Choose a reason for hiding this comment

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

Thanks for adding the tests and the clear descriptions! 👍🏽

@koesie10 koesie10 merged commit 519833e into main Jan 11, 2024
@koesie10 koesie10 deleted the koesie10/parse-access-paths branch January 11, 2024 12:34
@koesie10 koesie10 mentioned this pull request Jan 11, 2024
3 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.

2 participants