Skip to content

Sync with Phan, support version 70 instead of 50 #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.*.swp
.*.swo
tags
vendor/
394 changes: 301 additions & 93 deletions .phan/config.php

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
language: php

php:
- 7.0
- 7.1
- 7.2
- 7.3
- 7.4snapshot

dist: xenial

Expand All @@ -22,7 +22,7 @@ install:

# Install phan separately because the tolerant-php-parser version may be behind.
script:
- composer create-project phan/phan=1.2.1 ~/phan-install; ~/phan-install/phan
- composer create-project phan/phan=2.3.0 ~/phan-install; ~/phan-install/phan
- ./test

branches:
Expand Down
15 changes: 4 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,9 @@ Tolerant-PHP-Parser to php-ast

[![Build Status](https://travis-ci.org/TysonAndre/tolerant-php-parser-to-php-ast.svg?branch=master)](https://travis-ci.org/TysonAndre/tolerant-php-parser-to-php-ast)

This project uses Microsoft/tolerant-php-parser to generate a tree with error tolerance, then converts from that tree to ast\Node: https://github.com/Microsoft/tolerant-php-parser/issues/113
This project uses Microsoft/tolerant-php-parser to generate a tree with error tolerance, then converts from that tree to ast\Node from [php-ast](https://github.com/nikic/php-ast)

This is 90% done. Current test cases pass, but some cases aren't yet tested.

- Still being ported from https://github.com/TysonAndre/php-parser-to-php-ast
- The test suite is not yet comprehensive, may need to handle tokens

[Current Issues](https://github.com/TysonAndre/tolerant-php-parser-to-php-ast/issues/)

- The test suite this is based off of covers common cases for Phan, but edge cases still remain.
See https://github.com/TysonAndre/tolerant-php-parser-to-php-ast/issues/4
This release (0.1.0) supports AST version 70.

Usage
-----
Expand All @@ -28,11 +20,12 @@ Using it as an error-tolerant substitute for php-ast (e.g. for use in IDEs)
- Omitting errors only handles some common cases that come up while editing a file.
- Placeholders may change in the future.
- [tests/ASTConverter/ErrorTolerantConversionTest.php](https://github.com/TysonAndre/tolerant-php-parser-to-php-ast/blob/master/tests/ASTConverter/ErrorTolerantConversionTest.php)
- [Phan's](https://github.com/phan/phan) Language Server uses this code to do that.

Running unit tests
------------------

To run unit tests, you must install [nikic/php-ast](https://github.com/nikic/php-ast) 0.1.5+ (for the expected results to be created).
To run unit tests, you must install [nikic/php-ast](https://github.com/nikic/php-ast) 1.0.1+ (for the expected results to be created).
You must also run `composer install` if you haven't already done so.

- Then run `vendor/bin/phpunit`
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@
"config": {
"sort-packages": true,
"platform": {
"php": "7.0.24"
"php": "7.1.28"
}
},
"require": {
"php": ">=7.0",
"Microsoft/tolerant-php-parser": "0.0.16"
"microsoft/tolerant-php-parser": "0.0.18"
},
"require-dev": {
"phpunit/phpunit": "^6.4"
"phpunit/phpunit": "^6.4",
"phan/phan": "^2.3.0"
},
"suggest": {
"ext-ast": "~0.1.5||~1.0.0",
"phan/phan": "^1.2.1"
"ext-ast": "~1.0.1"
},
"autoload": {
"psr-4": {"TolerantASTConverter\\": "src/TolerantASTConverter"}
Expand Down
Loading