mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
feat: add ApX parser
ApX is a command-oriented scripting language for the APEX PDE (Personal Development Environment). It features pipelines, 200+ built-in commands, control flow, functions, macros, and more. Grammar repository: https://github.com/StackApe/tree-sitter-apx
This commit is contained in:
parent
d3218d988f
commit
05c0183dac
3 changed files with 208 additions and 0 deletions
|
|
@ -34,6 +34,14 @@ return {
|
|||
maintainers = { '@aheber', '@xixiafinland' },
|
||||
tier = 2,
|
||||
},
|
||||
apx = {
|
||||
install_info = {
|
||||
revision = 'b4998766b748d9559a5d1752b76b2719721bd096',
|
||||
url = 'https://github.com/StackApe/tree-sitter-apx',
|
||||
},
|
||||
maintainers = { '@StackApe' },
|
||||
tier = 2,
|
||||
},
|
||||
arduino = {
|
||||
install_info = {
|
||||
revision = '53eb391da4c6c5857f8defa2c583c46c2594f565',
|
||||
|
|
|
|||
161
queries/apx/highlights.scm
Normal file
161
queries/apx/highlights.scm
Normal file
|
|
@ -0,0 +1,161 @@
|
|||
; ApX Tree-sitter highlight queries for Neovim
|
||||
|
||||
; Comments
|
||||
(comment) @comment
|
||||
|
||||
; Strings
|
||||
(double_string) @string
|
||||
(single_string) @string
|
||||
(triple_string) @string
|
||||
(raw_string) @string
|
||||
(backtick_string) @string
|
||||
|
||||
; Numbers
|
||||
(integer) @number
|
||||
(float) @number.float
|
||||
(hex_number) @number
|
||||
(binary_number) @number
|
||||
(octal_number) @number
|
||||
|
||||
; Booleans and null
|
||||
(boolean) @boolean
|
||||
(null) @constant.builtin
|
||||
|
||||
; Variables
|
||||
(regular_variable) @variable
|
||||
(env_variable) @variable.builtin
|
||||
(special_variable) @variable.builtin
|
||||
|
||||
; Field access: $var.field
|
||||
(field_access
|
||||
(identifier) @property)
|
||||
|
||||
; Method calls: ai.ask
|
||||
(method_call
|
||||
(identifier) @function.call)
|
||||
|
||||
; Keywords - Control flow (using actual grammar keywords)
|
||||
"if" @keyword.control
|
||||
"else" @keyword.control
|
||||
"elif" @keyword.control
|
||||
"for" @keyword.control
|
||||
"while" @keyword.control
|
||||
"in" @keyword.control
|
||||
"match" @keyword.control
|
||||
"return" @keyword.control
|
||||
|
||||
; Break and continue are statement nodes
|
||||
(break_statement) @keyword.control
|
||||
(continue_statement) @keyword.control
|
||||
|
||||
; Keywords - Definition
|
||||
"fn" @keyword.function
|
||||
"macro" @keyword.function
|
||||
"alias" @keyword.function
|
||||
"let" @keyword.function
|
||||
"const" @keyword.function
|
||||
"set" @keyword.function
|
||||
|
||||
; Keywords - Error handling
|
||||
"try" @keyword.exception
|
||||
"catch" @keyword.exception
|
||||
|
||||
; Keywords - Modules
|
||||
"use" @keyword.import
|
||||
"from" @keyword.import
|
||||
"import" @keyword.import
|
||||
"as" @keyword.import
|
||||
|
||||
; Keywords - Testing
|
||||
"test" @keyword
|
||||
|
||||
; Keywords - Logical
|
||||
"and" @keyword.operator
|
||||
"or" @keyword.operator
|
||||
"not" @keyword.operator
|
||||
|
||||
; Operators
|
||||
[
|
||||
"+"
|
||||
"-"
|
||||
"*"
|
||||
"/"
|
||||
"%"
|
||||
"=="
|
||||
"!="
|
||||
"<"
|
||||
">"
|
||||
"<="
|
||||
">="
|
||||
"&&"
|
||||
"||"
|
||||
"!"
|
||||
"="
|
||||
"|"
|
||||
".."
|
||||
"..="
|
||||
"=>"
|
||||
] @operator
|
||||
|
||||
; Punctuation
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
","
|
||||
":"
|
||||
"::"
|
||||
] @punctuation.delimiter
|
||||
|
||||
; Function definition - identifier after 'fn'
|
||||
(function_definition
|
||||
(identifier) @function.definition)
|
||||
|
||||
; Macro definition - identifier after 'macro'
|
||||
(macro_definition
|
||||
(identifier) @function.macro)
|
||||
|
||||
; Alias definition - identifier after 'alias'
|
||||
(alias_definition
|
||||
(identifier) @function)
|
||||
|
||||
; Test definition
|
||||
(test_definition
|
||||
(string) @string.special)
|
||||
|
||||
; Function parameters
|
||||
(parameter
|
||||
(identifier) @variable.parameter)
|
||||
|
||||
; Record fields
|
||||
(record_field
|
||||
(identifier) @property)
|
||||
|
||||
; Import
|
||||
(import_item
|
||||
(identifier) @namespace)
|
||||
|
||||
; Flags
|
||||
(long_flag) @attribute
|
||||
(short_flag) @attribute
|
||||
|
||||
; Built-in commands
|
||||
(builtin_command) @function.builtin
|
||||
|
||||
; User-defined command calls
|
||||
(command_expression
|
||||
(command_name
|
||||
(identifier) @function.call))
|
||||
|
||||
; Match arms
|
||||
(match_arm
|
||||
(_) @constant)
|
||||
|
||||
; Range
|
||||
(range) @constant
|
||||
39
queries/apx/locals.scm
Normal file
39
queries/apx/locals.scm
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
; ApX Tree-sitter locals queries for scope tracking
|
||||
|
||||
; Scopes
|
||||
(function_definition) @local.scope
|
||||
(macro_definition) @local.scope
|
||||
(closure) @local.scope
|
||||
(for_statement) @local.scope
|
||||
(block) @local.scope
|
||||
|
||||
; Definitions
|
||||
(assignment
|
||||
(identifier) @local.definition)
|
||||
|
||||
(variable_assignment
|
||||
(variable) @local.definition)
|
||||
|
||||
(parameter
|
||||
(identifier) @local.definition)
|
||||
|
||||
(function_definition
|
||||
(identifier) @local.definition)
|
||||
|
||||
(macro_definition
|
||||
(identifier) @local.definition)
|
||||
|
||||
(alias_definition
|
||||
(identifier) @local.definition)
|
||||
|
||||
(for_statement
|
||||
(identifier) @local.definition)
|
||||
|
||||
(closure_parameters
|
||||
(identifier) @local.definition)
|
||||
|
||||
; References
|
||||
(regular_variable) @local.reference
|
||||
(command_expression
|
||||
(command_name
|
||||
(identifier) @local.reference))
|
||||
Loading…
Add table
Add a link
Reference in a new issue