// Parsing arithmetic/logical/compare operator and some other // special cases explicit parse_t(char _op, parse_t arg1 = parse_t(), parse_t arg2 = parse_t(), parse_t arg3 = parse_t(), parse_t arg4 = parse_t(), parse_t arg5 = parse_t(), parse_t arg6 = parse_t()) : val(), args(), op(_op) { switch ( op ) { case 'l': // list: create new or append one argument if ( arg2.op=='~' ) { if ( arg1.op!='~' ) args.push_back(arg1); } else { args = arg1.args; args.push_back(arg2); } break; case 'I': // integer, float, string literal values case 'F': case 'S': val = arg1.val; break; case 'a': // variable assignment args.push_back(arg1); args.push_back(arg2); break; case 'v': // variable, read index from arg2 if present val = arg1.val; if ( arg2.op=='l' ) args = arg2.args; break; case '@': // Command with argument list in arg2 op = ' '; val = arg1.val; args = arg2.args; break; case 'U': // UNIQUE test, has argument list in arg1 args = arg1.args; break; case '?': // comparison operator as arg1 val = arg1.val; args.push_back(arg2); args.push_back(arg3); break; default: if ( arg1.op!='~' ) args.push_back(arg1); if ( arg2.op!='~' ) args.push_back(arg2); if ( arg3.op!='~' ) args.push_back(arg3); if ( arg4.op!='~' ) args.push_back(arg4); if ( arg5.op!='~' ) args.push_back(arg5); if ( arg6.op!='~' ) args.push_back(arg6); } }
// Parsing command with optional arguments explicit parse_t(val_t _val, parse_t arg1 = parse_t(), parse_t arg2 = parse_t(), parse_t arg3 = parse_t(), parse_t arg4 = parse_t(), parse_t arg5 = parse_t(), parse_t arg6 = parse_t()) : val(_val), args(), op(' ') { if ( arg1.op!='~' ) args.push_back(arg1); if ( arg2.op!='~' ) args.push_back(arg2); if ( arg3.op!='~' ) args.push_back(arg3); if ( arg4.op!='~' ) args.push_back(arg4); if ( arg5.op!='~' ) args.push_back(arg5); if ( arg6.op!='~' ) args.push_back(arg6); }
tms option_time(char* opt, char* dflt, char* descr) { return parse_t(option(opt, dflt, descr)); }