Skip to content

Commit 54fe897

Browse files
committed
Added examples
1 parent 0e02dbd commit 54fe897

File tree

4 files changed

+43
-3
lines changed

4 files changed

+43
-3
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,17 @@ extension=zephir_parser.so
5656

5757
Finally, restart the web server.
5858

59+
## Usage
60+
61+
```php
62+
$path = __DIR__ . '/test.zep';
63+
$retval = zephir_parse_file(file_get_contents($path), $path);
64+
65+
echo PHP_EOL;
66+
var_export($retval);
67+
echo PHP_EOL;
68+
```
69+
5970
## License
6071

6172
Zephir Parser is open source software licensed under the MIT License. See the LICENSE file for more

ide/zephir_parser.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
/*
4+
+--------------------------------------------------------------------------+
5+
| Zephir Parser |
6+
+--------------------------------------------------------------------------+
7+
| Copyright (c) 2013-2017 Zephir Team and contributors |
8+
+--------------------------------------------------------------------------+
9+
| This source file is subject the MIT license, that is bundled with |
10+
| this package in the file LICENSE, and is available through the |
11+
| world-wide-web at the following url: |
12+
| https://zephir-lang.com/license.html |
13+
| |
14+
| If you did not receive a copy of the MIT license and are unable |
15+
| to obtain it through the world-wide-web, please send a note to |
16+
| license@zephir-lang.com so we can mail you a copy immediately. |
17+
+--------------------------------------------------------------------------+
18+
*/
19+
20+
/**
21+
* Parses a file and returning an intermediate array representation.
22+
*
23+
* @param string $content
24+
* @param string $filepath
25+
* @return array
26+
*/
27+
function zephir_parse_file($content, $filepath)
28+
{
29+
}

parser/base.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ static void xx_parse_with_token(void* xx_parser, int opcode, int parsercode, xx_
7070
}
7171

7272
/**
73-
* Parses a comment returning an intermediate array representation
73+
* Parses a programm and returning an intermediate array representation
7474
*/
7575
void xx_parse_program(zval *return_value, char *program, size_t program_length, char *file_path, zval **error_msg) {
7676

zephir_parser.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828

2929
extern void *xx_parse_program(zval *return_value, char *program, size_t program_length, char *file_path, zval **error_msg);
3030

31-
/* {{{ proto string zephir_parse_file(string arg)
32-
Return a string to confirm that the module is compiled in */
31+
/* {{{ proto array zephir_parse_file(string content, string filepath)
32+
Parses a file and returning an intermediate array representation */
3333
PHP_FUNCTION(zephir_parse_file)
3434
{
3535
size_t filepath_len = 0;

0 commit comments

Comments
 (0)