Go to the documentation of this file.
124 throw Eot(
"Empty text!",
156 <<
": " << text.
mText[i] <<
'\n';
212 os <<
"Expected whitespace, but got `" << dummy <<
"'.";
241 if ( isalnum(dummy) ||
'_'==dummy )
267 os <<
"Expected `" << c <<
"', but got `" << text.
Current() <<
"'.";
338 if (
'+' == dummy ||
'-' == dummy )
352 os <<
"Expected digit, but got `" << text.
Current() <<
"'.";
362 if ( isdigit(dummy) )
396 bool found_digit =
false;
400 if (
'+' == dummy ||
'-' == dummy )
416 if ( isdigit(dummy) )
456 if ( isdigit(dummy) )
472 throw ParseError(
"Expected at least one digit.",
479 if (
'e' == dummy ||
'E' == dummy )
503 istringstream is(res);
512 istringstream is(res);
543 while (
']' != text.
Current() )
556 res.push_back(dummy);
587 while (
']' != text.
Current() )
600 res.push_back(dummy);
635 while (
']' != text.
Current() )
648 tres.push_back(dummy);
691 const std::map<String, Index>
MdMap,
692 const std::map<String, Index>
WsvMap)
713 const map<String, Index>::const_iterator i =
MdMap.find(methodname);
714 if ( i ==
MdMap.end() )
730 if ( 0 <
md_data[
id].GOutput().nelem() +
md_data[
id].GInput().nelem() )
740 for (
Index j=0 ; j<
md_data[id].GOutput().nelem() ; ++j )
754 const map<String, Index>::const_iterator i =
WsvMap.find(wsvname);
776 output.push_back(wsvid);
782 for (
Index j=0 ; j<
md_data[id].GInput().nelem() ; ++j )
796 const map<String, Index>::const_iterator i =
WsvMap.find(wsvname);
816 input.push_back(wsvid);
839 for (
Index i=0 ; i<
md_data[id].Keywords().nelem() ; ++i )
841 if (!isalpha(text.
Current()) && 1==
md_data[
id].Keywords().nelem())
855 if ( keyname !=
md_data[
id].Keywords()[i] )
873 switch (
md_data[
id].Types()[i])
879 values.push_back(dummy);
900 values.push_back(dummy);
907 values.push_back(dummy);
914 values.push_back(dummy);
918 throw logic_error(
"Impossible parameter type.");
959 const std::map<String, Index>
MdMap,
960 const std::map<String, Index>
WsvMap)
973 out3 <<
"\nParsing:\n";
984 tasklist.push_back(
MRecord(
id,values,output,input));
996 <<
md_data[id].Keywords()[j] <<
": "
997 << values[j] <<
'\n';
1001 if ( 0 <
md_data[
id].GOutput().nelem() +
md_data[
id].GInput().nelem() )
1003 out3 <<
" Output: ";
1037 extern const std::map<String, Index>
MdMap;
1038 extern const std::map<String, Index>
WsvMap;
1048 out0 <<
"Unexpected end of control script.\n";
1049 out0 <<
"File: " << x.
file() <<
'\n';
1050 out0 <<
"Line: " << x.
line() <<
'\n';
1056 out0 <<
"Unexpected character:\n";
1057 out0 << x.what() <<
'\n';
1058 out0 <<
"File: " << x.
file() <<
'\n';
1059 out0 <<
"Line: " << x.
line() <<
'\n';
1066 out0 <<
"Illegal Line break:\n";
1067 out0 << x.what() <<
'\n';
1068 out0 <<
"File: " << x.
file() <<
'\n';
1069 out0 <<
"Line: " << x.
line() <<
'\n';
1077 out0 <<
"Unknown Method:\n";
1078 out0 << x.what() <<
'\n';
1079 out0 <<
"File: " << x.
file() <<
'\n';
1080 out0 <<
"Line: " << x.
line() <<
'\n';
1089 out0 <<
"Unknown workspace variable:\n";
1090 out0 << x.what() <<
'\n';
1091 out0 <<
"File: " << x.
file() <<
'\n';
1092 out0 <<
"Line: " << x.
line() <<
'\n';
1101 out0 <<
"Workspace variable belongs to the wrong group:\n";
1102 out0 << x.what() <<
'\n';
1103 out0 <<
"File: " << x.
file() <<
'\n';
1104 out0 <<
"Line: " << x.
line() <<
'\n';
1113 out0 <<
"Unknown keyword:\n";
1114 out0 << x.what() <<
'\n';
1115 out0 <<
"File: " << x.
file() <<
'\n';
1116 out0 <<
"Line: " << x.
line() <<
'\n';
1123 out0 <<
"Parse error:\n";
1124 out0 << x.what() <<
'\n';
1125 out0 <<
"File: " << x.
file() <<
'\n';
1126 out0 <<
"Line: " << x.
line() <<
'\n';
1130 catch (
const runtime_error x)
1132 cout <<
"Runtime error: ";
1133 cout << x.what() <<
'\n';
1135 catch (
const logic_error x)
1137 cout <<
"Logic error: ";
1138 cout << x.what() <<
'\n';
bool is_whitespace(const char c)
Returns true if this character is considered whitespace.
void AppendFile(const String &name)
Appends contents of file to the source text.
The declarations of all the exception classes.
Index mColumn
Column position in the text.
void Init()
This sets the pointer to the first existing character in the text.
ArrayOfString mSfName
Names associated with.
void parse_Stringvector(ArrayOfString &res, SourceText &text)
Read a vector of Strings.
ArrayOfString mText
The text.
Numeric last(ConstVectorView x)
Gives the last value of a vector.
Numeric first(ConstVectorView x)
Gives the first value of a vector.
Out0 out0
Level 0 output stream.
bool & LineBreak()
Read the line break flag.
void resize(Index n)
Resize function.
Index mLine
Line position in the text.
const Array< WsvRecord > wsv_data
bool mLineBreak
Is set to true if the last operation caused a line break.
void eat_whitespace(SourceText &text)
Eats whitespace.
std::map< String, Index > WsvMap
virtual String file() const
virtual Index column() const
Index Line()
Return the line number, but for the file that is associated with the current position.
void parse_numeric(Numeric &n, SourceText &text)
Use a String stream to parse a floating point number.
ArrayOfIndex mSfLine
Remember where which source file starts.
std::map< String, Index > MdMap
The map associated with md_data.
void AdvanceLine()
Advances position pointer by one line.
Declarations having to do with the four output streams.
virtual Index line() const
Index Column()
Return the current column.
void parse_String(String &res, SourceText &text)
Reads a String, complete with quotation marks.
void read_name(String &name, SourceText &text)
Reads name of method, keyword, or workspace variable.
NUMERIC Numeric
The type to use for all floating point numbers.
ostream & operator<<(ostream &os, const SourceText &text)
ArrayOfString wsv_group_names
const String & File()
Return the filename associated with the current position.
bool parse_method(Index &id, Array< TokVal > &values, ArrayOfIndex &output, ArrayOfIndex &input, SourceText &text, const std::map< String, Index > MdMap, const std::map< String, Index > WsvMap)
Parse the Contents of text as ARTS control input.
A smart class to hold the text for parsing.
void read_text_from_file(ArrayOfString &text, const String &name)
Reads an ASCII file and appends the contents to the String vector text.
void parse_integer(Index &n, SourceText &text)
Use a String stream to parse an integer number.
Array< MdRecord > md_data
The lookup information for the workspace methods.
Out3 out3
Level 3 output stream.
INDEX Index
The type to use for all integer numbers and indices.
char Current()
Return the current character.
void parse_main(Array< MRecord > &tasklist, SourceText &text)
The main function of the parser.
void read_integer(String &res, SourceText &text)
Reads an integer.
void parse_intvector(ArrayOfIndex &res, SourceText &text)
Read a vector of integers.
This file contains basic functions to handle ASCII and binary (HDF) data files.
void AdvanceChar()
Advance position pointer by one character.
void parse(Array< MRecord > &tasklist, SourceText &text, const std::map< String, Index > MdMap, const std::map< String, Index > WsvMap)
Parse the Contents of text as ARTS control input.
void parse_numvector(Vector &res, SourceText &text)
Read a vector of Numerics.
void assertain_character(char c, SourceText &text)
Make sure that the current character is equal to c and go to the next character.
Index nelem() const
Number of elements.
Declaration of the class MdRecord.
Auxiliary header stuff related to workspace variable groups.
Declares the enum type that acts as a handle for workspace variables. Also declares the workspace its...
void read_numeric(String &res, SourceText &text)
Reads a floating point number.
The global header file for ARTS.