Wartbed:Files/Formats/Script

From Dark Omen Wiki

(Difference between revisions)
Jump to: navigation, search
(Example: Operators, delimitors, whitespace)
(Syntax)
Line 5: Line 5:
===Syntax===
===Syntax===
WARTBED Script
WARTBED Script
-
* represents data as couples of names and values separated by an operator
+
* represents data as names/values pairs separated by an operator
* supports data values of types integers, doubles, strings and booleans.
* supports data values of types integers, doubles, strings and booleans.
 +
* supports UNICODE (which doesn't mean that the in-game typeface will be able to render every glyph in the full specification, though)
* uses curly brackets ("<span style="color:blue; font-weight: bold;"><tt>{</tt></span>" and "<span style="color:blue; font-weight: bold;"><tt>}</tt></span>") for scopes  
* uses curly brackets ("<span style="color:blue; font-weight: bold;"><tt>{</tt></span>" and "<span style="color:blue; font-weight: bold;"><tt>}</tt></span>") for scopes  
-
* uses C's assignment operators (<span style="color:blue; font-weight: bold;"><tt>=</tt></span>, <span style="color:blue; font-weight: bold;"><tt>+=</tt></span>, <span style="color:blue; font-weight: bold;"><tt>-=</tt></span>, <span style="color:blue; font-weight: bold;"><tt>*=</tt></span> and <span style="color:blue; font-weight: bold;"><tt>/=</tt></span>) to separate name and value of data
+
* uses C's assignment operators (<span style="color:blue; font-weight: bold;"><tt>=</tt></span>, <span style="color:blue; font-weight: bold;"><tt>+=</tt></span>, <span style="color:blue; font-weight: bold;"><tt>-=</tt></span>, <span style="color:blue; font-weight: bold;"><tt>*=</tt></span> and <span style="color:blue; font-weight: bold;"><tt>/=</tt></span>) to separate a datum's name and value
-
* supports white space in names and data without citation marks. If leading or trailing white space is required, to be retained or operators must be included in name or value, citation marks must be used
+
* supports whitespace in names and data without citation marks. Trailing and leading whitespace is trimmed, so citation marks must be used if these are significant or if the operator strings must be included in names or values
-
* reads EOL as end of the current declaration. Multiple declaration on the same line must be separated with semi-colon.  
+
* reads EOL as end of the current declaration. Multiple declarations on the same line must be separated with semi-colon.  
* uses <span style="color:blue; font-weight: bold;"><tt>//</tt></span> and <span style="color:blue; font-weight: bold;"><tt>/*</tt></span> ... <span style="color:blue; font-weight: bold;"><tt>*/</tt></span> for single-line and block comments.
* uses <span style="color:blue; font-weight: bold;"><tt>//</tt></span> and <span style="color:blue; font-weight: bold;"><tt>/*</tt></span> ... <span style="color:blue; font-weight: bold;"><tt>*/</tt></span> for single-line and block comments.
* when parsing values as booleans accepts the words "<span style="color:green; font-weight: bold;"><tt>true</tt></span>", "<span style="color:green; font-weight: bold;"><tt>yes</tt></span>" and "<span style="color:green; font-weight: bold;"><tt>on</tt></span>" for true, and "<span style="color:red; font-weight: bold;"><tt>false</tt></span>", "<span style="color:red; font-weight: bold;"><tt>no</tt></span>" and "<span style="color:red; font-weight: bold;"><tt>off</tt></span>" for false.
* when parsing values as booleans accepts the words "<span style="color:green; font-weight: bold;"><tt>true</tt></span>", "<span style="color:green; font-weight: bold;"><tt>yes</tt></span>" and "<span style="color:green; font-weight: bold;"><tt>on</tt></span>" for true, and "<span style="color:red; font-weight: bold;"><tt>false</tt></span>", "<span style="color:red; font-weight: bold;"><tt>no</tt></span>" and "<span style="color:red; font-weight: bold;"><tt>off</tt></span>" for false.

Revision as of 17:59, 22 November 2009

Human-readable text-based mark-up language for data definitions. Script v2 is a flexible language parser that can use arbitrarily defined symbols for scoping and operators, but the WARTBED Script syntax is loosely based on C/C++ syntax. The WARTBED Script can be said to fulfil the same function as XML, but is infinitely more readable and easy to maintain.

NOTE that WARTBED currently uses Script v2, but some examples in this wiki are written in the style of v1. In the first version, name and value in pairs where separated by colon, while in v2 C-style assignment operators are used.

Syntax

WARTBED Script

  • represents data as names/values pairs separated by an operator
  • supports data values of types integers, doubles, strings and booleans.
  • supports UNICODE (which doesn't mean that the in-game typeface will be able to render every glyph in the full specification, though)
  • uses curly brackets ("{" and "}") for scopes
  • uses C's assignment operators (=, +=, -=, *= and /=) to separate a datum's name and value
  • supports whitespace in names and data without citation marks. Trailing and leading whitespace is trimmed, so citation marks must be used if these are significant or if the operator strings must be included in names or values
  • reads EOL as end of the current declaration. Multiple declarations on the same line must be separated with semi-colon.
  • uses // and /* ... */ for single-line and block comments.
  • when parsing values as booleans accepts the words "true", "yes" and "on" for true, and "false", "no" and "off" for false.
  • is agnostic to character casing: all casing will be retained, but concerning the boolean keywords the script parser is case-insensitive

Example

first = Hello, file! second = " Hello, whitespace! " " more whitespace " = only ends are trimmed ; outer block { 1st value += 10 2nd value -= 3.1415 option1 *= false option2a /= yes; option2b = off; inner block {name 1=WARTBED;name 2="Script"} }

Editor Integration: Syntax Highlighting

Colour highlighting for WARTBED Scripts is now supported in UltraEdit.
Download the UltraEdit .uew language file here

Personal tools
communication