#include <parser_bits.h>
Static Public Member Functions | |
| static void | translate_CR_for_platform (istring &to_translate) |
| flips embedded EOL characters for this platform's needs. | |
| static istring | substitute_env_vars (const istring &text, bool leave_unknown=true) |
| resolves embedded environment variables in "text". | |
| static bool | is_printable_ascii (char to_check) |
| returns true if "to_check" is a normally visible ASCII character. | |
| static bool | white_space_no_cr (char to_check) |
| reports if "to_check" is white space but not a carriage return. | |
| static bool | is_eol (char to_check) |
| returns true if "to_check" is part of an end-of-line sequence. | |
| static bool | white_space (char to_check) |
| returns true if the character "to_check" is considered a white space. | |
| static bool | is_alphanumeric (char look_at) |
| returns true if "look_at" is one of the alphanumeric characters. | |
| static bool | is_alphanumeric (const char *look_at, int len) |
| returns true if the char ptr "look_at" is all alphanumeric characters. | |
| static bool | is_alphanumeric (const istring &look_at, int len) |
| returns true if the string "look_at" is all alphanumeric characters. | |
| static bool | is_numeric (char look_at) |
| returns true if "look_at" is a valid numerical character. | |
| static bool | is_numeric (const char *look_at, int len) |
| returns true if "look_at" is all valid numerical characters. | |
| static bool | is_numeric (const istring &look_at, int len) |
| returns true if the "look_at" string has only valid numerical chars. | |
| static bool | is_hexadecimal (char look_at) |
| returns true if "look_at" is one of the hexadecimal characters. | |
| static bool | is_hexadecimal (const char *look_at, int len) |
| returns true if "look_at" is all hexadecimal characters. | |
| static bool | is_hexadecimal (const istring &look_at, int len) |
| returns true if the string "look_at" is all hexadecimal characters. | |
| static bool | is_identifier (char look_at) |
| returns true if "look_at" is a valid identifier character. | |
| static bool | is_identifier (const char *look_at, int len) |
| returns true if "look_at" is composed of valid identifier character. | |
| static bool | is_identifier (const istring &look_at, int len) |
| like is_identifier() above but operates on a string. | |
Definition at line 22 of file parser_bits.h.
| void parser_bits::translate_CR_for_platform | ( | istring & | to_translate | ) | [static] |
flips embedded EOL characters for this platform's needs.
runs through the string "to_translate" and changes any CR or CRLF combinations into the EOL (end-of-line) character that's appropriate for this operating system.
Definition at line 42 of file parser_bits.cpp.
References log_base::CRLF_AT_END, istring::end(), istring::insert(), log_base::pick_ending_for_platform(), and istring::zap().
| istring parser_bits::substitute_env_vars | ( | const istring & | text, | |
| bool | leave_unknown = true | |||
| ) | [static] |
resolves embedded environment variables in "text".
replaces the names of any environment variables in "text" with the variable's value and returns the resulting string. the variable names are marked by a single dollar before an alphanumeric identifier (underscores are valid), for example: $PATH if the "leave_unknown" flag is true, then any unmatched variables are left in the text with a question mark instead of a dollar sign. if it's false, then they are simply replaced with nothing at all.
Definition at line 142 of file parser_bits.cpp.
References portable::env_string(), istring::find(), istring::insert(), is_identifier(), istring::length(), negative(), istring::substring(), istring::t(), and istring::zap().
Referenced by application_config::find_program(), path_configuration::get_logging_directory(), and path_configuration::read_item().
| bool parser_bits::is_printable_ascii | ( | char | to_check | ) | [static] |
returns true if "to_check" is a normally visible ASCII character.
this is defined very simply by it being within the range of 32 to 126. that entire range should be printable in ASCII. before 32 we have control characters. after 126 we have potentially freakish looking characters. this is obviously not appropriate for utf-8 or unicode.
Definition at line 30 of file parser_bits.cpp.
Referenced by byte_format::print_char(), and octopus_entity::text_form().
| bool parser_bits::white_space_no_cr | ( | char | to_check | ) | [static] |
reports if "to_check" is white space but not a carriage return.
returns true if the character "to_check" is considered a white space, but is not part of an end of line combo (both '
' and '' are disallowed). the allowed set includes tab ('') and space (' ') only.
Definition at line 33 of file parser_bits.cpp.
Referenced by tokenizer::parse(), and white_space().
| bool parser_bits::is_eol | ( | char | to_check | ) | [static] |
returns true if "to_check" is part of an end-of-line sequence.
this returns true for both the '' and '
' characters.
Definition at line 36 of file parser_bits.cpp.
Referenced by ini_parser::add(), string_manipulation::carriage_returns_to_spaces(), nechung_oracle::display_random(), tokenizer::is_eol_a_separator(), tokenizer::parse(), bookmark_tree::read_csv_file(), tokenizer::separator(), string_manipulation::split_lines(), and white_space().
| bool parser_bits::white_space | ( | char | to_check | ) | [static] |
returns true if the character "to_check" is considered a white space.
this set includes tab (''), space (' '), carriage return ('
'), and line feed ('').
Definition at line 39 of file parser_bits.cpp.
References is_eol(), and white_space_no_cr().
Referenced by command_line::command_line(), tokenizer::parse(), list_parsing::parse_csv_line(), and string_manipulation::split_lines().
| bool parser_bits::is_alphanumeric | ( | char | look_at | ) | [static] |
returns true if "look_at" is one of the alphanumeric characters.
This includes a to z in either case and 0 to 9.
Definition at line 89 of file parser_bits.cpp.
References range_check().
Referenced by is_alphanumeric().
| bool parser_bits::is_alphanumeric | ( | const char * | look_at, | |
| int | len | |||
| ) | [static] |
returns true if the char ptr "look_at" is all alphanumeric characters.
Definition at line 96 of file parser_bits.cpp.
References is_alphanumeric().
| bool parser_bits::is_alphanumeric | ( | const istring & | look_at, | |
| int | len | |||
| ) | [static] |
returns true if the string "look_at" is all alphanumeric characters.
Definition at line 103 of file parser_bits.cpp.
References is_alphanumeric(), and istring::observe().
| bool parser_bits::is_numeric | ( | char | look_at | ) | [static] |
returns true if "look_at" is a valid numerical character.
Definition at line 125 of file parser_bits.cpp.
References range_check().
Referenced by internet_address::has_ip_address(), internet_address::ip_appropriate_number(), is_identifier(), and is_numeric().
| bool parser_bits::is_numeric | ( | const char * | look_at, | |
| int | len | |||
| ) | [static] |
returns true if "look_at" is all valid numerical characters.
this allows the '-' character for negative numbers also (but only for first character if the char* or istring versions are used). does not support floating point numbers or exponential notation yet.
Definition at line 130 of file parser_bits.cpp.
References is_numeric().
| bool parser_bits::is_numeric | ( | const istring & | look_at, | |
| int | len | |||
| ) | [static] |
returns true if the "look_at" string has only valid numerical chars.
Definition at line 139 of file parser_bits.cpp.
References is_numeric(), and istring::observe().
| bool parser_bits::is_hexadecimal | ( | char | look_at | ) | [static] |
returns true if "look_at" is one of the hexadecimal characters.
This includes a to f in either case and 0 to 9.
Definition at line 72 of file parser_bits.cpp.
References range_check().
Referenced by is_hexadecimal(), cromp_transaction::peek_header(), and cromp_transaction::resynchronize().
| bool parser_bits::is_hexadecimal | ( | const char * | look_at, | |
| int | len | |||
| ) | [static] |
returns true if "look_at" is all hexadecimal characters.
Definition at line 79 of file parser_bits.cpp.
References is_hexadecimal().
| bool parser_bits::is_hexadecimal | ( | const istring & | look_at, | |
| int | len | |||
| ) | [static] |
returns true if the string "look_at" is all hexadecimal characters.
Definition at line 86 of file parser_bits.cpp.
References is_hexadecimal(), and istring::observe().
| bool parser_bits::is_identifier | ( | char | look_at | ) | [static] |
returns true if "look_at" is a valid identifier character.
this just allows alphanumeric characters and underscore.
Definition at line 106 of file parser_bits.cpp.
References range_check().
Referenced by is_identifier(), and substitute_env_vars().
| bool parser_bits::is_identifier | ( | const char * | look_at, | |
| int | len | |||
| ) | [static] |
returns true if "look_at" is composed of valid identifier character.
additionally, identifiers cannot start with a number.
Definition at line 114 of file parser_bits.cpp.
References is_identifier(), and is_numeric().
| bool parser_bits::is_identifier | ( | const istring & | look_at, | |
| int | len | |||
| ) | [static] |
like is_identifier() above but operates on a string.
Definition at line 122 of file parser_bits.cpp.
References is_identifier(), and istring::observe().
1.5.1