[Solved] make a keyword out of all words staring with "gl_"

Hi,
I’m new to Lezer/Codemirror and I am trying to make a parser for GLSL.
I have defined an “Identifier” as a token which represents any variable name. Now I want to specialize all words starting with the string “gl_” to be printed out in a special way.

Is there a way for the @specialize feature to take a regex into account ? like “gl.*” for example?

Thanks in advance

No, that’s not something you can use @specialize for. But you can simply define another token type that matches such identifiers and give it a higher precedence than regular identifiers.

1 Like

Thank you very much. This solved my issue!