const set of char: letter_char is {'A' .. 'Z'} | {'a' .. 'z'};
const set of char: digit_char is {'0' .. '9'};
const set of char: hexdigit_char is digit_char | {'A' .. 'F'} | {'a' .. 'f'};
const set of char: octdigit_char is {'0' .. '7'};
const set of char: alphanum_char is letter_char | digit_char;
const set of char: control_char is {'\0;' .. '\31;'} | {'\127;' .. '\159;'};
const set of char: special_char is
{'!', '$', '%', '&', '*', '+', ',', '-', '.', '/',
':', ';', '<', '=', '>', '?', '@', '\\','^', '`',
'|', '~'};
const set of char: extended_special_char is special_char | { '"', '#', ''' };
const set of char: left_angle_bracket is {'<'};
const set of char: right_angle_bracket is {'>'};
const set of char: special_html_char is special_char - left_angle_bracket;
const set of char: single_quotation_char is {'''};
const set of char: double_quotation_char is {'"'};
const set of char: sharp_char is {'#'};
const set of char: hyphen_char is {'-'};
const set of char: slash_char is {'/'};
const set of char: special_sql_char is special_char - hyphen_char - slash_char;
const set of char: paren_char is {'(', ')', '[', ']', '{', '}'};
const set of char: left_paren_char is {'('};
const set of char: other_paren_char is {')', '[', ']', '{', '}'};
const set of char: name_start_char is letter_char | {'_'};
const set of char: name_char is letter_char | digit_char | {'_'};
const set of char: space_or_tab is {' ', '\t'};
const set of char: line_end_char is {'\n', '\r'};
const set of char: white_space_char is {' ', '\t', '\n', '\r'};
const set of char: white_space_or_end_tag is white_space_char | {'>'};
const set of char: white_space_or_printable is white_space_char | {'!' .. '~'};
const set of char: equals_or_end_tag is {'=', '>'};
const set of char: special_comment_char is {'(', '*', EOF};
const set of char: html_name_start_char is letter_char | {'-', '.', '_', ':'};
const set of char: html_name_char is alphanum_char | {'-', '.', '_', ':'};
const set of char: http_separators is
{'(', ')', '<', '>', '@', ',', ';', ':', '\\',
'/', '[', ']', '?', '=', '{', '}'};
const set of char: http_token_char is {'!' .. '~'} - http_separators - double_quotation_char;
const set of char: no_escape_char is
{' ', '!', '#', '$', '%', '&', ''',
'(', ')', '*', '+', ',', '-', '.', '/',
'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', ':', ';', '<', '=', '>', '?',
'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
'X', 'Y', 'Z', '[', ']', '^', '_',
'`', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
'x', 'y', 'z', '{', '|', '}', '~'};
const array string: esc_tab is [](
"\"", " ", " ", " ", " ",
"'", " ", " ", " ", " ",
" ", " ", " ", " ", " ",
" ", " ", " ", " ", " ",
" ", " ", " ", " ", " ",
" ", " ", " ", " ", " ",
" ", "\A", "\B", "\C", "\D",
"\E", "\F", "\G", "\H", "\I",
"\J", "\K", "\L", "\M", "\N",
"\O", "\P", "\Q", "\R", "\S",
"\T", "\U", "\V", "\W", "\X",
"\Y", "\Z", " ", "\\", " ",
" ", " ", " ", "\a", "\b",
" ", " ", "\e", "\f", " ",
" ", " ", " ", " ", " ",
" ", "\n", " ", " ", " ",
"\r", " ", "\t", " ", "\v");
const func integer: pos (in string: stri, in set of char: chSet) is func
result
var integer: pos is 0;
local
var char: ch is ' ';
var integer: index is 0;
begin
for ch key index range stri until pos <> 0 do
if ch in chSet then
pos := index;
end if;
end for;
end func;