--- parser3/operators.txt 2024/12/20 19:20:02 1.263 +++ parser3/operators.txt 2026/11/04 13:41:23 1.276 @@ -156,6 +156,9 @@ odbc parser3odbc.dll ^rem{} a comment, removed at compile time + ^syslog[ident;message[;info|warning|error|debug]] + writes a message to syslog + ^cache[file](seconds){code}[{catch code}] relative time assignment caches the string resulting from the code execution for 'seconds' seconds @@ -241,6 +244,8 @@ int,double boolean value ^name.inc(how much +) ^name.dec(how much -) + ^name.++[] output the value, then increment by 1 + ^name.--[] output the value, then decrement by 1 ^name.mul(how much *) ^name.div(how much /) ^name.mod(how much %) @@ -295,6 +300,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] @@ -427,7 +437,7 @@ hash ^hash.foreach[key;value]{body}[[delimiter]|{delimiter executed before each non-empty non-first body}] ^hash.delete[key] delete key - ^hash.contain[key] + ^hash.contains[key] checks if hash contains a key (bool) ^hash.at[first|last][[key|value|hash]] ^hash.at([-]N)[[key|value|hash]] @@ -435,6 +445,8 @@ hash ^hash.set[first|last;value] ^hash.set([-+]N)[value] sets the value of the specified ordered hash element + ^hash.array[[keys|values]] + is equivalent to ^array::copy[$hash] or returns an array of the hash’s keys or values ^hash.rename[old_key;new_key] ^hash.rename[ $.old_key[new_key] ...] renames the specified hash keys @@ -508,7 +520,7 @@ array adds an element to the end of the array ^array.pop[] returns the last element and removes it from the array - ^array.contain(index) + ^array.contains(index) checks if an element exists at the given index (bool) ^array::sql{query}[ $.sparse(false|true) $.distinct(false|true) $.limit(n) $.offset(n) $.type[hash|string|table] ] creates an array based on a database query @@ -584,6 +596,8 @@ date date - %Y-%m-%d time - %H:%M:%S where published='^date.sql-string[]' + ^date:sql-string[[datetime|date|time]] + sql-string for now ^date:calendar[rus|eng](year;month) returns an unnamed table, columns: 0..6, week, year ^date:calendar[rus|eng](year;month;day) @@ -594,15 +608,21 @@ date returns the last day of $date's month ^date.gmt-string[] Fri, 23 Mar 2001 09:32:23 GMT + ^date:gmt-string[] + gmt-string for now ^date.iso-string[] 2001-03-23T12:32:23+03 + ^date:iso-string[] + iso-string for now file $uploaded_file_from_post.name $uploaded_file_from_post.size $uploaded_file_from_post.text - ^file.save[text|binary;filename[;$.charset[which charset to save in]]] + ^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 @@ -626,7 +646,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) ]] @@ -736,6 +757,45 @@ regex $pattern.options the string with the original text of the options +amqp + ^amqp::create[[ + $.host[localhost] $.port(5672) $.user[guest] $.password[guest] $.vhost[/] $.locale[en_US] + $.heartbeat(30) $.auto_reconnect(seconds) + $.tls[ $.ca[file] $.cert[file] $.key[file] $.verify(true) ] + ]] + connects to a RabbitMQ broker + auto_reconnect(N): after a lost connection reconnect before the next operation, waiting N seconds + tls: the server certificate is verified only if ca is specified + ^amqp.publish[message][[ + $.exchange[] $.routing_key[key]|$.queue[name] $.mandatory(false) + message properties: $.content_type[] $.content_encoding[] $.delivery_mode(1|2) $.priority(N) $.correlation_id[] $.reply_to[] + $.expiration[] $.message_id[] $.timestamp(N) $.type[] $.user_id[] $.app_id[] $.cluster_id[] $.headers[hash] + ]] + ^amqp.consume[ $.queue[name] $.ack(true) $.count(1) $.timeout(0) $.exclusive(false) $.consumer_tag[] ] + array of messages ready within timeout seconds (only the first one is waited for) + ^amqp.consume[ $.queue[name] $.callback[$method] ... ] + calls @method[message] for each message until ^amqp.stop_consume[], count messages or timeout seconds without messages + count and timeout are unlimited by default + message: hash with msg, delivery_tag, routing_key, exchange, redelivered, consumer_tag and the properties set + ^amqp.ack(delivery_tag) + with $.ack(true) (default) received messages must be acknowledged + ^amqp.nack(delivery_tag)[ $.requeue(false) ] + ^amqp.reject(delivery_tag)[ $.requeue(true) ] + ^amqp.qos[ $.prefetch_count(N) ] + ^amqp.declare[ $.queue[name] $.durable(false) $.exclusive(false) $.auto_delete(false) $.passive(false) $.arguments[hash] ] + for an empty name the server creates a queue with its own name, which is returned + ^amqp.declare[ $.exchange[name] $.type[direct] $.durable(false) $.auto_delete(false) $.internal(false) $.passive(false) $.arguments[hash] ] + ^amqp.delete[ $.queue[name]|$.exchange[name] $.if_unused(false) $.if_empty(false) ] + ^amqp.bind[ $.exchange[name] $.queue[name] $.routing_key[] ] + ^amqp.unbind[ $.exchange[name] $.queue[name] $.routing_key[] ] + ^amqp.purge[ $.queue[name] ] + number of deleted messages + ^amqp.info[ $.queue[name] ] + hash with queue, messages, consumers + ^amqp.release[] + closes the connection + arguments and headers values: [string], (number), (true|false) + console $console:timeout $console:line @@ -745,7 +805,7 @@ cookie $cookie:name read old or newly set cookie $cookie:name[value] for 90 days $cookie:name[$.value[value] $.expires[VALUE] $.secure(true) $.domain[domain name] $.httponly(true)] - the expires field value can be 'session', a date, or a number of days (0days=forever) + the expires field value can be 'session', a date, or a number of days (0days=session) if it's a date, it will be converted to "Sun, 25-Aug-2002 12:03:45 GMT" $cookie:fields hash with all cookies @@ -901,9 +961,9 @@ mail $value[FILE] ] ] - if charset is specified, the email is transcoded to this charset - content-type.charset does not affect transcoding - after the part name a # number can follow + if charset is specified, the email is transcoded to this charset + content-type.charset does not affect transcoding + after the part name a # number can follow ^mail:send[ # by default, matches the source encoding. @@ -982,6 +1042,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 @@ -992,6 +1053,8 @@ math ^math:convert[number|file](base-from)[alphabet][[ $.format[string|file] ]] converts a string or file with a number from one numeral system to another the numeral system can be set by an alphabet, a number from 2 to 16 (equivalent to the alphabet 0123456789ABCDEF), or 256 (all ASCII characters) + ^math:eq(a;b[;max ULP]) + true if difference between doubles less or equal max ULPs (default 3) ^math:uuid[ $.lower(bool) $.solid(bool) ] 22C0983C-E26E-4169-BD07-77ECE9405BA5 win32: uses cryptapi @@ -1017,6 +1080,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[] @@ -1085,10 +1150,38 @@ reflection the current state of the method call stack in the parser ^reflection:mixin[source; $.to[target] $.name[name] $.methods(true/false) $.fields(true/false) $.overwrite(false/true)] copies methods and fields from one class to another + ^reflection:override[method[; $.to[target] $.name[new_name]]] + overrides or defines a method + +redis + ^redis::open[[ + $.host[localhost] $.port(6379)|$.unix_socket[path] + $.user[] $.password[] $.db(0) $.timeout(2) $.protocol(3) $.auto_reconnect(seconds) + $.tls[ $.ca[file] $.cert[file] $.key[file] $.verify(true) ] + ]] + connects to a redis server + timeout in seconds for connecting and for each command, 0 - unlimited + protocol(2) for servers before redis 6 + auto_reconnect(N): after a lost connection reconnect before the next command, waiting N seconds + tls: the server certificate is verified only if ca is specified + ^redis.command_name[arguments;...] + any redis command, e.g. ^redis.set[key;value] ^redis.get[key] ^redis.hgetall[key] + ^redis.call[command;arguments;...] + ^redis.f-command_name[arguments;...], ^redis.f-call[command;arguments;...] + the strings of the reply are files (binary data) + arguments: string, number, bool as 1/0, file as its content; array - its elements, hash - key value pairs + reply: string, int, double, bool, void (nil), array, hash (map); an error reply is an exception + ^redis.release[] + closes the connection request + https://site.name/a%20b/?name=some%20value $request:query + name=some%20value $request:uri + /a%20b/?name=value + $request:path + /a b/ $request:document-root directory relative to which paths are considered in parser, default = $env:DOCUMENT_ROOT $request:argv @@ -1411,11 +1504,10 @@ system error types: http.response ^file::load[http://ok/there] host found, connection accepted, bad answer http.status ^file::load[http://ok/there] host found, connection accepted, status!=200 date.range ^date::create(10000;1;1) date out of valid range - -if $SIGPIPE(1) is defined in MAIN, then if processing was interrupted by the user, a message - about this is written to parser3.log + amqp ^amqp::create[$.port(1)] connection failed/error from the broker + redis ^redis::open[$.port(1)] connection failed/error reply 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.263 2024/12/20 19:20:02 moko Exp $ +$Id: operators.txt,v 1.276 2026/11/04 13:41:23 moko Exp $