Named Values

In ELCL, each section can have zero or more named values assigned to it. Named values follow a specific syntax that supports various data types and list structures.

The basic syntax consists of the value name, followed by a value separator, then the value assignment, and is finally terminated by an end-of-line sequence. The end-of-line sequence may include optional spacing, an optional comment, and a line break.

value_line          ::= value_name value_separator value_assignment end_of_line

value_name          ::= meta_name | name | text_name
meta_name           ::= AT_SIGN name

value_separator     ::= spacing (COLON | EQUAL) spacing
name : value [#comment]

The value assignment can appear directly after the value separator on the same line, or it can be indented on the next line. While both forms support single-line value lists, multi-line lists can only begin when the value is placed on the next line.

value_assignment    ::= value_on_same_line | value_on_next_line

value_on_same_line  ::= ml_value | sl_value_or_list
value_on_next_line  ::= end_of_line (ml_value_list | indentation_pattern (ml_value | sl_value_or_list))
name : value [#comment]
... or ...
name : [#comment]
    value [#comment]

The distinction between single-line and multi-line values is important because multi-line values cannot be used in lists.

sl_value            ::= datetime | date | time | float | integer |
                        boolean | text_value | code | binary | regex | time_delta
ml_value            ::= multi_line_text | multi_line_code |
                        multi_line_binary | multi_line_regex
  • In the EBNF syntax above, the symbol end_of_line is described in Comments.

  • Single-line and multi-line value lists, with the symbols sl_value_or_list and ml_value_list are described in Single-Line Value Lists and Multi-line Value Lists.

  • The symbols for specific value types, like datetime, are described in later chapters.

Named Value Rules

  1. Start at the Beginning: The name of a value, whether a regular name or a text name, must always start at the beginning of a line.

    [main]
    value 1: 123       # OK!
    
    [main]
        value 2: 123   # ERROR! The value name must start at the beginning of the line.
    
  2. Value Separator: A value separator, either a colon (:) or an equal sign (=), must follow the name. Optional spaces are allowed around the separator.

    [main]
    value 1: 123       # OK!
    value 2   =  123   # OK!
    
  3. Value on the Same or Next Line: The value must either follow the separator on the same line or start on the next line.

    [main]
    value 1: 123       # OK!
    value 2:
        123            # OK!
    
  4. Indentation Required: If the value starts on the next line, it must be indented by at least one space or tab character.

    [main]
    value:
        123           # OK!
    
    [main]
    value:
    123               # ERROR! The value is not indented.
    
  5. No Empty Line: There must be no empty line between the name and its value. Lines that contain only spaces, tabs and/or a comment are treated as empty lines.

    [main]
    value:
                        # Empty line (spaces, tabs and/or a comment)
        123             # ERROR! No empty line is allowed.
    
  6. Handling Name Conflicts: The guidelines for resolving name conflicts are detailed in Name Paths.

Example

[main]
first value: 123             # Simple case: name and value on the same line.
second value   : 123         # Extra spacing is allowed between the name and separator.
third value:                 # Value can start on the next line.
    123                      # Indentation is required when the value continues on the next line.
# Comments or lines with only spacing are allowed between value assignments.
fourth value: 123

fifth value: 123

[text values]
"text" : 123                 # Quoted names follow the same rules as unquoted names.

Features

Feature

Coverage

core

Regular names, meta values and the value assignment are part of the core language.

text-names

Text names are a standard feature.

multi-line

Multi-line values are a standard feature.

value-list

Value lists are a standard feature.

float

Floating point values are a standard feature.

date-time

Date-time values are a standard feature.

code

Code text values are a standard feature.

byte-data

Byte-data values are a standard feature.

regex

Regular expression values are an advanced feature.

time-delta

Time delta values are an advanced feature.

Errors

Error Code

Causes

All errors from invalid names. See Names.

NameConflict

Raised if a value name causes a name conflict as described in Name Conflicts.

Syntax

No value separator follows the name or text name.
No value follows a value separator on the same or the next line.

Indentation

There is spacing before the name.
There is no spacing before the value if the value is defined on the next line.