;
elements: element {
- $$ = new tidl::Elements();
- $$->Add($1);
+ $$ = new (std::nothrow) tidl::Elements();
+ if ($$ != nullptr) {
+ $$->Add($1);
+ }
}
| elements element {
$$ = $1;
- if ($$->Exist($2)) {
- ps->ReportError("syntax error. \"Already Exists\".", $2->GetLine());
- delete $2;
- } else {
- $$->Add($2);
+ if ($2 != nullptr) {
+ if ($$->Exist($2)) {
+ ps->ReportError("syntax error. \"Already Exists\".", $2->GetLine());
+ delete $2;
+ } else {
+ $$->Add($2);
+ }
}
}
| elements error T_SEMICOLON {
;
attributes: attribute {
- $$ = new tidl::Attributes();
- $$->Add($1);
+ $$ = new (std::nothrow) tidl::Attributes();
+ if ($$ != nullptr) {
+ $$->Add($1);
+ }
}
| attributes T_COMMA attribute {
$$ = $1;
- if ($$->Exist($3)) {
- ps->ReportError("syntax error. \"Already Exist\".", $3->GetLine());
- delete $3;
- } else {
- $$->Add($3);
+ if ($3 != nullptr) {
+ if ($$->Exist($3)) {
+ ps->ReportError("syntax error. \"Already Exist\".", $3->GetLine());
+ delete $3;
+ } else {
+ $$->Add($3);
+ }
}
}
| error {
;
declarations: declaration {
- $$ = new tidl::Declarations();
- $$->Add($1);
+ $$ = new (std::nothrow) tidl::Declarations();
+ if ($$ != nullptr) {
+ $$->Add($1);
+ }
}
| declarations declaration {
$$ = $1;
- if ($$->Exist($2)) {
- ps->ReportError("syntax error. \"Already Exists\".", $2->GetLine());
- delete $2;
- } else {
- $$->Add($2);
+ if ($2 != nullptr) {
+ if ($$->Exist($2)) {
+ ps->ReportError("syntax error. \"Already Exists\".", $2->GetLine());
+ delete $2;
+ } else {
+ $$->Add($2);
+ }
}
}
| declarations error T_SEMICOLON {
parameter_list: parameter {
$$ = new tidl::Parameters();
- if ($1 != nullptr)
+ if ($1 != nullptr) {
$$->Add($1);
+ }
}
| parameter_list T_COMMA parameter {
$$ = $1;
- if ($$->Exist($3)) {
- ps->ReportError("syntax error. \"Already Exists\".", $3->GetLine());
- delete $3;
- } else {
- $$->Add($3);
+ if ($3 != nullptr) {
+ if ($$->Exist($3)) {
+ ps->ReportError("syntax error. \"Already Exists\".", $3->GetLine());
+ delete $3;
+ } else {
+ $$->Add($3);
+ }
}
}
| error {