Closed supun-io closed 7 months ago
@supun-io great spot! Since this is going to change the parse result, the snapshot tests will need to be regenerated but I can handle that since it's not documented anywhere yet.
Actually, no changes needed to existing tests since this only affected PHP tags after inline HTML code. I've added a test to cover this.
@ryangjchandler thanks, as I have mentioned I was playing around with #47 and have some progress. So far something like <?php echo "Hello World" ?>
works. However, it still needs some work to correctly generate whitespaces. If you have some time, would be able to take a look at the code to see if it looks like what you expect?
Basically, I'm converting the stmts and exprs to their respective code, and then I'm adding whitespace later (I don't think there's a way to handle tabs vs spaces though)
I saw there's a pxp-visitor crate but I'm not sure I should use that (or how). So far, stmt / expr pattern matching seems to be working. Do we need the visitor?
Looking forward to hearing from you. This is definitely a fun project to work on!
@supun-io It's easier if you open a draft PR and we can talk about it over there :^)
I was working on #47 when I found this little bug:
The lexer sets
0
as thecolumn
of the<?php
token span. This PR fixes it.PS: I've tested with a test case, but I didn't add it so as not to pollute the beautifully organized code (I don't think you need bug test cases yet). but if you do let me, I'll add the test case as well.