Skip to content

Utilities/Sphinx: Improve Pygments CMake lexer

  • Add a "dummy" pyproject.toml to simplify installing needed tools w/ poetry
  • Cleanup cmake.py code according to basic linters
  • Extract CMakeLexer to a separate file for easy testing
  • Introduce tests for the CMake lexer
  • CMake lexer has been rewritten from scratch (now it's stateful) to fix the following cases:
    • <blah | blah> placeholders (e.g., see string(JSON…)
    • nested parenthesis now highlighted properly (e.g., if((A OR B) AND (C OR D)))
    • named arguments containing placeholders (e.g., <LANG>_STANDARD in try_compile())
    • bracket comments (e.g., see cmake-language.7)
    • bracket strings (e.g., see cmake-language.7)
  • Also the lexer learned new tokens and some inappropriate ones have been removed
    • genexes now highlighted
    • string escape characters now highlighted
    • strings interpolation support has improved
    • ENV/CACHE/DATA highlighting has improved
  • Some pages have been fixed to enable CMake code blocks instead of unparsed literals (cuz it was a "syntax" error for the previous lexer)
  • Since the new lexer supports bracket strings some signatures have been fixed to disambiguate [[ usage

Topic-rename: sphinx-pygments-lexer

Edited by Alex Turbov

Merge request reports