[codex] Implement awk Phase 3#241
Conversation
|
@codex please review this PR. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 95e160ef48
ℹ️ 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".
|
@codex please review this PR again after |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4d85c8b83e
ℹ️ 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".
|
@codex please review this PR again after |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8ac0c5a909
ℹ️ 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".
|
@codex please review this PR again after |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 09a78ff1bc
ℹ️ 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".
| if !p.match(tokLParen) { | ||
| return nil, fmt.Errorf("expected ( after for") | ||
| } | ||
| p.skipSeparators() |
There was a problem hiding this comment.
Preserve empty for-loop initializers
For C-style loops that intentionally omit the initializer, such as BEGIN { i=0; for (; i<3; i++) print i }, this skips the structural semicolon immediately after (, so parseOptionalForExpr parses the condition as the initializer and the parser then fails with expected ; in for loop. GNU awk accepts this form, and it is a common way to express loops with initialization done earlier; this should skip newlines only, not semicolons, before deciding whether the initializer is empty.
Useful? React with 👍 / 👎.
Summary
Implements awk Phase 3 on top of
codex/awk-phase-2, expanding the builtin from basic array element support into a more practical awk profile.in,delete,for (k in array), andsplitfor,while,break, andcontinue/start/,/end/FS, including-Fand runtimeFS = value$0rebuilds,$0 = valueresplitting, andNF = valueENVIRONfrom rshell's shell-visible environment snapshotValidation
make fmtgo test ./builtins/awk ./builtins/tests/awk ./analysisgo test ./tests -run 'TestShellScenarios/.*/cmd/awk/'RSHELL_BASH_TEST=1 go test ./tests/ -run TestShellScenariosAgainstBash -timeout 120sgo test ./...make buildRSHELL_BIN=./rshell AWK_UNDER_TEST=tools/awk-harness/rshell-awk GAWK_TEST_FILTER=opasnidx tools/awk-harness/run.sh gawkRSHELL_BIN=./rshell AWK_UNDER_TEST=tools/awk-harness/rshell-awk GAWK_TEST_FILTER=assignnumfield tools/awk-harness/run.sh gawkRSHELL_BIN=./rshell AWK_UNDER_TEST=tools/awk-harness/rshell-awk GAWK_TEST_FILTER=splitwht tools/awk-harness/run.sh gawkNote: the
splitwhtfocused harness run passes the supported whitespace split case and still failssplitwht2, which uses GNU typed regexp syntax (@/.../) outside the rshell awk profile.