This is an internal function of clipm/test, which is only mentioned for documentation. It extracts string tokens from a line string.
- Parameters
-
line | Line string. |
operators | A string containing characters that will be interpreted as non-text and will thus create new tokens. Contiguous characters are stored as one operator token. |
separators | A string containing characters that will also be interpreted as non-text and will thus create new tokens. Every separator character is stored in a single token. |
commentchar | Character indicating that the rest of the line is a comment, which will not be parsed. |
use_comment | Future-planned flag indicating whether a comment shall be used for the recorded parameter |
grouping | Future-planned string containing character pairs which indicate the starts and ends of a character group |
- Returns
- A list of properties containing the string tokens. Each property will contain the token as its value. The name of each property will be either "TXT" indicating text, "OPR" indicating an operator, or "SEP" indicating that it contains a separator
This function parses a line string for space-separated sub-strings, called tokens. Additional operator and separator characters can be specified, which will be stored in own tokens. There are three types of tokens, text, operator and separator tokens, indicated by their respective property names.
Double-quoted parts in the input line string are regarded as text as-is.
Escape sequences are recognized and after substitution regarded as text. The following special escape sequences are known so far:
- \n newline character
- \r return character
- \t tabulator
All other characters can be escaped as-well, forcing them to be interpreted as text.
Operators, separators, comment characters, quotes and the escape character should all be different! If not, the priority of interpretation is:
- Escape character
- Quotes
- Comment character
- Separators
- Operators
An example of usage is given below:
const char *operators = "=";
const char *separators = ";";