-
Notifications
You must be signed in to change notification settings - Fork 72
Better handle <?php
and ?>
tags
#138
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
Comments
I could provide an option in order to export tokens into an array, so it would be more generic. By joining all tokens you have exactly the same output as the original file. The implementation is compliant with this function : http://php.net/manual/en/function.token-get-all.php |
Hi @evilebottnawi, You can try the new tokens extraction here - https://glayzzle.com/php-parser/ Here a sample code that has no nodes, but can be serialized with tokens : The offsets on tokens are :
PHP Script : <?php /** **/ ?> AST Structure : {
"kind": "program",
"children": [],
"errors": [],
"comments": [
{
"kind": "commentblock",
"value": "/** **/"
}
],
"tokens": [
[
"T_OPEN_TAG",
"<?php ",
1,
0,
6
],
[
"T_DOC_COMMENT",
"/** **/",
1,
6,
13
],
[
"T_WHITESPACE",
" ",
1,
13,
14
],
[
"T_CLOSE_TAG",
"?>",
1,
14,
16
]
]
} |
We have problem when printing statement and inline nodes.
Example:
We need information when
php
tag opening and closing. Any idea how best we can get this information? Maybe addnode.hasOpenTag
andnode.hasCloseTag
(or maybe best names). It is allow output all tags as is.But, for
control
structure it is not good solution 😞Maybe you can export
tags
array ascomment
with position? I think it will be solve our problem 👍The text was updated successfully, but these errors were encountered: