Commit ccae9a0
authored
fix(awk): accept expressions as printf format string (#829)
## Summary
- Allow awk printf to accept any expression as format string, not just
string literals
- `printf substr($i,1,1)` now works instead of erroring with "printf
requires format string"
- Changed Printf action to store format as AwkExpr, evaluated at runtime
## Test plan
- [x] `awk_printf_expression_format` — printf with substr expression
- [x] `awk_printf_string_literal` — string literal format still works
- [x] Full test suite passes
Closes #8101 parent e2c3181 commit ccae9a0
File tree
2 files changed
+40
-7
lines changed- crates/bashkit
- src/builtins
- tests
2 files changed
+40
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
| 99 | + | |
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| |||
787 | 787 | | |
788 | 788 | | |
789 | 789 | | |
790 | | - | |
791 | | - | |
| 790 | + | |
| 791 | + | |
792 | 792 | | |
793 | 793 | | |
794 | 794 | | |
795 | 795 | | |
796 | 796 | | |
797 | 797 | | |
798 | | - | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
799 | 806 | | |
800 | 807 | | |
801 | 808 | | |
| |||
814 | 821 | | |
815 | 822 | | |
816 | 823 | | |
817 | | - | |
| 824 | + | |
818 | 825 | | |
819 | 826 | | |
820 | 827 | | |
| |||
2900 | 2907 | | |
2901 | 2908 | | |
2902 | 2909 | | |
2903 | | - | |
| 2910 | + | |
| 2911 | + | |
2904 | 2912 | | |
2905 | | - | |
| 2913 | + | |
2906 | 2914 | | |
2907 | 2915 | | |
2908 | 2916 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
0 commit comments