25 : mtasklist(tasklist),
26 ws(tasklist.workspace()),
27 mcfile(
std::move(controlfile)),
29 verbosity(rverbosity) {
58 <<
"Mixing positional and named arguments is not allowed.";
68 named_args.push_back(current_argument);
79 Index bracket_level = 0;
80 bool inside_quotes =
false;
85 while ((bracket_level || inside_quotes) ||
94 if (bracket_level < 0)
101 if (prev_char !=
'\\') inside_quotes = !inside_quotes;
110 }
catch (
const Eot& x) {
113 "Unexpectedly reached end of file.\nProbably a runaway argument.",
123 }
catch (
const Eot& x) {
145 os <<
"Expected ',' or ')' but found '" <<
msource.
Current() <<
"' after "
159 for (arg_index = 0; arg_index < (Index)named_args.size(); arg_index++) {
160 if (named_args[(
size_t)arg_index].name == name)
return;
190 out3 <<
"\nParsing control text:\n";
204 if (
"Arts" != md_data[
id].Name() &&
"Arts2" != md_data[
id].Name()) {
206 os <<
"The outermost agenda must be Arts2!\n"
207 <<
"(But it seems to be " << md_data[id].Name() <<
".)\n";
217 }
catch (
const Eot&) {
222 os <<
"Unexpected character(s) at the end of the control file\n";
223 os <<
"after the main agenda was already closed.\n";
224 os <<
"File: " << x.
file() <<
'\n';
225 os <<
"Line: " << x.
line() <<
'\n';
226 os <<
"Column: " << x.
column() <<
'\n';
227 throw runtime_error(os.str());
229 }
catch (
const Eot& x) {
232 os <<
"Unexpected end of control script.\n";
233 os <<
"File: " << x.
file() <<
'\n';
234 os <<
"Line: " << x.
line() <<
'\n';
235 throw runtime_error(os.str());
239 os <<
"Unexpected character:\n";
240 os << x.what() <<
'\n';
241 os <<
"File: " << x.
file() <<
'\n';
242 os <<
"Line: " << x.
line() <<
'\n';
243 os <<
"Column: " << x.
column() <<
'\n';
244 throw runtime_error(os.str());
248 os <<
"Illegal Line break:\n";
249 os << x.what() <<
'\n';
250 os <<
"File: " << x.
file() <<
'\n';
251 os <<
"Line: " << x.
line() <<
'\n';
252 throw runtime_error(os.str());
258 os <<
"Unknown Method:\n";
259 os << x.what() <<
'\n';
260 os <<
"File: " << x.
file() <<
'\n';
261 os <<
"Line: " << x.
line() <<
'\n';
262 os <<
"Column: " << x.
column() <<
'\n';
263 throw runtime_error(os.str());
269 os <<
"Unknown workspace variable:\n";
270 os << x.what() <<
'\n';
271 os <<
"File: " << x.
file() <<
'\n';
272 os <<
"Line: " << x.
line() <<
'\n';
273 os <<
"Column: " << x.
column() <<
'\n';
274 throw runtime_error(os.str());
278 os <<
"Attempt to create a workspace variable that already exists:\n";
279 os << x.what() <<
'\n';
280 os <<
"File: " << x.
file() <<
'\n';
281 os <<
"Line: " << x.
line() <<
'\n';
282 os <<
"Column: " << x.
column() <<
'\n';
283 throw runtime_error(os.str());
289 os <<
"Workspace variable belongs to the wrong group:\n";
290 os << x.what() <<
'\n';
291 os <<
"File: " << x.
file() <<
'\n';
292 os <<
"Line: " << x.
line() <<
'\n';
293 os <<
"Column: " << x.
column() <<
'\n';
294 throw runtime_error(os.str());
298 os <<
"Parse error:\n";
299 os << x.what() <<
'\n';
300 os <<
"File: " << x.
file() <<
'\n';
301 os <<
"Line: " << x.
line() <<
'\n';
302 os <<
"Column: " << x.
column() <<
'\n';
303 throw runtime_error(os.str());
344 id, output, input, tasks, auto_vars, auto_vars_values, include_file);
354 if (includedir.nelem()) {
355 if (current_includepath.
nelem() && current_includepath[0] != includedir)
356 current_includepath.insert(current_includepath.begin(), includedir);
362 find_file(matching_files, include_file, current_includepath);
363 find_file(matching_files, include_file +
".arts", current_includepath);
365 if (!matching_files.
nelem()) {
367 os <<
"Cannot find include file " << include_file <<
".\n";
369 os <<
"Search path was: " << current_includepath <<
"\n";
374 include_file = matching_files[0];
375 out2 <<
"- Including control file " << include_file <<
"\n";
380 for (
auto& method: tasks.Methods())
384 if (md_data[
id].SetMethod()) {
387 MRecord(
id, output, input, auto_vars_values[0], tasks));
399 const String& mname = md_data[id].Name();
401 if (mname.length() > 6 && mname.find(
"Create") == mname.length() - 6 &&
403 if (agenda_name !=
"Arts2") {
405 os << mname <<
" cannot be called inside an agenda.\n"
406 <<
"All workspace variables are global and must be created at the top level.";
414 wsv_groups[(*
ws->wsv_data_ptr)[output[0]].Group()].name;
415 map<String, Index>::const_iterator mdit;
416 mdit = MdMap.find(method_name);
428 out3 <<
"- " << md_data[id].Name() <<
"\n";
432 md_data[
id].GOutType().nelem() + md_data[
id].GInType().nelem()) {
434 for (Index j = 0; j < output.
nelem(); ++j) {
435 out3 << (*
ws->wsv_data_ptr)[output[j]].Name() <<
" ";
440 for (Index j = 0; j < input.
nelem(); ++j) {
441 out3 << (*
ws->wsv_data_ptr)[input[j]].Name() <<
" ";
499 bool found_curly_brace =
false;
507 auto_vars_values.resize(0);
513 if (methodname ==
"INCLUDE") {
522 if (methodname ==
"Arts2") {
524 }
else if (methodname ==
"Arts") {
526 "Arts version 1 controlfiles are no longer supported.");
532 mdd,
id, methodname, output, input, auto_vars, auto_vars_values);
540 found_curly_brace =
true;
547 out3 <<
"- " << mdd->
Name() <<
"\n";
556 os <<
"Expected method name , but got `" <<
msource.
Current() <<
"'.";
565 if (found_curly_brace) {
568 }
catch (
const Eot& x) {
570 if (!no_eot)
throw Eot(x);
597 ostringstream os_default_error;
599 <<
"\nParse error in default value for generic input variable.\n"
600 <<
"This is not a user error but a bug in methods.cc.\n"
601 <<
"Please contact the ARTS developers.";
611 istringstream is(mdd->
GInDefault()[gin_index]);
614 if (is.bad() || is.fail()) failed =
true;
617 istringstream is(mdd->
GInDefault()[gin_index]);
620 if (is.bad() || is.fail()) failed =
true;
630 os << p.what() << os_default_error.str();
643 os << p.what() << os_default_error.str();
656 os << p.what() << os_default_error.str();
666 }
catch (std::exception& e) {
667 std::ostringstream os;
668 os << e.what() << os_default_error.str();
676 os <<
"Default values for generic inputs with type "
677 << wsv_groups[mdd->
GInType()[gin_index]]
678 <<
" are not supported.\n"
679 <<
"Either remove the default value for generic input '"
680 << mdd->
GIn()[gin_index] <<
"' in workspace method\n"
681 <<
"*" << mdd->
Name() <<
"* in methods.cc or discuss this "
682 <<
"issue on the arts-dev mailing list.\n";
693 name =
"auto_" + mdd->
Name() +
"_" +
"gin" + os.str() +
"_" +
694 mdd->
GIn()[gin_index];
697 auto wsvit =
ws->WsvMap_ptr->find(name);
698 if (wsvit ==
ws->WsvMap_ptr->end()) {
700 "Automatically allocated variable.",
703 wsvid = wsvit->second;
706 auto_vars.push_back(wsvid);
707 auto_vars_values.push_back(tv);
711 os <<
"Failed to assign default value for generic '"
712 << mdd->
GIn()[gin_index] <<
"'.\n"
713 <<
"Check the documentation of workspace method *" << mdd->
Name()
720 os <<
"Generic input '" << mdd->
GIn()[gin_index]
721 <<
"' omitted but no default value found.\n"
722 <<
"Check the documentation of workspace method *" << mdd->
Name()
754 bool still_supergeneric =
true;
759 const auto md_raw_id = MdRawMap.find(methodname);
760 if (md_raw_id == MdRawMap.end())
764 id = md_raw_id->second;
769 mdd = &md_data_raw[id];
775 const auto i2 = MdMap.find(methodname);
781 still_supergeneric =
false;
786 Index supergeneric_index = -1;
788 Index this_method_end_line = -1;
789 Index this_method_end_column = -1;
790 bool call_by_name =
false;
821 bool is_first_arg =
true;
826 still_supergeneric, supergeneric_args,
827 supergeneric_index, named_arguments, call_by_name);
830 is_first_arg, named_arguments, call_by_name);
833 auto_vars_values, is_first_arg, still_supergeneric,
834 supergeneric_args, supergeneric_index,
835 named_arguments, call_by_name);
845 if (call_by_name && named_arguments.size()) {
848 os <<
"Error in arguments passed to " << mdd->
Name() <<
":\n";
849 for (
auto &argument_name : named_arguments) {
850 if (std::find(mdd->
GIn().begin(), mdd->
GIn().end(),
851 argument_name.name) == mdd->
GIn().end() &&
852 std::find(mdd->
GOut().begin(), mdd->
GOut().end(),
853 argument_name.name) == mdd->
GOut().end())
854 os <<
" Unkown argument: ";
856 os <<
" Duplicate argument: ";
857 os << argument_name.name << std::endl;
896 os <<
"This method has generic output. "
897 <<
"You have to pass a variable!";
905 for (
auto outs = vo.begin(); outs < vo.end(); ++outs) {
906 output.push_back(*outs);
910 for (
auto ins = vi.begin(); ins < vi.end(); ++ins) {
911 input.push_back(*ins);
917 bool all_gin_have_defaults =
true;
918 for (Index gin = 0; all_gin_have_defaults && gin < mdd->
GIn().
nelem();
924 all_gin_have_defaults =
false;
930 const auto wsvit =
ws->WsvMap_ptr->find(wsvname);
931 if (wsvit ==
ws->WsvMap_ptr->end()) {
936 wsvid = wsvit->second;
938 input.push_back(wsvid);
942 if (!all_gin_have_defaults) {
944 os <<
"Not all generic inputs of the method *" << methodname
945 <<
"* have default values, you have to specify them!";
975 bool& still_supergeneric,
976 String& supergeneric_args,
977 Index& supergeneric_index
_U_,
987 for (Index j = 0; j < mdd->
GInType().nelem(); ++j) {
988 Index this_arg_index = 0;
993 if (this_arg_index != -1) {
995 named_args[this_arg_index].
column);
996 named_args.erase(named_args.begin() + this_arg_index);
1010 if ((call_by_name && this_arg_index == -1) ||
msource.
Current() ==
',' ||
1019 "generic" + os.str(),
1025 "Unexpected '=' sign encountered.\n"
1026 "Mixing positional and named arguments is not allowed.",
1032 "Only constants can be passed to Set methods.\n"
1033 "You might want to use the *Copy* here.",
1044 ws->WsvMap_ptr->find(wsvname);
1045 if (wsvit ==
ws->WsvMap_ptr->end()) {
1050 wsvid = wsvit->second;
1056 if (still_supergeneric) {
1058 if (wsv_groups[mdd->
GInType()[j]] ==
"Any")
1059 supergeneric_args +=
1060 wsv_groups[(*
ws->wsv_data_ptr)[wsvid].Group()].name;
1061 os << mdd->
Name() <<
"_sg_" << supergeneric_args;
1062 methodname = os.str();
1065 const auto mdit = MdMap.find(methodname);
1066 if (mdit != MdMap.end()) {
1071 still_supergeneric =
false;
1082 if (supergeneric_index == -1) {
1083 bool wrong_group_id =
true;
1086 if ((*
ws->wsv_data_ptr)[wsvid].Group() == mdd->
GInSpecType()[j][i]) {
1087 wrong_group_id =
false;
1088 supergeneric_index = i;
1092 if (wrong_group_id) {
1094 bool firsttype =
true;
1104 "*" + mdd->
Name() +
"* is not defined for " +
1105 wsv_groups[(*
ws->wsv_data_ptr)[wsvid].Group()].name +
1106 " input. Check the online docs.",
1112 if ((*
ws->wsv_data_ptr)[wsvid].Group() !=
1115 wsvname +
" is not " +
1116 wsv_groups[mdd->
GInSpecType()[j][supergeneric_index]].name +
1118 wsv_groups[(*
ws->wsv_data_ptr)[wsvid].Group()].name,
1124 }
else if ((*
ws->wsv_data_ptr)[wsvid].Group() != mdd->
GInType()[j]) {
1126 wsvname +
" is not " + wsv_groups[mdd->
GInType()[j]].name +
1127 ", it is " + wsv_groups[(*
ws->wsv_data_ptr)[wsvid].Group()].name,
1134 input.push_back(wsvid);
1159 bool& still_supergeneric,
1160 String& supergeneric_args,
1161 Index& supergeneric_index,
1163 bool call_by_name) {
1171 for (Index j = 0; j < mdd->
GOut().nelem(); ++j) {
1173 Index this_arg_index;
1177 if (this_arg_index == -1) {
1179 os <<
"This method has generic output. "
1180 <<
"You have to pass a variable!";
1186 named_args[this_arg_index].
column);
1187 named_args.erase(named_args.begin() + this_arg_index);
1203 auto wsvit =
ws->WsvMap_ptr->find(wsvname);
1204 if (wsvit ==
ws->WsvMap_ptr->end()) {
1205 if (still_supergeneric) {
1207 os <<
"This might be either a typo or you have to create "
1208 <<
"the variable\nby calling TYPECreate(" << wsvname
1209 <<
") first. Replace TYPE with the\n"
1210 <<
"WSV group your variable should belong to.";
1216 if (mdd->
Name().length() <= 6 ||
1217 mdd->
Name().substr(mdd->
Name().length() - 6) !=
"Create") {
1219 os <<
"This might be either a typo or you have to create "
1220 <<
"the variable\nby calling "
1221 << wsv_groups[mdd->
GOutType()[j]] <<
"Create( " << wsvname
1230 "Automatically allocated variable.",
1235 if (mdd->
Name().length() > 6 &&
1236 mdd->
Name().find(
"Create") == mdd->
Name().length() - 6) {
1238 wsv_groups[(*
ws->wsv_data_ptr)[wsvit->second].Group()].name;
1239 if (mdd->
Name().find(gn) not_eq 0) {
1243 " already exists of group ",
1245 ". A variable cannot be redefined as a different group.\n"),
1251 wsvid = wsvit->second;
1259 if (still_supergeneric) {
1261 if (wsv_groups[mdd->
GOutType()[j]] ==
"Any")
1262 supergeneric_args +=
1263 wsv_groups[(*
ws->wsv_data_ptr)[wsvid].Group()].name;
1264 os << mdd->
Name() <<
"_sg_" << supergeneric_args;
1265 methodname = os.str();
1268 const auto mdit = MdMap.find(methodname);
1269 if (mdit != MdMap.end()) {
1274 still_supergeneric =
false;
1285 if (supergeneric_index == -1) {
1286 bool wrong_group_id =
true;
1289 if ((*
ws->wsv_data_ptr)[wsvid].Group() == mdd->
GOutSpecType()[j][i]) {
1290 wrong_group_id =
false;
1291 supergeneric_index = i;
1295 if (wrong_group_id) {
1297 bool firsttype =
true;
1307 "*" + mdd->
Name() +
"* is not defined for " +
1308 wsv_groups[(*
ws->wsv_data_ptr)[wsvid].Group()].name +
1309 " output. Check the online docs.",
1315 if ((*
ws->wsv_data_ptr)[wsvid].Group() !=
1318 wsvname +
" is not " +
1319 wsv_groups[mdd->
GOutSpecType()[j][supergeneric_index]].name +
1321 wsv_groups[(*
ws->wsv_data_ptr)[wsvid].Group()].name,
1327 }
else if ((*
ws->wsv_data_ptr)[wsvid].Group() != mdd->
GOutType()[j]) {
1329 wsvname +
" is not " + wsv_groups[mdd->
GOutType()[j]].name +
1330 ", it is " + wsv_groups[(*
ws->wsv_data_ptr)[wsvid].Group()].name,
1337 output.push_back(wsvid);
1361 bool call_by_name) {
1371 for (
auto ins = vi.begin(); ins < vi.end(); ++ins) {
1375 Index this_arg_index;
1377 wsvname = (*
ws->wsv_data_ptr)[*ins].Name();
1381 if (this_arg_index != -1) {
1383 named_args[this_arg_index].
column);
1384 named_args.erase(named_args.begin() + this_arg_index);
1389 (*
ws->wsv_data_ptr)[*ins].Name(),
1391 (*
ws->wsv_data_ptr)[*ins].Group());
1402 os <<
"Expected input WSV *" << (*
ws->wsv_data_ptr)[*ins].Name()
1411 (*
ws->wsv_data_ptr)[*ins].Name(),
1413 (*
ws->wsv_data_ptr)[*ins].Group());
1419 ws->WsvMap_ptr->find(wsvname);
1420 if (wsvit ==
ws->WsvMap_ptr->end())
1424 wsvid = wsvit->second;
1428 if ((*
ws->wsv_data_ptr)[wsvid].Group() !=
1429 (*
ws->wsv_data_ptr)[*ins].Group()) {
1431 wsvname +
" is not " +
1432 wsv_groups[(*
ws->wsv_data_ptr)[*ins].Group()].name +
", it is " +
1433 wsv_groups[(*
ws->wsv_data_ptr)[wsvid].Group()].name,
1439 input.push_back(wsvid);
1459 bool call_by_name) {
1467 for (
auto outs = vo.begin(); outs < vo.end();
1472 Index this_arg_index = 0;
1474 wsvname = (*
ws->wsv_data_ptr)[*outs].Name();
1478 if (this_arg_index != -1) {
1480 named_args[this_arg_index].
column);
1481 named_args.erase(named_args.begin() + this_arg_index);
1494 os <<
"Expected output WSV *" << (*
ws->wsv_data_ptr)[*outs].Name()
1509 ws->WsvMap_ptr->find(wsvname);
1510 if (wsvit ==
ws->WsvMap_ptr->end()) {
1511 if (mdd->
Name().length() > 6 &&
1512 mdd->
Name().substr(mdd->
Name().length() - 6) !=
"Create") {
1514 os <<
"This might be either a typo or you have to create "
1515 <<
"the variable\nby calling "
1516 << wsv_groups[(*
ws->wsv_data_ptr)[*outs].Group()]
1517 <<
"Create( " << wsvname <<
" ) first.\n";
1524 "Automatically allocated variable.",
1525 (*
ws->wsv_data_ptr)[*outs].Group()));
1528 if (wsvid == -1) wsvid = wsvit->second;
1532 if ((*
ws->wsv_data_ptr)[wsvid].Group() !=
1533 (*
ws->wsv_data_ptr)[*outs].Group()) {
1535 wsvname +
" is not " +
1536 wsv_groups[(*
ws->wsv_data_ptr)[*outs].Group()].name +
", it is " +
1537 wsv_groups[(*
ws->wsv_data_ptr)[wsvid].Group()].name,
1543 output.push_back(wsvid);
1565 const Index method_type,
1570 for (Index i = 0; i < auto_vars.
nelem(); i++) {
1571 map<String, Index>::const_iterator mdit;
1573 TokVal auto_keyword_value;
1578 const Index auto_group = (*
ws->wsv_data_ptr)[auto_vars[i]].Group();
1589 << wsv_groups[(*
ws->wsv_data_ptr)[auto_vars[i]].Group()]
1590 <<
" constant to a WSM is not supported!";
1596 switch (method_type) {
1598 auto_keyword_value = auto_vars_values[i];
1599 auto_output_var.push_back(auto_vars[i]);
1601 wsv_groups[(*
ws->wsv_data_ptr)[auto_vars[i]].Group()].name +
"Set";
1604 auto_input_var.push_back(auto_vars[i]);
1607 wsv_groups[(*
ws->wsv_data_ptr)[auto_vars[i]].Group()].name;
1616 mdit = MdMap.find(method_name);
1618 init_mdid = mdit->second;
1676 os <<
"Expected whitespace, but got `" << dummy <<
"'.";
1691 while (pos < str.length() &&
is_whitespace(str[pos])) pos++;
1711 os <<
"Workspace variable names must start with a letter!";
1719 if (isalnum(dummy) ||
'_' == dummy) {
1753 const String& default_name,
1755 const Index group) {
1765 os <<
"Passing constants as supergeneric arguments is not supported.";
1776 name =
"auto_" + mdd->
Name() +
"_" + default_name;
1777 auto wsvit =
ws->WsvMap_ptr->find(name);
1778 if (wsvit ==
ws->WsvMap_ptr->end()) {
1780 name.c_str(),
"Automatically allocated variable.", group));
1782 wsvid = wsvit->second;
1785 auto_vars.push_back(wsvid);
1792 auto_vars_values.push_back(dummy);
1796 auto_vars_values.push_back(n);
1800 auto_vars_values.push_back(n);
1804 auto_vars_values.push_back(dummy);
1808 auto_vars_values.push_back(dummy);
1813 if (dummy.
nelem()) {
1816 auto_vars_values.push_back(aost);
1820 auto_vars_values.push_back(dummy);
1824 auto_vars_values.push_back(dummy);
1828 os <<
"Unsupported argument type: " << wsv_groups[group];
1845 os <<
"Expected '" <<
c <<
"', but got '" <<
msource.
Current() <<
"'.";
1912 if (
'+' == dummy ||
'-' == dummy) {
1924 os <<
"Expected digit or variable name, but got `" <<
msource.
Current()
1932 if (isdigit(chtmp)) {
1964 bool found_digit =
false;
1968 if (
'+' == dummy ||
'-' == dummy) {
1982 if (isdigit(chtmp)) {
2012 if (isdigit(chtmp)) {
2026 throw ParseError(
"Expected at least one digit.",
2033 if (
'e' == dummy ||
'E' == dummy) {
2058 istringstream is(res);
2069 istringstream is(res);
2110 res.push_back(dummy);
2151 res.push_back(dummy);
2196 tres.push_back(dummy);
2201 res.resize(tres.
nelem());
2202 for (
int i = 0; i < tres.
nelem(); i++) {
2236 Index cur_ncols = 0;
2249 if (ncols != -1 && cur_ncols > ncols) {
2252 <<
"'. Check Matrix dimensions.";
2262 }
else if (ncols != cur_ncols) {
2265 <<
"'. Check Matrix dimensions.";
2274 if (ncols > cur_ncols)
c =
',';
2277 <<
"'. Check Matrix dimensions.";
2284 tres.push_back(dummy);
2288 if (ncols == -1) ncols = cur_ncols;
2289 if (ncols != cur_ncols) {
2290 throw ParseError(
"Missing element(s) in last row of matrix",
2297 res.resize(nrows, ncols);
2298 for (Index i = 0; i < nrows; i++)
2299 for (Index j = 0; j < ncols; j++) res(i, j) = tres[i * ncols + j];
2322 if (str[pos] !=
'[') {
2323 throw ParseError(
"No opening bracket found while parsing ArrayOfIndex.",
2335 while (pos < str.length() && str[pos] !=
']') {
2339 if (str[pos] !=
',') {
2347 istringstream is(str.substr(pos));
2349 if (is.bad() || is.fail())
return false;
2350 tres.push_back(dummy);
2351 while (pos < str.length() &&
2352 (isdigit(str[pos]) || str[pos] ==
'-' || str[pos] ==
'e'))
2358 res.resize(tres.
nelem());
2359 for (
int i = 0; i < tres.
nelem(); i++) {
2384 if (str[pos] !=
'[') {
2385 throw ParseError(
"No opening bracket found while parsing Vector.",
2397 while (pos < str.length() && str[pos] !=
']') {
2401 if (str[pos] !=
',') {
2409 istringstream is(str.substr(pos));
2411 if (is.bad() || is.fail())
return false;
2412 tres.push_back(dummy);
2413 if (str[pos] ==
'N' && str.find(
"NaN", pos) == pos) {
2416 while (pos < str.length() && (isdigit(str[pos]) || str[pos] ==
'-' ||
2417 str[pos] ==
'.' || str[pos] ==
'e'))
2424 res.resize(tres.
nelem());
2425 for (
int i = 0; i < tres.
nelem(); i++) {
2452 if (str[pos] !=
'[') {
2453 throw ParseError(
"No opening bracket found while parsing ArrayOfString.",
2465 while (pos < str.length() && str[pos] !=
']') {
2469 if (str[pos] !=
',') {
2476 if (str[pos] !=
'"') {
2477 throw ParseError(
"Expected quotes while parsing ArrayOfString.",
2486 while (pos < str.length() && str[pos] !=
'"') {
2491 if (pos == str.length() || str[pos] !=
'"')
return false;
2493 tres.push_back(dummy);
2499 res.resize(tres.
nelem());
2500 for (
int i = 0; i < tres.
nelem(); i++) {
The global header file for ARTS.
void push_back(const MRecord &n)
Append a new method to end of list.
void resize(Index n)
Resize the method list.
Index nelem() const ARTS_NOEXCEPT
bool parse_stringarray_from_string(ArrayOfString &res, String &str)
Read an Array of Strings from a String.
void parse_specific_output(const MdRecord *mdd, ArrayOfIndex &output, bool &first, NamedArguments &named_args, bool call_by_name)
Parse the output WSVs for current method from the controlfile.
const Verbosity & verbosity
void parse_numeric(Numeric &n)
Use a String stream to parse a floating point number.
vector< NamedArgument > NamedArguments
void parse_tasklist()
Public interface to the main function of the parser.
void read_name(String &name)
Reads name of method, keyword, or workspace variable.
void tasklist_insert_set_delete(const ArrayOfIndex &auto_vars, const Array< TokVal > &auto_vars_values, const Index method_type, Agenda &tasklist)
Insert Set and Delete methods for automatically allocated output WSVs.
void parse_generic_input(const MdRecord *&mdd, Index &id, String &methodname, ArrayOfIndex &input, ArrayOfIndex &auto_vars, Array< TokVal > &auto_vars_values, bool &first, bool &still_supergeneric, String &supergeneric_args, Index &supergeneric_index, NamedArguments &named_args, bool call_by_name)
Parse the generic input WSVs for current method from the controlfile.
void parse_Stringvector(ArrayOfString &res)
Read a vector of Strings.
void parse_integer(Index &n)
Use a String stream to parse an integer number.
void skip_to_next_argument()
Skips forward to the next argument.
void assertain_character(char c)
Make sure that the current character is equal to c and go to the next character.
void parse_specific_input(const MdRecord *mdd, ArrayOfIndex &input, ArrayOfIndex &auto_vars, Array< TokVal > &auto_vars_values, bool &first, NamedArguments &named_args, bool call_by_name)
Parse the specific input WSVs for current method from the controlfile.
std::shared_ptr< Workspace > ws
{ String name NamedArgument
Index read_name_or_value(String &name, ArrayOfIndex &auto_vars, Array< TokVal > &auto_vars_values, const String &default_name, const MdRecord *mdd, const Index group)
Reads name of a workspace variable or a value.
void find_named_arguments(vector< NamedArgument > &named_args)
Find named arguments.
bool parse_intvector_from_string(ArrayOfIndex &res, String &str)
Read an array of integers from a String.
ArtsParser(Agenda &tasklist, String controlfile, const Verbosity &verbosity)
Constructs a new parser.
bool parse_numvector_from_string(Vector &res, String &str)
Read a vector of Numerics from a String.
void use_default_method_args(const MdRecord *mdd, String &methodname, ArrayOfIndex &output, ArrayOfIndex &input, ArrayOfIndex &auto_vars, Array< TokVal > &auto_vars_values)
Set defaults if method is called without any arguments.
bool is_whitespace(const char c)
Returns true if this character is considered whitespace.
void parse_method(Index &id, ArrayOfIndex &output, ArrayOfIndex &input, Agenda &tasks, ArrayOfIndex &auto_vars, Array< TokVal > &auto_vars_values, String &include_file, bool no_eot=false)
Parse the Contents of text as ARTS control input.
void eat_whitespace_from_string(String &str, size_t &pos)
Eats whitespace from a String.
String set_gin_to_default(const MdRecord *mdd, ArrayOfIndex &auto_vars, Array< TokVal > &auto_vars_values, Index keyword_index)
Set generic input to default value.
void parse_agenda(Agenda &tasklist, const String &agenda_name)
Parse the Contents of text as ARTS control input.
void eat_whitespace()
Eats whitespace.
void parse_main()
The main function of the parser.
void parse_String(String &res)
Reads a String, complete with quotation marks.
void read_numeric(String &res)
Reads a floating point number.
void parse_method_args(const MdRecord *&mdd, Index &id, String &methodname, ArrayOfIndex &output, ArrayOfIndex &input, ArrayOfIndex &auto_vars, Array< TokVal > &auto_vars_values)
Parse method's argument list.
void parse_generic_output(const MdRecord *&mdd, Index &id, String &methodname, ArrayOfIndex &output, bool &first, bool &still_supergeneric, String &supergeneric_args, Index &supergeneric_index, NamedArguments &named_args, bool call_by_name)
Parse the generic output WSVs for current method from the controlfile.
void parse_numvector(Vector &res)
Read a vector of Numerics.
void read_integer(String &res)
Reads an integer.
void parse_intvector(ArrayOfIndex &res)
Read a vector of integers.
void parse_matrix(Matrix &res)
Read a Matrix.
void at_end_of_argument(const String &argname)
Check if current position in controlfile is at the end of an argument.
void get_argument_index_by_name(Index &arg_index, NamedArguments &named_args, const String &name)
Return the index of the argument with the given name.
All information for one workspace method.
const String & Name() const
const ArrayOfIndex & InOnly() const
const ArrayOfIndex & GOutType() const
const Array< String > & GInDefault() const
const ArrayOfArrayOfIndex & GInSpecType() const
const ArrayOfString & GOut() const
bool AgendaMethod() const
bool Supergeneric() const
const ArrayOfArrayOfIndex & GOutSpecType() const
const ArrayOfIndex & Out() const
const ArrayOfIndex & GInType() const
const ArrayOfString & GIn() const
Structure to hold all command line Parameters.
ArrayOfString includepath
List of paths to search for include files.
ArrayOfString datapath
List of paths to search for data files.
Index MarkedLine()
Return the marked line number, but for the file that is associated with the current position.
void AdvanceChar()
Advance position pointer by one character.
void AdvanceLine()
Advances position pointer by one line.
Index Line()
Return the line number, but for the file that is associated with the current position.
const String & File()
Return the filename associated with the current position.
void SetMark()
Mark current position.
void AppendFile(const String &name)
Appends contents of file to the source text.
char Current()
Return the current character.
bool & LineBreak()
Read the line break flag.
Index MarkedColumn()
Return the current marked column.
bool reachedEot()
Check if the current position reached the end.
Index Column()
Return the current column.
void Init()
This sets the pointer to the first existing character in the text.
Index LineRaw()
Return the line index.
Index ColumnRaw()
Return the column index.
void SetPosition(Index line, Index column)
Set current position.
This class contains all static information for one workspace variable.
Input manipulator class for doubles to enable nan and inf parsing.
#define ARTS_ASSERT(condition,...)
std::string var_string(Args &&... args)
The declarations of all the exception classes.
bool find_file(ArrayOfString &matches, const std::string_view filename, const ArrayOfString &paths, const ArrayOfString &extensions)
Searches through paths for a file with a matching name.
String get_dirname(const std::string_view path)
Return the parent directory of a path.
This file contains basic functions to handle ASCII files.
Index get_wsv_group_id(const String &name)
Returns the id of the given group.
Declaration of the class MdRecord.
const ArrayOfGroupRecord wsv_groups
The names associated with Wsv groups as Strings.
const Array< MdRecord > md_data_raw
Lookup information for workspace methods.
const Array< MdRecord > md_data
Lookup information for workspace methods.
const map< String, Index > MdMap
The map associated with md_data.
const map< String, Index > MdRawMap
The map associated with md_data_raw.
Parameters parameters
Holds the command line parameters.
This file contains header information for the dealing with command line parameters.
This file contains the Workspace class.
Auxiliary header stuff related to workspace variable groups.