diff options
| author | Alexander Potapenko <glider@google.com> | 2026-03-10 11:54:01 +0100 |
|---|---|---|
| committer | Alexander Potapenko <glider@google.com> | 2026-03-10 14:52:26 +0000 |
| commit | 9eee85817edcc7ad7e20ffadf0e43e1ba748cb35 (patch) | |
| tree | d32dc6df8eb02f955741b1005da95558bac33a21 /docs/program_syntax.md | |
| parent | feb3353f0d285ba3b66261f9ec7abf2334008822 (diff) | |
prog: add support for decimal/octal arguments in text format
Previously, the parser only expected the '0' character to begin an integer
argument, which effectively meant it only handled hexadecimal formatting
(e.g., `0x...`) when parsing arguments.
This change modifies parseArgImpl() to route any starting digit ('0'-'9')
to the integer parsing logic. Since `strconv.ParseUint` already handles
base-10 parsing using the "0" base flag, this cleanly enables the parser
to natively deserialize decimal and octal arguments.
Diffstat (limited to 'docs/program_syntax.md')
| -rw-r--r-- | docs/program_syntax.md | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/docs/program_syntax.md b/docs/program_syntax.md index 12bea732a..79b0e779a 100644 --- a/docs/program_syntax.md +++ b/docs/program_syntax.md @@ -26,7 +26,7 @@ line = assignment | call assignment = variable " = " call call = syscall-name "(" [arg ["," arg]*] ")" ["(" [call-prop ["," call-prop*] ")"] arg = "nil" | "AUTO" | const-arg | resource-arg | result-arg | pointer-arg | string-arg | struct-arg | array-arg | union-arg -const-arg = "0x" hex-integer +const-arg = integer resource-arg = variable ["/" hex-integer] ["+" hex-integer] result-arg = "<" variable "=>" arg pointer-arg = "&" pointer-arg-addr ["=ANY"] "=" arg @@ -37,8 +37,9 @@ array-arg = "[" [arg ["," arg]*] "]" union-arg = "@" field-name ["=" arg] call-prop = prop-name ": " prop-value variable = "r" dec-integer -pointer-addr = hex-integer -region-size = hex-integer +pointer-addr = integer +region-size = integer +integer = dec-integer | oct-integer | "0x" hex-integer ``` Programs may also contain blank lines and comments. |
