#include "arts.h"
#include <map>
#include "messages.h"
#include "exceptions.h"
#include "file.h"
#include "auto_wsv.h"
#include "methods.h"
#include "parser.h"
#include "wsv_aux.h"
Go to the source code of this file.
Functions | |
ostream & | operator<< (ostream &os, const SourceText &text) |
bool | is_whitespace (const char c) |
Returns true if this character is considered whitespace. | |
void | eat_whitespace (SourceText &text) |
Eats whitespace. | |
void | read_name (String &name, SourceText &text) |
Reads name of method, keyword, or workspace variable. | |
void | assertain_character (char c, SourceText &text) |
Make sure that the current character is equal to c and go to the next character. | |
void | parse_String (String &res, SourceText &text) |
Reads a String, complete with quotation marks. | |
void | read_integer (String &res, SourceText &text) |
Reads an integer. | |
void | read_numeric (String &res, SourceText &text) |
Reads a floating point number. | |
void | parse_integer (Index &n, SourceText &text) |
Use a String stream to parse an integer number. | |
void | parse_numeric (Numeric &n, SourceText &text) |
Use a String stream to parse a floating point number. | |
void | parse_Stringvector (ArrayOfString &res, SourceText &text) |
Read a vector of Strings. | |
void | parse_intvector (ArrayOfIndex &res, SourceText &text) |
Read a vector of integers. | |
void | parse_numvector (Vector &res, SourceText &text) |
Read a vector of Numerics. | |
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. | |
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_main (Array< MRecord > &tasklist, SourceText &text) |
The main function of the parser. |
void assertain_character | ( | char | c, | |
SourceText & | text | |||
) |
Make sure that the current character is equal to c and go to the next character.
UnexpectedChar | The character is not right. |
void eat_whitespace | ( | SourceText & | text | ) |
Eats whitespace.
Comments are a special case of whitespace. Everything from the `#' to the end of the line is eaten.
The whitespace cases implemented here must be consistent with is_whitespace!
bool is_whitespace | ( | const char | c | ) |
Returns true if this character is considered whitespace.
This includes the comment sign `#'. This function is used by other functions to test for delimiting whitespace.
The whitespace cases implemented here must be consistent with eat_whitespace!
ostream& operator<< | ( | ostream & | os, | |
const SourceText & | text | |||
) |
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.
tasklist | Output. The ids and keyword parameter values for the methods to run. | |
text | The input to parse. | |
MdMap | The method map. | |
WsvMap | The workspace variable map. |
void parse_integer | ( | Index & | n, | |
SourceText & | text | |||
) |
void parse_intvector | ( | ArrayOfIndex & | res, | |
SourceText & | text | |||
) |
Read a vector of integers.
This looks as follows in the control file: [123,5,334] Whitespace has to have been eaten before, that is, the current character must be `['.
The empty vector is allowed.
Line breaks are allowed before and after each number. Line breaks inside numbers are not allowed.
void parse_main | ( | Array< MRecord > & | tasklist, | |
SourceText & | text | |||
) |
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.
id | Output. Method id. | |
values | Output. Keyword parameter values for this method. | |
output | Output. Output workspace variables (for generic methods). | |
input | Output. Input workspace variables (for generic methods). | |
text | The input to parse. |
UnknownMethod | ||
UnknownWsv | ||
WrongWsvGroup | ||
UnexpectedKeyword |
void parse_numeric | ( | Numeric & | n, | |
SourceText & | text | |||
) |
void parse_numvector | ( | Vector & | res, | |
SourceText & | text | |||
) |
Read a vector of Numerics.
This looks as follows in the control file: [1.3, 5, 3.4] Whitespace has to have been eaten before, that is, the current character must be `['.
The empty vector is allowed.
Line breaks are allowed before and after each number. Line breaks inside numbers are not allowed.
void parse_String | ( | String & | res, | |
SourceText & | text | |||
) |
Reads a String, complete with quotation marks.
Whitespace has to have been eaten before, that is, the current character must be the quotation mark ("). Quotation marks inside Strings are currently not possible.
Line breaks inside Strings are not allowed.
IllegalLinebreak | An illegal linebreak has occured. |
void parse_Stringvector | ( | ArrayOfString & | res, | |
SourceText & | text | |||
) |
Read a vector of Strings.
This looks as follows in the control file: ["String1","String2"]
Whitespace has to have been eaten before, that is, the current character must be `['.
The empty vector is allowed.
Quotation marks inside Strings are currently not possible.
Line breaks are allowed before and after each String. Line breaks inside Strings are not allowed.
void read_integer | ( | String & | res, | |
SourceText & | text | |||
) |
Reads an integer.
Whitespace has to have been eaten before, that is, the current character must be a number or `+' or `-'.
Whitespace or line breaks terminate the scanning! There are no whitespaces allowed anywhere, consisten with ANSI C scanf.
IllegalLinebreak | An illegal linebreak has occured. | |
UnexpectedChar | Unexpected character encountered. |
void read_name | ( | String & | name, | |
SourceText & | text | |||
) |
Reads name of method, keyword, or workspace variable.
These names may consist only of letters (case matters!), numbers, and underscores. Line break or any other character ends the name.
Whitespace has to have been eaten before. Scanns text for the name, starting at position specified by line and column.
void read_numeric | ( | String & | res, | |
SourceText & | text | |||
) |
Reads a floating point number.
Whitespace has to have been eaten before, that is, the current character must be a number or `+' or `-'.
Example numbers: 23., 1.0, -.3, -3.3e5, +3e8, 1.0E-9
Illegal numbers: ., 3e, e3, 2e-
Whitespace is not allowed inside the number. Line breaks or whitespace terminates the scanning.
IllegalLinebreak | Illegal line break. | |
ParseError | Cannot parse this as a number. |