This repository was archived by the owner on Jun 18, 2025. It is now read-only.
forked from intitni/CopilotForXcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathObjectiveCSyntax.swift
More file actions
85 lines (83 loc) · 3.2 KB
/
ObjectiveCSyntax.swift
File metadata and controls
85 lines (83 loc) · 3.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import Foundation
/// https://github.com/lukepistrol/tree-sitter-objc/blob/feature/spm/test/corpus/imports.txt
/// https://github.com/lukepistrol/tree-sitter-objc/blob/feature/spm/test/corpus/expressions.txt
/// https://github.com/lukepistrol/tree-sitter-objc/blob/feature/spm/test/corpus/declarations.txt
/// https://github.com/lukepistrol/tree-sitter-objc/blob/feature/spm/node-types.json
/// Some of the test cases are actually incorrect?
enum ObjectiveCNodeType: String {
/// The top most item
case translationUnit = "translation_unit"
/// `#include`
case preprocInclude = "preproc_include"
/// `#import "bar.h"`
case preprocImport = "preproc_import"
/// `@import foo.bar`
case moduleImport = "module_import"
/// ```objc
/// @interface ClassName(Category)<Protocol1, Protocol2>: SuperClass {
/// type1 iv1;
/// type2 iv2;
/// }
/// @property (readwrite, copy) float value;
/// + (tr)k1:(t1)a1 : (t2)a2 k2: a3;
/// @end
/// ```
case classInterface = "class_interface"
/// `@implementation`
case classImplementation = "class_implementation"
/// Similar to class interface.
case categoryInterface = "category_interface"
/// Similar to class implementation.
case categoryImplementation = "category_implementation"
/// Similar to class interface.
case protocolDeclaration = "protocol_declaration"
/// `@protocol <P1, P2>`
case protocolDeclarationList = "protocol_declaration_list"
/// ```objc
/// @class C1, C2;
/// ```
case classDeclarationList = "class_declaration_list"
/// ```
/// + (tr)k1: (t1)a1 : (t2)a2 k2: a3;
/// ```
case propertyDeclaration = "property_declaration"
/// ```objc
/// + (tr)k1: (t1)a1 : (t2)a2 k2: a3;
/// ```
case methodDeclaration = "method_declaration"
/// `- (rt)sel {}`
case methodDefinition = "method_definition"
/// function definitions
case functionDefinition = "function_definition"
/// Names of symbols
case identifier = "identifier"
/// Type identifiers
case typeIdentifier = "type_identifier"
/// Compound statements, such as `{ ... }`
case compoundStatement = "compound_statement"
/// Typedef.
case typeDefinition = "type_definition"
/// `struct {}`.
case structSpecifier = "struct_specifier"
/// `enum {}`.
case enumSpecifier = "enum_specifier"
/// `NS_ENUM {}` and `NS_OPTIONS {}`.
case nsEnumSpecifier = "ns_enum_specifier"
/// Fields inside a type definition.
case fieldDeclarationList = "field_declaration_list"
/// Protocols that a type conforms.
case protocolQualifiers = "protocol_qualifiers"
/// Superclass of a type.
case superclassReference = "superclass_reference"
/// The generic type arguments.
case parameterizedClassTypeArguments = "parameterized_class_type_arguments"
/// `__GENERICS` in category interface and implementation.
case genericsTypeReference = "generics_type_reference"
/// `IB_DESIGNABLE`, etc. The typo is from the original source.
case classInterfaceAttributeSpecifier = "class_interface_attribute_specifier"
}
extension ObjectiveCNodeType {
init?(rawValue: String?) {
self.init(rawValue: rawValue ?? "")
}
}