|
< index < 7. File parser |
===================================== | > 7.2 Declaring the 'structures' |
// This is a single line comment /* This is a multi-line comment */Multi-line comments can be nested :
/*
This is a
multi-line comment containing another
/*
multi-line
comment
*/
*/
The parser is not sensible to space characters, tabulations or carriage return except inside strings.
item_type "blade" { // structure's type : 'item_type'. structure's name : 'blade'
cost=300 // an integer property
weight=3.5 // a float property
deal_damage=true // a boolean property
damages="3d6+2" // a dice property
color="#FF0000" // a color property, using #RRGGBB syntax
damaged_color="128,96,96" // another color property, using rrr,ggg,bbb syntax
damage_type="slash" // a string property
description="This is a long"
"description." // a multi-line string property
abstract // a flag (simplified boolean property)
intList= [ 1,2,3 ] // a list of int values
floatList= [ 1.0,2,3.5 ] // a list of float values
stringList= [ "string1","string2","string3" ] // a list of string values
}
A structure can also contain other structures either of the same type, or structures of another type :
item_type "blade" {
item_type "one-handed blades" {
// the item_type "blade" contains another item_type named "one-handed blades"
}
item_type "two-handed blades" {
// the item_type "blade" contains another item_type named "two-handed blades"
}
feature "damage" {
// the item_type "blade" contains another structure, type "feature", name "damage"
}
}