Logmanager documentation
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Logmanager language reference

Logmanager language reference is description of internal language, used in parser section. This document describes the semantics of the internal Logmanager language and will be useful as reference to create a Blockly schema.

Message parsing and processing language elements

Standard types

None

This type has only single value. There is only one object of this value. It is used to signify absence of value. Truth value is false.

Integers (int)

These represent numbers in an unlimited range, subject to available (virtual) memory only.

Real (float)

These represent machine-level double precision floating point numbers.

Booleans

Represents truth values True or False. Booleans behave as integers of value 1 and 0.

Sequences

These represent finite ordered sets indexed by non-negative numbers. The built-in function len() returns the number of items of a sequence. When the length of a sequence is n, the index set contains the numbers 0, 1, …, n-1. Item i of sequence a is selected by a[i].

Sequences also support slicing: a[i:j] selects all items with index k such that i <= k < j. When used as an expression, a slice is a sequence of the same type. This implies that the index set is renumbered so that it starts at 0.

Mutable sequences

Mutable sequences can be changed after they are created. The subscription and slicing notations can be used as the target of assignment and del (delete) statements.

Implemented mutable sequence type is list.

Lists

The items of a list are arbitrary objects. Lists are formed by placing a comma-separated list of expressions in square brackets.

Immutable sequences

An object of an immutable sequence type cannot change once it is created.

Implementation of immutable sequence is string.

Strings

A string is a sequence of values that represent Unicode code points.

Mappings

These represent finite sets of objects indexed by arbitrary index sets. The subscript notation a[k] selects the item indexed by k from the mapping a; this can be used in expressions and as the target of assignments or del statements. The built-in function len() returns the number of items in a mapping.

Dictionaries

These represent finite sets of objects indexed by nearly arbitrary values. The only types of values not acceptable as keys are values containing lists or dictionaries or other mutable types that are compared by value rather than by object identity.

Advanced types

Those types are derived from basic standard types with extended functionality.

IP address

Representation of IP address derived from mapping type.

Assignment of string value into this type attempts to identify if given string is a IP address. Otherwise represents IP address of 0.0.0.0.

Sub values of this type are read only and can be accessed via standard mapping access.

MAC address

Representation of MAC address (IEEE 802 MAC-48 address) in human friendly form.

Assignment of a string value into this type attempts find 12 hexadecimal characters and form normalized MAC address representation.In case of invalid input value represents address of value “000000000000”.

Sub values of this type are read only and can be accessed via standard mapping access.

Expressions

Variables

Every variable has unique identifier and value with type defined by assignment. Special build-in variables can be for reading only.

Slicings

A slicing selects a range of items in a sequence object (e.g., a list, string). Slicing may be used as expressions or as targets in assignment or del statements.

Subscription

Subscript selects value of item from mapping objects. In case that mapping object is also Mutable subscription can be used as an expression in del statement.

Comparisions

Comparisons yield boolean values: True or False.

Comparisons can be chained arbitrarily, e.g., x < y <= z is equivalent to x < y and y <= z.

Arithmetic

Arithmetic operations are define only on numeric data types and between them. Use of arithmetic operators on any other type have undefined results which can change between versions.

Value comparison

The operators <, >, ==, >=, <=, and != compare the values of two objects. The objects do not need to have the same type.

Membership test operators

The operators in and not in test for membership. x in s evaluates to true if x is a member of s, and false otherwise.

Boolean operations

In the context of Boolean operations, and also when expressions are used by control flow statements, the following values are interpreted as false: False, None, numeric zero of all types, and empty strings and containers (including strings, tuples, lists, dictionaries). All other values are interpreted as true.

The operator not yields True if its argument is false, False otherwise.

Simple Statements

return assignment del with

Assignment statement

Assigns value to variable expression. As expression can be used variable, slicing, subscription.

Del statement

Deletion of a name removes the binding of that name from the local or global namespace.

Deletion of attribute references, subscriptions and slicing is passed to the primary object involved; deletion of a slicing is in general equivalent to assignment of an empty slice of the right type (but even this is determined by the sliced object).

Return statement

return leaves the current function call with the value (or None) as return value.

If statement

The if statement is used for conditional execution.

With statement

Statement defines execution context which is wrapped in specified context managers.

Function definitions

A function definition defines a user-defined function object.

In fact parameter names and values are specified by given block types.

A function definition is an executable statement. Its execution binds the function name in the current local namespace to a function object (a wrapper around the executable code for the function). This function object contains a reference to the current global namespace as the global namespace to be used when the function is called.

The function definition does not execute the function body; this gets executed only when the function is called.

Calls

A call calls a callable object (e.g., a function) with a possibly empty series of arguments:

The primary must evaluate to a callable object (user-defined functions, built-in functions, methods of built-in objects; extensions may define additional callable object types). All argument expressions are evaluated before the call is attempted.

Calls are currently defined in special blocks with specified arguments.