- if (!adefs[argi].name)
- parse_error("Command %s has no parameter %s", cdef->name, token.c_str());
- if (c->args.count(token))
- parse_error("Parameter %s given multiple times", token.c_str());
- t = next_token();
- if (t == TOK_EQUAL)
- has_value = true;
+ if (adefs[argi].name)
+ {
+ if (c->args.count(token))
+ err("Argument %s given multiple times", token.c_str());
+ t = next_token();
+ if (t == TOK_EQUAL)
+ has_value = true;
+ else
+ return_token();
+ saw_named = true;
+ }
+ else if (next_pos < num_args && (adefs[next_pos].type & AT_TYPE_MASK) == AT_STRING)
+ {
+ // Shortcut syntax: positional arguments of string type can be specified
+ // as bare identifiers if they do not collide with names or other arguments.
+ return_token();
+ argi = next_pos++;
+ has_value = true;
+ }