Names

In the Erbsland Configuration Language, names are essential for identifying values, sections, and subsections within a configuration. There are two types of names used:

  1. Regular names (or simply names): These are primarily used throughout the configuration to define sections and values.

  2. Text names: These are reserved for special cases where a portion of text needs to be directly mapped to a configuration section or value.

Name Definition

Names are defined by a sequence of alphanumeric characters, with optional spaces or underscores to separate words.

name                ::= ALPHA DIGIT_OR_ALPHA* name_part*
name_part           ::= word_separator DIGIT_OR_ALPHA+
word_separator      ::= SPACE | UNDERSCORE

Rules

  1. Characters: Names can contain letters (az, AZ), digits (09), spaces ( ), and underscores (_).

    Valid names:            Name
                            multiple_words
                            Multiple Words
                            Name123
                            Value 200
                            X_Axis
    
  2. Starting Character: Names must always begin with a letter.

    100days                 # ERROR! Starts with a digit.
    _example                # ERROR! Starts with an underscore.
    
  3. Case-Insensitive: Names are case-insensitive.

    Three identical names:  Example_Name
                            example_name
                            EXAMPLE_NAME
    
  4. Spaces and Underscores are Interchangeable: A name can be written with spaces or underscores, and they are treated the same.

    Three identical names:  one_long_name
                            One Long Name
                            one_long NAME
    
  5. No Consecutive Word Separators: Names cannot contain consecutive underscores or multiple spaces in a row.

    example__name           # ERROR! Multiple underscores aren't allowed.
    Example  Name           # ERROR! Multiple spaces aren't allowed.
    example _name           # ERROR! Mixing spaces and underscores makes no difference.
    
  6. No Trailing Underscores: Names must not end with an underscore.

    example_                # ERROR! Must not end with an underscore.
    
  7. Maximum Length: Names must not exceed 100 characters in length.

    abc(+200 chars)xyz      # ERROR! Exceeds the maximum length of 100 characters.
    

    Micro-Parsers

    The maximum length of a name is 30 characters.

Name Normalization

When normalizing a name, the following two rules are applied:

  1. Convert to Underscores: Replace all spaces ( ) with underscores (_).

    Name with Spaces                  => name_with_spaces
    
  2. Convert to Lowercase: Convert all uppercase letters (AZ) to lowercase (az).

    EXAMPLE                           => example
    Multiple_Words                    => multiple_words
    

Name Comparison

Name comparison is crucial for identifying sections and values using name paths and for detecting name conflicts. The following rules apply when comparing names:

  1. Normalize Regular Names for Comparison: Regular names must be compared using their normalized form. For details on normalization, refer to Name Normalization.

    EXAMPLE               == example
    Example               == example
    eXaMpLe               == example
    Name with Words       == name_with_words
    Name_with_Words       == name_with_words
    

For the comparison of text names, see Text Name Comparison in the next chapter.

Features

Feature

Coverage

core

Regular names are part of the core language.

text-names

Text names are a standard feature.

Errors

Error Code

Causes

Syntax

Raised if a name starts with an underscore or a digit.
Raised if a name ends with an underscore.
Raised if a name contains consecutive underscores or spaces.

NameConflict

Raised if an already used name is reused.

LimitExceeded

Raised if a name exceeds the 100-character limit.