tml markup language’s purpose is to describe tree of text strings. The language syntax is very simple and intentionally kept minimalistic. Here are the syntax rules:
-
The only type of language element is a string of text. Strings can be unquoted, quoted, C++-style raw trings, Quotes-style raw strings.
-
Unquoted string is a string which does not contain any of the following characters:
-
space (except when it is preceeded by
\, see escape sequences below) -
tabulation
-
new line
-
carriage return
-
left curly brace
{(except when it is preceeded by\, see escape sequences below) -
right curly brace
}(except when it is preceeded by\, see escape sequences below) -
double quote
"(except when it is preceeded by\, see escape sequences below)
-
-
Unquoted string can contain the following escape sequences:
-
space
\<space> -
backslash
\\ -
double quote
\" -
curly braces
\{and\} -
4 hex digit unicode value
\uXXXX -
8 hex digit unicode value
\UXXXXXXXX
-
-
Quoted string is a string which is enclosed in double quotes. The following characters of the quoted string are not part of the document (ignored by parser):
-
tabulation
-
new line
-
carriage return
-
-
Quoted string can contain the following escape sequences:
-
\n- new line -
\"- double quote -
\\- back slash -
\t- tabulation -
4 hex digit unicode value
\uXXXX -
8 hex digit unicode value
\UXXXXXXXX
-
-
C++-style raw string:
R"<sequence>(The C++ raw string)<sequence>" -
Quotes-style raw string:
"""The Quotes raw string""" -
If any raw string, C++ or Quotes-style, starts or ends with a new line character, then this first leading new line character and/or last trailing new line character is not a part of the document (ignored by parser).
-
-
String can have arbitrary number of child strings. Those are optionally listed in the curly brackets following the string. If string does not have any children then the curly brackets can be omitted.
-
Parts of a document can be commented. C++ commenting rules apply.
-
single-line comment is opened by a sequence of two forward slashes
//and is closed by the end of the line. -
A multi-line comment is opened by forward slash and asterisk sequence
/*and is closed by asterisk and forward slash sequence*/. -
Comment’s opening sequence, for both, single and multi-line comments, should be preceeded by whitespace or be at the beginning of the line. Otherwise it is not recognized as comment opening sequence. This is in order to make possible URLs (e.g.
http://website.com/*) to be unquoted strings. -
Comments are not regarded inside quoted and raw strings.
-
"quoted string"
unquoted_string
string_one string_two "string_three"
string_four"string five"
"string six"string_seven
"string with children"{
"child 1"
Child2
"child three"{
SubChild1
"Subchild two"
// properties can be expressed as string with just one child (property's value)
Property1 {Value1}
"Property two" {"Value 2"}
// comment
/* multi line
comment */
// comment opening sequence should have preceding whitespace
// or be at the beginning of the line.
// the following line does not make any comments
http://website.com/some/url/*
// comment at the beginning of the line
/*
* multiline
* comment at the
* beginning of the line
*/
"Escape sequences inside single double quotes: \" \n \t \\ \/"
// C++-style raw string
R"qwerty(raw string content " """ { } \ / )qwerty"
// quotes-style raw string
"""bla bla {} "" and "quoted" bla bla"""
// the leading and ending new line is ignored in raw strings:
"""
multiline
verbatim text
block
"""
// is the same as
"""multiline
verbatim text
block"""
// in order to make the new line at the beginning/ending of
// the raw string to be part of the document, just add an extra one(s):
"""
verbatim text block which has a
single new line at its beginning
and at its ending
"""
}
}