Menu

Tree [73bbbd] master /
 History

HTTPS access


File Date Author Commit
 Harrier-GR3-set.iml 2021-06-08 Julian Smith Julian Smith [78bca8] Adding sample input and output files.
 Harrier-GR3-set.iml.noindent.xml 2021-06-09 Julian Smith Julian Smith [73bbbd] Added control over whether to indent element data.
 Harrier-GR3-set.iml.xml 2021-06-09 Julian Smith Julian Smith [73bbbd] Added control over whether to indent element data.
 Harrier-GR3-set.xml 2021-06-08 Julian Smith Julian Smith [78bca8] Adding sample input and output files.
 Makefile 2021-06-09 Julian Smith Julian Smith [73bbbd] Added control over whether to indent element data.
 README.md 2021-06-09 Julian Smith Julian Smith [73bbbd] Added control over whether to indent element data.
 iml.cxx 2021-06-08 Julian Smith Julian Smith [625543] iml.cxx: removed docs as now in README.md.
 iml.hxx 2021-06-09 Julian Smith Julian Smith [73bbbd] Added control over whether to indent element data.
 main.cxx 2021-06-09 Julian Smith Julian Smith [73bbbd] Added control over whether to indent element data.

Read Me

IML - Indentation Markup Language

Contents.

IML format

  • Indentation is used to define structure and "double indentation" is used for
    multi-line values. This results in a very clean syntax with no need to escape
    special characters.

  • Colons and square brackets can be optionally added to aid readability.

  • The "#" character is used for comments.

  • There are two types of line, "Simple lines" and "Double-indented lines".

Simple lines

  • A simple line must start with an exact multiple of 4 spaces, followed by
    the name of the element, optional space-separated attributes in the form
    <name>=<value>, and finally the value for the element (which can be an empty
    string).

  • Element and attribute names must start with a letter and thereafter contain
    only letters, digits, minus sign and underscore characters.

  • Attribute values should be inside double-quotes if they are not in the same
    format as element and attribute names.

  • If the value starts with a space, this space is skipped.

  • A simple line cannot be indented by more than 4 spaces beyond the previous
    simple line.

  • Simple lines starting with "#" are ignored.

For example:

PropertyList
    sim
        view n="0"
            x-offset-m type=float archive="y" 0.0
    nasal

is equivalent to:

<PropertyList>
    <sim>
        <view n="0">
            <x-offset-m type="float" archive="y">0.0</x-offset-m>
        </view>
    </sim>
    <nasal>
    </nasal>
</PropertyList>

Optional formatting

To aid readability, attributes can optionally be inside square brackets and one
can insert a colon or colon+space before the value:

x-offset-m [type=float archive="y"]: 0.0

Colons or square brackets can be used if the initial part of the value would
otherwise be interpreted as attributes:

foo: bar=12

Double-indented lines

  • Lines that are indented by 8 or more spaces beyond the most recent simple
    line.

  • Always used for the value of the current element.

  • Can be used to define multi-line values.

  • The use of indentation means that there is no need to escape any special
    characters - for example angled-brackets and braces can be specified verbatim.

For example:

PropertyList
    sim
        # Info
        description Hawker Siddeley Harrier GR3
        long-description
                The Hawker Siddeley Harrier, developed in the 1960s, was the
                first of the Harrier Jump Jet series of aircraft. It was the first
                operational close-support and reconnaissance fighter aircraft with
                vertical/short takeoff and landing (V/STOL) capabilities and the only
                truly successful V/STOL design of the many that arose in that era.

is equivalent to:

<PropertyList>

    <sim>
        <!-- Info -->
        <description>Hawker Siddeley Harrier GR3</description>
        <long-description>The Hawker Siddeley Harrier, developed in the 1960s, was the
first of the Harrier Jump Jet series of aircraft. It was the first
operational close-support and reconnaissance fighter aircraft with
vertical/short takeoff and landing (V/STOL) capabilities and the only
truly successful V/STOL design of the many that arose in that era.
        </long-description>
    </sim>
</PropertyList>

The n + 8 indentation is removed from the specified text.

IML parser

  • See iml.hxx and iml.cxx.

Errors

The parser throws an exception if it finds a parse error, and the exception
text shows the location where the error occurred. For example:

Failed: Harrier-GR3-set.iml:50:11: Bad indentation of 11 spaces; current indentation=16 so expected indentation of 0, 4, 8, 12, 16, 20 or >= 24.

iml - a command line programme to convert IML to XML

  • Uses a class derived from iml_visitor to write XML.

  • Run with -h or --help to see help.

Build/test

On Unix, running make will build iml and run a couple of simple tests.

License

GPL.