mirror of
https://github.com/nikic/PHP-Parser.git
synced 2025-01-17 15:18:17 +01:00
Doc fixes
This commit is contained in:
parent
4cd2b95a23
commit
f56db26d8b
@ -6,22 +6,14 @@ There are multiple ways to include the PHP parser into your project:
|
||||
Installing via Composer
|
||||
-----------------------
|
||||
|
||||
Create a `composer.json` file in your project root and use it to define your dependencies:
|
||||
Run the following command inside your project:
|
||||
|
||||
{
|
||||
"require": {
|
||||
"nikic/php-parser": "~1.0.2"
|
||||
}
|
||||
}
|
||||
php composer.phar require nikic/php-parser
|
||||
|
||||
Then install Composer in your project (or [download the composer.phar][1] directly):
|
||||
If you haven't installed [Composer][1] yet, you can do so using:
|
||||
|
||||
curl -s http://getcomposer.org/installer | php
|
||||
|
||||
And finally ask Composer to install the dependencies:
|
||||
|
||||
php composer.phar install
|
||||
|
||||
Installing as a Git Submodule
|
||||
-----------------------------
|
||||
|
||||
@ -35,5 +27,5 @@ Installing from the Zip- or Tarball
|
||||
Download the latest version from [the download page][2], unpack it and move the files somewhere into your project.
|
||||
|
||||
|
||||
[1]: http://getcomposer.org/composer.phar
|
||||
[2]: https://github.com/nikic/PHP-Parser/tags
|
||||
[1]: https://getcomposer.org/
|
||||
[2]: https://github.com/nikic/PHP-Parser/tags
|
||||
|
@ -6,7 +6,7 @@ This document explains how to use the parser, the pretty printer and the node tr
|
||||
Bootstrapping
|
||||
-------------
|
||||
|
||||
The library needs to register a class autoloader. You can either use the ''vendor/autoload.php'' file generated by
|
||||
The library needs to register a class autoloader. You can either use the `vendor/autoload.php` file generated by
|
||||
Composer or by including the bundled `lib/bootstrap.php` file:
|
||||
|
||||
```php
|
||||
@ -415,4 +415,4 @@ class NodeVisitor_NamespaceConverter extends PhpParser\NodeVisitorAbstract
|
||||
}
|
||||
```
|
||||
|
||||
That's all.
|
||||
That's all.
|
||||
|
@ -67,7 +67,11 @@ class MyNodeVisitor extends PhpParser\NodeVisitorAbstract {
|
||||
}
|
||||
}
|
||||
|
||||
$lexer = new TokenOffsetLexer();
|
||||
$lexer = new PhpParser\Lexer(array(
|
||||
'usedAttributes' => array(
|
||||
'comments', 'startLine', 'endLine', 'startTokenPos', 'endTokenPos'
|
||||
)
|
||||
));
|
||||
$parser = new PhpParser\Parser($lexer);
|
||||
|
||||
$visitor = new MyNodeVisitor();
|
||||
|
Loading…
x
Reference in New Issue
Block a user