Skip to content

Fix GLSL and HLSL preprocessor directive start#2357

Merged
Anteru merged 1 commit intopygments:masterfrom
bitsawer:shader_lang_preprocessor_changes
Feb 26, 2023
Merged

Fix GLSL and HLSL preprocessor directive start#2357
Anteru merged 1 commit intopygments:masterfrom
bitsawer:shader_lang_preprocessor_changes

Conversation

@bitsawer
Copy link
Contributor

Currently, both shader language lexers require that when parsing preprocessor directives # is the first character on a line. This PR loosens the restriction as these should all be valid directives:

#define NORMAL 1
#    define VALUE 10
    #define MORE 20
    #    define ANOTHER 30

This also allows putting line numbers, non-breaking spaces etc. in certain code snippets:

10. #ifdef VALUE
11. ...
12. #endif

@Anteru Anteru added A-lexing area: changes to individual lexers changelog-update Items which need to get mentioned in the changelog labels Feb 26, 2023
@Anteru Anteru merged commit 875b858 into pygments:master Feb 26, 2023
@Anteru
Copy link
Collaborator

Anteru commented Feb 26, 2023

Merged, thanks for the contribution!

@Anteru Anteru removed the changelog-update Items which need to get mentioned in the changelog label Mar 25, 2023
@Anteru Anteru added this to the 2.15.0 milestone Mar 25, 2023
@bitsawer bitsawer deleted the shader_lang_preprocessor_changes branch May 29, 2023 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-lexing area: changes to individual lexers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants