php-parser icon indicating copy to clipboard operation
php-parser copied to clipboard

fix: 🐛 syntax error on multiline class constant with comment

Open shufo opened this issue 10 months ago • 1 comments

Context

  • fixes: #1151

Problem

  • see: #1151

Solution

Skip comments and whitespace when peeking as peek() is just peeking next token without consider comment. I don't know this is proper solution but it works as expected in my environment.

shufo avatar Jan 14 '25 17:01 shufo

Tests has passed but seems benchmark failed. I don't know it's ok to failed.

Run python cachegrind.py node test/benchmark2.js > output.txt
==2711== Cachegrind, a high-precision tracing profiler
==2711== Copyright (C) 2002-2017, and GNU GPL'd, by Nicholas Nethercote et al.
==2711== Using Valgrind-3.22.0 and LibVEX; rerun with -h for copyright info
==2711== Command: node test/benchmark2.js
==2711== 
==2711== 
==2711== I refs:        237,39[5](https://github.com/glayzzle/php-parser/actions/runs/12772711343/job/35611721161?pr=1152#step:7:6),387
Traceback (most recent call last):
  File "/home/runner/work/php-parser/php-parser/cachegrind.py", line 137, in <module>
    print(github_action_benchmark_json(combined_instruction_estimate(get_counts(run_with_cachegrind(sys.argv[1:])))))
                                                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/php-parser/php-parser/cachegrind.py", line [10](https://github.com/glayzzle/php-parser/actions/runs/12772711343/job/35611721161?pr=1152#step:7:11)0, in get_counts
    ram_hits = d["DLmr"] + d["DLmw"] + d["ILmr"]
               ~^^^^^^^^
KeyError: 'DLmr'

shufo avatar Jan 15 '25 09:01 shufo

@shufo sorry about the late response! We're looking to fix the CI in #1157.

czosel avatar Jun 25 '25 07:06 czosel

Released in v3.2.4 :tada:

czosel avatar Jun 27 '25 22:06 czosel

@czosel Thank you!

shufo avatar Jul 11 '25 10:07 shufo