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

Collections need to support locations #2389

Open
KathleenDollard opened this issue Apr 20, 2024 · 0 comments
Open

Collections need to support locations #2389

KathleenDollard opened this issue Apr 20, 2024 · 0 comments
Assignees
Labels
Design Powderhouse Work to isolate parser and features

Comments

@KathleenDollard
Copy link
Contributor

The current structure of Location is:

   public string Text { get; }
   public string Source { get; }
   public int Index { get; }
   public int Offset { get; }
   public int Length { get; }
   public Location? OuterLocation { get; }

To support goals of errata and reporting where values came from, we are building in a location system. This is attached to ValueResult and CommandValueResult in the public API. This does not currently support collections.

In order to support a pattern were -x is an option that accepts a collection, we need to maintain a Location instance for each member of the collection:

mycommand -x One @mine.rsp Two

AFAIK, this is valid, and if the response file had three entries, there would be five values in the collection for the option.

Thus, the design is that ValueResult will hold a collection of Location.

Sidenotes:

  • Index was renamed from Start recently.
  • We plan to rename CommandValueResult, but do not want the disruption now of renaming CommandResult which is one of the alternate names.
  • For performance reasons, we may later set a flag to maintain locations only when requested or be able to turn them off. Also, the size is relatively small because the Text, Source, and Location will generally be references to existing instance.
@KathleenDollard KathleenDollard added Design Powderhouse Work to isolate parser and features labels Apr 20, 2024
@KathleenDollard KathleenDollard self-assigned this Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Design Powderhouse Work to isolate parser and features
Projects
None yet
Development

No branches or pull requests

1 participant