develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r34515 - in trunk: . languages/pipp/src/pct languages/pipp/t/in_php

From:
bernhard
Date:
December 28, 2008 11:16
Subject:
[svn:parrot] r34515 - in trunk: . languages/pipp/src/pct languages/pipp/t/in_php
Message ID:
20081228191648.2B707CB9FA@x12.develooper.com
Author: bernhard
Date: Sun Dec 28 11:16:47 2008
New Revision: 34515

Added:
   trunk/languages/pipp/t/in_php/ops.t   (contents, props changed)
Modified:
   trunk/MANIFEST
   trunk/languages/pipp/src/pct/grammar.pg

Log:
[Pipp] Add support for $x = ( $y = 2 ) * 3;
as a special case.


Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST	(original)
+++ trunk/MANIFEST	Sun Dec 28 11:16:47 2008
@@ -1,7 +1,7 @@
 # ex: set ro:
 # $Id$
 #
-# generated by tools\dev\mk_manifest_and_skip.pl Sun Dec 28 10:28:36 2008 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Sun Dec 28 19:14:47 2008 UT
 #
 # See tools/dev/install_files.pl for documentation on the
 # format of this file.
@@ -2393,6 +2393,7 @@
 languages/pipp/t/in_php/01_sea_only.t                       [pipp]
 languages/pipp/t/in_php/02_sanity.t                         [pipp]
 languages/pipp/t/in_php/array.t                             [pipp]
+languages/pipp/t/in_php/ops.t                               [pipp]
 languages/pipp/t/php/arithmetics.t                          [pipp]
 languages/pipp/t/php/base64.t                               [pipp]
 languages/pipp/t/php/basic.t                                [pipp]

Modified: trunk/languages/pipp/src/pct/grammar.pg
==============================================================================
--- trunk/languages/pipp/src/pct/grammar.pg	(original)
+++ trunk/languages/pipp/src/pct/grammar.pg	Sun Dec 28 11:16:47 2008
@@ -130,7 +130,7 @@
     | <for_statement>           {*}  #= for_statement
     | <inline_sea_short_tag>    {*}  #= inline_sea_short_tag
     | <inline_sea_script_tag>   {*}  #= inline_sea_script_tag
-    | <var_assign>              {*}  #= var_assign
+    | [ <var_assign> ';' ]      {*}  #= var_assign
     | <function_definition>     {*}  #= function_definition
     | <class_definition>        {*}  #= class_definition
 }
@@ -208,7 +208,7 @@
 }
 
 rule for_statement {
-    'for' '(' <var_assign> <expression> ';' <expression> ')' '{' <statement_list> '}'
+    'for' '(' <var_assign> ';' <expression> ';' <expression> ')' '{' <statement_list> '}'
     {*}
 }
 
@@ -231,7 +231,7 @@
 }
 
 rule var_assign {
-    <var> '=' <expression> <.statement_delimiter>
+    <var> '=' <expression>
     {*}
 }
 
@@ -383,6 +383,7 @@
     | <function_call>          {*}   #= function_call
     | <instantiate_array>      {*}   #= instantiate_array
     | <constructor_call>       {*}   #= constructor_call
+    | '(' <var_assign> ')'     {*}   #= var_assign
     | '(' <expression> ')'     {*}   #= expression
     | <literal>                {*}   #= literal
     | <class_constant>         {*}   #= class_constant

Added: trunk/languages/pipp/t/in_php/ops.t
==============================================================================
--- (empty file)
+++ trunk/languages/pipp/t/in_php/ops.t	Sun Dec 28 11:16:47 2008
@@ -0,0 +1,36 @@
+<?php
+
+# Copyright (C) 2008, The Perl Foundation.
+# $Id$
+
+/*
+
+=head1 NAME
+
+t/in_php/ops.t - test various ops
+
+=head1 SYNOPSIS
+
+    perl t/harness t/in_php/ops.t
+
+=head1 DESCRIPTION
+
+Test various operators.
+
+=cut
+
+*/
+
+require_once 'Test.php';
+
+plan(2);
+$count = 1;
+
+$x = ( $y = 2 ) * 3;
+is( $x, 6, 'multiplication', $count );
+$count++;
+is( $y, 2, 'inner assignment', $count );
+$count++;
+
+# vim: expandtab shiftwidth=4 ft=php:
+?>



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About