New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For loops with parentheses #3

Closed
phillipdonald opened this Issue Apr 10, 2017 · 4 comments

Comments

Projects
None yet
3 participants
@phillipdonald
Copy link

phillipdonald commented Apr 10, 2017

Expected and Actual Behavior

Expecting syntax of for loops with parentheses to work as they do with if statements and while loops.

class ForParentheses
{
    public function alpha(string $str)
    {
        char $ch;

        for ($ch in $str) {
            echo $ch, "\n";
        }
    }
}

Build output.

vagrant@zephir:~/zephir/utils$ zephir build 
Zephir\Exception: Cannot parse file: /home/vagrant/zephir/utils/utils/forparentheses.zep

Details

ubuntu-16.04

vagrant@zephir:~/zephir/utils$ php -v
PHP 7.0.15-0ubuntu0.16.04.4 (cli) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.15-0ubuntu0.16.04.4, Copyright (c) 1999-2017, by Zend Technologies
vagrant@zephir:~/zephir/utils$

vagrant@zephir:~/zephir/utils$ zephir
Zephir version 0.9.7-6608033934

Compiled from source.

@sergeyklay sergeyklay self-assigned this Apr 10, 2017

@sergeyklay

This comment has been minimized.

Copy link
Member

sergeyklay commented Apr 10, 2017

I'll take a look ASAP. Thank you for contributing

@sjinks

This comment has been minimized.

Copy link
Contributor

sjinks commented Apr 13, 2017

if and while accept parentheses for a different reason: the syntax is if expression or while expression; expression can be ( expression ). That is, parentheses are a part of expression.

sjinks added a commit to sjinks/php-zephir-parser that referenced this issue Apr 13, 2017

@sjinks sjinks referenced this issue Apr 13, 2017

Merged

Support for parentheses in `for` loops #6

2 of 3 tasks complete

sjinks added a commit to sjinks/php-zephir-parser that referenced this issue Apr 13, 2017

sjinks added a commit to sjinks/php-zephir-parser that referenced this issue Apr 13, 2017

@sjinks

This comment has been minimized.

Copy link
Contributor

sjinks commented Apr 13, 2017

Implemented in cdf64af

@phillipdonald

This comment has been minimized.

Copy link

phillipdonald commented Apr 18, 2017

Thanks. You guys rock!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment