looplang/doc/syntax.md

4.7 KiB

Values

Null

Null can be used with null.

Booleans

True can be used with true and false with false.

Numbers

Integer values can be defined like followed (example with the value 127):

+----------------+--------------------------------------+ | Encoding type: | Code: | +----------------+--------------------------------------+ | Binary | 0b0111111 or 0B0111111 | +----------------+--------------------------------------+ | Octal | 0o0177 or 0O177. Please use the | | | lower case for a better readability. | +----------------+--------------------------------------+ | Decimal | 127 | +----------------+--------------------------------------+ | Hexadecimal | 0x7f, 0x7F, 0X7f or 0X7F. | | | Mixing of upper and lowercase is | | | allowed. | +----------------+--------------------------------------+

Strings

A string can be defined by putting single quotes around it like 'text'. This strings aren't allowed to have line breaks (or single quotes). For string with line breaks use three single quotes like '''text'''. Be aware that indenting isn't consider and will be written into the string (when a line breaks appears into the string).

To escape specific string values (like single quotes):

+--------------------+-------------------------------------------+ | Encoding name: | Enconding inside of the code: | +--------------------+-------------------------------------------+ | Backslash (\) | \\ | +--------------------+-------------------------------------------+ | Single Quote (') | \' | +--------------------+-------------------------------------------+ | Bell | \a | +--------------------+-------------------------------------------+ | Backspace | \b | +--------------------+-------------------------------------------+ | Formfeed | \f | +--------------------+-------------------------------------------+ | New line | \n | +--------------------+-------------------------------------------+ | Carriage return | \r | +--------------------+-------------------------------------------+ | Horizontal tab | \t | +--------------------+-------------------------------------------+ | Vertical tab | \v | +--------------------+-------------------------------------------+ | Octal 8-Bit | \YYY | | | | | | YYY have to be filled with the | | | octal representation of the char. | | | Allowed are three values between 0-7. | +--------------------+-------------------------------------------+ | 8-Bit Unicode | \xYY or \XYY | | | | | | YY have to be filled with the | | | hexadecimal representation of the char. | | | Allowed are two values between 0-9, | | | a-f and A-F. Mixing lower and upper | | | case is allowed. | +--------------------+-------------------------------------------+ | 16-Bit Unicode | \uYYYY | | | | | | YYYY have to be filled with the | | | hexadecimal representation of the char. | | | Allowed are four values between 0-9, | | | a-f and A-F. Mixing lower and upper | | | case is allowed. | +--------------------+-------------------------------------------+ | 32-Bit Unicode | \UYYYYYYYY | | | | | | YYYYYYYY have to be filled with | | | hexadecimal representation of the char. | | | Allowed are eight values between 0-9, | | | a-f and A-F. Mixing lower and upper | | | case is allowed. | +--------------------+-------------------------------------------+