Skip to content

Commit

Permalink
Rename vlang to v and add highlights.scm
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed May 24, 2022
1 parent b7195a9 commit 907437d
Show file tree
Hide file tree
Showing 2 changed files with 150 additions and 3 deletions.
6 changes: 3 additions & 3 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1382,14 +1382,14 @@ name = "scheme"
source = { git = "https://github.com/6cdh/tree-sitter-scheme", rev = "27fb77db05f890c2823b4bd751c6420378df146b" }

[[language]]
name = "vlang"
scope = "source.vlang"
name = "v"
scope = "source.v"
file-types = ["v", "vv"]
shebangs = ["v run"]
roots = []
comment-token = "//"
indent = { tab-width = 2, unit = " " }

[[grammar]]
name = "vlang"
name = "v"
source = { git = "https://github.com/vlang/vls", subpath = "tree_sitter_v", rev = "3e8124ea4ab80aa08ec77f03df53f577902a0cdd" }
147 changes: 147 additions & 0 deletions runtime/queries/v/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
(ERROR) @error
(comment) @comment

(identifier) @variable
(module_identifier) @variable
(import_path) @variable

(parameter_declaration
name: (identifier) @parameter)
(function_declaration
name: (identifier) @function)
(function_declaration
receiver: (parameter_list)
name: (identifier) @method)

(call_expression
function: (identifier) @function)
(call_expression
function: (selector_expression
field: (identifier) @method))

(type_identifier) @type
(builtin_type) @type
(pointer_type) @type
(array_type) @type

(field_identifier) @property
(selector_expression
field: (identifier) @property)

(int_literal) @number
(interpreted_string_literal) @string
(rune_literal) @string
(escape_sequence) @string.escape

[
"as"
"asm"
"assert"
;"atomic"
;"break"
"const"
;"continue"
"defer"
"else"
"enum"
"fn"
"for"
"$for"
"go"
"goto"
"if"
"$if"
"import"
"in"
"!in"
"interface"
"is"
"!is"
"lock"
"match"
"module"
"mut"
"or"
"pub"
"return"
"rlock"
"select"
;"shared"
;"static"
"struct"
"type"
;"union"
"unsafe"
] @keyword

[
(true)
(false)
] @boolean

[
"."
","
":"
";"
] @punctuation.delimiter

[
"("
")"
"{"
"}"
"["
"]"
] @punctuation.bracket

(array) @punctuation.bracket

[
"++"
"--"

"+"
"-"
"*"
"/"
"%"

"~"
"&"
"|"
"^"

"!"
"&&"
"||"
"!="

"<<"
">>"

"<"
">"
"<="
">="

"+="
"-="
"*="
"/="
"&="
"|="
"^="
"<<="
">>="

"="
":="
"=="

"?"
"<-"
"$"
".."
"..."
] @operator

0 comments on commit 907437d

Please sign in to comment.