### <a id="object-definition"></a> Object Definition
-Icinga 2 features an object-based configuration format. In order to
-define objects the `object` keyword is used:
+Icinga 2 features an object-based configuration format. You can define new
+objects using the `object` keyword:
object Host "host1.example.org" {
display_name = "host1",
Certain characters need to be escaped. The following escape sequences
are supported:
- Character |Escape sequence
- ------------------------------------|------------------------------------
- " |\\"
- \\ |\\\\
- \<TAB\> |\\t
- \<CARRIAGE-RETURN\> |\\r
- \<LINE-FEED\> |\\n
- \<BEL\> |\\b
- \<FORM-FEED\> |\\f
+Character |Escape sequence
+------------------------------------|------------------------------------
+" |\\"
+\\ |\\\\
+\<TAB\> |\\t
+\<CARRIAGE-RETURN\> |\\r
+\<LINE-FEED\> |\\n
+\<BEL\> |\\b
+\<FORM-FEED\> |\\f
In addition to these pre-defined escape sequences you can specify
arbitrary ASCII characters using the backslash character (\\) followed
The value can be a string, number, array, or a dictionary.
-Constants cannot be changed once they are set.
-
-> **Note**
->
-> The `set` and `var` keywords are an alias for `const` and are available
-> in order to provide compatibility with older versions. Their use is
-> deprecated.
+Once defined a constant can be access from any file. Constants cannot be changed
+once they are set.
### <a id="apply"></a> Apply
%token <op> T_LESS_THAN "< (T_LESS_THAN)"
%token <op> T_GREATER_THAN "> (T_GREATER_THAN)"
-%token T_VAR "var (T_VAR)"
%token T_CONST "const (T_CONST)"
%token <type> T_TYPE_DICTIONARY "dictionary (T_TYPE_DICTIONARY)"
%token <type> T_TYPE_ARRAY "array (T_TYPE_ARRAY)"
%type <variant> rterm
%type <variant> rterm_scope
%type <variant> lterm
-%type <num> variable_decl
%left T_LOGICAL_OR
%left T_LOGICAL_AND
| statements statement
;
-statement: object | type | include | include_recursive | library | variable | apply
+statement: object | type | include | include_recursive | library | constant | apply
{ }
| lterm
{
}
;
-variable: variable_decl identifier T_SET rterm
+constant: T_CONST identifier T_SET rterm
{
AExpression::Ptr aexpr = static_cast<AExpression::Ptr>(*$4);
delete $4;
}
;
-variable_decl: T_VAR
- {
- $$ = true;
- }
- | T_CONST
- {
- $$ = false;
- }
- ;
-
identifier: T_IDENTIFIER
| T_STRING
{