mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-08 22:40:12 -04:00
feat(arduino): separate from cpp
This commit is contained in:
parent
9705316fff
commit
63b6f1f984
6 changed files with 125 additions and 1 deletions
|
|
@ -2,7 +2,6 @@ local api = vim.api
|
|||
local ts = vim.treesitter
|
||||
|
||||
local filetype_to_parsername = {
|
||||
arduino = "cpp",
|
||||
javascriptreact = "javascript",
|
||||
ecma = "javascript",
|
||||
jsx = "javascript",
|
||||
|
|
@ -1300,6 +1299,14 @@ list.awk = {
|
|||
},
|
||||
}
|
||||
|
||||
list.arduino = {
|
||||
install_info = {
|
||||
url = "https://github.com/ObserverOfTime/tree-sitter-arduino",
|
||||
files = { "src/parser.c", "src/scanner.cc" },
|
||||
},
|
||||
maintainers = { "@ObserverOfTime" },
|
||||
}
|
||||
|
||||
local M = {
|
||||
list = list,
|
||||
filetype_to_parsername = filetype_to_parsername,
|
||||
|
|
|
|||
1
queries/arduino/folds.scm
Normal file
1
queries/arduino/folds.scm
Normal file
|
|
@ -0,0 +1 @@
|
|||
; inherits: cpp
|
||||
111
queries/arduino/highlights.scm
Normal file
111
queries/arduino/highlights.scm
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
; inherits: cpp
|
||||
|
||||
((identifier) @function.builtin
|
||||
(#any-of? @function.builtin
|
||||
; Digital I/O
|
||||
"digitalRead"
|
||||
"digitalWrite"
|
||||
"pinMode"
|
||||
; Analog I/O
|
||||
"analogRead"
|
||||
"analogReference"
|
||||
"analogWrite"
|
||||
; Zero, Due & MKR Family
|
||||
"analogReadResolution"
|
||||
"analogWriteResolution"
|
||||
; Advanced I/O
|
||||
"noTone"
|
||||
"pulseIn"
|
||||
"pulseInLong"
|
||||
"shiftIn"
|
||||
"shiftOut"
|
||||
"tone"
|
||||
; Time
|
||||
"delay"
|
||||
"delayMicroseconds"
|
||||
"micros"
|
||||
"millis"
|
||||
; Math
|
||||
"abs"
|
||||
"constrain"
|
||||
"map"
|
||||
"max"
|
||||
"min"
|
||||
"pow"
|
||||
"sq"
|
||||
"sqrt"
|
||||
; Trigonometry
|
||||
"cos"
|
||||
"sin"
|
||||
"tan"
|
||||
; Characters
|
||||
"isAlpha"
|
||||
"isAlphaNumeric"
|
||||
"isAscii"
|
||||
"isControl"
|
||||
"isDigit"
|
||||
"isGraph"
|
||||
"isHexadecimalDigit"
|
||||
"isLowerCase"
|
||||
"isPrintable"
|
||||
"isPunct"
|
||||
"isSpace"
|
||||
"isUpperCase"
|
||||
"isWhitespace"
|
||||
; Random Numbers
|
||||
"random"
|
||||
"randomSeed"
|
||||
; Bits and Bytes
|
||||
"bit"
|
||||
"bitClear"
|
||||
"bitRead"
|
||||
"bitSet"
|
||||
"bitWrite"
|
||||
"highByte"
|
||||
"lowByte"
|
||||
; External Interrupts
|
||||
"attachInterrupt"
|
||||
"detachInterrupt"
|
||||
; Interrupts
|
||||
"interrupts"
|
||||
"noInterrupts"
|
||||
))
|
||||
|
||||
((identifier) @type.builtin
|
||||
(#any-of? @type.builtin
|
||||
"Serial"
|
||||
"SPI"
|
||||
"Stream"
|
||||
"Wire"
|
||||
"Keyboard"
|
||||
"Mouse"
|
||||
"String"
|
||||
))
|
||||
|
||||
((identifier) @constant.builtin
|
||||
(#any-of? @constant.builtin
|
||||
"HIGH"
|
||||
"LOW"
|
||||
"INPUT"
|
||||
"OUTPUT"
|
||||
"INPUT_PULLUP"
|
||||
"LED_BUILTIN"
|
||||
))
|
||||
|
||||
(function_definition
|
||||
(function_declarator
|
||||
declarator: (identifier) @function.builtin)
|
||||
(#any-of? @function.builtin "loop" "setup"))
|
||||
|
||||
(call_expression
|
||||
function: (primitive_type) @function.builtin)
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @constructor
|
||||
(#any-of? @constructor "SPISettings" "String"))
|
||||
|
||||
(declaration
|
||||
(type_identifier) @type.builtin
|
||||
(function_declarator
|
||||
declarator: (identifier) @constructor)
|
||||
(#eq? @type.builtin "SPISettings"))
|
||||
1
queries/arduino/indents.scm
Normal file
1
queries/arduino/indents.scm
Normal file
|
|
@ -0,0 +1 @@
|
|||
; inherits: cpp
|
||||
3
queries/arduino/injections.scm
Normal file
3
queries/arduino/injections.scm
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
(preproc_arg) @arduino
|
||||
|
||||
(comment) @comment
|
||||
1
queries/arduino/locals.scm
Normal file
1
queries/arduino/locals.scm
Normal file
|
|
@ -0,0 +1 @@
|
|||
; inherits: cpp
|
||||
Loading…
Add table
Add a link
Reference in a new issue