This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
|
syntax [2011/09/26 09:53] Patrick Michel created |
syntax [2012/07/25 12:14] (current) Patrick Michel |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== XCend File Syntax ====== | ====== XCend File Syntax ====== | ||
| + | |||
| + | <fs 150%>The page is incomplete and outdated</fs>. | ||
| A XCend file consists mainly of a ''pattern'', which has to be an ''element'' at the root: | A XCend file consists mainly of a ''pattern'', which has to be an ''element'' at the root: | ||
| Line 9: | Line 11: | ||
| </code> | </code> | ||
| - | In general a pattern is a sequence of ''element'' and ''attribute'' declarations: | + | In general, a pattern is a sequence of ''element'' and ''attribute'' declarations: |
| <code xcend> | <code xcend> | ||
| - | element <name> (?|*|+)? { | + | element <name> (?|* (<name>)?)? { |
| <body> | <body> | ||
| } | } | ||
| Line 23: | Line 25: | ||
| </code> | </code> | ||
| - | Elements can be optional, repeated or repeated but have to appear at least once. Attributes can only be optional. | + | Elements can be //optional// or //repeated//, attributes can only be optional. For repeated elements, the implicit disambiguation identifier can be renamed and accessed like a normal attribute. |
| + | You can also specify choices between elements and attributes, which means that only one has to exist. | ||
| + | <code xcend> | ||
| + | element choice { | ||
| + | element a {} | element b {} | attribute c {} | ||
| + | } | ||
| + | </code> | ||
| A body can either be empty, pattern, type or enumeration declaration: | A body can either be empty, pattern, type or enumeration declaration: | ||
| <code xcend> | <code xcend> | ||
| - | element types { | + | element empty { |
| } | } | ||