- Add tree-sitter grammar for syntax highlighting - Add Neovim plugin with syntax, LSP integration, and commands - Add code formatter (lux fmt) with check mode - Add CLI commands: fmt, check, test, watch, init - Add project initialization with lux.toml template Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
90 lines
2.4 KiB
VimL
90 lines
2.4 KiB
VimL
" Vim syntax file for Lux
|
|
" Language: Lux
|
|
" Maintainer: Lux Team
|
|
|
|
if exists("b:current_syntax")
|
|
finish
|
|
endif
|
|
|
|
" Keywords
|
|
syn keyword luxKeyword fn let type effect handler trait impl for import export
|
|
syn keyword luxKeyword match if then else with run resume is
|
|
syn keyword luxKeyword nextgroup=luxFunction skipwhite
|
|
|
|
" Boolean literals
|
|
syn keyword luxBoolean true false
|
|
|
|
" Built-in types
|
|
syn keyword luxType Int Float Bool String Char Unit Option Result List
|
|
syn keyword luxType Some None Ok Err
|
|
|
|
" Operators
|
|
syn match luxOperator /[+\-*/%=<>!&|]/
|
|
syn match luxOperator /==/
|
|
syn match luxOperator /!=/
|
|
syn match luxOperator /<=/
|
|
syn match luxOperator />=/
|
|
syn match luxOperator /&&/
|
|
syn match luxOperator /||/
|
|
syn match luxOperator /|>/
|
|
syn match luxOperator /=>/
|
|
|
|
" Delimiters
|
|
syn match luxDelimiter /[(){}\[\],;:]/
|
|
syn match luxDelimiter /|/ contained
|
|
|
|
" Numbers
|
|
syn match luxNumber /\<\d\+\>/
|
|
syn match luxFloat /\<\d\+\.\d\+\>/
|
|
|
|
" Strings
|
|
syn region luxString start=/"/ skip=/\\./ end=/"/ contains=luxEscape,luxInterpolation
|
|
syn match luxEscape /\\[nrt\\'"0{}]/ contained
|
|
syn region luxInterpolation start=/{/ end=/}/ contained contains=TOP
|
|
|
|
" Characters
|
|
syn region luxChar start=/'/ skip=/\\./ end=/'/
|
|
|
|
" Comments
|
|
syn match luxComment /\/\/.*$/
|
|
syn match luxDocComment /\/\/\/.*$/
|
|
|
|
" Function definitions
|
|
syn match luxFunction /\<[a-z_][a-zA-Z0-9_]*\>/ contained
|
|
syn match luxFunctionCall /\<[a-z_][a-zA-Z0-9_]*\>\s*(/me=e-1
|
|
|
|
" Type definitions and constructors
|
|
syn match luxTypedef /\<[A-Z][a-zA-Z0-9_]*\>/
|
|
|
|
" Module access
|
|
syn match luxModule /\<[A-Z][a-zA-Z0-9_]*\>\./me=e-1
|
|
|
|
" Effect signatures
|
|
syn region luxEffectSig start=/with\s*{/ end=/}/ contains=luxType,luxDelimiter
|
|
|
|
" Properties
|
|
syn match luxProperty /\<is\s\+\(pure\|total\|idempotent\|commutative\|associative\)\>/
|
|
|
|
" Highlight groups
|
|
hi def link luxKeyword Keyword
|
|
hi def link luxBoolean Boolean
|
|
hi def link luxType Type
|
|
hi def link luxOperator Operator
|
|
hi def link luxDelimiter Delimiter
|
|
hi def link luxNumber Number
|
|
hi def link luxFloat Float
|
|
hi def link luxString String
|
|
hi def link luxEscape SpecialChar
|
|
hi def link luxInterpolation Special
|
|
hi def link luxChar Character
|
|
hi def link luxComment Comment
|
|
hi def link luxDocComment SpecialComment
|
|
hi def link luxFunction Function
|
|
hi def link luxFunctionCall Function
|
|
hi def link luxTypedef Type
|
|
hi def link luxModule Include
|
|
hi def link luxEffectSig Special
|
|
hi def link luxProperty PreProc
|
|
|
|
let b:current_syntax = "lux"
|