0

I'm working on an VS Code extension for LOLCode. I've gotten most of my RegEx expressions to do what I want but when I tried to work with isolating variables in some instances it includes almost everything in the line. I'm really not sure how to fix my RegEx to get the right results. enter image description here

My RegEx expressions

"variables": {
            "patterns": [
                {
                    "begin": "\\b(?<=I HAS A)\\b",
                    "end": "\\b(?=ITZ)\\b",
                    "contentName": "variable.color.lolcode"
                },
                {
                    "name": "variable.color.lolcode",
                    "match": "^.*(?= R |I HAS| CAN HAS |HAS)"
                },
                {
                    "name": "variable.color.lolcode",
                    "match": "\\b(?<=YR|OF|SRS|SMOOSH|AN|SAEM|VISIBLE|INVISIBLE)((?!.*(LOOP|UPPIN)).*)(?=AN|TIL|ITZ|MKAY|'Z)\\b"
                },
                {
                    "name": "variable.color.lolcode",
                    "match": "\\b(?<=YR|SAEM|AN|SRS|ITZ|VISIBLE|INVISIBLE)((?!.*(LOOP|MKAY)).*)(?=\\n+?)\\b"
                }
            ]
        },
  • Which regex is not working? Are they all multiline? – Andrew Jun 07 '22 at 04:31
  • '\\b(?<=YR|OF|SRS|SMOOSH|AN|SAEM|VISIBLE|INVISIBLE)((?!.*(LOOP|UPPIN)).*)(?=AN|TIL|ITZ|MKAY|'Z)\\b' seems to be the most broken. The variable names should be the only words in light blue. I thought I caught them by accounting for all the keywords that might surround them but then it breaks. Should be singleline. – emonegarand Jun 07 '22 at 05:10
  • It's hard to understand, you need to clearly specify which are keywords and which are variables. LOLCODE is not something popular enough. You should also include your code in text so we don't have to type. I also don't understand the underlining. What is wrong there? Shouldn't variables be everything that's not a keyword or string literal? Would it make sense to color everything else and then there remaining stuff (variables) is light blue? – Andrew Jun 07 '22 at 14:02
  • Still there, @emonegarand? – Andrew Jun 13 '22 at 13:38

0 Answers0