elements: element {
$$ = new (std::nothrow) tidl::Elements();
if ($$ != nullptr) {
- $$->Add(std::unique_ptr<tidl::Element>($1));
+ if ($1 != nullptr) {
+ $$->Add(std::unique_ptr<tidl::Element>($1));
+ }
}
}
| elements element {
attributes: attribute {
$$ = new (std::nothrow) tidl::Attributes();
if ($$ != nullptr) {
- $$->Add(std::unique_ptr<tidl::Attribute>($1));
+ if ($1 != nullptr) {
+ $$->Add(std::unique_ptr<tidl::Attribute>($1));
+ }
}
}
| attributes T_COMMA attribute {
declarations: declaration {
$$ = new (std::nothrow) tidl::Declarations();
if ($$ != nullptr) {
- $$->Add(std::unique_ptr<tidl::Declaration>($1));
+ if ($1 != nullptr) {
+ $$->Add(std::unique_ptr<tidl::Declaration>($1));
+ }
}
}
| declarations declaration {
parameter_list: parameter {
$$ = new tidl::Parameters();
- if ($1 != nullptr) {
- $$->Add(std::unique_ptr<tidl::Parameter>($1));
+ if ($$ != nullptr) {
+ if ($1 != nullptr) {
+ $$->Add(std::unique_ptr<tidl::Parameter>($1));
+ }
}
}
| parameter_list T_COMMA parameter {