- Saved searches
- Use saved searches to filter your results more quickly
- No longer to parse PHP 7.4 syntax in php parser #690
- No longer to parse PHP 7.4 syntax in php parser #690
- Comments
- Saved searches
- Use saved searches to filter your results more quickly
- No longer to parse PHP 7.4 syntax in php parser #690
- No longer to parse PHP 7.4 syntax in php parser #690
- Comments
- php — Code not fully parsing data
- Answer
- Solution:
- Share solution ↓
- Additional Information:
- Didn’t find the answer?
- Similar questions
- Write quick answer
- About the technologies asked in this question
- PHP
- HTML
- Welcome to programmierfrage.com
- Get answers to specific questions
- Help Others Solve Their Issues
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
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
No longer to parse PHP 7.4 syntax in php parser #690
No longer to parse PHP 7.4 syntax in php parser #690
Comments
The following file is valid PHP 7 syntax, however php parser rejects it:
The text was updated successfully, but these errors were encountered:
Similarly, T_NAME_* is a bit of a pain. It would be nice to be able to set the target language version to 7.4 or 8.0, and have the correct parsing behaviour.
Yeah, I wanted to suggest Emulative lexer to be configurable with a PHP version but unfortunately spilled water on my Macbook during preparing a PR for that and killed it on Wednesday 😂
I first discovered this problem here: #672 (comment)
Yeh, the match PR was the breaking point for me too. I know that technically each minor PHP 7 release had breaking syntax changes too, but PHP 8.0 seems to have changed a particularly large amount. Indeed, the PHP 7 integration tests (https://travis-ci.org/github/nikic/PHP-Parser/jobs/711719487) in this repo are actually failing, which is a pretty good indicator that we need to separate PHP 7 and 8.
So, if this is even wanted, the question is how we backtrack without messing up libraries. Do we say that it was a bug that PHP7 mode was parsing as PHP8, and break it, or do we maybe change the default parsing mode to PHP8, but if someone explicitly asks for PHP7, they get PHP7 still.
I think there should be a distinct PHP Parser mode for PHP 8, and the current PHP 7 parser mode must not parse match expressions or union types or really any other PHP 8 syntax.
Yeah, I wanted to suggest Emulative lexer to be configurable with a PHP version but unfortunately spilled water on my Macbook during preparing a PR for that and killed it on Wednesday.
Happy to accept this — though it’s important here to not just disable forward emulation by version, but have reverse emulation if you’re running on a newer PHP version and want to parse an older one. Reverse emulation should generally be a lot simpler than forward emulation though.
Similarly, T_NAME_* is a bit of a pain. It would be nice to be able to set the target language version to 7.4 or 8.0, and have the correct parsing behaviour.
I will not support non-T_NAME token representation. Supporting two canonical token dialects is more work for me and anyone else who needs the token representation. It’s a one time effort for you to update to the new representation (as I already take care of emulation for you), but a long-term maintenance burden if you need to support both.
These are not PHP 7 integration tests. These are PHP 8 integration tests running on an old PHP version to test emulation. PHP 8 support is not finished yet, thus the failures.
I think there should be a distinct PHP Parser mode for PHP 8, and the current PHP 7 parser mode must not parse match expressions or union types or really any other PHP 8 syntax.
A PHP 8 parser will have to be introduced at some point. However, I expect the only difference will be the treatment of concatenation precedence. This library has always been very liberal with accepting code from newer PHP versions. It’s an explicit non-goal to reject this at the parser level, though of course you can check for the presence of new features in the AST, if you like.
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
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
No longer to parse PHP 7.4 syntax in php parser #690
No longer to parse PHP 7.4 syntax in php parser #690
Comments
The following file is valid PHP 7 syntax, however php parser rejects it:
The text was updated successfully, but these errors were encountered:
Similarly, T_NAME_* is a bit of a pain. It would be nice to be able to set the target language version to 7.4 or 8.0, and have the correct parsing behaviour.
Yeah, I wanted to suggest Emulative lexer to be configurable with a PHP version but unfortunately spilled water on my Macbook during preparing a PR for that and killed it on Wednesday 😂
I first discovered this problem here: #672 (comment)
Yeh, the match PR was the breaking point for me too. I know that technically each minor PHP 7 release had breaking syntax changes too, but PHP 8.0 seems to have changed a particularly large amount. Indeed, the PHP 7 integration tests (https://travis-ci.org/github/nikic/PHP-Parser/jobs/711719487) in this repo are actually failing, which is a pretty good indicator that we need to separate PHP 7 and 8.
So, if this is even wanted, the question is how we backtrack without messing up libraries. Do we say that it was a bug that PHP7 mode was parsing as PHP8, and break it, or do we maybe change the default parsing mode to PHP8, but if someone explicitly asks for PHP7, they get PHP7 still.
I think there should be a distinct PHP Parser mode for PHP 8, and the current PHP 7 parser mode must not parse match expressions or union types or really any other PHP 8 syntax.
Yeah, I wanted to suggest Emulative lexer to be configurable with a PHP version but unfortunately spilled water on my Macbook during preparing a PR for that and killed it on Wednesday.
Happy to accept this — though it’s important here to not just disable forward emulation by version, but have reverse emulation if you’re running on a newer PHP version and want to parse an older one. Reverse emulation should generally be a lot simpler than forward emulation though.
Similarly, T_NAME_* is a bit of a pain. It would be nice to be able to set the target language version to 7.4 or 8.0, and have the correct parsing behaviour.
I will not support non-T_NAME token representation. Supporting two canonical token dialects is more work for me and anyone else who needs the token representation. It’s a one time effort for you to update to the new representation (as I already take care of emulation for you), but a long-term maintenance burden if you need to support both.
These are not PHP 7 integration tests. These are PHP 8 integration tests running on an old PHP version to test emulation. PHP 8 support is not finished yet, thus the failures.
I think there should be a distinct PHP Parser mode for PHP 8, and the current PHP 7 parser mode must not parse match expressions or union types or really any other PHP 8 syntax.
A PHP 8 parser will have to be introduced at some point. However, I expect the only difference will be the treatment of concatenation precedence. This library has always been very liberal with accepting code from newer PHP versions. It’s an explicit non-goal to reject this at the parser level, though of course you can check for the presence of new features in the AST, if you like.
php — Code not fully parsing data
I have the following code that looks at the wolfram alpha xml data and pull out the answer surrounded in the tags. It works for the first tag, but not for after the answer.
Monday, May 3, 2011
Answer
Solution:
echo get($contents,'',' '); ?>
Share solution ↓
Additional Information:
Didn’t find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.
About the technologies asked in this question
PHP
PHP (from the English Hypertext Preprocessor — hypertext preprocessor) is a scripting programming language for developing web applications. Supported by most hosting providers, it is one of the most popular tools for creating dynamic websites. The PHP scripting language has gained wide popularity due to its processing speed, simplicity, cross-platform, functionality and distribution of source codes under its own license.
https://www.php.net/
HTML
HTML (English «hyper text markup language» — hypertext markup language) is a special markup language that is used to create sites on the Internet. Browsers understand html perfectly and can interpret it in an understandable way. In general, any page on the site is html-code, which the browser translates into a user-friendly form. By the way, the code of any page is available to everyone.
https://www.w3.org/html/
Welcome to programmierfrage.com
programmierfrage.com is a question and answer site for professional web developers, programming enthusiasts and website builders. Site created and operated by the community. Together with you, we create a free library of detailed answers to any question on programming, web development, website creation and website administration.
Get answers to specific questions
Ask about the real problem you are facing. Describe in detail what you are doing and what you want to achieve.
Help Others Solve Their Issues
Our goal is to create a strong community in which everyone will support each other. If you find a question and know the answer to it, help others with your knowledge.