aboutsummaryrefslogtreecommitdiff
path: root/runtime/queries/nasm
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/queries/nasm')
-rw-r--r--runtime/queries/nasm/highlights.scm126
-rw-r--r--runtime/queries/nasm/injections.scm2
-rw-r--r--runtime/queries/nasm/textobjects.scm15
3 files changed, 143 insertions, 0 deletions
diff --git a/runtime/queries/nasm/highlights.scm b/runtime/queries/nasm/highlights.scm
new file mode 100644
index 00000000..5e3cfebe
--- /dev/null
+++ b/runtime/queries/nasm/highlights.scm
@@ -0,0 +1,126 @@
+(comment) @comment
+
+(label) @label
+
+(preproc_expression) @keyword.directive
+
+[
+ (line_here_token)
+ (section_here_token)
+] @variable.builtin
+
+(unary_expression
+ operator: _ @operator)
+(binary_expression
+ operator: _ @operator)
+(conditional_expression
+ "?" @operator
+ ":" @operator)
+
+[
+ ":"
+ ","
+] @punctuation.delimiter
+
+[
+ "("
+ ")"
+ "["
+ "]"
+ "{"
+ "}"
+] @punctuation.bracket
+
+(instruction_prefix) @keyword
+(actual_instruction
+ instruction: (word) @function)
+
+(call_syntax_expression
+ base: (word) @function)
+
+(size_hint) @type
+(struc_declaration
+ name: (word) @type)
+(struc_instance
+ name: (word) @type)
+
+(effective_address
+ hint: _ @type)
+(effective_address
+ segment: _ @constant.builtin)
+
+(register) @constant.builtin
+
+(number_literal) @constant.numeric.integer
+(string_literal) @string
+(float_literal) @constant.numeric.float
+(packed_bcd_literal) @constant.numeric.integer
+
+((word) @constant
+ (#match? @constant "^[A-Z_][?A-Z_0-9]+$"))
+((word) @constant.builtin
+ (#match? @constant.builtin "^__\\?[A-Z_a-z0-9]+\\?__$"))
+(word) @variable
+
+(preproc_arg) @keyword.directive
+
+[
+ (preproc_def)
+ (preproc_function_def)
+ (preproc_undef)
+ (preproc_alias)
+ (preproc_multiline_macro)
+ (preproc_multiline_unmacro)
+ (preproc_if)
+ (preproc_rotate)
+ (preproc_rep_loop)
+ (preproc_include)
+ (preproc_pathsearch)
+ (preproc_depend)
+ (preproc_use)
+ (preproc_push)
+ (preproc_pop)
+ (preproc_repl)
+ (preproc_arg)
+ (preproc_stacksize)
+ (preproc_local)
+ (preproc_reporting)
+ (preproc_pragma)
+ (preproc_line)
+ (preproc_clear)
+] @keyword.directive
+[
+ (pseudo_instruction_dx)
+ (pseudo_instruction_resx)
+ (pseudo_instruction_incbin_command)
+ (pseudo_instruction_equ_command)
+ (pseudo_instruction_times_prefix)
+ (pseudo_instruction_alignx_macro)
+] @function.special
+[
+ (assembl_directive_target)
+ (assembl_directive_defaults)
+ (assembl_directive_sections)
+ (assembl_directive_absolute)
+ (assembl_directive_symbols)
+ (assembl_directive_common)
+ (assembl_directive_symbolfixes)
+ (assembl_directive_cpu)
+ (assembl_directive_floathandling)
+ (assembl_directive_org)
+ (assembl_directive_sectalign)
+
+ (assembl_directive_primitive_target)
+ (assembl_directive_primitive_defaults)
+ (assembl_directive_primitive_sections)
+ (assembl_directive_primitive_absolute)
+ (assembl_directive_primitive_symbols)
+ (assembl_directive_primitive_common)
+ (assembl_directive_primitive_symbolfixes)
+ (assembl_directive_primitive_cpu)
+ (assembl_directive_primitive_floathandling)
+ (assembl_directive_primitive_org)
+ (assembl_directive_primitive_sectalign)
+ (assembl_directive_primitive_warning)
+ (assembl_directive_primitive_map)
+] @keyword
diff --git a/runtime/queries/nasm/injections.scm b/runtime/queries/nasm/injections.scm
new file mode 100644
index 00000000..2f0e58eb
--- /dev/null
+++ b/runtime/queries/nasm/injections.scm
@@ -0,0 +1,2 @@
+((comment) @injection.content
+ (#set! injection.language "comment"))
diff --git a/runtime/queries/nasm/textobjects.scm b/runtime/queries/nasm/textobjects.scm
new file mode 100644
index 00000000..ddfbad78
--- /dev/null
+++ b/runtime/queries/nasm/textobjects.scm
@@ -0,0 +1,15 @@
+(preproc_multiline_macro
+ body: (body) @function.inside) @function.around
+(struc_declaration
+ body: (struc_declaration_body) @class.inside) @class.around
+(struc_instance
+ body: (struc_instance_body) @class.inside) @class.around
+
+(preproc_function_def_parameters
+ (word) @parameter.inside)
+(call_syntax_arguments
+ (_) @parameter.inside)
+(operand) @parameter.inside
+
+(comment) @comment.inside
+(comment)+ @comment.around