GithubHelp home page GithubHelp logo

zephir-lang / php-zephir-parser Goto Github PK

View Code? Open in Web Editor NEW
179.0 19.0 36.0 1.01 MB

The Zephir Parser delivered as a C extension for the PHP language.

Home Page: https://zephir-lang.com

License: MIT License

Shell 0.90% C 49.10% C++ 4.19% M4 0.93% PHP 42.84% JavaScript 0.21% PowerShell 0.34% Makefile 0.55% Emacs Lisp 0.05% Dockerfile 0.88%
zephir php-extension php lemon parser parser-generator c php-api zend-engine lalr

php-zephir-parser's People

Contributors

alexndrmac avatar davidofferman avatar dreamsxin avatar jabirchall avatar jeckerson avatar niden avatar ruudboon avatar sergeyklay avatar sjinks avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

php-zephir-parser's Issues

parser fails on utf8 chars

cat test.php

<?php
$filePath = __DIR__ . '/file.zep';
$content = file_get_contents($filePath);
$a = \zephir_parse_file($content, $filePath);

var_dump($a);

cat file.zep

namespace Test;
class test {
    public function testUTF8() {
	return "dfsfsdf";
    }
}

php test.php

array(2) {
  [0]=>
  array(5) {
    ["type"]=>
    string(9) "namespace"
    ["name"]=>
    string(4) "Test"
    ["file"]=>
    string(28) "/home/izopi4a/tests/file.zep"
    ["line"]=>
    int(3)
    ["char"]=>
    int(5)
  }
  [1]=>
  array(8) {
    ["type"]=>
    string(5) "class"
    ["name"]=>
    string(4) "test"
    ["abstract"]=>
    int(0)
.......

which is expected behavior, but when I add utf8 chars in the file ...

cat file.zep

namespace Test;

class test {

    public function testUTF8() {
	return "сдфггхх";
    }
}

php test.php

    array(5) {
        ["type"]=>
        string(5) "error"
        ["message"]=>
        string(42) "Scanner error: -2 сдфггхх";
            }
        }"
    ["file"]=>
        string(28) "/home/izopi4a/tests/file.zep"
        ["line"]=>
        int(6)
        ["char"]=>
        int(8)
    }

Environment (please complete the following information):

  • OS: ubuntu 18.04
  • Zephir Parser version - 1.2.0
  • Installation type: pphize && ./configure && make -j64 && make install
  • Compiler version: gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
  • PHP version ubuntu's 7.2.10

using const in a class in a non-consecutive order throws a ParseException

From @chilimatic on September 29, 2017 9:29

the parser throws an syntax error if const are not declared in an consecutive block

namespace Bugreport;

class ConstOrder {
    const MY_FIRST_CONST = "test";

    private $oneProperty = 1;

    const MY_SECOND_CONST = "test2";
}

zephir\Parser\ParseException: Syntax error in /home/j/development/repos/bugreport-zephir/bugreport/bugreport/constorder.zep on line 7

this works.

namespace Bugreport;
class ConstOrder {
    const MY_FIRST_CONST = "test";
    const MY_SECOND_CONST = "test2";

    private $oneProperty = 1;
}

I know splitting consts with other parameters is ugly and I just ran into this error by accident.
At least if we're following the classic patterns and structures.

namespace Bugreport;

class ExampleAction {

    const MY_ACTION_NAME = "MY_ACTION_NAME";
    public static createMyAction(array payload): void {
        return [
            "type": self::MY_ACTION_NAME,
            "payload": payload
        ]
    }

    const MY_OTHER_ACTION_NAME = "MY_OTHER_ACTION_NAME";
    public static createMyOtherAction(array payload): void {
       return [
           "type": self::MY_OTHER_ACTION_NAME,
           "payload": payload
       ]
    }
}

(this is an 1:1 adaption of the declarative CQRS, Redux (js) implementation of an action)

this for example is another way to structure code more contextualized.
I know we could just extract this to a flyweight pattern but that's not the point.

The point is, it's an undefined behaviour and just getting "syntax error" is not enough feedback, since it's syntactically correct at least you don't write any specifics in your documentation https://docs.zephir-lang.com/en/latest/oop.html

Copied from original issue: zephir-lang/zephir#1582

[NFR] Add support for creating classes/methods with capitalized names

From @tamaranga on February 1, 2014 9:39

It's impossible to create class:

class HTML {
}

and method:

class Test {
      public function HTML() {}
}

Maybe it is not so difficult to allow such capitalized names or describe this limitation in docs. Currently it's just "ParseException: Syntax error", that is not very obvious.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/1431269-nfr-add-support-for-creating-classes-methods-with-capitalized-names?utm_campaign=plugin&utm_content=tracker%2F280146&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F280146&utm_medium=issues&utm_source=github).

Copied from original issue: zephir-lang/zephir#141

Why does the compiler(parser) not give an error or warning if an abstract method(function) is not implemented by a subclass

Expected and Actual Behavior

When the class B in Zephir (which inherits from an abstract class A)vhas to implement at least one abstract methods, gives now at runtime the error:

"Cannot instantiate abstract class B"

What I expect that during the build the compiler(parser) will notice, or even gives an error which tells me that
1 - Class B must be abstract
or
2 - Class B must implement the abstract method

Is this a 'bug'/missing feature, or is this a config setting which a have missed?

Details

  • Zephir Parser version: 1.1.1
  • PHP Version PHP 7.0.22-0ubuntu0.16.04.1 (cli) ( NTS )
  • Operating System: ubuntu0.16.04.1
  • Installation type: Compiling from source
  • Compiler version: gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
  • Zephir version: 0.10.7-2917ebe8ae

Bitwise operator priority

php

$t = 1 & 1 << 7;
var_dump($t);

int(0)

zephir

int t;
int u = 1;
int v = 1;
let t = u & v << 7;
var_dump(t);
u = 1;
v = 1;
t = ((u & v) << 7);
ZEPHIR_INIT_VAR(&_10);
ZEPHIR_INIT_NVAR(&_10);
ZVAL_LONG(&_10, t);
zephir_var_dump(&_10);

int(128)

look at this:

php -r "var_dump((1 & 1) << 7);"
int(128)
php -r "var_dump(1 & 1 << 7);"
int(0)

so we shouldn't add parenthes t = ((u & v) << 7); here.

segmentation fault while lexing

From @flip111 on February 1, 2016 17:15

I would consider this issue low priority, but i'm reporting it just to keep a record. When i have zephir code public®static it segfaults.

Also i would like to notify that there is no whitespace requirement after keywords. "public" is recognized as a token if it isn't followed by [a-zA-Z_\\], otherwise it's part of another token. Possibly one of these https://github.com/phalcon/zephir/blob/f78e01d3a5d4e988fd30efe269d432ef635a56c1/parser/parser/scanner.re#L486-L665 When public is matched and then immediately a new token starts (without whitespace) it likely syntax error later by the parser.

Copied from original issue: zephir-lang/zephir#1178

Grammar railroad diagram

Using the sql output of the lemon parser generator with the query shown bellow give us an EBNF understood by https://www.bottlecaps.de/rr/ui to generate railroad diagrams.

lemon -S zephir.lemon
select name || ' ::=' || group_concat(
	case when hasOr == 1 then ' (' || trim(rtxt) || ')'
	else
		case when length(rtxt) == 0 then ' /* empty */' else rtxt end
	end, '
	|')
from (
	select lhs, name, substr(txt, instr(txt, tbl.sep) + length(tbl.sep)) rtxt, (instr(txt, '|') > 0) hasOr
	from rule left join symbol on lhs=id, (select '::=' as sep) tbl
) as t
group by lhs;

We can see a railroad diagram for the grammar in parser/zephir.lemon with tokens manually added from parser/scanner.re, copy and paste the EBNF shown bellow on https://www.bottlecaps.de/rr/ui in the tab Edit Grammar then switching to the tab View Diagram.

input ::= xx_language
xx_language ::= xx_top_statement_list
xx_top_statement_list ::= xx_top_statement_list xx_top_statement
    | xx_top_statement
xx_top_statement ::= xx_namespace_def
    | xx_use_aliases
    | xx_function_def
    | xx_class_def
    | xx_interface_def
    | xx_comment
    | xx_cblock
xx_namespace_def ::= NAMESPACE IDENTIFIER DOTCOMMA
    | USE xx_use_aliases_list DOTCOMMA
xx_use_aliases ::= IDENTIFIER
    | IDENTIFIER AS IDENTIFIER
xx_function_def ::= FUNCTION IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE ARROW xx_method_return_type BRACKET_OPEN BRACKET_CLOSE
    | FUNCTION IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE ARROW xx_method_return_type DOTCOMMA
    | FUNCTION IDENTIFIER PARENTHESES_OPEN xx_parameter_list PARENTHESES_CLOSE ARROW xx_method_return_type BRACKET_OPEN BRACKET_CLOSE
    | FUNCTION IDENTIFIER PARENTHESES_OPEN xx_parameter_list PARENTHESES_CLOSE ARROW xx_method_return_type DOTCOMMA
    | FUNCTION IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE ARROW xx_method_return_type BRACKET_OPEN xx_statement_list BRACKET_CLOSE
    | FUNCTION IDENTIFIER PARENTHESES_OPEN xx_parameter_list PARENTHESES_CLOSE ARROW xx_method_return_type BRACKET_OPEN xx_statement_list BRACKET_CLOSE
    | FUNCTION IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE BRACKET_OPEN BRACKET_CLOSE
    | FUNCTION IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE DOTCOMMA
    | FUNCTION IDENTIFIER PARENTHESES_OPEN xx_parameter_list PARENTHESES_CLOSE BRACKET_OPEN BRACKET_CLOSE
    | FUNCTION IDENTIFIER PARENTHESES_OPEN xx_parameter_list PARENTHESES_CLOSE DOTCOMMA
    | FUNCTION IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE BRACKET_OPEN xx_statement_list BRACKET_CLOSE
    | FUNCTION IDENTIFIER PARENTHESES_OPEN xx_parameter_list PARENTHESES_CLOSE BRACKET_OPEN xx_statement_list BRACKET_CLOSE
xx_class_def ::= CLASS IDENTIFIER xx_class_body
    | CLASS IDENTIFIER EXTENDS IDENTIFIER xx_class_body
    | CLASS IDENTIFIER IMPLEMENTS xx_implements_list xx_class_body
    | CLASS IDENTIFIER EXTENDS IDENTIFIER IMPLEMENTS xx_implements_list xx_class_body
    | ABSTRACT CLASS IDENTIFIER xx_class_body
    | ABSTRACT CLASS IDENTIFIER EXTENDS IDENTIFIER xx_class_body
    | ABSTRACT CLASS IDENTIFIER IMPLEMENTS xx_implements_list xx_class_body
    | ABSTRACT CLASS IDENTIFIER EXTENDS IDENTIFIER IMPLEMENTS xx_implements_list xx_class_body
    | FINAL CLASS IDENTIFIER xx_class_body
    | FINAL CLASS IDENTIFIER EXTENDS IDENTIFIER xx_class_body
    | FINAL CLASS IDENTIFIER IMPLEMENTS xx_implements_list xx_class_body
    | FINAL CLASS IDENTIFIER EXTENDS IDENTIFIER IMPLEMENTS xx_implements_list xx_class_body
xx_interface_def ::= INTERFACE IDENTIFIER xx_interface_body
    | INTERFACE IDENTIFIER EXTENDS xx_implements_list xx_interface_body
xx_comment ::= COMMENT
xx_cblock ::= CBLOCK
xx_use_aliases_list ::= xx_use_aliases_list COMMA xx_use_aliases
    | xx_use_aliases
xx_method_return_type ::= VOID
    | xx_method_return_type_list
xx_parameter_list ::= xx_parameter_list COMMA xx_parameter
    | xx_parameter
xx_statement_list ::= xx_statement_list xx_statement
    | xx_statement
xx_interface_body ::= BRACKET_OPEN BRACKET_CLOSE
    | BRACKET_OPEN xx_interface_definition BRACKET_CLOSE
xx_implements_list ::= xx_implements_list COMMA xx_implements
    | xx_implements
xx_class_body ::= BRACKET_OPEN BRACKET_CLOSE
    | BRACKET_OPEN xx_class_definition BRACKET_CLOSE
xx_class_definition ::= xx_class_properties_definition
    | xx_class_consts_definition
    | xx_class_methods_definition
    | xx_class_properties_definition xx_class_methods_definition
    | xx_class_properties_definition xx_class_consts_definition
    | xx_class_consts_definition xx_class_properties_definition
    | xx_class_consts_definition xx_class_methods_definition
    | xx_class_properties_definition xx_class_consts_definition xx_class_methods_definition
    | xx_class_consts_definition xx_class_properties_definition xx_class_methods_definition
xx_implements ::= IDENTIFIER
xx_interface_definition ::= xx_class_consts_definition
    | xx_interface_methods_definition
    | xx_class_consts_definition xx_interface_methods_definition
xx_class_properties_definition ::= xx_class_properties_definition xx_class_property_definition
    | xx_class_property_definition
xx_class_consts_definition ::= xx_class_consts_definition xx_class_const_definition
    | xx_class_const_definition
xx_class_methods_definition ::= xx_class_methods_definition xx_class_method_definition
    | xx_class_method_definition
xx_interface_methods_definition ::= xx_interface_methods_definition xx_interface_method_definition
    | xx_interface_method_definition
xx_class_property_definition ::= COMMENT xx_visibility_list IDENTIFIER DOTCOMMA
    | xx_visibility_list IDENTIFIER DOTCOMMA
    | COMMENT xx_visibility_list IDENTIFIER ASSIGN xx_literal_expr DOTCOMMA
    | xx_visibility_list IDENTIFIER ASSIGN xx_literal_expr DOTCOMMA
    | COMMENT xx_visibility_list IDENTIFIER xx_class_property_shortcuts DOTCOMMA
    | xx_visibility_list IDENTIFIER xx_class_property_shortcuts DOTCOMMA
    | COMMENT xx_visibility_list IDENTIFIER ASSIGN xx_literal_expr xx_class_property_shortcuts DOTCOMMA
    | xx_visibility_list IDENTIFIER ASSIGN xx_literal_expr xx_class_property_shortcuts DOTCOMMA
xx_visibility_list ::= xx_visibility_list xx_visibility
    | xx_visibility
xx_literal_expr ::= INTEGER
    | CHAR
    | STRING
    | DOUBLE
    | NULL
    | FALSE
    | TRUE
    | IDENTIFIER DOUBLECOLON CONSTANT
    | CONSTANT
    | SBRACKET_OPEN SBRACKET_CLOSE
    | SBRACKET_OPEN xx_literal_array_list SBRACKET_CLOSE
xx_class_property_shortcuts ::= BRACKET_OPEN BRACKET_CLOSE
    | BRACKET_OPEN xx_class_property_shortcuts_list BRACKET_CLOSE
xx_class_property_shortcuts_list ::= xx_class_property_shortcuts_list COMMA xx_class_property_shortcut
    | xx_class_property_shortcut
xx_class_property_shortcut ::= IDENTIFIER
    | COMMENT IDENTIFIER
xx_class_const_definition ::= COMMENT CONST CONSTANT ASSIGN xx_literal_expr DOTCOMMA
    | CONST CONSTANT ASSIGN xx_literal_expr DOTCOMMA
    | COMMENT CONST IDENTIFIER ASSIGN xx_literal_expr DOTCOMMA
    | CONST IDENTIFIER ASSIGN xx_literal_expr DOTCOMMA
xx_class_method_definition ::= xx_visibility_list FUNCTION IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE BRACKET_OPEN BRACKET_CLOSE
    | xx_visibility_list FUNCTION IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE DOTCOMMA
    | xx_visibility_list FUNCTION IDENTIFIER PARENTHESES_OPEN xx_parameter_list PARENTHESES_CLOSE BRACKET_OPEN BRACKET_CLOSE
    | xx_visibility_list FUNCTION IDENTIFIER PARENTHESES_OPEN xx_parameter_list PARENTHESES_CLOSE DOTCOMMA
    | xx_visibility_list FUNCTION IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE BRACKET_OPEN xx_statement_list BRACKET_CLOSE
    | xx_visibility_list FUNCTION IDENTIFIER PARENTHESES_OPEN xx_parameter_list PARENTHESES_CLOSE BRACKET_OPEN xx_statement_list BRACKET_CLOSE
    | COMMENT xx_visibility_list FUNCTION IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE BRACKET_OPEN BRACKET_CLOSE
    | COMMENT xx_visibility_list FUNCTION IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE DOTCOMMA
    | COMMENT xx_visibility_list FUNCTION IDENTIFIER PARENTHESES_OPEN xx_parameter_list PARENTHESES_CLOSE BRACKET_OPEN BRACKET_CLOSE
    | COMMENT xx_visibility_list FUNCTION IDENTIFIER PARENTHESES_OPEN xx_parameter_list PARENTHESES_CLOSE DOTCOMMA
    | COMMENT xx_visibility_list FUNCTION IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE BRACKET_OPEN xx_statement_list BRACKET_CLOSE
    | COMMENT xx_visibility_list FUNCTION IDENTIFIER PARENTHESES_OPEN xx_parameter_list PARENTHESES_CLOSE BRACKET_OPEN xx_statement_list BRACKET_CLOSE
    | xx_visibility_list FUNCTION IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE ARROW xx_method_return_type BRACKET_OPEN BRACKET_CLOSE
    | xx_visibility_list FUNCTION IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE ARROW xx_method_return_type DOTCOMMA
    | xx_visibility_list FUNCTION IDENTIFIER PARENTHESES_OPEN xx_parameter_list PARENTHESES_CLOSE ARROW xx_method_return_type BRACKET_OPEN BRACKET_CLOSE
    | xx_visibility_list FUNCTION IDENTIFIER PARENTHESES_OPEN xx_parameter_list PARENTHESES_CLOSE ARROW xx_method_return_type DOTCOMMA
    | xx_visibility_list FUNCTION IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE ARROW xx_method_return_type BRACKET_OPEN xx_statement_list BRACKET_CLOSE
    | xx_visibility_list FUNCTION IDENTIFIER PARENTHESES_OPEN xx_parameter_list PARENTHESES_CLOSE ARROW xx_method_return_type BRACKET_OPEN xx_statement_list BRACKET_CLOSE
    | COMMENT xx_visibility_list FUNCTION IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE ARROW xx_method_return_type BRACKET_OPEN BRACKET_CLOSE
    | COMMENT xx_visibility_list FUNCTION IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE ARROW xx_method_return_type DOTCOMMA
    | COMMENT xx_visibility_list FUNCTION IDENTIFIER PARENTHESES_OPEN xx_parameter_list PARENTHESES_CLOSE ARROW xx_method_return_type BRACKET_OPEN BRACKET_CLOSE
    | COMMENT xx_visibility_list FUNCTION IDENTIFIER PARENTHESES_OPEN xx_parameter_list PARENTHESES_CLOSE ARROW xx_method_return_type DOTCOMMA
    | COMMENT xx_visibility_list FUNCTION IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE ARROW xx_method_return_type BRACKET_OPEN xx_statement_list BRACKET_CLOSE
    | COMMENT xx_visibility_list FUNCTION IDENTIFIER PARENTHESES_OPEN xx_parameter_list PARENTHESES_CLOSE ARROW xx_method_return_type BRACKET_OPEN xx_statement_list BRACKET_CLOSE
xx_interface_method_definition ::= xx_visibility_list FUNCTION IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE ARROW xx_method_return_type DOTCOMMA
    | xx_visibility_list FUNCTION IDENTIFIER PARENTHESES_OPEN xx_parameter_list PARENTHESES_CLOSE ARROW xx_method_return_type DOTCOMMA
    | COMMENT xx_visibility_list FUNCTION IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE ARROW xx_method_return_type DOTCOMMA
    | COMMENT xx_visibility_list FUNCTION IDENTIFIER PARENTHESES_OPEN xx_parameter_list PARENTHESES_CLOSE ARROW xx_method_return_type DOTCOMMA
    | xx_visibility_list FUNCTION IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE DOTCOMMA
    | xx_visibility_list FUNCTION IDENTIFIER PARENTHESES_OPEN xx_parameter_list PARENTHESES_CLOSE DOTCOMMA
    | COMMENT xx_visibility_list FUNCTION IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE DOTCOMMA
    | COMMENT xx_visibility_list FUNCTION IDENTIFIER PARENTHESES_OPEN xx_parameter_list PARENTHESES_CLOSE DOTCOMMA
xx_visibility ::= INTERNAL
    | PUBLIC
    | PROTECTED
    | PRIVATE
    | STATIC
    | SCOPED
    | INLINE
    | DEPRECATED
    | ABSTRACT
    | FINAL
xx_method_return_type_list ::= xx_method_return_type_list BITWISE_OR xx_method_return_type_item
    | xx_method_return_type_item
xx_method_return_type_item ::= xx_parameter_type
    | NULL
    | THIS
    | xx_parameter_type NOT
    | xx_parameter_cast
    | xx_parameter_cast_collection
xx_parameter_type ::= TYPE_INTEGER
    | TYPE_UINTEGER
    | TYPE_LONG
    | TYPE_ULONG
    | TYPE_CHAR
    | TYPE_UCHAR
    | TYPE_DOUBLE
    | TYPE_BOOL
    | TYPE_STRING
    | TYPE_ARRAY
    | TYPE_VAR
    | TYPE_CALLABLE
    | TYPE_RESOURCE
    | TYPE_OBJECT
xx_parameter_cast ::= LESS IDENTIFIER GREATER
xx_parameter_cast_collection ::= LESS IDENTIFIER SBRACKET_OPEN SBRACKET_CLOSE GREATER
xx_parameter ::= IDENTIFIER
    | BITWISE_AND IDENTIFIER
    | CONST IDENTIFIER
    | CONST BITWISE_AND IDENTIFIER
    | xx_parameter_type IDENTIFIER
    | xx_parameter_type BITWISE_AND IDENTIFIER
    | CONST xx_parameter_type IDENTIFIER
    | CONST xx_parameter_type BITWISE_AND IDENTIFIER
    | xx_parameter_type NOT IDENTIFIER
    | xx_parameter_type NOT BITWISE_AND IDENTIFIER
    | CONST xx_parameter_type NOT IDENTIFIER
    | CONST xx_parameter_type NOT BITWISE_AND IDENTIFIER
    | xx_parameter_cast IDENTIFIER
    | xx_parameter_cast BITWISE_AND IDENTIFIER
    | CONST xx_parameter_cast IDENTIFIER
    | CONST xx_parameter_cast BITWISE_AND IDENTIFIER
    | IDENTIFIER ASSIGN xx_literal_expr
    | BITWISE_AND IDENTIFIER ASSIGN xx_literal_expr
    | CONST IDENTIFIER ASSIGN xx_literal_expr
    | CONST BITWISE_AND IDENTIFIER ASSIGN xx_literal_expr
    | xx_parameter_type IDENTIFIER ASSIGN xx_literal_expr
    | xx_parameter_type BITWISE_AND IDENTIFIER ASSIGN xx_literal_expr
    | CONST xx_parameter_type IDENTIFIER ASSIGN xx_literal_expr
    | CONST xx_parameter_type BITWISE_AND IDENTIFIER ASSIGN xx_literal_expr
    | xx_parameter_type NOT IDENTIFIER ASSIGN xx_literal_expr
    | xx_parameter_type NOT BITWISE_AND IDENTIFIER ASSIGN xx_literal_expr
    | CONST xx_parameter_type NOT IDENTIFIER ASSIGN xx_literal_expr
    | CONST xx_parameter_type NOT BITWISE_AND IDENTIFIER ASSIGN xx_literal_expr
    | xx_parameter_cast IDENTIFIER ASSIGN xx_literal_expr
    | xx_parameter_cast BITWISE_AND IDENTIFIER ASSIGN xx_literal_expr
    | CONST xx_parameter_cast IDENTIFIER ASSIGN xx_literal_expr
    | CONST xx_parameter_cast BITWISE_AND IDENTIFIER ASSIGN xx_literal_expr
xx_statement ::= xx_cblock
    | xx_let_statement
    | xx_if_statement
    | xx_loop_statement
    | xx_echo_statement
    | xx_return_statement
    | xx_require_statement
    | xx_fetch_statement
    | xx_fcall_statement
    | xx_mcall_statement
    | xx_scall_statement
    | xx_unset_statement
    | xx_throw_statement
    | xx_declare_statement
    | xx_break_statement
    | xx_continue_statement
    | xx_while_statement
    | xx_do_while_statement
    | xx_try_catch_statement
    | xx_switch_statement
    | xx_for_statement
    | xx_comment
    | xx_empty_statement
xx_let_statement ::= LET xx_let_assignments DOTCOMMA
xx_if_statement ::= IF xx_eval_expr BRACKET_OPEN BRACKET_CLOSE
    | IF xx_eval_expr BRACKET_OPEN BRACKET_CLOSE xx_elseif_statements
    | IF xx_eval_expr BRACKET_OPEN BRACKET_CLOSE ELSE BRACKET_OPEN BRACKET_CLOSE
    | IF xx_eval_expr BRACKET_OPEN BRACKET_CLOSE xx_elseif_statements ELSE BRACKET_OPEN BRACKET_CLOSE
    | IF xx_eval_expr BRACKET_OPEN xx_statement_list BRACKET_CLOSE
    | IF xx_eval_expr BRACKET_OPEN xx_statement_list BRACKET_CLOSE xx_elseif_statements
    | IF xx_eval_expr BRACKET_OPEN xx_statement_list BRACKET_CLOSE ELSE BRACKET_OPEN xx_statement_list BRACKET_CLOSE
    | IF xx_eval_expr BRACKET_OPEN xx_statement_list BRACKET_CLOSE xx_elseif_statements ELSE BRACKET_OPEN xx_statement_list BRACKET_CLOSE
    | IF xx_eval_expr BRACKET_OPEN xx_statement_list BRACKET_CLOSE ELSE BRACKET_OPEN BRACKET_CLOSE
    | IF xx_eval_expr BRACKET_OPEN xx_statement_list BRACKET_CLOSE xx_elseif_statements ELSE BRACKET_OPEN BRACKET_CLOSE
    | IF xx_eval_expr BRACKET_OPEN BRACKET_CLOSE ELSE BRACKET_OPEN xx_statement_list BRACKET_CLOSE
xx_loop_statement ::= LOOP BRACKET_OPEN BRACKET_CLOSE
    | LOOP BRACKET_OPEN xx_statement_list BRACKET_CLOSE
xx_echo_statement ::= ECHO xx_echo_expressions DOTCOMMA
xx_return_statement ::= RETURN xx_common_expr DOTCOMMA
    | RETURN DOTCOMMA
xx_require_statement ::= REQUIRE xx_common_expr DOTCOMMA
xx_fetch_statement ::= xx_fetch_expr DOTCOMMA
xx_fcall_statement ::= xx_fcall_expr DOTCOMMA
xx_mcall_statement ::= xx_mcall_expr DOTCOMMA
xx_scall_statement ::= xx_scall_expr DOTCOMMA
xx_unset_statement ::= UNSET xx_common_expr DOTCOMMA
xx_throw_statement ::= THROW xx_common_expr DOTCOMMA
xx_declare_statement ::= TYPE_INTEGER xx_declare_variable_list DOTCOMMA
    | TYPE_UINTEGER xx_declare_variable_list DOTCOMMA
    | TYPE_CHAR xx_declare_variable_list DOTCOMMA
    | TYPE_UCHAR xx_declare_variable_list DOTCOMMA
    | TYPE_LONG xx_declare_variable_list DOTCOMMA
    | TYPE_ULONG xx_declare_variable_list DOTCOMMA
    | TYPE_DOUBLE xx_declare_variable_list DOTCOMMA
    | TYPE_STRING xx_declare_variable_list DOTCOMMA
    | TYPE_BOOL xx_declare_variable_list DOTCOMMA
    | TYPE_VAR xx_declare_variable_list DOTCOMMA
    | TYPE_ARRAY xx_declare_variable_list DOTCOMMA
xx_break_statement ::= BREAK DOTCOMMA
xx_continue_statement ::= CONTINUE DOTCOMMA
xx_while_statement ::= WHILE xx_eval_expr BRACKET_OPEN BRACKET_CLOSE
    | WHILE xx_eval_expr BRACKET_OPEN xx_statement_list BRACKET_CLOSE
xx_do_while_statement ::= DO BRACKET_OPEN BRACKET_CLOSE WHILE xx_eval_expr DOTCOMMA
    | DO BRACKET_OPEN xx_statement_list BRACKET_CLOSE WHILE xx_eval_expr DOTCOMMA
xx_try_catch_statement ::= TRY BRACKET_OPEN BRACKET_CLOSE
    | TRY BRACKET_OPEN xx_statement_list BRACKET_CLOSE
    | TRY BRACKET_OPEN xx_statement_list BRACKET_CLOSE xx_catch_statement_list
xx_switch_statement ::= SWITCH xx_eval_expr BRACKET_OPEN BRACKET_CLOSE
    | SWITCH xx_eval_expr BRACKET_OPEN xx_case_clauses BRACKET_CLOSE
xx_for_statement ::= FOR IDENTIFIER IN xx_common_expr BRACKET_OPEN xx_statement_list BRACKET_CLOSE
    | FOR IDENTIFIER IN xx_common_expr BRACKET_OPEN BRACKET_CLOSE
    | FOR IDENTIFIER IN REVERSE xx_common_expr BRACKET_OPEN xx_statement_list BRACKET_CLOSE
    | FOR IDENTIFIER IN REVERSE xx_common_expr BRACKET_OPEN BRACKET_CLOSE
    | FOR IDENTIFIER COMMA IDENTIFIER IN xx_common_expr BRACKET_OPEN xx_statement_list BRACKET_CLOSE
    | FOR IDENTIFIER COMMA IDENTIFIER IN xx_common_expr BRACKET_OPEN BRACKET_CLOSE
    | FOR IDENTIFIER COMMA IDENTIFIER IN REVERSE xx_common_expr BRACKET_OPEN xx_statement_list BRACKET_CLOSE
    | FOR PARENTHESES_OPEN IDENTIFIER IN xx_common_expr PARENTHESES_CLOSE BRACKET_OPEN xx_statement_list BRACKET_CLOSE
    | FOR PARENTHESES_OPEN IDENTIFIER IN xx_common_expr PARENTHESES_CLOSE BRACKET_OPEN BRACKET_CLOSE
    | FOR PARENTHESES_OPEN IDENTIFIER IN REVERSE xx_common_expr PARENTHESES_CLOSE BRACKET_OPEN xx_statement_list BRACKET_CLOSE
    | FOR PARENTHESES_OPEN IDENTIFIER COMMA IDENTIFIER IN xx_common_expr PARENTHESES_CLOSE BRACKET_OPEN xx_statement_list BRACKET_CLOSE
    | FOR PARENTHESES_OPEN IDENTIFIER COMMA IDENTIFIER IN xx_common_expr PARENTHESES_CLOSE BRACKET_OPEN BRACKET_CLOSE
    | FOR PARENTHESES_OPEN IDENTIFIER COMMA IDENTIFIER IN REVERSE xx_common_expr PARENTHESES_CLOSE BRACKET_OPEN xx_statement_list BRACKET_CLOSE
xx_empty_statement ::= DOTCOMMA
xx_eval_expr ::= xx_common_expr
xx_elseif_statements ::= xx_elseif_statements xx_elseif_statement
    | xx_elseif_statement
xx_elseif_statement ::= ELSEIF xx_eval_expr BRACKET_OPEN BRACKET_CLOSE
    | ELSEIF xx_eval_expr BRACKET_OPEN xx_statement_list BRACKET_CLOSE
xx_case_clauses ::= xx_case_clauses xx_case_clause
    | xx_case_clause
xx_case_clause ::= CASE xx_eval_expr COLON
    | CASE xx_eval_expr COLON xx_statement_list
    | DEFAULT COLON xx_statement_list
xx_catch_statement_list ::= xx_catch_statement_list xx_catch_statement
    | xx_catch_statement
xx_catch_statement ::= CATCH xx_catch_classes_list BRACKET_OPEN xx_statement_list BRACKET_CLOSE
    | CATCH xx_catch_classes_list BRACKET_OPEN BRACKET_CLOSE
    | CATCH xx_catch_classes_list COMMA IDENTIFIER BRACKET_OPEN BRACKET_CLOSE
    | CATCH xx_catch_classes_list COMMA IDENTIFIER BRACKET_OPEN xx_statement_list BRACKET_CLOSE
xx_catch_classes_list ::= xx_catch_classes_list BITWISE_OR xx_catch_class
    | xx_catch_class
xx_catch_class ::= IDENTIFIER
xx_common_expr ::= BITWISE_AND xx_common_expr
    | NOT xx_common_expr
    | BITWISE_NOT xx_common_expr
    | SUB xx_common_expr
    | PLUS xx_common_expr
    | ISSET xx_common_expr
    | REQUIRE xx_common_expr
    | CLONE xx_common_expr
    | EMPTY xx_common_expr
    | LIKELY xx_common_expr
    | UNLIKELY xx_common_expr
    | xx_common_expr EQUALS xx_common_expr
    | xx_common_expr NOTEQUALS xx_common_expr
    | xx_common_expr IDENTICAL xx_common_expr
    | xx_common_expr NOTIDENTICAL xx_common_expr
    | xx_common_expr LESS xx_common_expr
    | xx_common_expr GREATER xx_common_expr
    | xx_common_expr LESSEQUAL xx_common_expr
    | xx_common_expr GREATEREQUAL xx_common_expr
    | PARENTHESES_OPEN xx_common_expr PARENTHESES_CLOSE
    | PARENTHESES_OPEN xx_parameter_type PARENTHESES_CLOSE xx_common_expr
    | LESS IDENTIFIER GREATER xx_common_expr
    | xx_common_expr ARROW IDENTIFIER
    | xx_common_expr ARROW BRACKET_OPEN IDENTIFIER BRACKET_CLOSE
    | xx_common_expr ARROW BRACKET_OPEN STRING BRACKET_CLOSE
    | IDENTIFIER DOUBLECOLON IDENTIFIER
    | IDENTIFIER DOUBLECOLON CONSTANT
    | xx_common_expr SBRACKET_OPEN xx_common_expr SBRACKET_CLOSE
    | xx_common_expr ADD xx_common_expr
    | xx_common_expr SUB xx_common_expr
    | xx_common_expr MUL xx_common_expr
    | xx_common_expr DIV xx_common_expr
    | xx_common_expr MOD xx_common_expr
    | xx_common_expr CONCAT xx_common_expr
    | xx_common_expr AND xx_common_expr
    | xx_common_expr OR xx_common_expr
    | xx_common_expr BITWISE_OR xx_common_expr
    | xx_common_expr BITWISE_AND xx_common_expr
    | xx_common_expr BITWISE_XOR xx_common_expr
    | xx_common_expr BITWISE_SHIFTLEFT xx_common_expr
    | xx_common_expr BITWISE_SHIFTRIGHT xx_common_expr
    | xx_common_expr INSTANCEOF xx_common_expr
    | xx_common_expr INCLUSIVE_RANGE xx_common_expr
    | xx_common_expr EXCLUSIVE_RANGE xx_common_expr
    | xx_fetch_expr
    | TYPEOF xx_common_expr
    | IDENTIFIER
    | INTEGER
    | STRING
    | ISTRING
    | CHAR
    | DOUBLE
    | NULL
    | TRUE
    | FALSE
    | CONSTANT
    | SBRACKET_OPEN SBRACKET_CLOSE
    | SBRACKET_OPEN xx_array_list SBRACKET_CLOSE
    | NEW STATIC
    | NEW STATIC PARENTHESES_OPEN PARENTHESES_CLOSE
    | NEW STATIC PARENTHESES_OPEN xx_call_parameters PARENTHESES_CLOSE
    | NEW IDENTIFIER
    | NEW IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE
    | NEW IDENTIFIER PARENTHESES_OPEN xx_call_parameters PARENTHESES_CLOSE
    | NEW BRACKET_OPEN IDENTIFIER BRACKET_CLOSE
    | NEW BRACKET_OPEN IDENTIFIER BRACKET_CLOSE PARENTHESES_OPEN PARENTHESES_CLOSE
    | NEW BRACKET_OPEN IDENTIFIER BRACKET_CLOSE PARENTHESES_OPEN xx_call_parameters PARENTHESES_CLOSE
    | NEW xx_parameter_type PARENTHESES_OPEN xx_call_parameters PARENTHESES_CLOSE
    | xx_mcall_expr
    | xx_scall_expr
    | xx_fcall_expr
    | xx_common_expr QUESTION xx_common_expr COLON xx_common_expr
    | xx_common_expr QUESTION COLON xx_common_expr
    | FUNCTION PARENTHESES_OPEN PARENTHESES_CLOSE BRACKET_OPEN BRACKET_CLOSE
    | FUNCTION PARENTHESES_OPEN PARENTHESES_CLOSE USE PARENTHESES_OPEN xx_use_parameter_list PARENTHESES_CLOSE BRACKET_OPEN BRACKET_CLOSE
    | FUNCTION PARENTHESES_OPEN PARENTHESES_CLOSE BRACKET_OPEN xx_statement_list BRACKET_CLOSE
    | FUNCTION PARENTHESES_OPEN PARENTHESES_CLOSE USE PARENTHESES_OPEN xx_use_parameter_list PARENTHESES_CLOSE BRACKET_OPEN xx_statement_list BRACKET_CLOSE
    | FUNCTION PARENTHESES_OPEN xx_parameter_list PARENTHESES_CLOSE BRACKET_OPEN BRACKET_CLOSE
    | FUNCTION PARENTHESES_OPEN xx_parameter_list PARENTHESES_CLOSE USE PARENTHESES_OPEN xx_use_parameter_list PARENTHESES_CLOSE BRACKET_OPEN BRACKET_CLOSE
    | FUNCTION PARENTHESES_OPEN xx_parameter_list PARENTHESES_CLOSE BRACKET_OPEN xx_statement_list BRACKET_CLOSE
    | FUNCTION PARENTHESES_OPEN xx_parameter_list PARENTHESES_CLOSE USE PARENTHESES_OPEN xx_use_parameter_list PARENTHESES_CLOSE BRACKET_OPEN xx_statement_list BRACKET_CLOSE
    | IDENTIFIER DOUBLEARROW xx_common_expr
xx_let_assignments ::= xx_let_assignments COMMA xx_let_assignment
    | xx_let_assignment
xx_let_assignment ::= IDENTIFIER xx_assignment_operator xx_assign_expr
    | IDENTIFIER ARROW IDENTIFIER xx_assignment_operator xx_assign_expr
    | IDENTIFIER ARROW BRACKET_OPEN IDENTIFIER BRACKET_CLOSE xx_assignment_operator xx_assign_expr
    | IDENTIFIER ARROW BRACKET_OPEN STRING BRACKET_CLOSE xx_assignment_operator xx_assign_expr
    | IDENTIFIER ARROW IDENTIFIER SBRACKET_OPEN SBRACKET_CLOSE xx_assignment_operator xx_assign_expr
    | IDENTIFIER ARROW IDENTIFIER xx_array_offset_list xx_assignment_operator xx_assign_expr
    | IDENTIFIER ARROW IDENTIFIER xx_array_offset_list SBRACKET_OPEN SBRACKET_CLOSE xx_assignment_operator xx_assign_expr
    | IDENTIFIER DOUBLECOLON IDENTIFIER xx_assignment_operator xx_assign_expr
    | IDENTIFIER DOUBLECOLON IDENTIFIER SBRACKET_OPEN SBRACKET_CLOSE xx_assignment_operator xx_assign_expr
    | IDENTIFIER DOUBLECOLON IDENTIFIER xx_array_offset_list xx_assignment_operator xx_assign_expr
    | IDENTIFIER DOUBLECOLON IDENTIFIER xx_array_offset_list SBRACKET_OPEN SBRACKET_CLOSE xx_assignment_operator xx_assign_expr
    | IDENTIFIER SBRACKET_OPEN SBRACKET_CLOSE xx_assignment_operator xx_assign_expr
    | IDENTIFIER xx_array_offset_list xx_assignment_operator xx_assign_expr
    | IDENTIFIER xx_array_offset_list SBRACKET_OPEN SBRACKET_CLOSE xx_assignment_operator xx_assign_expr
    | IDENTIFIER ARROW IDENTIFIER INCR
    | IDENTIFIER ARROW IDENTIFIER DECR
    | IDENTIFIER INCR
    | IDENTIFIER DECR
    | BRACKET_OPEN IDENTIFIER BRACKET_CLOSE xx_assignment_operator xx_assign_expr
    | BRACKET_OPEN STRING BRACKET_CLOSE xx_assignment_operator xx_assign_expr
xx_assignment_operator ::= ASSIGN
    | ASSIGN_ADD
    | ASSIGN_SUB
    | ASSIGN_MUL
    | ASSIGN_DIV
    | ASSIGN_CONCAT
    | ASSIGN_MOD
    | ASSIGN_BITWISE_AND
    | ASSIGN_BITWISE_OR
    | ASSIGN_BITWISE_XOR
    | ASSIGN_BITWISE_SHIFTLEFT
    | ASSIGN_BITWISE_SHIFTRIGHT
xx_assign_expr ::= xx_common_expr
xx_array_offset_list ::= xx_array_offset_list xx_array_offset
    | xx_array_offset
xx_array_offset ::= SBRACKET_OPEN xx_index_expr SBRACKET_CLOSE
xx_index_expr ::= xx_common_expr
xx_echo_expressions ::= xx_echo_expressions COMMA xx_echo_expression
    | xx_echo_expression
xx_echo_expression ::= xx_common_expr
xx_mcall_expr ::= xx_common_expr ARROW IDENTIFIER PARENTHESES_OPEN xx_call_parameters PARENTHESES_CLOSE
    | xx_common_expr ARROW IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE
    | xx_common_expr ARROW BRACKET_OPEN IDENTIFIER BRACKET_CLOSE PARENTHESES_OPEN xx_call_parameters PARENTHESES_CLOSE
    | xx_common_expr ARROW BRACKET_OPEN IDENTIFIER BRACKET_CLOSE PARENTHESES_OPEN PARENTHESES_CLOSE
    | xx_common_expr ARROW BRACKET_OPEN STRING BRACKET_CLOSE PARENTHESES_OPEN xx_call_parameters PARENTHESES_CLOSE
    | xx_common_expr ARROW BRACKET_OPEN STRING BRACKET_CLOSE PARENTHESES_OPEN PARENTHESES_CLOSE
xx_fcall_expr ::= IDENTIFIER PARENTHESES_OPEN xx_call_parameters PARENTHESES_CLOSE
    | IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE
    | BRACKET_OPEN IDENTIFIER BRACKET_CLOSE PARENTHESES_OPEN xx_call_parameters PARENTHESES_CLOSE
    | BRACKET_OPEN IDENTIFIER BRACKET_CLOSE PARENTHESES_OPEN PARENTHESES_CLOSE
xx_scall_expr ::= IDENTIFIER DOUBLECOLON IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE
    | IDENTIFIER DOUBLECOLON IDENTIFIER PARENTHESES_OPEN xx_call_parameters PARENTHESES_CLOSE
    | STATIC DOUBLECOLON IDENTIFIER PARENTHESES_OPEN xx_call_parameters PARENTHESES_CLOSE
    | STATIC DOUBLECOLON IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE
    | BRACKET_OPEN IDENTIFIER BRACKET_CLOSE DOUBLECOLON IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE
    | BRACKET_OPEN IDENTIFIER BRACKET_CLOSE DOUBLECOLON IDENTIFIER PARENTHESES_OPEN xx_call_parameters PARENTHESES_CLOSE
    | BRACKET_OPEN IDENTIFIER BRACKET_CLOSE DOUBLECOLON BRACKET_OPEN IDENTIFIER BRACKET_CLOSE PARENTHESES_OPEN PARENTHESES_CLOSE
    | BRACKET_OPEN IDENTIFIER BRACKET_CLOSE DOUBLECOLON BRACKET_OPEN IDENTIFIER BRACKET_CLOSE PARENTHESES_OPEN xx_call_parameters PARENTHESES_CLOSE
    | IDENTIFIER DOUBLECOLON BRACKET_OPEN IDENTIFIER BRACKET_CLOSE PARENTHESES_OPEN PARENTHESES_CLOSE
    | IDENTIFIER DOUBLECOLON BRACKET_OPEN IDENTIFIER BRACKET_CLOSE PARENTHESES_OPEN xx_call_parameters PARENTHESES_CLOSE
xx_fetch_expr ::= FETCH IDENTIFIER COMMA xx_common_expr
xx_declare_variable_list ::= xx_declare_variable_list COMMA xx_declare_variable
    | xx_declare_variable
xx_declare_variable ::= IDENTIFIER
    | IDENTIFIER ASSIGN xx_common_expr
xx_array_list ::= xx_array_list COMMA xx_array_item
    | xx_array_item
xx_call_parameters ::= xx_call_parameters COMMA xx_call_parameter
    | xx_call_parameter
xx_call_parameter ::= xx_common_expr
    | IDENTIFIER COLON xx_common_expr
xx_use_parameter_list ::= xx_use_parameter_list COMMA xx_use_parameter
    | xx_use_parameter
xx_use_parameter ::= IDENTIFIER
    | BITWISE_AND IDENTIFIER
    | CONST IDENTIFIER
    | CONST BITWISE_AND IDENTIFIER
xx_array_item ::= xx_array_key COLON xx_array_value
    | xx_array_value
xx_array_key ::= xx_common_expr
xx_array_value ::= xx_common_expr
xx_literal_array_list ::= xx_literal_array_list COMMA xx_literal_array_item
    | xx_literal_array_item
xx_literal_array_item ::= xx_literal_array_key COLON xx_literal_array_value
    | xx_literal_array_value
xx_literal_array_key ::= IDENTIFIER
    | STRING
    | INTEGER
xx_literal_array_value ::= xx_literal_expr

// Tokens

NULL ::= "null"
FALSE ::= "false"
TRUE ::= "true"
NAMESPACE ::= "namespace"
USE ::= "use"
AS ::= "as"
INTERFACE ::= "interface"
CLASS ::= "class"
EXTENDS ::= "extends"
IMPLEMENTS ::= "implements"
INTERNAL ::= "internal"
PUBLIC ::= "public"
PROTECTED ::= "protected"
PRIVATE ::= "private"
STATIC ::= "static"
INLINE ::= "inline"
DEPRECATED ::= "deprecated"
FINAL ::= "final"
ABSTRACT ::= "abstract"
FUNCTION ::= "function"
FUNCTION ::= "fn"
LET ::= "let"
ECHO ::= "echo"
CONST ::= "const"
TYPE_INTEGER ::= "int"
TYPE_UINTEGER ::= "uint"
TYPE_LONG ::= "long"
TYPE_ULONG ::= "ulong"
TYPE_CHAR ::= "char"
TYPE_UCHAR ::= "uchar"
TYPE_DOUBLE ::= "double"
TYPE_DOUBLE ::= "float"
TYPE_BOOL ::= "bool"
TYPE_BOOL ::= "boolean"
TYPE_STRING ::= "string"
TYPE_ARRAY ::= "array"
TYPE_VAR ::= "var"
TYPE_OBJECT ::= "object"
TYPE_CALLABLE ::= "callable"
TYPE_RESOURCE ::= "resource"
IF ::= "if"
ELSE ::= "else"
ELSEIF ::= "elseif"
DO ::= "do"
WHILE ::= "while"
FOR ::= "for"
IN ::= "in"
NEW ::= "new"
RETURN ::= "return"
REQUIRE ::= "require"
CLONE ::= "clone"
EMPTY ::= "empty"
VOID ::= "void"
LOOP ::= "loop"
BREAK ::= "break"
CONTINUE ::= "continue"
TYPEOF ::= "typeof"
INSTANCEOF ::= "instanceof"
LIKELY ::= "likely"
UNLIKELY ::= "unlikely"
ISSET ::= "isset"
UNSET ::= "unset"
THROW ::= "throw"
FETCH ::= "fetch"
SWITCH ::= "switch"
CASE ::= "case"
DEFAULT ::= "default"
REVERSE ::= "reverse"
TRY ::= "try"
CATCH ::= "catch"
PARENTHESES_OPEN ::= "("
PARENTHESES_CLOSE ::= ")"
BRACKET_OPEN ::= "{"
BRACKET_CLOSE ::= "}"
SBRACKET_OPEN ::= "["
SBRACKET_CLOSE ::= "]"
AT ::= "@"
NOT ::= "!"
BITWISE_NOT ::= "~"
AND ::= "&&"
OR ::= "||"
BITWISE_AND ::= "&"
BITWISE_OR ::= "|"
BITWISE_XOR ::= "^"
BITWISE_SHIFTLEFT ::= "<<"
BITWISE_SHIFTRIGHT ::= ">>"
ASSIGN ::= "="
ASSIGN_ADD ::= "+="
ASSIGN_SUB ::= "-="
ASSIGN_MUL ::= "*="
ASSIGN_DIV ::= "/="
ASSIGN_MOD ::= "%="
ASSIGN_BITWISE_AND ::= "&="
ASSIGN_BITWISE_OR ::= "|="
ASSIGN_BITWISE_XOR ::= "^="
ASSIGN_BITWISE_SHIFTLEFT ::= "<<="
ASSIGN_BITWISE_SHIFTRIGHT ::= ">>="
ASSIGN_CONCAT ::= ".="
EQUALS ::= "=="
NOTEQUALS ::= "!="
NOTEQUALS ::= "<>"
IDENTICAL ::= "==="
NOTIDENTICAL ::= "!=="
LESSEQUAL ::= "<="
GREATEREQUAL ::= ">="
LESS ::= "<"
GREATER ::= ">"
ARROW ::= "->"
DOUBLEARROW ::= "=>"
DOUBLECOLON ::= "::"
DOT ::= "."
ADD ::= "+"
SUB ::= "-"
MUL ::= "*"
DIV ::= "/"
MOD ::= "%"
INCR ::= "++"
DECR ::= "--"
INCLUSIVE_RANGE ::= ".."
EXCLUSIVE_RANGE ::= "..."
COLON ::= ":"
DOTCOMMA ::= ";"
COMMA ::= ","
QUESTION ::= "?"

zephir_parse_file terminates the program without any error messages

From @pakey on March 21, 2017 16:46

There is no error feedback after executing zephir build
After checking found in the implementation to the Library/CompilerFile.php file

$ir = zephir_parse_file(file_get_contents($zepRealPath), $zepRealPath);

The program is terminated, no one after any output, and can not capture the specific error message,
What should I do if I do not know where I can do it?

Copied from original issue: zephir-lang/zephir#1409

Compiling on Mac OSX with macports

In install file /opt/local/include needs to be included

gcc -Wl,-rpath /usr/local/lib -I/opt/local/include -I/usr/local/include -L/usr/local/lib -L/opt/local/lib -g3 -O0 -w parser.c scanner.c -ljson-c -o ../bin/zephir-parser

zephir build doesn't create a dll, instead opens configure.js in Notepad++

I'm trying to build a dll file but it doesn't build any dll. I run this command: zephir build

Then the output is:

Preparing for PHP compilation...
Proparing configuration file...

And then it opens the configure.js in Notepad++. http://i.imgur.com/vBQiWSn.png And it stays like this forever. If I close the Notepad++ it prints 2 more lines and there is no dll http://i.imgur.com/Hssuc2b.jpg

Details

  • Everything is 64bit

  • Zephir Parser => enabled

  • Author => Zephir Team and contributors

  • Version => 1.0.3

  • Build Date => May 13 2017 15:03:23

  • PHP 5.6.31 (cli) (built: Jul 5 2017 22:24:47)

  • Copyright (c) 1997-2016 The PHP Group

  • Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

  • Microsoft Windows [Version 6.3.9600]

  • Installation type: installing via package manager

  • Visual Studio Ultimate 2012 with Blend
    ** Blend for Visual Studio
    ** LightSwitch
    ** Microsoft Foundation Classes for C++
    ** Microsoft Office Developer Tools
    ** Microsoft SharePoint Developer Tools
    ** Microsoft Web Developer Tools

compile-errors.log:

Microsoft (R) Program Maintenance Utility Version 11.00.50727.1
Copyright (C) Microsoft Corporation. All rights reserved.

NMAKE : fatal error U1064: MAKEFILE not found and no target specified
Stop.

The compile.log is empty.

ParseException Syntax error while call static method dynamically

From @ikandars on February 16, 2014 10:31

I've got "Zephir\ParseException: Syntax error" when try to call a static method dynamically.

echo self::{"name"}();
-----------^
namespace Test;

class MyClass
{
    public function __construct()
    {
        echo self::{"name"}();
    }

    public static function name()
    {
        return "Jhon";
    }
}

I pulled the source from bc91853e3e8a0528481daaf26f1e04b0fab1ab33 commit id

Copied from original issue: zephir-lang/zephir#197

Cant concatenate strings

I'm getting this error.

[ERROR] Unknown type: concat

var virtualHostFile = file_get_contents("/etc/apache2/sites-available/000-default.conf");
var newVirtualHostFile = virtualHostFile . "newtext";

When i do a var_dump in virtualHostFile im getting this as string.

What am i doing wrong?

Compilation error on accessing dynamic properties

From @SliceOfLife on December 14, 2014 12:54

The documentation says, that I can use a variable value as property name:

let someProperty = "myProperty";
let this->{someProperty} = 100;

But I can't use variable to access a property of class in array:

    public static function doSomething()
    {
        var _array, property;

        let _array = [];
        let _array["index"] = new stdClass();
        let property = "test";
        let _array["index"]->{property} = 1;
    }

Compiler throws an exception:

Zephir\ParseException: Syntax error in .../TestClass.zep on line 13

      let _array["index"]->{property} = 1;
    ----------------------^

Zephir version 0.5.9a [396cb30]

Copied from original issue: zephir-lang/zephir#684

Support nested property-access

From @steffengy on October 12, 2014 20:13

namespace Debug;
class ZephirDebug
{
    public arr;

    public static function test()
    {
        let this->arr = new ZephirDebug();
        let this->arr->arr = 1;
    }
}

results in

Zephir\ParseException: Syntax error in /media/rdata/projects/XXX/zephir_debug/debug/zephirdebug.zep on line 9

                let this->arr->arr = 1;
        ----------------------^

Which is probably not expected behavior?

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Copied from original issue: zephir-lang/zephir#573

Syntax improvements

I have a few issues with the syntax parsing in this case. It uses it's own parser so I would expect it to be better. Expressions should just work.

I have a weird little bit of code like this:

                let obj->{arr["prop"]}[arr["key"]] = [
                    "a": arr["key"], "b": []
                ];

This fails to parse on several levels but should parse.

A secondary issue is whether or not assigning the array at that property to a variable will create a cow array or array by reference. When you need to create large structures COW arrays are extremely inefficient. I would hope the framework would provide arrays by reference by default and then a copy method for when a copy is needed. I have tested and it is COW, which is a major drawback. There is no benefit to it being COW in PHP, they just made it that way in the beginning. Importing this quirk from PHP is a major design flaw in zephir that defeats its purpose in many cases. I have worked with passing PHP arrays by pointer/reference in C extensions by hand and there is no problem with it. zvals are pointers already so it's really easy:

I don't think it is a good idea to make it too safe or managed like PHP CPP because we tested PHP CPP and half the time it gave no gains or so little gains that PHP code optimisation or using another scripting language would have done the trick. Because I can't do what I am doing in PHP in zephir my PHP code is more memory efficient by a factor of 10. zephir is useless to me until this is fixed. The point of passing around arrays in an object collection is to get around the limitations of PHP so without supporting dereferencing there PHP is faster than zephir.

At the very least I should be able to tell it that I want a pointer to the array in such and such a location rather than a copy.

var also does not support complex expressions. You need...

 var x;
 let x = this->something();

var appears to only allow literal/defalt assignment.

I cannot create a dynamic class. In PHP you can do new $classname();. I would expect new (classname)() to work but it does not.

In a switch statement I cannot declare a local variable.

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Use retrun value of zephir_parse_file() trigger a signal 11: SIGSEGV

Describe the bug
The process interrupted by signal 11: SIGSEGV when do same logic in return val of zephir_parse_file twice.

To Reproduce
Run this code:

function once()
{
    $code = "class Translate {}";
    $ast  = zephir_parse_file($code, '/test_filename.zep');

    try {
        $node = $ast[0];

        unset($node['type']);
        unset($node['file']);
        unset($node['line']);
        unset($node['char']);

        throw new \Exception();
    } catch (\Exception $e) {
    }
}

once();
once(); // It trigger error in second times

Expected behavior
Don't trgger error.

Environment (please complete the following information):

  • OS: MacOS 10.14
  • Zephir Parser version: development(b8e3162)
  • Installation type: compiling from source
  • Compiler version [e.g. gcc 5.4.0]: Apple LLVM version 10.0.0 (clang-1000.11.45.5)
  • PHP version [e.g. 7.2.4 ( NTS )]: 7.0.30

Provide support of the cast to uchar

calling zephir_parse_file with content as follows

    public function extract()
    {
        char ch1;
        string name = "peter";

        let ch1 = name[1];

        return (uchar)ch1;
    }

will print to stderr

unknown type?

Object type declaration, syntax error

The parser doesn't recognize type object declaration. Maybe it's not a native C type so I just want to point it out. But method argument hint type works as intended.

object obj = new stdClass; //---> throw error syntax

A workaround is to use var obj

Syntax error with final class and use of extends and implements

I use Zephir Parser 1.1.3 and Zephir 0.11.6 with Docker image php:7.2-cli-alpine3.8.
If I use a final class with extends and implements I've got the error above but without final or without implements or extends it works, but not with all of them.

In CompilerFile.php line 598
Syntax error in ServerException.zep on line 14

use Psr\Http\Client\ClientExceptionInterface;

final class ServerException extends \RuntimeException implements ClientExceptionInterface
{
}

The Psr\Http\Client\ClientExceptionInterface is an external class which was imported via prototype and is empty.

<?php

namespace Psr\Http\Client {
    interface ClientExceptionInterface {
    }
}

Class names consisting of one letter are not allowed

namespace Test\Calls;

class A
{
}
$ zephir fullclean; zephir generate --backend=ZendEngine3
Zephir\Parser\ParseException: Syntax error in /home/vladimir/workspace/zephir/test/calls/a.zep on line 3

at Library/CompilerFile.php(595)
#0 Library/Compiler.php(258): Zephir\CompilerFile->preCompile(Object(Zephir\Compiler))
#1 Library/Compiler.php(297): Zephir\Compiler->preCompile('test/calls/a.ze...')
#2 Library/Compiler.php(827): Zephir\Compiler->recursivePreCompile('test')
#3 Library/Commands/CommandAbstract.php(107): Zephir\Compiler->generate(Object(Zephir\Commands\CommandGenerate))
#4 Library/Bootstrap.php(200): Zephir\Commands\CommandAbstract->execute(Object(Zephir\Config), Object(Zephir\Logger))
#5 compiler.php(22): Zephir\Bootstrap::boot()
#6 {main}

At that:

namespace Test\Calls;

class a
{
}

works.

re2c 1.0.2 keeps the initial "/" at the beginning of an docblock (DCOMMENT-Token)

Hey,

relates to zephir-lang/zephir#1591

I got an issue and I cannot pinpoint it, I already solved it but it's a hack.
I am not sure if even another user is affected, it could just be my setup.

The reason why I put it here an not the zephir compiler is that I didn't want to invest more than 5 hours into reading/debugging the C/C++ and PHP code, esp since I am not used to re2c syntax.

But first things first.
versions zephir_parser / zephir (i tried different tags with zephir it doesn't matter)

zephir parser Tag/v1.1.0
Zephir version 0.10.4-11e39849b0 

lib / program versions

re2c 1.0.2

gcc (GCC) 5.4.0

PHP 7.1.11 (cli) (built: Oct 25 2017 18:30:55) ( NTS )

Error log (shortened because it's the same error for all files)

/home/j/development/tools/php/cphalcon/ext/phalcon/exception.zep.c:18:2: error: stray ‘\’ in program
  * Phalcon\Exception
  ^
/home/j/development/tools/php/cphalcon/ext/phalcon/exception.zep.c:18:12: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Exception’
  * Phalcon\Exception
            ^
/home/j/development/tools/php/cphalcon/ext/phalcon/exception.zep.c:18:12: error: unknown type name ‘Exception’
....

The exception.zep.c compiled source code so the error is obvious:

#ifdef HAVE_CONFIG_H
#include "../ext_config.h"
#endif

#include <php.h>
#include "../php_ext.h"
#include "../ext.h"

#include <Zend/zend_operators.h>
#include <Zend/zend_exceptions.h>
#include <Zend/zend_interfaces.h>

#include "kernel/main.h"


//**
 * Phalcon\Exception
 *
 * All framework exceptions should use or extend this exception
 */
ZEPHIR_INIT_CLASS(Phalcon_Exception) {

	ZEPHIR_REGISTER_CLASS_EX(Phalcon, Exception, phalcon, exception, zend_exception_get_default(TSRMLS_C), NULL, 0);

	return SUCCESS;

}

as you can see -> there are two slashes for the doc block comment.

The scanner keeps the beginning slash in /** for the DCOMMENT token which your compiler does not expect.

the hacky fix is pretty simple in zephir/Compilerfile

    /**
     * @param array $topStatement
     */
    public function compileComment(CompilationContext $compilationContext, $topStatement)
    {
        $compilationContext->codePrinter->output('/' . ltrim($topStatement['value'], '/') . '/');
    }

this does not affect the behaviour and works for me locally but fixing symptoms is not a reasonable approach.

Since I cannot find anyone else complaining about this I assume this a local setup issue but it's still better to report such behavior than leave it unchecked.

Too me this is a low prio bug esp since I fixed it by a small hack in the compiler.

Bitwise Operator Or issue

From @sergeyklay on August 15, 2015 19:31

php works fine

$a = 16;
$a |= $a >> 1; // 24
// the same as
// $a = $a | ($a >> 1);

zephir throws Zephir\ParseException with "Syntax error" message

var a;

let a = 16;
let a |= a >> 1;
Syntax error in /tmp/foo/foo/bar.zep on line 33

            let a |= a >> 1;
    --------------^

works fine

var a;

let a = 16;
let a = a | (a >> 1);

[NFR] PHP74 support for windows

For building Phalcon on AppVeyor we're using the pre builded windows DLL's. PHP74 isn't available (zephir_parser_x86_vc15_php7.4_1.3.2-505.zip)
Can we add them?

For loops with parentheses

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.

Parser does not understand classes in the annotation

From @sergeyklay on December 9, 2015 22:4

How to reproduce:

$ zephir init phpdoc
$ cd phpdoc
$ vim phpdoc/test.zep
namespace Phpdoc;

class Test
{
    /**
     * @var \stdClass
     */
    protected _foo { get, set };
}
$ zephir build

/usr/bin/php5 -dextension="/home/klay/projects/c/zephir/Library/../parser/zephir_parser.so"
/home/klay/projects/c/zephir/compiler.php build --parser-compiledZephir\CompilerException:
Unknown type \stdClass in /home/klay/projects/zephir/phpdoc/phpdoc/test.zep on line 9

    }

But when I use scalar type

namespace Phpdoc;

class Test
{
    /**
     * @var string
     */
    protected _foo { get, set };
}

all ok.

Real example: https://travis-ci.org/phalcon/cphalcon/jobs/95902591

Copied from original issue: zephir-lang/zephir#1143

can not install zephir-parser on my mac

fesiong:php-zephir-parser fesiong$ sudo ./install
Generating parser...
Parser statistics: 132 terminals, 99 nonterminals, 470 rules
                   982 states, 0 parser table entries, 0 conflicts
Configuring for:
PHP Api Version:         20160303
Zend Module Api No:      20160303
Zend Extension Api No:   320160303
autoheader: error: AC_CONFIG_HEADERS not found in configure.in
aclocal: warning: autoconf input should be named 'configure.ac', not 'configure.in'
glibtoolize: putting auxiliary files in '.'.
glibtoolize: linking file './ltmain.sh'
glibtoolize: You should add the contents of the following files to 'aclocal.m4':
glibtoolize:   '/usr/local/Cellar/libtool/2.4.6_1/share/aclocal/libtool.m4'
glibtoolize:   '/usr/local/Cellar/libtool/2.4.6_1/share/aclocal/ltoptions.m4'
glibtoolize:   '/usr/local/Cellar/libtool/2.4.6_1/share/aclocal/ltsugar.m4'
glibtoolize:   '/usr/local/Cellar/libtool/2.4.6_1/share/aclocal/ltversion.m4'
glibtoolize:   '/usr/local/Cellar/libtool/2.4.6_1/share/aclocal/lt~obsolete.m4'
glibtoolize: Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.in,
glibtoolize: and rerunning glibtoolize and aclocal.
glibtoolize: Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
autoheader: error: AC_CONFIG_HEADERS not found in configure.in
./configure: line 1: syntax error near unexpected token `('
./configure: line 1: `m4trace:aclocal.m4:3142: -1- m4_include([build/ax_check_compile_flag.m4])'
make: *** No targets specified and no makefile found.  Stop.

Thanks for compiling Zephir Parser!
Build succeed: Please restart your web server to complete the installation

What should I do next?

Rename zephir_parser.so to contain PHP version?

From @crocodile2u on April 7, 2016 11:2

Hey there.

There is a known issue with Zephir & switching between PHP versions 5.X and 7 (see related issue: zephir-lang/zephir#1175).

I found out that when Zephir compiles parser as a shared object, the filename is always zephir_parser.so. So, when I build my extension for the first time with php5, it will create the zephir_parser.so. Then I switch to PHP7 (I have both and I can switch with update-alternatives). Then zephir build results in an error. Yes, I can use --parser-compiled=force but this is something to figure out first. I mean, this is not obvious.

Moreover, its an overhead to always compile parser. What if zephir_parser.so is named zephir_parser-50620.so, zephir_parser-70005.so - depending on PHP_VERSION_ID ? This way it is still consistent with the --parser-compiled=force option (forces recompilation) and will result in less confusion from users that are unfamiliar with Zephir internals.

Cheers and thanks for a good job!

Copied from original issue: zephir-lang/zephir#1230

Parser leaks a lot of memory

[Fri Apr  7 12:41:42 2017]  Script:  '/home/vladimir/workspace/zephir/compiler.php'
/tmp/php-build/source/5.6.0/Zend/zend_hash.c(286) :  Freeing 0x55ADD22BDFA8 (77 bytes), script=/home/vladimir/workspace/zephir/compiler.php
Last leak repeated 112885 times
[Fri Apr  7 12:41:42 2017]  Script:  '/home/vladimir/workspace/zephir/compiler.php'
/home/vladimir/workspace/zephir/parser/parser/parser.php5.inc.h(35) :  Freeing 0x55ADD22BE058 (32 bytes), script=/home/vladimir/workspace/zephir/compiler.php
Last leak repeated 44052 times
[Fri Apr  7 12:41:42 2017]  Script:  '/home/vladimir/workspace/zephir/compiler.php'
/home/vladimir/workspace/zephir/parser/parser/parser.php5.inc.h(13) :  Freeing 0x55ADD22BE2B8 (32 bytes), script=/home/vladimir/workspace/zephir/compiler.php
Last leak repeated 26917 times
[Fri Apr  7 12:41:42 2017]  Script:  '/home/vladimir/workspace/zephir/compiler.php'
/home/vladimir/workspace/zephir/parser/parser/parser.php5.inc.h(27) :  Freeing 0x55ADD22BE338 (32 bytes), script=/home/vladimir/workspace/zephir/compiler.php
Last leak repeated 12722 times
[Fri Apr  7 12:41:42 2017]  Script:  '/home/vladimir/workspace/zephir/compiler.php'
/tmp/php-build/source/5.6.0/Zend/zend_hash.c(255) :  Freeing 0x55ADD22BE3B8 (64 bytes), script=/home/vladimir/workspace/zephir/compiler.php
/tmp/php-build/source/5.6.0/Zend/zend_alloc.c(2583) : Actual location (location was relayed)
Last leak repeated 18613 times
[Fri Apr  7 12:41:42 2017]  Script:  '/home/vladimir/workspace/zephir/compiler.php'
/home/vladimir/workspace/zephir/parser/parser/parser.php5.inc.h(20) :  Freeing 0x55ADD22BE5B8 (32 bytes), script=/home/vladimir/workspace/zephir/compiler.php
Last leak repeated 38370 times
[Fri Apr  7 12:41:42 2017]  Script:  '/home/vladimir/workspace/zephir/compiler.php'
/home/vladimir/workspace/zephir/parser/parser/parser.php5.inc.h(21) :  Freeing 0x55ADD22BE638 (46 bytes), script=/home/vladimir/workspace/zephir/compiler.php
Last leak repeated 38370 times
[Fri Apr  7 12:41:42 2017]  Script:  '/home/vladimir/workspace/zephir/compiler.php'
/home/vladimir/workspace/zephir/parser/parser/parser.php5.inc.h(14) :  Freeing 0x55ADD22BEA58 (72 bytes), script=/home/vladimir/workspace/zephir/compiler.php
/tmp/php-build/source/5.6.0/Zend/zend_API.c(1011) : Actual location (location was relayed)
Last leak repeated 27067 times
[Fri Apr  7 12:41:42 2017]  Script:  '/home/vladimir/workspace/zephir/compiler.php'
/tmp/php-build/source/5.6.0/Zend/zend_hash.c(392) :  Freeing 0x55ADD22BEB00 (64 bytes), script=/home/vladimir/workspace/zephir/compiler.php
/tmp/php-build/source/5.6.0/Zend/zend_alloc.c(2583) : Actual location (location was relayed)
Last leak repeated 7102 times
[Fri Apr  7 12:41:42 2017]  Script:  '/home/vladimir/workspace/zephir/compiler.php'
/tmp/php-build/source/5.6.0/Zend/zend_API.c(1469) :  Freeing 0x55ADD22BEBA0 (72 bytes), script=/home/vladimir/workspace/zephir/compiler.php
/tmp/php-build/source/5.6.0/Zend/zend_hash.c(419) : Actual location (location was relayed)
Last leak repeated 13057 times
[Fri Apr  7 12:41:42 2017]  Script:  '/home/vladimir/workspace/zephir/compiler.php'
/home/vladimir/workspace/zephir/parser/parser/parser.php5.inc.h(28) :  Freeing 0x55ADD22BF7B0 (19 bytes), script=/home/vladimir/workspace/zephir/compiler.php
Last leak repeated 12722 times
[Fri Apr  7 12:41:42 2017]  Script:  '/home/vladimir/workspace/zephir/compiler.php'
/tmp/php-build/source/5.6.0/Zend/zend_hash.c(454) :  Freeing 0x55ADD227F538 (128 bytes), script=/home/vladimir/workspace/zephir/compiler.php
Last leak repeated 1350 times
[Fri Apr  7 12:41:42 2017]  Script:  '/home/vladimir/workspace/zephir/compiler.php'
/home/vladimir/workspace/zephir/parser/parser/parser.php5.inc.h(50) :  Freeing 0x55ADD2282968 (32 bytes), script=/home/vladimir/workspace/zephir/compiler.php
Last leak repeated 3878 times
[Fri Apr  7 12:41:42 2017]  Script:  '/home/vladimir/workspace/zephir/compiler.php'
/home/vladimir/workspace/zephir/parser/zephir_parser.c(58) :  Freeing 0x55ADD22488E8 (32 bytes), script=/home/vladimir/workspace/zephir/compiler.php
Last leak repeated 149 times
[Fri Apr  7 12:41:42 2017]  Script:  '/home/vladimir/workspace/zephir/compiler.php'
/home/vladimir/workspace/zephir/parser/parser/parser.php5.inc.h(51) :  Freeing 0x55ADD2010F30 (7 bytes), script=/home/vladimir/workspace/zephir/compiler.php
Last leak repeated 3878 times
=== Total 361147 memory leaks detected ===

Provide minimal script to reproduce the issue

zephir fullclean && zephir generate --backend=ZendEngine2

Details

  • Zephir Parser version: (php --ri "Zephir Parser""): latest parser from zephir/parser
  • PHP Version: (php -v): PHP 5.6.0 (cli) (built: Mar 24 2017 18:45:49) (DEBUG ZTS)

Can php7.2 be used?

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.