User Tools

Site Tools


ded:syntax

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
ded:syntax [2017-03-17 10:41]
skyjake [Directives]
ded:syntax [2017-03-21 08:06] (current)
skyjake [Example]
Line 1: Line 1:
 +====== DED syntax ======
 +
 +This page describes the common syntax elements of the [[ded]] (Doomsday Engine Definition) language.
 +
 +===== Directives =====
 +
 +Directives instruct the DED [[http://​en.wikipedia.org/​w/​index.php?​title=Parser|parser]] to perform special actions when encountered.
 +
 +^ Keyword^ Description |
 +| [[include|Include]]| Include the specified //.DED// file. |
 +| [[include|IncludeIf]]| Include the specified //.DED// file if the conditional statement is **true**. |
 +| [[skip|SkipIf]]| Skip the rest of the current file if the conditional statement is **true**. |
 +| [[model_path|ModelPath]]| Append a new path to the list of model search paths. |
 +
 +
 +
 +===== Comments =====
 +
 +There are two kinds of comment in DED; single-line and multi-line.
 +
 +Single line comments begin with **#** and continue until the end of line.
 +
 +<​code>#​ A single line comment stops here
 +</​code>​
 +Multi line comments begin with **#>** and continue until **<#** is found.
 +  ​
 +  #> A multi-line comment begins...
 +  And continues
 +  ...and ends here <#
 +
 +
 +===== Assignment statements =====
 +
 +
 +==== Flag values ====
 +
 +<​code>​Property = flaga | flagb | flagc; ​ # Version 6 syntax
 +Property = "flaga flagb flagc"; ​   # Version 5 syntax (still supported).
 +</​code>​
 +The special case of 'no flags' is defined as follows:
 +  ​
 +  Property = 0;   # Supported from Doomsday 1.9.9 onwards
 +  Property = ""; ​ # Version 5 syntax
 +
 +<note warning>
 +The following is a syntax error:
 +  Property = ;
 +</​note>​
 +
 +
 +==== String values ====
 +
 +Strings begin and end with **"** (double quotation mark). If newline (''​\n''​) characters are found inside a string (the string has been divided into multiple lines) the newline and all following whitespace are skipped, and the actual string continues from the first non-whitespace character that follows.
 +
 +  Property = "Some text string";​
 +
 +To include a double quotation mark in the string itself, [[http://​en.wikipedia.org/​wiki/​Escape_sequence|escape]] it with **\** (backward slash).
 +
 +  Property = "Some \"​quoted text\"";​
 +
 +To include a backward slash in the string itself, it must appear twice (to escape the escape sequence).
 +
 +<​code>​Property = "​path\\to\\something";​
 +</​code>​
 +
 +For this reason it is generally better to use forward slashes in paths. Doomsday uses forward slashes on all platforms, internally.
 +
 +
 +==== URI values ====
 +
 +Resource [[uri]]s are used throughout Doomsday and use the following form:
 +  Property = "<​scheme>:<​path>";​
 +
 +
 +===== Definition scopes =====
 +
 +A scope describes the extent of zero or more definition statements which apply to a named [[ded#​Definition_types|definition type]].
 +
 +Syntax example:
 +  <​attribute>​ definitiontype <​attribute>​ <​identifier>​ {
 +    //... Definition statements ...//
 +  }
 +
 +
 +==== Attributes ====
 +
 +Attributes are optional keywords that either precede or follow a scope. These "​derivation"​ attributes change the behavior of the parser when interpreting definition statements within the scope.
 +
 +^ Keyword ^ Description |
 +| [[altering_and_copying_definitions|Copy]]| Use the previous definition of the same type as a base. |
 +| [[altering_and_copying_definitions|Mods]]| Modify an existing definition. |
 +
 +Clever use of attributes in conjunction with [[#​Directives|directives]] allows the add-on author to construct multi-part, combinatorial add-ons.
 +
 +
 +===== Example =====
 +
 +The following snippet (taken from //​libdoom.pk3:​defs/​doom1/​materials.ded//​) serves as good example of what a //.DED// file typically looks like:
 +  ​
 +  Header { Version = 6; }
 +  ​
 +  # Allow disabling from the command line.
 +  SkipIf -nodefaultfx;​
 +  ​
 +  # Add an animated light glow effect to the NUKAGE1 material.
 +  Material Mods "​flats:​NUKAGE1"​ {
 +    Layer {
 +        Stage { Glow = .5;  Tics = 24; Rnd = .5; }
 +        Stage { Glow = .44; Tics = 24; Rnd = .5; }
 +    }
 +  }
 +
 +
 +
 +===== See also =====
 +
 +  *  [[:ded|DED language overview]]
 +  *  [[Flags reference]]
  
ded/syntax.txt ยท Last modified: 2017-03-21 08:06 by skyjake