LumixEngine

Text-based markup

Example:

[box id="main" width=800 height=600] {
    [box .title] {
        Game Menu
    }
    [box] {
        [box .primary width=8em height=2em] { Start }
        [box width=8em height=2em] { Options }
        [box .danger width=8em height=2em] { Quit }
    }
    [box bg-color=#f0f0f0] {
        Some text with background color
    }
    [box] {
        Some text
        [image src="path/to/image.png" width=100 height=100]
        [image src="path/to/image2.png" width=100 height=100]
    }
    [box] {
        Multiline text
            is on 
            multiple lines
        [box font="path/to/font.ttf" font_size=13] { Some other text }
        How to "escape" quotes
    }
    [box] {
        [box width=50%] {
            Left box content
        }
        [box width=50%] {
            Right box content
            [image src="path/to/image.png" width=100 height=100]
        }
    }
}

The markup language also supports CSS-like [style] blocks for defining reusable styles. See Style documentation for details.

Grammar

Tokens

Syntax

markup ::= element*

element ::= '[' identifier attribute* ']' '{' (element | text)* '}'

attribute ::= identifier '=' (string | number | number '%' | number 'em' | '#' hexdigit{6,8} | identifier) | '.' identifier | '$' identifier

string ::= '"' (any char except '"' and '\' | '\\' ('"' | '\' | 'n' | 't' | 'r'))* '"'

text ::= (any char except '{' '}' '[' ']')*

number ::= digit+ ('.' digit+)?

identifier ::= letter (letter | digit | '_' | '-')*

digit ::= '0'-'9'

hexdigit ::= '0'-'9' | 'a'-'f' | 'A'-'F'

letter ::= 'a'-'z' | 'A'-'Z'

Notes