Click here to Skip to main content
15,900,108 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: The joy of working at a big multinational company Pin
Stuart Dootson1-Nov-21 5:56
professionalStuart Dootson1-Nov-21 5:56 
GeneralRe: The joy of working at a big multinational company Pin
Super Lloyd1-Nov-21 14:08
Super Lloyd1-Nov-21 14:08 
GeneralRe: The joy of working at a big multinational company Pin
dandy722-Nov-21 4:32
dandy722-Nov-21 4:32 
GeneralThe Red Roses reign supreme Pin
Richard MacCutchan31-Oct-21 7:18
mveRichard MacCutchan31-Oct-21 7:18 
GeneralRe: The Red Roses reign supreme Pin
Greg Utas31-Oct-21 9:49
professionalGreg Utas31-Oct-21 9:49 
RantError handing is taking me more time than the functionality :( Pin
honey the codewitch31-Oct-21 5:16
mvahoney the codewitch31-Oct-21 5:16 
PraiseRe: Error handing is taking me more time than the functionality :( Pin
User 1537660031-Oct-21 6:05
User 1537660031-Oct-21 6:05 
GeneralRe: Error handing is taking me more time than the functionality :( Pin
honey the codewitch31-Oct-21 6:11
mvahoney the codewitch31-Oct-21 6:11 
Thanks!

It is and they are, especially since it is pluggable especially with VS Code. It's really quite amazing, but they do it I think using regex mostly. I used to parse to try to get to syntax highlighting but that's an anti-pattern. Comments and (often) whitespace need to be stripped so the parser doesn't trip over them, and reporting those elements "out of band" to the highlighter complicates things, because they must "pass through" the parser without the parser choking on them. It's easier to discard them. Furthermore, parsers are way more finicky about errors and choke up far more easily on bad input.

I think what VS Code (i refuse to call it Visual Studio Code) and Visual Studio (in one of its two modes at least) does a variation of PEG parsing, which is heavily regular expression and substitution oriented, but I can't be sure because I haven't dug into it, but either way, I think regex or a similar set of constructions (possibly something of a superset) runs the show.

With parsers, you typically use "substitution grammars" and they require the text to be far more structured, but unlike with the kind of thing syntax highlighters use you get a nice clean, unambiguous tree back, which is more suitable for a compiler to consume.
Real programmers use butterflies

GeneralRe: Error handing is taking me more time than the functionality :( Pin
User 1537660031-Oct-21 6:22
User 1537660031-Oct-21 6:22 
GeneralRe: Error handing is taking me more time than the functionality :( Pin
honey the codewitch31-Oct-21 6:24
mvahoney the codewitch31-Oct-21 6:24 
GeneralRe: Error handing is taking me more time than the functionality :( Pin
Greg Utas31-Oct-21 6:21
professionalGreg Utas31-Oct-21 6:21 
GeneralRe: Error handing is taking me more time than the functionality :( Pin
honey the codewitch31-Oct-21 6:28
mvahoney the codewitch31-Oct-21 6:28 
GeneralRe: Error handing is taking me more time than the functionality :( Pin
Daniel Pfeffer31-Oct-21 6:55
professionalDaniel Pfeffer31-Oct-21 6:55 
GeneralRe: Error handing is taking me more time than the functionality :( Pin
honey the codewitch31-Oct-21 7:16
mvahoney the codewitch31-Oct-21 7:16 
GeneralRe: Error handing is taking me more time than the functionality :( Pin
Gerry Schmitz31-Oct-21 7:43
mveGerry Schmitz31-Oct-21 7:43 
GeneralRe: Error handing is taking me more time than the functionality :( Pin
ElectronProgrammer31-Oct-21 10:10
ElectronProgrammer31-Oct-21 10:10 
GeneralRe: Error handing is taking me more time than the functionality :( Pin
honey the codewitch31-Oct-21 10:59
mvahoney the codewitch31-Oct-21 10:59 
GeneralRe: Error handing is taking me more time than the functionality :( Pin
charlieg31-Oct-21 11:33
charlieg31-Oct-21 11:33 
GeneralRe: Error handing is taking me more time than the functionality :( Pin
honey the codewitch31-Oct-21 12:05
mvahoney the codewitch31-Oct-21 12:05 
GeneralRe: Error handing is taking me more time than the functionality :( Pin
Jon McKee31-Oct-21 11:33
professionalJon McKee31-Oct-21 11:33 
GeneralRe: Error handing is taking me more time than the functionality :( Pin
honey the codewitch31-Oct-21 12:01
mvahoney the codewitch31-Oct-21 12:01 
GeneralRe: Error handing is taking me more time than the functionality :( Pin
Rick York31-Oct-21 18:37
mveRick York31-Oct-21 18:37 
GeneralRe: Error handing is taking me more time than the functionality :( Pin
honey the codewitch31-Oct-21 18:38
mvahoney the codewitch31-Oct-21 18:38 
QuestionMessage Closed Pin
30-Oct-21 17:06
giridhar k 202130-Oct-21 17:06 
AnswerRe: sub string using user input Pin
OriginalGriff30-Oct-21 20:40
mveOriginalGriff30-Oct-21 20:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Straw Poll

Were you affected by the geomagnetic storms this past weekend?
Communication disruptions, electrified pipes, random unexplained blue-screens in Windows - the list of effects is terrifying.
  Results   481 votes