Front page | perl.cvs.parrot |
Postings from December 2008
[svn:parrot] r34696 - trunk/compilers/pirc/new
From:
kjs
Date:
December 31, 2008 02:41
Subject:
[svn:parrot] r34696 - trunk/compilers/pirc/new
Message ID:
20081231104151.346CDCB9FA@x12.develooper.com
Author: kjs
Date: Wed Dec 31 02:41:48 2008
New Revision: 34696
Modified:
trunk/compilers/pirc/new/pir.y
trunk/compilers/pirc/new/pircompunit.c
trunk/compilers/pirc/new/pirparser.c
trunk/compilers/pirc/new/pirpcc.c
Log:
[pirc] fix :named results. + cleanup debug stuff.
Modified: trunk/compilers/pirc/new/pir.y
==============================================================================
--- trunk/compilers/pirc/new/pir.y (original)
+++ trunk/compilers/pirc/new/pir.y Wed Dec 31 02:41:48 2008
@@ -1803,7 +1803,9 @@
;
opt_target_list : '(' opt_list ')'
- { $$ = $2; }
+ {
+ $$ = $2;
+ }
;
opt_list : /* empty */
@@ -1840,8 +1842,6 @@
{
$$ = TARGET_FLAG_NAMED;
set_param_alias(lexer, $2);
- if (TEST_FLAG(lexer->curtarget->flags, TARGET_FLAG_NAMED))
- fprintf(stderr, "alias: %s\n", lexer->curtarget->alias);
}
;
Modified: trunk/compilers/pirc/new/pircompunit.c
==============================================================================
--- trunk/compilers/pirc/new/pircompunit.c (original)
+++ trunk/compilers/pirc/new/pircompunit.c Wed Dec 31 02:41:48 2008
@@ -680,7 +680,6 @@
PARROT_ASSERT(lexer->curtarget != NULL);
lexer->curtarget->alias = alias;
SET_FLAG(lexer->curtarget->flags, TARGET_FLAG_NAMED);
- fprintf(stderr, "lexer->curtarget->alias = %s\n", lexer->curtarget->alias);
return lexer->curtarget;
}
@@ -810,10 +809,8 @@
argument *
set_arg_alias(lexer_state * const lexer, char const * const alias) {
PARROT_ASSERT(lexer->curarg != NULL);
- fprintf(stderr, "set arg_alias attempt...\n");
lexer->curarg->alias = alias;
SET_FLAG(lexer->curarg->flags, ARG_FLAG_NAMED);
- fprintf(stderr, "set_arg_alias ok\n");
return lexer->curarg;
}
@@ -1627,6 +1624,7 @@
Set the invocation results on the invocation object C<inv>.
The number of results is stored in the invocation object.
+The invocation object C<inv> is returned.
=cut
@@ -1636,38 +1634,28 @@
target *result_iter;
unsigned result_count = 0;
- inv->results = results;
-
- if (results) {
- result_iter = results;
- do {
-
- if (TEST_FLAG(result_iter->flags, TARGET_FLAG_NAMED)) {
-
- target * targ = new_target(lexer);
-
- CLEAR_FLAG(result_iter->flags, TARGET_FLAG_NAMED);
-
- SET_FLAG(targ->flags, TARGET_FLAG_NAMED);
-
- /* XXX thius is not working:: */
- add_target(lexer, result_iter, targ);
-
-
- result_iter = result_iter->next;
+ if (results == NULL) {
+ inv->results = NULL;
+ inv->num_results = 0;
+ return inv;
+ }
- result_count += 2;
- }
- else
- ++result_count;
+ /* set the list of results in the invocation object */
+ inv->results = results;
- result_iter = result_iter->next;
+ /* count the number of operands for the "get_results" op; :named results are counted twice. */
+ result_iter = results;
+ do {
+ /* count :named result targets twice for calculating number of operands */
+ if (TEST_FLAG(result_iter->flags, TARGET_FLAG_NAMED))
+ result_count += 2;
+ else
+ ++result_count;
- }
- while (result_iter != results);
+ result_iter = result_iter->next;
}
+ while (result_iter != results);
- /* fprintf(stderr, "invocation has %u results\n", result_count); */
inv->num_results = result_count;
Modified: trunk/compilers/pirc/new/pirparser.c
==============================================================================
--- trunk/compilers/pirc/new/pirparser.c (original)
+++ trunk/compilers/pirc/new/pirparser.c Wed Dec 31 02:41:48 2008
@@ -1079,8 +1079,8 @@
1642, 1643, 1646, 1658, 1659, 1663, 1665, 1669, 1673, 1675,
1677, 1683, 1684, 1689, 1690, 1694, 1696, 1705, 1707, 1711,
1715, 1717, 1719, 1723, 1724, 1727, 1747, 1754, 1756, 1766,
- 1783, 1785, 1787, 1791, 1800, 1805, 1810, 1811, 1815, 1817,
- 1821, 1823, 1828, 1829, 1833, 1835, 1837, 1839, 1851, 1855,
+ 1783, 1785, 1787, 1791, 1800, 1805, 1812, 1813, 1817, 1819,
+ 1823, 1825, 1830, 1831, 1835, 1837, 1839, 1841, 1851, 1855,
1856, 1857, 1858, 1861, 1866, 1877, 1884, 1889, 1890, 1894,
1896, 1900, 1901, 1904, 1908, 1912, 1916, 1925, 1935, 1936,
1941, 1943, 1948, 1953, 1954, 1958, 1960, 1964, 1970, 1971,
@@ -4061,71 +4061,71 @@
case 275:
#line 1806 "pir.y"
- { (yyval.targ) = (yyvsp[(2) - (3)].targ); ;}
+ {
+ (yyval.targ) = (yyvsp[(2) - (3)].targ);
+ ;}
break;
case 276:
-#line 1810 "pir.y"
+#line 1812 "pir.y"
{ (yyval.targ) = NULL; ;}
break;
case 277:
-#line 1812 "pir.y"
+#line 1814 "pir.y"
{ (yyval.targ) = (yyvsp[(1) - (1)].targ); ;}
break;
case 278:
-#line 1816 "pir.y"
+#line 1818 "pir.y"
{ (yyval.targ) = (yyvsp[(1) - (1)].targ); ;}
break;
case 279:
-#line 1818 "pir.y"
+#line 1820 "pir.y"
{ (yyval.targ) = add_target(lexer, (yyvsp[(1) - (3)].targ), (yyvsp[(3) - (3)].targ)); ;}
break;
case 280:
-#line 1822 "pir.y"
+#line 1824 "pir.y"
{ (yyval.targ) = set_param_flag(lexer, (yyvsp[(1) - (2)].targ), (yyvsp[(2) - (2)].ival)); ;}
break;
case 281:
-#line 1824 "pir.y"
+#line 1826 "pir.y"
{ (yyval.targ) = set_param_alias(lexer, (yyvsp[(1) - (3)].sval)); ;}
break;
case 282:
-#line 1828 "pir.y"
+#line 1830 "pir.y"
{ (yyval.ival) = 0; ;}
break;
case 283:
-#line 1830 "pir.y"
+#line 1832 "pir.y"
{ SET_FLAG((yyval.ival), (yyvsp[(2) - (2)].ival)); ;}
break;
case 284:
-#line 1834 "pir.y"
+#line 1836 "pir.y"
{ (yyval.ival) = TARGET_FLAG_OPTIONAL; ;}
break;
case 285:
-#line 1836 "pir.y"
+#line 1838 "pir.y"
{ (yyval.ival) = TARGET_FLAG_OPT_FLAG; ;}
break;
case 286:
-#line 1838 "pir.y"
+#line 1840 "pir.y"
{ (yyval.ival) = TARGET_FLAG_SLURPY; ;}
break;
case 287:
-#line 1840 "pir.y"
+#line 1842 "pir.y"
{
(yyval.ival) = TARGET_FLAG_NAMED;
set_param_alias(lexer, (yyvsp[(2) - (2)].sval));
- if (TEST_FLAG(lexer->curtarget->flags, TARGET_FLAG_NAMED))
- fprintf(stderr, "alias: %s\n", lexer->curtarget->alias);
;}
break;
Modified: trunk/compilers/pirc/new/pirpcc.c
==============================================================================
--- trunk/compilers/pirc/new/pirpcc.c (original)
+++ trunk/compilers/pirc/new/pirpcc.c Wed Dec 31 02:41:48 2008
@@ -195,8 +195,6 @@
if (num_targets == 0)
return;
- fprintf(stderr, "targets 2 operands\n");
-
/* retrieve the FixedIntegerArray PMC */
signature_array = get_pmc_const(lexer->bc, array_index);
@@ -217,23 +215,12 @@
PARROT_ASSERT(iter->alias);
- if (iter->alias == NULL)
- fprintf(stderr, "no alias!\n");
- else {
- fprintf(stderr, "alias: %s\n", iter->alias);
- push_operand(lexer, expr_from_string(lexer, iter->alias));
- ++i;
-
- }
+ push_operand(lexer, expr_from_string(lexer, iter->alias));
+ ++i;
/* clear flag on the target that was marked :named XXX is this correct? */
CLEAR_FLAG(iter->flags, TARGET_FLAG_NAMED);
}
- else {
- if (iter->alias) {
- fprintf(stderr, "no named flag but still an alias! (%s)\n", iter->alias);
- }
- }
flag = calculate_pcc_target_flags(iter);
@@ -251,7 +238,6 @@
iter = iter->next;
}
- fprintf(stderr, "targets 2 operands ok\n");
}
/*
-
[svn:parrot] r34696 - trunk/compilers/pirc/new
by kjs