asp.vb.net.tmbundle icon indicating copy to clipboard operation
asp.vb.net.tmbundle copied to clipboard

Wrong syntax colouring for the number 7 in Visual Basic

Open aeschli opened this issue 8 years ago • 2 comments

From @SeamusConacher on February 22, 2017 15:34

  • VSCode Version: 1.9.1
  • OS Version: Windows 10 Pro 1607

Steps to Reproduce:

  1. Declare a Dim or Const in Visual Basic with the Visual Basic syntax colouring
  2. Set it equal to any number that does not start with 7
  3. Set it equal to any number starting with 7

With any number starting with the number 7 the syntax colouring stays the variable colouring, rather than changing to the number colouring.

Copied from original issue: Microsoft/vscode#21155

aeschli avatar Feb 23 '17 06:02 aeschli

With a subject like this, I'm intrigued, so here is my analysis.

<string>(?i:(dim)\s*(?:(\b[a-zA-Z_x7f-xff][a-zA-Z0-9_x7f-xff]*?\b)\s*(,?)))</string>

@infininight, Isn't the ~Unicode~ 'hexadecimal escape' ~character~ pattern \xhh? The grammar is incorrectly accepting a 7 in the first character position because the pattern x7F-xFF needs to be \x7F-\xFF, but instead this matches x,7,f-x,f,f. This pattern seems to appear a lot in the grammar. Would you like me to post a PR to fix all of them?

/cc: @SeamusConacher

msftrncs avatar May 15 '19 22:05 msftrncs

I'm not sure what \x7F-\xFF corresponds to, but it doesn't seem to be extended-ascii or UTF 8 \x00-\x7F does however correspond to ASCII Should probably use \x{7F}-\x{FF} instead as it corresponds to UTF 8 (in the context of vscodes json based textmate engine) image image

RedCMD avatar Apr 16 '22 06:04 RedCMD