summaryrefslogtreecommitdiff
path: root/src/parser.y
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2011-12-26 15:34:47 (GMT)
committerMarius Kintel <marius@kintel.net>2011-12-26 15:34:47 (GMT)
commit4ff2d1af446c1f276c644b12e6ec4cc6db0b6d65 (patch)
tree10e9e52c2483efd6149f189c21366cdb0b11de77 /src/parser.y
parentf0817a1c167c9d9f0ecf0ef8ec7bee03d61e63f2 (diff)
Some light refactoring attempts, didn't get very far..
Diffstat (limited to 'src/parser.y')
-rw-r--r--src/parser.y19
1 files changed, 4 insertions, 15 deletions
diff --git a/src/parser.y b/src/parser.y
index d703a81..b0df50d 100644
--- a/src/parser.y
+++ b/src/parser.y
@@ -146,7 +146,7 @@ statement:
'{' inner_input '}' |
module_instantiation {
if ($1) {
- module->children.push_back($1);
+ module->addChild($1);
} else {
delete $1;
}
@@ -193,10 +193,8 @@ statement:
children_instantiation:
module_instantiation {
$$ = new ModuleInstantiation();
- if ($1) {
+ if ($1) {
$$->children.push_back($1);
- } else {
- delete $1;
}
} |
'{' module_instantiation_list '}' {
@@ -206,7 +204,6 @@ children_instantiation:
if_statement:
TOK_IF '(' expr ')' children_instantiation {
$$ = new IfElseModuleInstantiation();
- $$->modname = "if";
$$->argnames.push_back("");
$$->argexpr.push_back($3);
@@ -262,8 +259,7 @@ module_instantiation_list:
module_instantiation_list module_instantiation {
$$ = $1;
if ($$) {
- if ($2)
- $$->children.push_back($2);
+ if ($2) $$->children.push_back($2);
} else {
delete $2;
}
@@ -271,19 +267,12 @@ module_instantiation_list:
single_module_instantiation:
TOK_ID '(' arguments_call ')' {
- $$ = new ModuleInstantiation();
- $$->modname = $1;
+ $$ = new ModuleInstantiation($1);
$$->argnames = $3->argnames;
$$->argexpr = $3->argexpr;
free($1);
delete $3;
} |
- TOK_ID ':' single_module_instantiation {
- $$ = $3;
- if ($$)
- $$->label = $1;
- free($1);
- } |
'!' single_module_instantiation {
$$ = $2;
if ($$)
contact: Jan Huwald // Impressum