Mark issues #02 (backtick lexing/parsing), #03 (command execution runtime), and #04 (argv parsing) as resolved. Add new issues for configuration (#08), programmable prompt (#09), and interactive command execution (#10).
910 B
910 B
04 — Implement argv parsing (tokenize command strings)
Status: resolved Blocked by: #01 Blocks: #06
Since we're not using a shell, we need our own command-line tokenizer to split a command string into argv[].
Must handle
- Simple whitespace splitting:
ls -l /tmp→["ls", "-l", "/tmp"] - Single-quoted strings:
echo 'hello world'→["echo", "hello world"] - Double-quoted strings with escapes:
echo "hello \"world\"" - Backslash escaping outside quotes:
echo hello\ world - Mixed quoting:
echo "it's a test"
May handle (depending on #01 decisions)
- Variable/expression interpolation:
echo $HOMEorecho ${dir} - Glob expansion:
ls *.lua(could also defer to a later issue)
Implementation
- Standalone C module, likely
lcmd_parse.cor part oflcmd.c - Returns a
char **argv(NULL-terminated) + argc count - Must handle memory allocation/cleanup