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

powershell: more robust handling of data structure literals #1595

Merged
merged 1 commit into from
Nov 9, 2020

Conversation

jneen
Copy link
Member

@jneen jneen commented Sep 26, 2020

fixes #1579

The problem was that the hash table state was a huge special case and was not tested on larger tables with comments and code in them at all. I factored out a more generic :expr state that should be able to handle most of these.

I also reduced the overall level of highlighting - this is one of the lexers that suffered from over-highlighting, where too many things were emphasized with the colours. Pulling back a little allows the really important stuff to come through a bit better.

@jneen
Copy link
Member Author

jneen commented Sep 26, 2020

@pyrmont it looks like you added this in 83665dd - is there a reason for using casecmp here instead of downcase? In any case, we'd need 'package'.casecmp(m[0]) == 0 to test equality.

@pyrmont pyrmont self-assigned this Oct 13, 2020
@pyrmont pyrmont added the needs-review The PR needs to be reviewed label Oct 13, 2020
@pyrmont
Copy link
Contributor

pyrmont commented Oct 13, 2020

@pyrmont it looks like you added this in 83665dd - is there a reason for using casecmp here instead of downcase? In any case, we'd need 'package'.casecmp(m[0]) == 0 to test equality.

@jneen Did you mean to refer to this in this PR? The commit in question relates to the Apex lexer, not the PowerShell one.

@pyrmont pyrmont added author-action The PR has been reviewed but action by the author is needed and removed needs-review The PR needs to be reviewed labels Oct 13, 2020
@pyrmont pyrmont merged commit d7fd623 into master Nov 9, 2020
pyrmont added a commit that referenced this pull request Nov 10, 2020
While #1595 improved the lexing of more complex structures, the
PowerShell lexer is limited in its support for nested data structures.
This commit moves more of the syntax for representing values from the
`:root` state to the `:expr` state so that this syntax can work when
nested.
mattt pushed a commit to NSHipster/rouge that referenced this pull request May 19, 2021
…e-ruby#1595)

The PowerShell lexer includes a hash table state as a special case and
is not tested on more complex tables (e.g. including comments and
code). This commit factors out the hash table state into a more generic
`:expr` state that can handle more complex structures.

This commit also reduces the overall level of highlighting. This 
improves the visibility of the more important syntax.
mattt pushed a commit to NSHipster/rouge that referenced this pull request May 19, 2021
…uby#1622)

While rouge-ruby#1595 improved the lexing of more complex structures, the
PowerShell lexer is limited in its support for nested data structures.
This commit moves more of the syntax for representing values from the
`:root` state to the `:expr` state so that this syntax can work when
nested.
@tancnle tancnle deleted the bugfix.powershell-data-structures branch September 22, 2021 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author-action The PR has been reviewed but action by the author is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PowerShell curly braces and newlines
2 participants