mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-31 01:24:19 +02:00
parent
2140cef041
commit
84b873fb4e
@ -118,6 +118,7 @@ static char *lb_steal(lex_buf *lb)
|
|||||||
class { return T_CLASS; }
|
class { return T_CLASS; }
|
||||||
namespace { return T_NAMESPACE; }
|
namespace { return T_NAMESPACE; }
|
||||||
code { return T_CODE; }
|
code { return T_CODE; }
|
||||||
|
abstract { return T_ABSTRACT; }
|
||||||
config { yylval->num = FAConfig; return T_FIELD_ATTRIBUTE; }
|
config { yylval->num = FAConfig; return T_FIELD_ATTRIBUTE; }
|
||||||
state { yylval->num = FAState; return T_FIELD_ATTRIBUTE; }
|
state { yylval->num = FAState; return T_FIELD_ATTRIBUTE; }
|
||||||
enum { yylval->num = FAEnum; return T_FIELD_ATTRIBUTE; }
|
enum { yylval->num = FAEnum; return T_FIELD_ATTRIBUTE; }
|
||||||
|
@ -50,6 +50,7 @@ using namespace icinga;
|
|||||||
%token T_INCLUDE "include (T_INCLUDE)"
|
%token T_INCLUDE "include (T_INCLUDE)"
|
||||||
%token T_CLASS "class (T_CLASS)"
|
%token T_CLASS "class (T_CLASS)"
|
||||||
%token T_CODE "code (T_CODE)"
|
%token T_CODE "code (T_CODE)"
|
||||||
|
%token T_ABSTRACT "abstract (T_ABSTRACT)"
|
||||||
%token T_NAMESPACE "namespace (T_NAMESPACE)"
|
%token T_NAMESPACE "namespace (T_NAMESPACE)"
|
||||||
%token T_STRING "string (T_STRING)"
|
%token T_STRING "string (T_STRING)"
|
||||||
%token T_ANGLE_STRING "angle_string (T_ANGLE_STRING)"
|
%token T_ANGLE_STRING "angle_string (T_ANGLE_STRING)"
|
||||||
@ -72,6 +73,7 @@ using namespace icinga;
|
|||||||
%type <num> field_attributes
|
%type <num> field_attributes
|
||||||
%type <num> field_attribute_list
|
%type <num> field_attribute_list
|
||||||
%type <num> T_FIELD_ACCESSOR_TYPE
|
%type <num> T_FIELD_ACCESSOR_TYPE
|
||||||
|
%type <num> abstract_specifier
|
||||||
%type <field> class_field
|
%type <field> class_field
|
||||||
%type <fields> class_fields
|
%type <fields> class_fields
|
||||||
%type <klass> class
|
%type <klass> class
|
||||||
@ -163,20 +165,32 @@ code: T_CODE T_STRING
|
|||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
class: T_CLASS T_IDENTIFIER inherits_specifier '{' class_fields '}' ';'
|
class: abstract_specifier T_CLASS T_IDENTIFIER inherits_specifier '{' class_fields '}' ';'
|
||||||
{
|
{
|
||||||
$$ = new Klass();
|
$$ = new Klass();
|
||||||
|
|
||||||
$$->Name = $2;
|
$$->Name = $3;
|
||||||
free($2);
|
free($3);
|
||||||
|
|
||||||
if ($3) {
|
if ($4) {
|
||||||
$$->Parent = $3;
|
$$->Parent = $4;
|
||||||
free($3);
|
free($4);
|
||||||
}
|
}
|
||||||
|
|
||||||
$$->Fields = *$5;
|
$$->Abstract = $1;
|
||||||
delete $5;
|
|
||||||
|
$$->Fields = *$6;
|
||||||
|
delete $6;
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
abstract_specifier: /* empty */
|
||||||
|
{
|
||||||
|
$$ = false;
|
||||||
|
}
|
||||||
|
| T_ABSTRACT
|
||||||
|
{
|
||||||
|
$$ = true;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -107,6 +107,7 @@ struct Klass
|
|||||||
{
|
{
|
||||||
std::string Name;
|
std::string Name;
|
||||||
std::string Parent;
|
std::string Parent;
|
||||||
|
bool Abstract;
|
||||||
std::vector<Field> Fields;
|
std::vector<Field> Fields;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user