DiGrande.it

Blind, Braille and Embossing Technologies

This site uses cookies to personalize content and ads, provide social media features and analyze links. By closing this banner or continuing to browse, you consent to their use.
Read the DiGrande.it Cookie Policy

The language of the “Condition of text” line

Each window for adding or modifying a “Writing Element” contains the “Text Condition” field, where a specially designed programming language can be used. The conditional language includes logical operators and instructions. Each instruction is always written in a concise form, typically consisting of two letters.

The “Condition” field of each Writing Element contains instructions that condition the text writing process. Each Key thus becomes an active element in writing, capable of behaving differently based on the specified conditions. All usable instructions are contained in a contextual menu associated with the field, making them easily accessible when needed.

Key instructions generally consist of two letters. It is essential to respect case sensitivity. These instructions are interpreted in real-time by Biblos during typing. To avoid slowing down the typing process, these instructions are designed in a concise structure to optimize execution.

The line of conditional instructions always results in a boolean value of true or false. If the boolean expression returns true, the Element is used; if false, it is ignored.

There are three logical operators that result in a true or false condition. The logical operators are:

- "&" - AND operator, logical conjunction.

A & B - True if both A and B are true, false otherwise.

- "|" - OR operator, logical disjunction.

A | B - False if both A and B are false, true otherwise.

- "!" - NOT operator, logical negation.

!A - True if A is false, false if A is true.

LOGICAL CONJUNCTION: And

The "&" operator (Ampersand) performs a logical conjunction (And), resulting in true if both operands are true, and false otherwise. Since it is a binary operator and each operand has two values, there are four possible combinations:

True & True = True

False & False = False

False & True = False

True & False = False

The implied operator between instructions is always the AND operator. This means that if the logical operator is omitted, it is implicitly AND. Thus, writing "A & B" is almost the same as writing "A B".

LOGICAL DISJUNCTION: Or

The "|" operator (Vertical Bar) performs a logical disjunction (OR), resulting in true if at least one of the operands is true, and false if both operands are false. Since it is a binary operator and each operand has two values, there are four possible combinations:

True | True = True

False | False = False

False | True = True

True | False = True

LOGICAL NEGATION: Not

The "!" operator (Exclamation Mark) is used to perform logical negation (Not). The logical negation of a boolean value results in the opposite value. If an instruction returns a true value, then "! Instruction" returns false, and vice versa. Since logical negation is a unary operator, there are only two possible values for its single operand: true or false.

One or more instructions can be enclosed in parentheses "(...)" to define a block. Enclosing instructions in blocks is useful for evaluating the final result of the instructions within the block, rather than the individual results of each instruction. For example:

- A & B | C - The expression is true if A is true and B is true, or if C is true. The evaluation of the expression stops if A and B are true; otherwise, it continues by evaluating C. Additionally, if A is false, the evaluation stops with a result of false.

- A & (B | C) - The expression is true if A is true and either B or C is true. The evaluation of the expression stops if A is false, or it continues by entering the block of instructions, evaluating B, stopping if B is true, or proceeding to evaluate C.

SHORT CIRCUIT:

When logical operators are explicitly used, expressions are interpreted following the SHORT CIRCUIT technique. This means that if the already evaluated part provides a value sufficient to satisfy the entire expression, the remaining part is ignored, and the evaluation stops. For example:

- A | B - If A is true, B is not evaluated because the expression would still result in true.

- A & B - In this case, both A and B must be true to satisfy the expression, so the entire expression is evaluated if A is true. Otherwise, if A is false, the evaluation stops because the expression would be false regardless of B's value.

SHORT CIRCUIT AND IMPLICIT AND

In expressions where the & (AND) operator is not explicitly specified, short circuit evaluation is not applied. For example:

- A B - The expression is evaluated for both A and B, even if A is false. At the end, if both A and B are true, the expression will be true.

- A & B - In this case, we have explicitly used the AND operator. If A is false, B is not evaluated because the short circuit considers the expression false.

CURSOR POSITION AND INSTRUCTIONS

Note that Biblos analyzes the text starting from the current position of the writing cursor. Instructions fulfill their conditions (true or false) by reading the text at or around the cursor. Generally, instructions require values. The instruction always refers to the cursor position to check if the value matches the surrounding text. Each instruction always returns a unary boolean value (true or false). It will return true if the text and value match; otherwise, it returns false.