hoaproject / Compiler

The Hoa\Compiler library.
https://hoa-project.net/
453 stars 47 forks source link

Broken visualization of invalid input token in multiline input #97

Open Majkl578 opened 5 years ago

Majkl578 commented 5 years ago

When using multiline input, the arrow indicating position of invalid token is not positioned correctly:

/**
 * @Foo(hello
 */

When error is the ( (i.e. missing pair )), the exception message currently contains:

/**
 * @Foo(hello
 */
                   ↑

What would be expceted instead:

/**
 * @Foo(hello
        ↑
 */

or:

/**
 * @Foo(hello
        ↑
flip111 commented 5 years ago

@Majkl578 i might take a look at this bug, but please make it easy for me and provide runnable test code

Majkl578 commented 5 years ago

I'll see what can be done, but Hoa's proprietary test suite makes things hard for contributors.

flip111 commented 5 years ago

@Majkl578 what do you mean? proprietary is usually used to refer to license. In this case it's not proprietary but BSD license.

As for test framework it's based on http://atoum.org/ instead of phpunit as far as i know. I used atoum once it was pretty good.

You can just provide a snippet of code that shows your error, don't need a test case at the moment.

flip111 commented 5 years ago

It would be good to fix this bug together with https://github.com/hoaproject/Compiler/issues/78 at the same time.

Majkl578 commented 5 years ago

By proprietary I meant it's an in-house suite (hoa/test), not a standard tool like PHPUnit. So a contributor must first spend time investigating how this tool works and how the tests look like. It's an entry barrier.

Majkl578 commented 5 years ago

Also, proprietary doesn't only mean properietary license, in this sense it should be understood as non-standard (see Wiktionary, adj. 4).

flip111 commented 5 years ago

@Majkl578 you are right PHPUnit is not Atoum. PHPUnit is the most used test framework for PHP, but a standard? Anyway we can worry about unit test later, i can do it if necessary, it's not that difficult