The arguments of `Name(a, "b", c)`: up to DG_ARGS_MAX, quotes dropped. */
| 965 | |
| 966 | /* The arguments of `Name(a, "b", c)`: up to DG_ARGS_MAX, quotes dropped. */ |
| 967 | static int dg_args(dg_str_t s, dg_str_t *args) { |
| 968 | const char *open = memchr(s.p, '(', s.n); |
| 969 | if (!open) { |
| 970 | return 0; |
| 971 | } |
| 972 | int n = 0; |
| 973 | bool quoted = false; |
| 974 | const char *start = open + SKIP_ONE; |
| 975 | for (const char *p = start; p < s.p + s.n && n < DG_ARGS_MAX; p++) { |
| 976 | quoted = *p == '"' ? !quoted : quoted; |
| 977 | if (!quoted && (*p == ',' || *p == ')')) { |
| 978 | args[n++] = dg_unquote(dg_s(start, (size_t)(p - start))); |
| 979 | start = p + SKIP_ONE; |
| 980 | if (*p == ')') { |
| 981 | break; |
| 982 | } |
| 983 | } |
| 984 | } |
| 985 | return n; |
| 986 | } |
| 987 | |
| 988 | /* A C4 macro line `Person(id, "Label", ...)` or `Rel(a, b, "label")`: false |
| 989 | * when the line is none. */ |
no test coverage detected