Skip to content

Lines, lists and messages

This page describes the rules that apply to every block of a .mtd file: where a statement ends, how to wrap a long list, how to write a comment, and what the compiler prints when it reads the file.

A line ends a statement. Write one property, column or statement on each line:

columns: name, email
sort: name

A statement that is the last one before } does not need its own line, so a short block fits on one line: field notes { rows: 5 }. Two properties on one line are refused, also when a comma separates them. Write min: 0 and max: 120 on two lines.

// starts a comment. The comment continues to the end of the line. A line that holds only a comment, and an empty line, end no statement.

A text is written between straight double quotes: "Fee group". A typographic quote does not start or end a text. Outside a text, „, “, ”, «, », ‚, ‘ and ’ are one error, at the quote, and the repair is use a straight " quote. The rest of the line is still read as the text, so no other error follows it. Inside a text, a typographic quote is ordinary prose: "Family „Öztürk“" is a valid text. A text that ends in ” has no closing quote, and the message names the ”.

A line break after ,, ->, (, [, +, - or * does not end the statement. The next line continues it, so a long list or a long sum can wrap:

columns: name,
email,
joined_on
sort: joined_on desc,
name asc

The same rule wraps the arguments of a function, enum(...) members, a grants: list and a list in [ ]:

share int "Share (hundredths)" {
value: round(ratio(points,
max_points),
scale: 2,
ties: up)
}

A long enum does not need to wrap: write its values in the column’s block, one per line. See values in the column’s block.

A comma at the end of a line says that the list continues on the next line. When the next line starts a property (sort:), starts a statement that begins with a name and a colon, or closes the block with }, the compiler refuses the comma:

report of members {
columns: name, email,
sort: name
}
pages/members.mtd:2:23: a trailing comma joins the next line to this list, and the next line starts "sort:"
remove the trailing comma — write: columns: name, email

Remove the comma. Inside ( ) and [ ] the rule does not apply, because a named argument such as scale: 2 can follow a comma there.

A trailing comma before a line that starts some other statement, such as a region list of events, is also an error. The message then names the word that cannot follow the list, not the comma.

The compiler reads the whole application before the engine uses it. For each problem it prints the file, the line, the column, one sentence, and on a second line a repair where it has one:

pages/members.mtd:7:5: unknown property "serach" in a report block
did you mean "search"?

An error stops the application. matterdata install, add-app and upgrade refuse an application that has one, and they print every error they found.

A warning does not stop the application. The source is valid and the compiler knows what it means, but a reader could take it to mean something else. The line has warning: after the location, and the commands print it and continue:

pages/signup.mtd:6:13: warning: event.signups walks the event column of event_signups, and the page's data row is also called "event": one colon apart, event.signups reads through the column and :event.signups reads the data row as the page loaded it
rename the data row, e.g. data this_event of events, and write :this_event.… where :event.… reads it — keep the walk event.signups: it reads the region's own row, and in a deny when it reads it inside the write

The compiler has one warning today: a path through a column with the name of the data row.

Website privacy policy