mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-11 11:15:24 +03:00
[tree-sitter] More C++ fixes
Built a new `tree-sitter-cpp` parser from latest master to fix a parsing error with variable assignment. Also added/tweaked scopes for some specific scenarios.
This commit is contained in:
parent
f9232482d0
commit
80126cdbc8
@ -17,3 +17,6 @@ fileTypes: [
|
||||
'c'
|
||||
'h.in'
|
||||
]
|
||||
|
||||
comments:
|
||||
start: '// '
|
||||
|
@ -6,6 +6,7 @@ parser: 'tree-sitter-cpp'
|
||||
injectionRegex: '^(c|C)(\\+\\+|pp|PP)$'
|
||||
|
||||
treeSitter:
|
||||
parserSource: 'github:tree-sitter/tree-sitter-cpp#a90f170f92d5d70e7c2d4183c146e61ba5f3a457'
|
||||
grammar: 'tree-sitter-cpp/tree-sitter-cpp.wasm'
|
||||
highlightsQuery: 'tree-sitter-cpp/highlights.scm'
|
||||
tagsQuery: 'tree-sitter-cpp/tags.scm'
|
||||
@ -33,3 +34,6 @@ fileTypes: [
|
||||
]
|
||||
|
||||
contentRegex: '\n\\s*(namespace|class|template)\\s+'
|
||||
|
||||
comments:
|
||||
start: '// '
|
||||
|
@ -51,12 +51,14 @@
|
||||
|
||||
(primitive_type) @support.type.builtin.cpp
|
||||
|
||||
; Type parameters
|
||||
(template_argument_list
|
||||
(type_descriptor
|
||||
type: (type_identifier) @variable.parameter.type.cpp
|
||||
(#set! capture.final true)))
|
||||
; Mark all function definition types with data…
|
||||
(function_definition
|
||||
type: (_) @_IGNORE_
|
||||
(#set! functionDefinitionType true))
|
||||
|
||||
; …so that we can detect when a type identifier is part of a template/generic.
|
||||
((type_identifier) @variable.parameter.type.cpp
|
||||
(#is? test.descendantOfNodeWithData functionDefinitionType))
|
||||
|
||||
(class_specifier
|
||||
(type_identifier) @entity.name.class.cpp
|
||||
@ -150,6 +152,13 @@
|
||||
name: (identifier) @support.other.function.cpp)
|
||||
(#set! capture.final true))
|
||||
|
||||
; The "foo" in `troz::foo<SomeType>(...)`.
|
||||
(call_expression
|
||||
function: (qualified_identifier
|
||||
name: (template_function
|
||||
name: (identifier) @support.other.function.cpp))
|
||||
(#set! capture.final true))
|
||||
|
||||
(call_expression
|
||||
(identifier) @support.other.function.cpp
|
||||
(#set! capture.final true))
|
||||
@ -272,7 +281,6 @@
|
||||
(null)
|
||||
(true)
|
||||
(false)
|
||||
(nullptr)
|
||||
] @constant.language._TYPE_.cpp
|
||||
|
||||
((identifier) @constant.cpp
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user