saem / vscode-nim

Other
180 stars 23 forks source link

redo changes from #86/#90 #91

Closed morganholly closed 2 years ago

morganholly commented 2 years ago

this was easier than trying to rebase

RSDuck commented 2 years ago

I forgot that last time, but of is an binary operator too 😄.

https://nim-lang.org/docs/manual.html#types-tuples-and-object-types

morganholly commented 2 years ago

oops. well i’ll work on the regex some more later today. i have an idea of how it will work, hopefully it’s right.

morganholly commented 2 years ago

@RSDuck is it possible to put a case expression in an if/when/elif? it seems to not work, i'm getting errors from the extension, but if it does the regex i came up with wouldn't work there.

morganholly commented 2 years ago

oh im going to have to create a new PR right, i was confused when my commit didn't show up here

RSDuck commented 2 years ago

@RSDuck is it possible to put a case expression in an if/when/elif? it seems to not work, i'm getting errors from the extension, but if it does the regex i came up with wouldn't work there.

yes it's possible like this:

if (case range[0..1](1)
    of 0: false
    of 1: true):
  echo "miauz"
morganholly commented 2 years ago

does it require the parens?

RSDuck commented 2 years ago

I think yes, I cannot get it to work without them, though I'm not 100% sure.

saem commented 2 years ago

Not at my computer, but I'm pretty sure it'dt be possible to do similar things in a bracket expression that evaluates to an array index for lookup.

Basically the nesting could be achieved in a few ways.