Giter Club home page Giter Club logo

php-lenient-parser's Introduction

PHP Lenient Parser

This is a PHP 7 parser written in PHP. It handles some partial and illegal code, producing best-effort partial syntax tree. Its purpose is to simplify static code analysis and manipulation.

It's error reporting is not complete though, i.e. it may silently accept illegal PHP input.

As this is just a parser replacement for PHP Parser, go there for actual documentation.

Installation

The preferred installation method is composer:

php composer.phar require tsufeki/php-lenient-parser

Usage

Use the factory to get an instance of parser:

$parser = (new LenientParserFactory())->create();

Or provide your own lexer and options (no options are supported at the moment though):

$parser = (new LenientParserFactory())->create(LenientParserFactory::ONLY_PHP7, $lexer, $options);

Created parser is a drop-in replacement for php-parser.

Do not instantiate LenientParser directly, use the factory.

Info

At the moment parsing of PHP 5 is not supported, only PHP 7.

Internally, the parser is implemented as a Pratt parser (also called "Top down operator precedence parser").

License

Same as php-parser, BSD - see LICENCE.

Test suite and CLI script (below bin/, test/ and test_old/) are borrowed from php-parser and modified.

php-lenient-parser's People

Contributors

algo13 avatar anlutro avatar benedyktbla avatar grahamcampbell avatar hakre avatar hason avatar igrizzli avatar jesseschalken avatar kix avatar lisachenko avatar nicmart avatar nikic avatar ovr avatar polomsky avatar prayagverma avatar remicollet avatar rmruano avatar royopa avatar sasezaki avatar schmittjoh avatar sebastianbergmann avatar siwinski avatar ss23 avatar suralc avatar taoso avatar theofidry avatar theseer avatar thomasruiz avatar tomzx avatar tsufeki avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.