Skip to content
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

Fixes for automatic variables #166

Merged
merged 3 commits into from
May 8, 2019

Conversation

msftrncs
Copy link
Contributor

@msftrncs msftrncs commented Apr 27, 2019

Fixes #133.

This corrects the regex used for matching $$, $^ and $? automatic variables. This occurs because the current regex can be simplified to \$[$^?]\b, but the \b (word boundary) fails if one of the two characters tested at the boundary is not a word character (one must be a word, one must not be a word, and the set [$^?] contains no word characters). As such, only very limited cases would have successfully matched. A boundary test is not required for these particular patterns. $_ is not affected because _ is a word character, and so it has been left in the part of the regex that still applies the boundary test (and is actually required).

This also fixes the mismatch of scopes for these same variables and the larger set specified in the same regex(s), between #variable and #variableNoProperty, by adopting support.variable.automatic.powershell in both places.

Tests have been corrected for the scope change, and then updated to include tests specific to the two conditions being resolved.

corrects scope mismatch between #variable and #variableNoProperty for
automatics and fixes REGEX for $$, $^, and $?
Copy link
Member

@TylerLeonhardt TylerLeonhardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@TylerLeonhardt TylerLeonhardt merged commit 6e2fb74 into PowerShell:master May 8, 2019
@msftrncs msftrncs deleted the fixAutomaticVars branch May 9, 2019 05:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

$_ scoped differently between inside and outside string.quoted.double
2 participants