php-parser
php-parser copied to clipboard
fix: 🐛 syntax error on multiline class constant with comment
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.
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 sorry about the late response! We're looking to fix the CI in #1157.
Released in v3.2.4 :tada:
@czosel Thank you!