aboutsummaryrefslogtreecommitdiffstats
path: root/queries
diff options
context:
space:
mode:
authorAmaan Qureshi <amaanq12@gmail.com>2023-02-25 19:40:08 -0500
committerAmaan Qureshi <amaanq12@gmail.com>2023-02-27 20:24:32 -0500
commit5cfb5d776812296a7b77d0d74d63a5f77df22327 (patch)
treec8d55a5ce5fa449b723e3520f3f8acb1c92f508e /queries
parentuse lua-match where possible (diff)
downloadnvim-treesitter-5cfb5d776812296a7b77d0d74d63a5f77df22327.tar
nvim-treesitter-5cfb5d776812296a7b77d0d74d63a5f77df22327.tar.gz
nvim-treesitter-5cfb5d776812296a7b77d0d74d63a5f77df22327.tar.bz2
nvim-treesitter-5cfb5d776812296a7b77d0d74d63a5f77df22327.tar.lz
nvim-treesitter-5cfb5d776812296a7b77d0d74d63a5f77df22327.tar.xz
nvim-treesitter-5cfb5d776812296a7b77d0d74d63a5f77df22327.tar.zst
nvim-treesitter-5cfb5d776812296a7b77d0d74d63a5f77df22327.zip
feat(fortran): update highlight queries
Diffstat (limited to 'queries')
-rw-r--r--queries/fortran/highlights.scm326
1 files changed, 235 insertions, 91 deletions
diff --git a/queries/fortran/highlights.scm b/queries/fortran/highlights.scm
index 95839184a..4604e9a92 100644
--- a/queries/fortran/highlights.scm
+++ b/queries/fortran/highlights.scm
@@ -1,96 +1,224 @@
-(identifier) @variable
-(string_literal) @string
-(number_literal) @number
-(boolean_literal) @boolean
-(comment) @comment
+; Preprocs
+
+(preproc_file_line) @preproc
+
+; Namespaces
+
+(program_statement
+ (name) @namespace)
+
+(end_program_statement
+ (name) @namespace)
+
+(module_statement
+ (name) @namespace)
+
+(end_module_statement
+ (name) @namespace)
+
+(submodule_statement
+ (name) @namespace)
+
+(end_submodule_statement
+ (name) @namespace)
+
+; Includes
[
- (intrinsic_type)
- "pointer"
+ "import"
+ "include"
+ "use"
+] @include
+
+(import_statement
+ ","
+ ["all" "none"] @keyword)
+
+; Attributes
+
+[
+ (none)
+ "implicit"
+ "intent"
+] @attribute
+
+(implicit_statement
+ "type" @attribute)
+
+; Keywords
+
+[
+ "attributes"
+ "associate"
+ "block"
+ "class"
+ "classis"
+ "contains"
+ "default"
+ "dimension"
+ "endassociate"
+ "endenum"
+ "endinterface"
+ "endmodule"
+ "endselect"
+ "endsubmodule"
+ "endtype"
+ "enum"
+ "enumerator"
+ "equivalence"
+ "extends"
+ "goto"
+ "interface"
+ "intrinsic"
+ "non_intrinsic"
+ "module"
+ "submodule"
+ "namelist"
+ "parameter"
+ "quiet"
+ "rank"
+ "save"
+ "selectcase"
+ "selectrank"
+ "selecttype"
+ "sequence"
+ "stop"
+ "target"
+ "type"
+ "typeis"
+] @keyword
+
+[
+ (default)
+] @keyword
+
+; Types
+
+[
+ (type_name)
] @type
[
+ (intrinsic_type)
+] @type.builtin
+
+; Qualifiers
+
+[
+ "abstract"
"allocatable"
- "attributes"
+ "automatic"
+ "constant"
+ "contiguous"
+ "data"
+ "deferred"
"device"
- "dimension"
+ "external"
+ "family"
+ "final"
+ "generic"
"global"
"grid_global"
"host"
+ "initial"
+ "local"
+ "local_init"
+ "managed"
+ "nopass"
+ "non_overridable"
"optional"
+ "pass"
+ "pinned"
+ "pointer"
"private"
+ "property"
+ "protected"
"public"
+ "shared"
+ "static"
+ "texture"
"value"
+ "volatile"
+ (procedure_qualifier)
] @type.qualifier
[
- "endtype"
- "type"
-] @type.definition
-
-[
+ "common"
"in"
"inout"
"out"
] @storageclass
-[
- "contains"
- "import"
-] @include
+; Labels
[
- (none)
- "implicit"
- "intent"
-] @attribute
+ (statement_label)
+ (statement_label_reference)
+] @label
[
+ "call"
"endfunction"
"endprogram"
+ "endprocedure"
"endsubroutine"
"function"
"procedure"
+ "program"
"subroutine"
] @keyword.function
[
+ "result"
+ "return"
+] @keyword.return
+
+; Functions
+
+(function_statement
+ (name) @function)
+
+(end_function_statement
+ (name) @function)
+
+(subroutine_statement
+ (name) @function)
+
+(end_subroutine_statement
+ (name) @function)
+
+(module_procedure_statement
+ (name) @function)
+
+(end_module_procedure_statement
+ (name) @function)
+
+(subroutine_call
+ (identifier) @function.call)
+
+[
+ "character"
+ "close"
"bind"
- "call"
- "class"
- "continue"
- "cycle"
- "endenum"
- "endinterface"
- "endmodule"
- "endprogram"
- "enum"
- "enumerator"
- "equivalence"
- "exit"
"format"
- "goto"
- "include"
- "interface"
- "module"
- "namelist"
- "only"
- "parameter"
+ "open"
"print"
- "program"
"read"
- "stop"
- "use"
"write"
- (default)
- (procedure_qualifier)
-] @keyword
+] @function.builtin
-"return" @keyword.return
+; Exceptions
+
+[
+ "error"
+] @exception
+
+; Conditionals
[
"else"
"elseif"
+ "elsewhere"
"endif"
"endwhere"
"if"
@@ -98,17 +226,44 @@
"where"
] @conditional
+; Repeats
+
[
"do"
+ "concurrent"
"enddo"
+ "endforall"
"forall"
"while"
+ "continue"
+ "cycle"
+ "exit"
] @repeat
+; Variables
+
+(identifier) @variable
+
+; Parameters
+
+(keyword_argument
+ name: (identifier) @parameter)
+
+(parameters
+ (identifier) @parameter)
+
+; Properties
+
+(derived_type_member_expression
+ (type_member) @property)
+
+; Operators
+
[
- "*"
"+"
"-"
+ "*"
+ "**"
"/"
"="
"<"
@@ -117,69 +272,58 @@
">="
"=="
"/="
+ "//"
+ (assumed_rank)
] @operator
[
"\\.and\\."
"\\.or\\."
+ "\\.eqv\\."
+ "\\.neqv\\."
"\\.lt\\."
"\\.gt\\."
- "\\.ge\\."
"\\.le\\."
+ "\\.ge\\."
"\\.eq\\."
- "\\.eqv\\."
- "\\.neqv\\."
+ "\\.ne\\."
+ "\\.not\\."
] @keyword.operator
- ;; Brackets
- [
- "("
- ")"
- "["
- "]"
- "<<<"
- ">>>"
- ] @punctuation.bracket
+; Punctuation
- ;; Delimiter
- [
- "::"
- ","
- "%"
- ] @punctuation.delimiter
+[ "[" "]" ] @punctuation.bracket
-(parameters
- (identifier) @parameter)
+[ "(" ")" ] @punctuation.bracket
-(program_statement
- (name) @namespace)
+[ "<<<" ">>>" ] @punctuation.bracket
-(module_statement
- (name) @namespace)
+(array_literal
+ ["(/" "/)"] @punctuation.bracket)
-(function_statement
- (name) @function)
+[
+ ":"
+ ","
+ "/"
+ "%"
+ "::"
+ "=>"
+] @punctuation.delimiter
-(subroutine_statement
- (name) @function)
+; Literals
-(end_program_statement
- (name) @namespace)
+(string_literal) @string
-(end_module_statement
- (name) @namespace)
+(number_literal) @number
-(end_function_statement
- (name) @function)
+(boolean_literal) @boolean
-(end_subroutine_statement
- (name) @function)
+(null_literal) @constant.builtin
-(subroutine_call
- (identifier) @function.call)
+; Comments
-(keyword_argument
- name: (identifier) @keyword)
+(comment) @comment @spell
-(derived_type_member_expression
- (type_member) @property)
+; Errors
+
+(ERROR) @error