-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement PHP support #520
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the port!
A minor thing, but can you put all PHP entries sorted alphabetically, between OCaml and Python?
Also, please rebase on top of master.
This is a partial review. I'll do the full review as soon as I can, but I broke my arm a few days ago, and I'm slower than usual.
@skvadrik I adjusted alphabetically the implementation. There are still work in examples/ and I'll need your help in some already made examples, especially with |
Thanks!
I think you should use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few more comments.
single_quoted_strings = 1; | ||
indentation_sensitive = 0; | ||
wrap_blocks_in_braces = 1; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a new configuration special_escapes
that needs to go here, see other syntax files.
@@ -0,0 +1,16 @@ | |||
<?php | |||
// re2php $INPUT -o $OUTPUT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should always be the first line of the file (as expected by run_tests.py).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Impossible, as <?php
must be on 1st line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Then I suggest adding some sed magic in examples/php/__run_all.sh
that will cut off the comments in the temporary file (this one and the one autogenerated by re2php).
supported_api_styles = ["free-form"]; | ||
supported_code_models = ["loop-switch"]; | ||
supported_targets = ["code", "dot"]; | ||
supported_features = ["nested-ifs", "bitmaps", "tags", "captures", "captvars"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For all supported and unsupported features there must be a test. Tags, captures and captvars are covered by examples, and for the rest see tests in test/codegen/<language>
.
@@ -247,6 +247,7 @@ opt_lang: /*!local:re2c | |||
"java" end { *lang = Lang::JAVA; goto opt; } | |||
"js" end { *lang = Lang::JS; goto opt; } | |||
"ocaml" end { *lang = Lang::OCAML; goto opt; } | |||
"php" end { *lang = Lang::PHP; goto opt; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add it to the error message on line 249 as well.
So I downloaded the patch and tried to build some of the problematic examples, but it seems that the .php files are not generated from the current syntax file (it was copied from javascript without modification). Please let me know when you update it (or if you have any questions). |
No description provided.