/php-ast/ |
H A D | util.php | 3 use ast\flags; 14 foreach (ast\get_metadata() as $data) { 58 if ($ast instanceof ast\Node) { 59 $result = ast\get_kind_name($ast->kind); 62 $result .= " @ $ast->lineno"; 68 … if ((ast\kind_uses_flags($ast->kind) && !is_combinable_flag($ast->kind)) || $ast->flags != 0) { 69 $result .= "\n flags: " . format_flags($ast->kind, $ast->flags); 78 } else if ($ast === null) { 80 } else if (is_string($ast)) { 81 return "\"$ast\""; [all …]
|
H A D | README.md | 1 php-ast 47 * `ast\Node` class 66 $ast = ast\parse_code('<?php ...', $version=100); 68 $ast = ast\parse_file('file.php', $version=100); 75 namespace ast; 198 namespace ast; 231 // Used by ast\AST_METHOD, ast\AST_PROP_DECL, ast\AST_PROP_GROUP, 232 // ast\AST_CLASS_CONST_DECL, ast\AST_CLASS_CONST_GROUP, and ast\AST_TRAIT_ALIAS (combinable) 241 // Used by ast\AST_CLOSURE, ast\AST_ARROW_FUNC (combinable) 244 // Used by ast\AST_FUNC_DECL, ast\AST_METHOD, ast\AST_CLOSURE, ast\AST_ARROW_FUNC (combinable) [all …]
|
H A D | config.m4 | 1 dnl config.m4 for extension ast 3 PHP_ARG_ENABLE(ast, whether to enable ast support, 4 [ --enable-ast Enable ast support]) 7 PHP_NEW_EXTENSION(ast, ast.c ast_data.c, $ext_shared)
|
H A D | config.w32 | 3 ARG_ENABLE("ast", "enable ast support", "no"); 6 EXTENSION("ast", "ast.c ast_data.c");
|
H A D | ast.c | 375 zend_ast *ast; in get_ast() local 379 return ast; in get_ast() 385 zend_ast *ast; in get_ast() 405 ast = CG(ast); in get_ast() 413 return ast; in get_ast() 440 if (!ast) { in ast_is_name() 547 if (ast && ast->kind == ZEND_AST_STMT_LIST) { in ast_should_normalize_list() 939 ast->attr = ast_assign_op_to_binary_op(ast->attr); in ast_to_zval() 979 ast->child[0]->attr = ast->attr; in ast_to_zval() 1230 if (!ast) { in PHP_FUNCTION() [all …]
|
H A D | ast.stub.php | 14 namespace ast; namespace 19 function parse_code(string $code, int $version, string $filename = 'string code'): \ast\Node {} 21 function parse_file(string $filename, int $version): \ast\Node {}
|
H A D | php_ast.h | 24 ZEND_BEGIN_MODULE_GLOBALS(ast) in ZEND_BEGIN_MODULE_GLOBALS() argument 26 ZEND_END_MODULE_GLOBALS(ast) 28 ZEND_EXTERN_MODULE_GLOBALS(ast) 30 #define AST_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(ast, v)
|
/php-ast/tests/ |
H A D | get_kind_name.phpt | 2 Test ast\get_kind_name() 6 var_dump(ast\get_kind_name(ast\AST_VAR)); 7 var_dump(ast\get_kind_name(ast\AST_NAME)); 8 var_dump(ast\get_kind_name(ast\AST_CLOSURE_VAR)); 11 var_dump(ast\get_kind_name(12345));
|
H A D | zpp_errors.phpt | 6 try { ast\parse_code(); } 8 try { ast\parse_file(); } 10 try { ast\get_kind_name(); } 12 try { ast\kind_uses_flags(); } 17 ast\parse_code() expects at least 1 %s, 0 given 18 ast\parse_file() expects at least 1 %s, 0 given 19 ast\get_kind_name() expects exactly 1 %s, 0 given 20 ast\kind_uses_flags() expects exactly 1 %s, 0 given
|
H A D | constructor.phpt | 2 ast\Node has a __construct method 10 var_dump(new \ast\Node()); 14 var_dump(new \ast\Node(null, null, null, null)); 17 echo ast_dump(new \ast\Node(\ast\AST_NAME, 1, ['name' => 'FOO'], 2), AST_DUMP_LINENOS) . "\n"; 22 object(ast\Node)#1 (4) { 32 object(ast\Node)#1 (4) {
|
H A D | parse_file.phpt | 2 ast\parse_file() on valid file 8 $ast = ast\parse_file(__DIR__ . '/valid_file.php', $version=70); 9 echo ast_dump($ast);
|
H A D | empty_file_parse.phpt | 2 ast\parse_file() with empty file 7 $file = ast\parse_file(__DIR__ . '/empty_file.php', $version=70); 8 var_dump($file instanceof ast\Node); 10 $file = ast\parse_code('', $version=70); 11 var_dump($file instanceof ast\Node);
|
H A D | decl_normalization.phpt | 2 The class ast\Node\Decl no longer exists 29 $ast = ast\parse_code($code, $version=70); 30 var_dump(array_map('get_class', $ast->children)); 31 echo ast_dump($ast) . "\n"; 32 $ast = ast\parse_code($code, $version=50); 33 echo ast_dump($ast) . "\n"; 39 string(8) "ast\Node" 41 string(8) "ast\Node" 43 string(8) "ast\Node" 45 string(8) "ast\Node" [all …]
|
H A D | php82_dynamic_property_attribute.phpt | 22 $node = new ast\Node(); 25 $metadata = new ast\Metadata(); 28 dump_attributes(ast\Node::class); 29 dump_attributes(ast\Metadata::class); 38 Deprecated: Creation of dynamic property ast\Metadata::$undeclaredDynamic is deprecated in %sphp82_… 46 Attributes of ast\Node: 48 Attributes of ast\Metadata:
|
H A D | parse_code_parse_error.phpt | 2 ast\parse_code() throwing a ParseError 9 ast\parse_code($code, 70); 14 ast\parse_code($code, 70, 'file.php'); 23 #0 %s(%d): ast\parse_code('%s', %d) 27 #0 %s(%d): ast\parse_code('%s', %d, 'file.php')
|
H A D | parse_file_not_existing.phpt | 2 ast\parse_file() on file that does not exist 7 ast\parse_file(__DIR__ . '/non_existing_file.php', $version=70); 14 RuntimeException: ast\parse_file(%stests/non_existing_file.php): %sailed to open stream: No such fi… 16 #0 %s(%d): ast\parse_file('%s', %d)
|
H A D | get_supported_versions.phpt | 2 ast\get_supported_versions() function 6 var_dump(ast\get_supported_versions()); 7 var_dump(ast\get_supported_versions(true));
|
H A D | ast_dump_with_linenos.phpt | 5 if (!extension_loaded("ast")) print "skip"; 24 $ast = ast\parse_code($code, $version=70); 25 echo ast_dump($ast, AST_DUMP_LINENOS);
|
H A D | node_constructor_throw.phpt | 2 new ast\Node() throwing 4 <?php if (!extension_loaded("ast")) print "skip"; ?> 9 new ast\Node('invalid');
|
H A D | parse_file_parse_error.phpt | 2 ast\parse_file() on file with parse error 7 ast\parse_file(__DIR__ . '/invalid_file.php', $version=70); 16 #0 %s(%d): ast\parse_file('%s', %d)
|
H A D | ast_dump_with_exclude_doc.phpt | 19 $ast = ast\parse_code($code, $version=80); 20 echo ast_dump($ast, AST_DUMP_EXCLUDE_DOC_COMMENT);
|
H A D | functions_dont_use.phpt | 14 echo ast_dump(ast\parse_code($code, $version=50)), "\n"; 15 echo ast_dump(ast\parse_code($code, $version=60)), "\n"; 20 Deprecated: ast\parse_code(): Version 50 is deprecated in %s.php on line 11 39 Deprecated: ast\parse_code(): Version 60 is deprecated in %s.php on line 12
|
H A D | concat.phpt | 6 // This tests that php-ast consistently exposes the AST in PHP 7.0-7.4 7 // For https://github.com/nikic/php-ast/issues/123 16 echo ast_dump(ast\parse_code($code, $version=70)), "\n";
|
H A D | version_errors.phpt | 7 ast\parse_code('<?php ...'); 13 ast\parse_code('<?php ...', $version=10000);
|
H A D | php81_readonly.phpt | 17 $node = ast\parse_code($code, $version=60); 19 $node = ast\parse_code($code, $version=85); 22 Deprecated: ast\parse_code(): Version 60 is deprecated in %sphp81_readonly.php on line 12
|