-
Notifications
You must be signed in to change notification settings - Fork 79
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
Using short echo syntax with commas: <?=$a, $b;?> #220
Comments
Do you have short tags enabled? |
From @bibainet on February 9, 2018 19:26 Yes. The 'php.executablePath' (and also 'php.validate.executablePath') option points to a working PHP 7 executable, and there is 'short_open_tag = On' option in 'php.ini' in this directory. |
Just to be sure (because this issue has come up quite a few times and there can be multiple php.ini at play), could you run |
From @bibainet on February 9, 2018 19:36 The output of
|
Related to #185 (tolerant-php-parser uses EDIT: Never mind, |
Before, tolerant-php-parser parsed the tokens after `<?=` and `<?php` the same way. Fixes microsoft#220 (This commit and subsequent commits in this PR) This adds `TokenKind::ScriptSectionStartWithEchoTag` and handles the subsequent tokens differently if that token kind is seen instead of `ScriptSectionStartTag`. This reuses `EchoExpression` for simplicity. The resulting expression will have no `echoKeyword` because `<?=` was part of the preceding `InlineHTML` Node. - In the majority of cases, the EchoExpression will be moved into the outer statement list.
Before, tolerant-php-parser parsed the tokens after `<?=` and `<?php` the same way. Fixes microsoft#220 (This commit and subsequent commits in this PR) This adds `TokenKind::ScriptSectionStartWithEchoTag` and handles the subsequent tokens differently if that token kind is seen instead of `ScriptSectionStartTag`. This reuses `EchoExpression` for simplicity. The resulting expression will have no `echoKeyword` because `<?=` was part of the preceding `InlineHTML` Node. - In the majority of cases, the EchoExpression will be moved into the outer statement list.
Before, tolerant-php-parser parsed the tokens after `<?=` and `<?php` the same way. Fixes microsoft#220 (This commit and subsequent commits in this PR) This adds `TokenKind::ScriptSectionStartWithEchoTag` and handles the subsequent tokens differently if that token kind is seen instead of `ScriptSectionStartTag`. This reuses `EchoExpression` for simplicity. The resulting expression will have no `echoKeyword` because `<?=` was part of the preceding `InlineHTML` Node. - In the majority of cases, the EchoExpression will be moved into the outer statement list.
Before, tolerant-php-parser parsed the tokens after `<?=` and `<?php` the same way. Fixes microsoft#220 (This commit and subsequent commits in this PR) This adds `TokenKind::ScriptSectionStartWithEchoTag` and handles the subsequent tokens differently if that token kind is seen instead of `ScriptSectionStartTag`. This reuses `EchoExpression` for simplicity. The resulting expression will have no `echoKeyword` because `<?=` was part of the preceding `InlineHTML` Node. - In all cases that I'm aware of, the EchoExpression will be moved into the outer statement list. Fix parsing "echo" statements - echo is a statement, not an expression - `echo exprList` can't be used as an expression. - Contrast with `print expr`, (`PrintIntrinsicExpression`), which is correctly treated as an expression. Update documentation
Before, tolerant-php-parser parsed the tokens after `<?=` and `<?php` the same way. Fixes microsoft#220 (This commit and subsequent commits in this PR) This adds `TokenKind::ScriptSectionStartWithEchoTag` and handles the subsequent tokens differently if that token kind is seen instead of `ScriptSectionStartTag`. This reuses `ExpressionStatement` with an `EchoExpression` for simplicity. The resulting expression will have no `echoKeyword` because `<?=` was part of the preceding `InlineHTML` Node. - In all cases that I'm aware of, the ExpressionStatement with the EchoExpression will be moved into the outer statement list. NOTE: echo is a statement, not an expression. It must be followed by `?>` or `;` - `echo exprList` can't be used as an expression. - Contrast with `print expr`, (`PrintIntrinsicExpression`), which is correctly treated as an expression. Update documentation Add a test that the Parser will warn about `<?= 'expr'<EOF>`. - Fixing that bug got rid of an incorrect EmptyExpression in another test (programStructure5.php.tree)
Fixes #220 : Properly parse expression lists passed to `<?=`
From @bibainet on February 9, 2018 15:6
PHP IntelliSense reports error/problem on
<?=$a, $b;?>
constructs (short echo syntax with commas):Screenshot:
Copied from original issue: felixfbecker/php-language-server#596
The text was updated successfully, but these errors were encountered: