Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/tree-sitter-omega/blob/main/queries/highlights.scm # tree-sitter-omega aien-dev/tree-sitter-omega Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `tree-sitter-omega / queries / highlights.scm` 151 lines ยท 3888 bytes Raw Blame History 1 ; Omega (.om) highlights. Word lists come from the reserved-word table in aien-dev/omega-mv 2 ; seed/omc/omc.om (fn kw, fn kw2) and docs/one_layer/OMEGESE.md. When several patterns match one node, 3 ; the later pattern wins (tree-sitter CLI 0.27, Neovim), so the generic identifier capture comes first, 4 ; then the word lists, then the names a declaration defines: an OM-1 unit may name a function `rotr` or 5 ; a global `out`, and the definition then wins over the word list. 6 7 (identifier) @variable 8 9 ; The first word of a line that is not an assignment is a call (or an assignment written without `=`). 10 (expression_statement 11 (expression 12 . 13 (identifier) @function.call)) 14 15 (parameter_list 16 (identifier) @variable.parameter) 17 18 ; ---- words that are identifiers to the grammar ---- 19 ((identifier) @boolean 20 (#any-of? @boolean "true" "false")) 21 22 ((identifier) @type.builtin 23 (#any-of? @type.builtin 24 "bool" "uchar" "u8" "ushort" "u16" "uint" "u32" "ulong" "u64" "byte" "i8" "short" "i16" "int" 25 "i32" "long" "i64" "f32" "f64" "void")) 26 27 ((identifier) @keyword.operator 28 (#any-of? @keyword.operator 29 "add" "sub" "mul" "div" "rem" "and" "or" "xor" "shl" "shr" "eq" "ne" "lt" "le" "gt" "ge" "neg" 30 "not" "rotr" "rotl" "bitcast" "fsqrt" "fabs" "fmin" "fmax" "sizeof" "offsetof")) 31 32 ((identifier) @keyword.modifier 33 (#any-of? @keyword.modifier 34 "view" "edit" "own" "out" "fresh" "inline" "unroll" "at" "little" "big" "ops")) 35 36 ((identifier) @keyword 37 (#any-of? @keyword "requires" "ensures" "invariant" "new" "free" "seal" "open" "part")) 38 39 ((identifier) @variable.builtin 40 (#eq? @variable.builtin "result")) 41 42 ; Host and memory words: built-in operations that take values. 43 ((identifier) @function.builtin 44 (#any-of? @function.builtin 45 "get" "len" "read" "write" "pread" "pwrite" "cwd" "readlnk" "sockopt" "random" "envcnt" 46 "envread" "chdir" "ftrunc" "stat" "link" "symlnk" "chmod" "faccess" "getuid" "geteuid" "getgid" 47 "getegid" "lstat" "truncate" "chown" "fchdir" "getppid" "umask" "fdsync" "memfd" "setsid" 48 "getpgid" "setpgid" "getsid" "syncfs" "shutdown" "devctl" "mapnew" "mapdrop" "mapread" 49 "mapwrite" "devcall" "uvmctl" "mapaddr" "mapget" "mapset" "maphold" "mapbind" "flock" "sockname" 50 "realns" "execprog" "renames" "rmdir" "killpid" "pipefds" "getpid" "waitio" "getdnts" "connect" 51 "bind" "waitpid" "fstat" "recv" "send" "sleepns" "argcnt" "argread" "fclose" "fsync" "fchmod" 52 "fseek" "socknew" "listen" "accept" "fork" "dupfd" "monons" "fopen" "unlink" "makedir" 53 "peercred" "pollfds" "sendmsg")) 54 55 ; ---- definitions ---- 56 (function_definition 57 name: (identifier) @function) 58 59 (global_declaration 60 name: (identifier) @variable) 61 62 (text_declaration 63 name: (identifier) @variable) 64 65 (const_declaration 66 name: (identifier) @constant) 67 68 (struct_declaration 69 name: (identifier) @type.definition) 70 71 (layout_declaration 72 name: (identifier) @type.definition) 73 74 (abstract_declaration 75 name: (identifier) @type.definition) 76 77 (holds_declaration 78 name: (identifier) @type) 79 80 (field_declaration 81 name: (identifier) @variable.member) 82 83 (for_statement 84 counter: (identifier) @variable) 85 86 (assignment 87 name: (identifier) @variable) 88 89 (comment) @comment 90 91 ; ---- structural keywords (tokens in the grammar) ---- 92 [ 93 "fn" 94 "to" 95 "end" 96 "global" 97 "text" 98 "const" 99 "struct" 100 "layout" 101 "field" 102 "abstract" 103 "holds" 104 "export" 105 ] @keyword 106 107 [ 108 "if" 109 "else" 110 ] @keyword.conditional 111 112 [ 113 "while" 114 "for" 115 "bound" 116 (break_statement) 117 (continue_statement) 118 ] @keyword.repeat 119 120 [ 121 "ret" 122 "exit" 123 "trap" 124 ] @keyword.return 125 126 "put" @function.builtin 127 128 (profile 129 name: _ @keyword.directive 130 option: (identifier) @keyword.directive) 131 132 (profile 133 name: _ @keyword.directive) 134 135 "=" @operator 136 137 [ 138 "(" 139 ")" 140 ] @punctuation.bracket 141 142 ; ---- literals ---- 143 (integer) @number 144 145 (float) @number.float 146 147 (string) @string 148 149 (escape_sequence) @string.escape 150 151 (unsized) @type