Skip to content

Commit

Permalink
Merge pull request #2 from royopa/patch-1
Browse files Browse the repository at this point in the history
Added syntax highlighting for PHP code in readme
  • Loading branch information
nikic committed Jun 25, 2015
2 parents d141d0b + c9b9618 commit d73f9f8
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@ A Control-Flow-Graph implementation in Pure PHP.
## Usage

To bootstrap the parser, you need to give it a `PhpParser` instance:

$parser = new PHPCfg\Parser(
new PhpParser\Parser(new PhpParser\Lexer)
);

```php
$parser = new PHPCfg\Parser(
new PhpParser\Parser(new PhpParser\Lexer)
);
```
Then, just call parse on a block of code, giving it a filename:

$block = $parser->parse(file_get_contents(__FILE__), __FILE__);

```php
$block = $parser->parse(file_get_contents(__FILE__), __FILE__);
```
To dump the graph, simply use the built-in dumper:

$dumper = new PHPCfg\Dumper;
echo $dumper->dump($block);
```php
$dumper = new PHPCfg\Dumper;
echo $dumper->dump($block);
```

0 comments on commit d73f9f8

Please # to comment.