--- parser3/operators.txt 2026/10/26 22:52:46 1.274 +++ parser3/operators.txt 2026/11/29 17:53:21 1.280 @@ -19,6 +19,7 @@ operators e.g., "is the method parameter not a hash?" -f checks if a file exists on disk, -d checks if a directory exists on disk, + -l checks if a symbolic link exists on disk, a quoted string (double or single quotes) is treated as a string, unquoted text is a string until the nearest whitespace numeric literals can be in hex format like 0xABC priorities: @@ -28,7 +29,7 @@ operators %left "&&" %left '<' '>' "<=" ">=" "lt" "gt" "le" "ge" %left "==" "!=" "eq" "ne" - %left "is" "def" "in" "-f" "-d" + %left "is" "def" "in" "-f" "-d" "-l" %left '!' /* bitwise */ @@ -166,6 +167,11 @@ odbc parser3odbc.dll in the catch code, $exception.handled[cache] ^rem{flag that exception is handled} ^cache[file][expires date]{code}[{catch code}] absolute time assignment + ^cache[file][ $.expires(seconds)|[expires date] $.extend(seconds) ]{code}[{catch code}] + the same, with the options + $.extend(seconds) if the cache expired no more than 'seconds' ago [$MAIN:LIMITS.lock_wait_timeout by default], one request renews it, the others get the old copy meanwhile + for no more than 'seconds': if the code runs longer or fails, the next request renews the cache + if cache expired more than 'seconds' ago, there is no copy, or with $.extend(0), the others wait for the result: the code does not run twice ^cache[file] deletes the file [no error if it doesn't exist] ^cache(seconds) @@ -300,6 +306,11 @@ string ^string.pos[substring] ^string.pos[substring](position from which to search) <0 = not found + ^string.rpos[substring] + the last substring in the string + ^string.rpos[substring](maximum position of the substring start) + the last substring that starts at or before the position + <0 = not found ^string.replace[$table_of_substitutions_string_to_string] ^string.replace[$what;$to] ^string.save[[append;]path] @@ -365,9 +376,9 @@ table ^table.count[cells] number of cells in the current row ^table.sort{{string-key-maker}|(numeric-key-maker)}[{desc|asc}] default=asc - ^table.append{data} + ^table.append{data}[[$.separator[^#09] $.encloser[]]] ^table.append[ $.column_name[column_value] ] - ^table.insert{data} add a record at the current position + ^table.insert{data}[[$.separator[^#09] $.encloser[]]] add a record at the current position ^table.insert[ $.column_name[column_value] ] ^table.delete[] deletes the record at the current position @@ -616,11 +627,13 @@ file $uploaded_file_from_post.text ^file.save[text|binary;filename[;$.charset[which charset to save in] $.append(false)]] ^file:delete[filename] + ^file:rmdir[dirname[; $.exception(false) ]] + removes the empty directory ^file:find[filename][{if not found}] ^file:list[path[;pattern-string|pattern-regex]] - table with columns name dir + table with columns name dir symlink ^file:list[path;$.filter[pattern-string|pattern-regex] $.stat(true)] - table with columns name dir size [mca]date + table with columns name dir symlink size [mca]date ^file::load[text|binary;big.zip[;domain_press_release_2001_03_01.zip][;options]] ^file::create[text|binary;filename;data] ^file::create[text|binary;filename;data[;$.charset[charset of the created file] $.content-type[...]]] @@ -639,7 +652,8 @@ file options: $.stdin[text|file] if empty, disables automatic passing of HTTP-POST data ^file:move[oldfilename;newfilename] - can rename and move directories [win32: but not across disk boundaries] + can rename and move files and directories, but not across disk boundaries + the existing file is replaced, as well as the empty directory if a directory is moved directories for dest are created with 775 permissions source directory is removed if empty after move ^file:copy[filename;copy_filename[; $.append(1) ]] @@ -930,6 +944,9 @@ mail ] $.message#[MESSAGE] (message, message2, ...) + ^mail:parse[string|file] + parses the letter and returns MESSAGE, the same as $mail.received for the incoming one + ^mail:send[ $.options[-odd] unix: a string that will be added to the sendmail startup command @@ -1034,6 +1051,7 @@ math ^math:round floor ceiling ^math:trunc frac ^math:abs sign + ^math:min(a;b[;c...]) max(a;b[;c...]) ^math:exp log log10 ^math:sin asin cos acos tan atan atan2 ^math:degrees radians @@ -1071,6 +1089,8 @@ math ^math:digest[[md5|sha1|sha256|sha512];string or file][[ $.format[hex|base64|file] $.hmac[key string|key file] ]] combines the ability to use various cryptographic hashing algorithms. $.hmac[key] for verifying the integrity of transmitted data + ^math:xxhash[xxh32|32|xxh64|64;string or file][[ $.format[hex|base64|file] ]] + fast non-cryptographic xxHash, 4 or 8 bytes, the most significant byte first memory ^memory:compact[] @@ -1499,4 +1519,4 @@ system error types: if the method description explicitly contains the local variable result (there is also an implicit variable), then the code for outputting whitespace literals does not get into the final bytecode -$Id: operators.txt,v 1.274 2026/10/26 22:52:46 moko Exp $ +$Id: operators.txt,v 1.280 2026/11/29 17:53:21 moko Exp $