Aaronontheweb / Aaronontheweb/ShellSyntaxTree

Extract shared native argument fragment classification

Abierto
#69 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Lenguaje dominante
C#
Estrellas
15
Forks
0
Merge medio
9 min
PR fusionados (30 d)
7

Descripción

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.

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Compara los recorridos de fragmentos de argumentos nativos de Bash y PowerShell introducidos por PR #68 y, después, inspecciona sus casos de corpus adversariales para valores entre comillas, ejecuciones máximas, sintaxis mixta y la transformación de curl @. Extrae únicamente la clasificación neutral respecto al shell, manteniendo separados los adaptadores de tokens y el comportamiento del parser. Ejecuta dotnet build -c Release, dotnet test -c Release y la verificación de headers; se considera terminado cuando todo el comportamiento existente sigue pasando en ambos shells.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
bash, csharp, powershell
Área
tooling
Tipo de issue
Refactorización
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Tranquilo
Claridad
Bastante claro
Aptitud para principiantes
48/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.