Add bit operators, defer, list methods, rand, assert and rex test

- Bit operators & | ^ ~ << >> and their op= forms (Go precedence),
  plus hex, binary and octal literals (0xff, 0b1010, 0o755)
- defer stmt / defer { ... }: runs when the block ends, last first,
  also on return, ?, break and continue
- List methods insert, remove, clear, contains, index_of, reverse,
  sort and sort_by (stable merge sort)
- rand module: int(a, b), float(), seed(n)
- assert(cond[, msg]) and `rex test`, which runs each test_ function
  in its own process
- rex.toml marks a project's top folder: imports count from there
- Docs, formatter, LSP completions and editor grammars updated

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Your NameandClaude Opus 5.5 committed 2026-11-12 23:30:05 +01:00
1 parent 910bde692a
commit 300d767124
28 files changed
+1373 -65

No files matched your search

+3 -3
View File
@@ -3,15 +3,15 @@ if exists("b:current_syntax")
finish
endif
syn keyword rexControl if else for in step match return break continue
syn keyword rexControl if else for in step match return break continue defer
syn keyword rexDeclare func var const import struct enum interface pub
syn keyword rexModifier shared weak
syn keyword rexConstant true false nil
syn keyword rexType int float bool char string error map i8 i16 i32 i64 u8 u16 u32 u64 f32 f64
syn match rexTypeName "\<[A-Z][A-Za-z0-9_]*\>"
syn match rexNumber "\<[0-9][0-9_]*\(\.[0-9][0-9_]*\)\?\>"
syn match rexNumber "\<\(0[xX][0-9a-fA-F_]\+\|0[bB][01_]\+\|0[oO][0-7_]\+\|[0-9][0-9_]*\(\.[0-9][0-9_]*\)\?\)\>"
syn match rexCall "\<[a-z_][A-Za-z0-9_]*\ze\s*("
syn match rexOperator "=>\|\.\.\|==\|!=\|<=\|>=\|&&\|||\|[-+*/%]=\?\|[<>!?=]"
syn match rexOperator "=>\|\.\.\|==\|!=\|<<=\=\|>>=\=\|<=\|>=\|&&\|||\|[-+*/%&|^]=\?\|[<>!?=~]"
syn match rexEscape "\\." contained
syn region rexInterp matchgroup=rexInterpEdge start="{" end="}" contained contains=TOP
syn region rexString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=rexEscape,rexInterp
+2 -2
View File
@@ -62,7 +62,7 @@
},
"keywords": {
"patterns": [
{ "name": "keyword.control.rex", "match": "\\b(if|else|for|in|step|match|return|break|continue)\\b" },
{ "name": "keyword.control.rex", "match": "\\b(if|else|for|in|step|match|return|break|continue|defer)\\b" },
{ "name": "keyword.declaration.rex", "match": "\\b(func|var|const|import|struct|enum|interface|pub)\\b" },
{ "name": "storage.modifier.rex", "match": "\\b(shared|weak)\\b" }
]
@@ -73,7 +73,7 @@
},
"numbers": {
"name": "constant.numeric.rex",
"match": "\\b[0-9][0-9_]*(?:\\.[0-9][0-9_]*)?\\b"
"match": "\\b(?:0[xX][0-9a-fA-F_]+|0[bB][01_]+|0[oO][0-7_]+|[0-9][0-9_]*(?:\\.[0-9][0-9_]*)?)\\b"
},
"types": {
"patterns": [