Replace the }` heuristic in inject.sh with a brace-depth counter:
start at depth=1 after the opening {, increment on {, decrement on },
stop when depth reaches 0. This correctly handles nested if/else blocks,
loops, and structs that close at 4-space indent inside calculateParams.
Also emit a non-zero exit with a descriptive message if EOF is reached
without finding the matching closing brace.
Add test_inject_extraction.sh covering simple bodies, nested if/else,
multi-level nesting, and the EOF-without-match error case.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
17 lines
406 B
JSON
17 lines
406 B
JSON
{
|
|
"name": "push3-transpiler",
|
|
"version": "1.0.0",
|
|
"description": "Push3 to Solidity transpiler for OptimizerV3",
|
|
"main": "dist/index.js",
|
|
"scripts": {
|
|
"build": "tsc",
|
|
"transpile": "ts-node src/index.ts",
|
|
"test": "bash test_inject_extraction.sh"
|
|
},
|
|
"dependencies": {},
|
|
"devDependencies": {
|
|
"typescript": "^5.0.0",
|
|
"ts-node": "^10.0.0",
|
|
"@types/node": "^20.0.0"
|
|
}
|
|
}
|