Aaronontheweb / Aaronontheweb/ShellSyntaxTree
Extract shared native argument fragment classification
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 15
- Forks
- 0
- Avg merge
- 9m
- Merged PRs (30d)
- 7
Description
Problem
PR #68 added equivalent native-argument fragment walks to the Bash and PowerShell parsers. Both implementations now collect contiguous lexer fragments, preserve the complete raw span and decoded value, detect opaque fragments, and safe-fail resolver-sensitive mixed quoting. Keeping those rules duplicated creates a drift risk when another fragment shape or shell is added.
This is not a request for a shared lexer or parser core. Bash and PowerShell must retain their shell-specific tokenization, quoting, recursion, and command semantics.
Proposed scope
Extract an internal shell-neutral classification result for one native argument assembled from parser-owned lexer fragments. Each parser adapts its own tokens into the helper and remains responsible for consuming the resulting token range.
The shared result should carry:
- the complete authored source span and raw value;
- the combined decoded logical value;
- whether any fragment is opaque or computed;
- whether all value fragments are literal;
- whether mixed literal and expandable fragments contain resolver-sensitive syntax;
- the first index after the consumed fragment run.
Non-goals
- Unifying the Bash and PowerShell lexers.
- Building a shared parser base class.
- Changing the public AST or parser APIs.
- Weakening
DynamicSkipbehavior for ambiguous mixed quoting.
Acceptance criteria
- Bash and PowerShell use one internal fragment-classification implementation.
- Shell-specific token adapters remain small and explicit.
- Existing
Raw,Value, source-span, path, andDynamicSkipbehavior remains unchanged. - The PR #68 adversarial corpus cases for quoted values, maximal fragment runs, unquoted prefixes, mixed literal syntax, and curl
@transformation remain green in both shells. dotnet build -c Release,dotnet test -c Release, and header verification pass.
Extraction trigger
Do this before adding a third shell or another native fragment rule. Until then, the current duplication is correct but carries maintenance cost.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Compare the Bash and PowerShell native-argument fragment walks introduced by PR #68, then inspect their adversarial corpus cases for quoted values, maximal runs, mixed syntax, and curl @ transformation. Extract only the shell-neutral classification while keeping token adapters and parser behavior separate. Run dotnet build -c Release, dotnet test -c Release, and header verification; done means all existing behavior remains green in both shells.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bash, csharp, powershell
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100