Skip to content

feat: add JQ syntax highlighting lexer - #1290

Merged
alecthomas merged 1 commit into
alecthomas:masterfrom
W-Floyd:feat/jq-lexer
Jul 2, 2026
Merged

alecthomas merged 1 commit into
alecthomas:masterfrom
W-Floyd:feat/jq-lexer

Conversation

@W-Floyd

@W-Floyd W-Floyd commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Closes #1135

Summary

  • Adds lexers/embedded/jq.xml with full JQ syntax highlighting
  • 188 builtins cross-referenced against the real jq source
  • Keywords (if/then/else/end, def, try/catch, reduce, foreach, label/break, module/import/include)
  • and/or/not as word operators
  • true/false/null constants
  • Format filters (@base64, @html, @uri, etc.) as builtins
  • String interpolation (\(...)) via push/pop states
  • $variables, .field access, . identity, .. recurse
  • Operators (|, //, //=, |=, +=, ==, !=, etc.)
  • Test file (jq.actual) exercises every single builtin

Test plan

  • go test ./lexers/ -run TestLexers/JQ passes
  • go test ./lexers/ -run TestCompileAllRegexes passes
  • Visual inspection with chroma -l jq --style=dracula

Implements full JQ lexer with 188 builtins cross-referenced against the
real jq source, keywords, operators, string interpolation with push/pop
states, format filters (@base64, @html, etc.), variables, and field access.

Closes alecthomas#1135

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@alecthomas

Copy link
Copy Markdown
Owner

Thanks!

@alecthomas
alecthomas merged commit c74f282 into alecthomas:master Jul 2, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"jq" lexer

2 participants

⌂ 换网址