Aaronontheweb / Aaronontheweb/ShellSyntaxTree

Extract shared native argument fragment classification

Đang mở
#69 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
C#
Star
15
Fork
0
Merge trung bình
9 phút
Pull request đã merge (30 ngày)
7

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

So sánh các lượt duyệt fragment đối số native của Bash và PowerShell được giới thiệu bởi PR #68, sau đó kiểm tra các trường hợp corpus adversarial của chúng đối với các giá trị được đặt trong dấu ngoặc kép, các chuỗi chạy tối đa, cú pháp hỗn hợp và phép chuyển đổi curl @. Chỉ trích xuất phân loại trung lập với shell, đồng thời tách riêng các bộ chuyển đổi token và hành vi của parser. Chạy dotnet build -c Release, dotnet test -c Release và xác minh header; được coi là hoàn tất khi toàn bộ hành vi hiện có vẫn xanh trên cả hai shell.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
bash, csharp, powershell
Lĩnh vực
tooling
Loại issue
Tái cấu trúc
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
48/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.