Giter Site home page Giter Site logo

Comments (7)

daxian-dbw avatar daxian-dbw commented on July 23, 2024 2

one more instance I know of is $a:b. There are a few well-known prefixes like $private:, $script:, $global:, but this syntax applies to more scenarios beyond, such as

$function:SayHello = {"Hello"}
SayHello
> Hello

$f:myfile = "content for my file"
$f:myfile
> content for my file
cat F:\myfile
> content for my file

$f:myfile:alternateDataStream = "hidden content"
$f:myfile:alternateDataStream
> hidden content
cat F:\myfile:alternateDataStream
> hidden content

from editorsyntax.

SteveL-MSFT avatar SteveL-MSFT commented on July 23, 2024 2

You can look at the tokenizer code to see what characters are valid. Basically almost anything and if you use a brace, pretty much anything (including whitespace) until a closing brace.

from editorsyntax.

omniomi avatar omniomi commented on July 23, 2024

Is there a list of special characters that don't require ${ } anywhere? Ie, $Foo*bar is allowed but you need to use ${Foo*bar}. I assume it's every special character that isn't an operator or keyword but I could be wrong.

from editorsyntax.

TylerLeonhardt avatar TylerLeonhardt commented on July 23, 2024

Hmm I think @JamesWTruher, @daxian-dbw, or @SteveL-MSFT might know the answer to that.

from editorsyntax.

omniomi avatar omniomi commented on July 23, 2024

Thanks @SteveL-MSFT.

Will need to give some thought to the best way to tackle variables. With so many ways to PowerShell a cat I want to cover all of the variable variants in as concise a manner as possible. The current definitions are not great.

@daxian-dbw, part of me hates that those are real... part of me thinks that's super cool lol.

from editorsyntax.

SteveL-MSFT avatar SteveL-MSFT commented on July 23, 2024

@omniomi It seems that the main set of characters is [A-z0-9_?:]. However, if it's a colon followed by another colon, it's a static member and not part of the variable name like $a::b. And if a brace follows the $, then anything until the closing brace is part of the variable name.

from editorsyntax.

omniomi avatar omniomi commented on July 23, 2024

@SteveL-MSFT that works and should probably cover most cases.

I just need to figure out the best way to split everything in the repository so that it can be logically included in other places. How things are highlighted on their own, in strings, in sub-expressions, etc adds to the complexity. Can't just have one variable definition and use it everywhere. Splatting adds to complexity as well since Get-Something @Splat is a variable but $ByLine = "Author: @omniomi" is not.

from editorsyntax.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.