Giter Site home page Giter Site logo

Comments (8)

mkusher avatar mkusher commented on August 23, 2024

Hello, thanks for the bug report. This happens because of using hacked php-parser. It is unable to parse line like 'a' => $a->

from padawan.php.

allan-simon avatar allan-simon commented on August 23, 2024

hmmm ok, actually if i put it on one line , then it's able to parse it correctly

by the way, now that php7 has a AST (and a lib to access it) , would it make things easier ? (like the people from this project https://github.com/etsy/phan/ are doing)

from padawan.php.

allan-simon avatar allan-simon commented on August 23, 2024

more on the bug itself, do you think it would be hard to fix, i.e if i could try my hand on it ?

from padawan.php.

mkusher avatar mkusher commented on August 23, 2024

@allan-simon I haven't tried it yet, but I think at least it would be faster. What about fixing this bug, right now I have not enough time and would be able to fix it only after holidays.
The problem lives here https://github.com/mkusher/padawan.php/blob/master/src/Parser/ErrorFreePhpParser.php
but if it is possible to use https://github.com/nikic/PHP-Parser/blob/master/doc/component/Error.markdown then maybe it will be easy to solve

from padawan.php.

allan-simon avatar allan-simon commented on August 23, 2024

I've added some debug in ErrorFreePhpParser, and what I can see is that most of the time the exception which get returned is

Syntax error, unexpected EOF, expecting T_STRING or T_VARIABLE or '{' or '$' on line 1

even for [ 'a' => $a-> ] (for which autocompletion works

but for

[
     'a' => $a->
]

I got :

"Syntax error, unexpected T_DOUBLE_ARROW on line 1"

from padawan.php.

allan-simon avatar allan-simon commented on August 23, 2024

oh I see what you mean, as it handles on a line per line basis , hence why it works when the beginning of the array is on the same line, and for other type of multiline statement

from padawan.php.

golaod avatar golaod commented on August 23, 2024

Is there a chance to fix it?

from padawan.php.

mkusher avatar mkusher commented on August 23, 2024

@golaod there should be fix in a parser logic, I'm not sure how easy it is. Currently I'm working on https://github.com/mkusher/padawan.php/pulls

from padawan.php.

Related Issues (20)

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.