Skip to content

Commit

Permalink
Updated documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
mck89 committed Sep 11, 2016
1 parent 1806c05 commit a8335df
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ To generate AST for your JavaScript code just write:

```php
$source = "var a = 1"; //JavaScript code
$ast = Peast\Peast::ES6($source, $options)->parse();
$ast = Peast\Peast::ES7($source, $options)->parse();
```
`ES6` is the ECMAScript version used to parse the code, right now only ES6 is implemented.

The previous code generates this structure:
```
Expand All @@ -51,7 +50,7 @@ Tokenization
-------------
```php
$source = "var a = 1"; //JavaScript code
$tokens = Peast\Peast::ES6($source, $options)->tokenize();
$tokens = Peast\Peast::ES7($source, $options)->tokenize();
```
The `$tokens` array is:
```
Expand All @@ -71,6 +70,13 @@ array(
)
```

EcmaScript version
-------------
Peast can parse different versions of EcmaScript, you can choose the version by using the relative method on the main class.
Available methods are:
* ```Peast\Peast::ES6(source, options)```: parse using EcmaScript 6 syntax
* ```Peast\Peast::ES7(source, options)```: parse using EcmaScript 7 syntax

Options
-------------

Expand Down

0 comments on commit a8335df

Please sign in to comment.