mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-23 21:55:03 +02:00
parent
ae23e456a6
commit
51f473d08a
@ -859,6 +859,15 @@ supports:
|
|||||||
Additional documentation on type methods is available in the
|
Additional documentation on type methods is available in the
|
||||||
[library reference](19-library-reference.md#library-reference).
|
[library reference](19-library-reference.md#library-reference).
|
||||||
|
|
||||||
|
## <a id="location-information"></a> Location Information
|
||||||
|
|
||||||
|
The location of the currently executing script can be obtained using the
|
||||||
|
`current_filename` and `current_line` keywords.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
log("Hello from '" + current_filename + "' in line " + current_line)
|
||||||
|
|
||||||
## <a id="reserved-keywords"></a> Reserved Keywords
|
## <a id="reserved-keywords"></a> Reserved Keywords
|
||||||
|
|
||||||
These keywords are reserved and must not be used as constants or custom attributes.
|
These keywords are reserved and must not be used as constants or custom attributes.
|
||||||
@ -867,6 +876,7 @@ These keywords are reserved and must not be used as constants or custom attribut
|
|||||||
template
|
template
|
||||||
include
|
include
|
||||||
include_recursive
|
include_recursive
|
||||||
|
ignore_on_error
|
||||||
library
|
library
|
||||||
null
|
null
|
||||||
true
|
true
|
||||||
@ -887,6 +897,8 @@ These keywords are reserved and must not be used as constants or custom attribut
|
|||||||
if
|
if
|
||||||
else
|
else
|
||||||
in
|
in
|
||||||
|
current_filename
|
||||||
|
current_line
|
||||||
|
|
||||||
You can escape reserved keywords using the `@` character. The following example
|
You can escape reserved keywords using the `@` character. The following example
|
||||||
tries to set `vars.include` which references a reserved keyword and generates
|
tries to set `vars.include` which references a reserved keyword and generates
|
||||||
|
@ -232,6 +232,8 @@ const std::vector<String>& ConfigWriter::GetKeywords(void)
|
|||||||
keywords.push_back("locals");
|
keywords.push_back("locals");
|
||||||
keywords.push_back("use");
|
keywords.push_back("use");
|
||||||
keywords.push_back("ignore_on_error");
|
keywords.push_back("ignore_on_error");
|
||||||
|
keywords.push_back("current_filename");
|
||||||
|
keywords.push_back("current_line");
|
||||||
keywords.push_back("apply");
|
keywords.push_back("apply");
|
||||||
keywords.push_back("to");
|
keywords.push_back("to");
|
||||||
keywords.push_back("where");
|
keywords.push_back("where");
|
||||||
|
@ -196,6 +196,8 @@ else return T_ELSE;
|
|||||||
while return T_WHILE;
|
while return T_WHILE;
|
||||||
throw return T_THROW;
|
throw return T_THROW;
|
||||||
ignore_on_error return T_IGNORE_ON_ERROR;
|
ignore_on_error return T_IGNORE_ON_ERROR;
|
||||||
|
current_filename return T_CURRENT_FILENAME;
|
||||||
|
current_line return T_CURRENT_LINE;
|
||||||
=\> return T_FOLLOWS;
|
=\> return T_FOLLOWS;
|
||||||
\<\< return T_SHIFT_LEFT;
|
\<\< return T_SHIFT_LEFT;
|
||||||
\>\> return T_SHIFT_RIGHT;
|
\>\> return T_SHIFT_RIGHT;
|
||||||
|
@ -144,6 +144,8 @@ static void MakeRBinaryOp(Expression** result, Expression *left, Expression *rig
|
|||||||
%token T_LOCALS "locals (T_LOCALS)"
|
%token T_LOCALS "locals (T_LOCALS)"
|
||||||
%token T_CONST "const (T_CONST)"
|
%token T_CONST "const (T_CONST)"
|
||||||
%token T_IGNORE_ON_ERROR "ignore_on_error (T_IGNORE_ON_ERROR)"
|
%token T_IGNORE_ON_ERROR "ignore_on_error (T_IGNORE_ON_ERROR)"
|
||||||
|
%token T_CURRENT_FILENAME "current_filename (T_CURRENT_FILENAME)"
|
||||||
|
%token T_CURRENT_LINE "current_line (T_CURRENT_LINE)"
|
||||||
%token T_USE "use (T_USE)"
|
%token T_USE "use (T_USE)"
|
||||||
%token T_OBJECT "object (T_OBJECT)"
|
%token T_OBJECT "object (T_OBJECT)"
|
||||||
%token T_TEMPLATE "template (T_TEMPLATE)"
|
%token T_TEMPLATE "template (T_TEMPLATE)"
|
||||||
@ -799,6 +801,14 @@ rterm_no_side_effect: T_STRING
|
|||||||
{
|
{
|
||||||
$$ = new GetScopeExpression(ScopeLocal);
|
$$ = new GetScopeExpression(ScopeLocal);
|
||||||
}
|
}
|
||||||
|
| T_CURRENT_FILENAME
|
||||||
|
{
|
||||||
|
$$ = MakeLiteral(@$.Path);
|
||||||
|
}
|
||||||
|
| T_CURRENT_LINE
|
||||||
|
{
|
||||||
|
$$ = MakeLiteral(@$.FirstLine);
|
||||||
|
}
|
||||||
| rterm_array
|
| rterm_array
|
||||||
| rterm_scope_require_side_effect
|
| rterm_scope_require_side_effect
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user