nvim-treesitter/queries/perl/highlights.scm

161 lines
3.9 KiB
Scheme
Raw Permalink Normal View History

((source_file . (comment) @preproc)
(#lua-match? @preproc "^#!/"))
[ "use" "no" "require" ] @include
[ "if" "elsif" "unless" "else" ] @conditional
(conditional_expression [ "?" ":" ] @conditional.ternary)
[ "while" "until" "for" "foreach" ] @repeat
"return" @keyword.return
"sub" @keyword.function
2023-10-29 19:39:57 +00:00
[ "map" "grep" "sort" ] @function.builtin
"package" @include
[
"do"
2023-10-29 19:39:57 +00:00
"my" "our" "local" "state"
"last" "next" "redo" "goto"
"undef"
] @keyword
(_ operator: _ @operator)
"\\" @operator
(yadayada) @exception
(phaser_statement phase: _ @keyword.phaser)
[
"or" "and"
"eq" "ne" "cmp" "lt" "le" "ge" "gt"
"isa"
] @keyword.operator
(eof_marker) @preproc
(data_section) @comment
(pod) @text
2023-08-03 13:49:22 +03:00
[
(number)
(version)
] @number
[
(string_literal)
(interpolated_string_literal)
(quoted_word_list)
(command_string)
(heredoc_content)
(replacement)
(transliteration_content)
] @string
[
(heredoc_token)
(command_heredoc_token)
(heredoc_end)
] @label
[(escape_sequence) (escaped_delimiter)] @string.escape
(_ modifiers: _ @character.special)
[
(quoted_regexp)
(match_regexp)
(regexp_content)
] @string.regex
2023-10-23 21:40:18 +03:00
(autoquoted_bareword) @string.special
(use_statement (package) @type)
(package_statement (package) @type)
(require_expression (bareword) @type)
(subroutine_declaration_statement name: (bareword) @function)
(attribute_name) @attribute
(attribute_value) @string
(label) @label
2023-08-03 13:49:22 +03:00
(statement_label label: _ @label)
2023-08-03 13:49:22 +03:00
(relational_expression operator: "isa" right: (bareword) @type)
(function_call_expression (function) @function.call)
(method_call_expression (method) @method.call)
(method_call_expression invocant: (bareword) @type)
(func0op_call_expression function: _ @function.builtin)
(func1op_call_expression function: _ @function.builtin)
2023-11-02 19:58:38 +00:00
; this was a regex for the CLI
([(function)(expression_statement (bareword))] @function.builtin
2023-11-02 19:58:38 +00:00
(#any-of? @function.builtin
"accept" "atan2" "bind" "binmode" "bless" "crypt" "chmod" "chown" "connect"
"die" "dbmopen" "exec" "fcntl" "flock" "formline" "getpriority"
"getprotobynumber" "gethostbyaddr" "getnetbyaddr" "getservbyname"
"getservbyport" "getsockopt" "glob" "index" "ioctl" "join" "kill" "link"
"listen" "mkdir" "msgctl" "msgget" "msgrcv" "msgsend" "open" "opendir"
"print" "printf" "push" "pack" "pipe" "return" "rename" "rindex" "read"
"recv" "reverse" "say" "select" "seek" "semctl" "semget" "semop" "send"
"setpgrp" "setpriority" "seekdir" "setsockopt" "shmctl" "shmread" "shmwrite"
"shutdown" "socket" "socketpair" "split" "sprintf" "splice" "substr" "system"
"symlink" "syscall" "sysopen" "sysseek" "sysread" "syswrite" "tie" "truncate"
"unlink" "unpack" "utime" "unshift" "vec" "warn"
"waitpid"
))
2023-08-03 13:49:22 +03:00
(function) @function
(_
"{" @punctuation.special
(varname)
"}" @punctuation.special)
(varname
(block
"{" @punctuation.special
"}" @punctuation.special))
2021-08-30 12:36:55 +09:00
2023-11-02 19:58:38 +00:00
([(varname) (filehandle)] @variable.builtin
(#any-of? @variable.builtin "ENV" "ARGV" "INC" "ARGVOUT" "SIG" "STDIN" "STDOUT" "STDERR" "a" "b" "_"))
((varname) @variable.builtin
; highlights all the reserved ^ vars like ${^THINGS}
(#lua-match? @variable.builtin "%^"))
((varname) @variable.builtin
; highlights punc vars and also numeric only like $11
(#lua-match? @variable.builtin "^%A+$"))
2023-08-03 13:49:22 +03:00
(scalar) @variable.scalar
(scalar_deref_expression [ "$" "*"] @variable.scalar)
[(array) (arraylen)] @variable.array
(array_deref_expression [ "@" "*"] @variable.array)
(hash) @variable.hash
(hash_deref_expression [ "%" "*"] @variable.hash)
2023-08-03 13:49:22 +03:00
(array_element_expression array:(_) @variable.array)
(slice_expression array:(_) @variable.array)
(keyval_expression array:(_) @variable.array)
(hash_element_expression hash:(_) @variable.hash)
(slice_expression hash:(_) @variable.hash)
(keyval_expression hash:(_) @variable.hash)
(comment) @comment
([ "=>" "," ";" "->" ] @punctuation.delimiter)
(
[ "[" "]" "{" "}" "(" ")" ] @punctuation.bracket
; priority hack so nvim + ts-cli behave the same
(#set! "priority" 90))