Skip to content
This repository has been archived by the owner on Feb 4, 2019. It is now read-only.

Parser prohibits 1..2..3 #50

Closed
JayBazuzi opened this issue Mar 26, 2013 · 1 comment
Closed

Parser prohibits 1..2..3 #50

JayBazuzi opened this issue Mar 26, 2013 · 1 comment

Comments

@JayBazuzi
Copy link
Contributor

The official grammar in the PowerShell Language Specification, and the shipping Windows PowerShell v3 parser both allow:

> 1..2..3

If you evaluate it in PowerShell, it will fail (``):

Cannot convert the "System.Object[]" value of type "System.Object[]" to type "System.Int32".
At line:1 char:1
+ 1..1..1
+ ~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [], RuntimeException
    + FullyQualifiedErrorId : ConvertToFinalInvalidCastException

If there is a use for this syntax, I don't know what it is.

It's causing the Pash parser to get confused around multiple arguments to a method:

> [char]::IsUpper("abc", 2)       # Produces a false error about expecting `..`

Because chaining array range operators are less important to me than method calls, I'm disabling the former to allow the latter.

@JayBazuzi
Copy link
Contributor Author

Duplicate if issue #51.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant