Aaronontheweb / Aaronontheweb/ShellSyntaxTree

Extract shared native argument fragment classification

Offen
#69 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
C#
Sterne
15
Forks
0
Ø Merge
9 Min.
Gemergte PRs (30 T.)
7

Beschreibung

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 DynamicSkip behavior 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, and DynamicSkip behavior 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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Vergleiche die von PR #68 eingeführten Native-Argument-Fragmentdurchläufe von Bash und PowerShell und untersuche anschließend ihre adversarialen Korpusfälle für quotierte Werte, maximale Läufe, gemischte Syntax und die curl @-Transformation. Extrahiere ausschließlich die Shell-neutrale Klassifizierung und halte Token-Adapter und Parserverhalten getrennt. Führe dotnet build -c Release, dotnet test -c Release und die Header-Verifizierung aus; als abgeschlossen gilt die Aufgabe, wenn das gesamte bestehende Verhalten in beiden Shells weiterhin grün ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
bash, csharp, powershell
Bereich
tooling
Issue-Typ
Refactoring
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Ruhig
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
48/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.