Skip to content

shell/syntax: add typed parser error context - #792

Merged
ewhauser merged 3 commits into
mainfrom
ewhauser/parser-typed-error-context
Mar 30, 2026
Merged

ewhauser merged 3 commits into
mainfrom
ewhauser/parser-typed-error-context

Conversation

@ewhauser

Copy link
Copy Markdown
Owner

Summary

  • add internal typed parse-error context for malformed function openers, stray ]], and empty [[ ... ]] failures
  • route the relevant parser call sites through shared helpers instead of relying on bash formatting to infer intent from raw text alone
  • add parser coverage for both the typed context and the preserved bash-compatible diagnostics

Why

A few malformed parser cases still only carried message text, which forced BashError() compatibility to special-case strings instead of using structured context from the originating parser branch.

Impact

This keeps successful parsing unchanged, preserves existing raw ParseError.Text strings, and makes bash-style formatting for these malformed cases depend on typed parser context rather than brittle text matching.

Validation

  • go test ./shell/syntax -run 'TestParseError(BashErrorParseCompatibility|BashErrorConditionalDiagnostics|TypedContext)$'
  • go test ./shell/syntax -run 'TestParseErr$'
  • go test ./shell/syntax
  • go test ./internal/shell/interp -run 'TestDbracketParseErrorAbortsScript$'
  • make lint

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 75098b9f7e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread shell/syntax/parser.go Resolved
@ewhauser
ewhauser force-pushed the ewhauser/parser-typed-error-context branch from 75098b9 to 503e35b Compare March 30, 2026 03:02

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 503e35bad8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread shell/syntax/parser.go Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4412c1b9bd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread shell/syntax/parser.go Resolved
@ewhauser
ewhauser merged commit 0d5523f into main Mar 30, 2026
16 checks passed
@ewhauser
ewhauser deleted the ewhauser/parser-typed-error-context branch March 30, 2026 03:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant