summaryrefslogtreecommitdiff
path: root/syntaxes/dataclass.json
blob: 1766daac75dcc82e895f8f3f7a3b32320ed9de40 (plain)
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
{
    "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
    "name": "dataclass",
    "scopeName": "source.perl.package.dataclass",
    "injectionSelector": "L:meta.dataclass.perl -comment -string -text",
    "patterns": [
        {
            "include": "#dataclass"
        },
        {
            "include": "#letblocks"
        },
        {
            "include": "#defblocks"
        }
    ],
    "repository": {
        "dataclass": {
            "patterns": [
                {
                    "match": "\\b(has|private|public|readonly|lazy|protected|initvar)\\s+(\\w+)\\s*(?::(\\s*\\{[\\s\\|\\w:\\[\\],]+\\}|[\\s\\|\\w:\\[\\]]+))?\\s*(?=[;=])",
                    "captures": {
                        "1": {
                            "name": "keyword.other.attribute.dataclass.perl"
                        },
                        "2": {
                            "name": "entity.other.attribute-name.dataclass.perl"
                        },
                        "3": {
                            "name": "support.type.dataclass.perl"
                        }
                    }
                },
                {
                    "match": "\\b(private|public|protected)\\s+(?=(?:sub|def)\\s)",
                    "captures": {
                        "1": {
                            "name": "keyword.other.attribute.dataclass.perl"
                        }
                    }
                },
                {
                    "match": "\\b(class)\\s+(\\w+)\\b(?:\\s+(extends)\\s+(\\w+)\\b)?",
                    "captures": {
                        "1": {
                            "name": "keyword.control.dataclass"
                        },
                        "2": {
                            "name": "entity.name.type.class"
                        },
                        "3": {
                            "name": "storage.modifier.dataclass.perl"
                        },
                        "4": {
                            "name": "entity.name.type.class"
                        }
                    }
                },
                {
                    "match": "\\b(let)\\s+([\\$\\@\\%]\\w+)\\s*(?::(\\s*\\{[\\s\\|\\w:\\[\\],]+\\}|[\\s\\|\\w:\\[\\]]+))?",
                    "captures": {
                        "1": {
                            "name": "keyword.other.attribute.dataclass.perl"
                        },
                        "2": {
                            "name": "variable.other.readwrite.global.perl"
                        },
                        "3": {
                            "name": "support.type.dataclass.perl"
                        }
                    }
                }
            ]
        },
        "letblocks": {
            "name": "let.block.typehint",
            "begin": "\\b(let)\\s+\\(",
            "beginCaptures": {
                "0": {
                    "name": "keyword.other.attribute.dataclass.perl"
                }
            },
            "end": "\\)",
            "endCaptures": {
                "0": {
                    "name": "punctuation.definition.block.ts"
                }
            },
            "patterns": [
                {
                    "match": "([\\$\\@\\%]\\w+)\\s*(?::(\\s*\\{[\\s\\|\\w:\\[\\],]+\\}|[\\s\\|\\w:\\[\\]]+))?",
                    "captures": {
                        "1": {
                            "name": "variable.other.readwrite.global.perl"
                        },
                        "2": {
                            "name": "support.type.dataclass.perl"
                        }
                    }
                }
            ]
        }, 
        "defblocks": {
            "name": "def.block.typehint",
            "begin": "\\b(?:(def)\\s+(\\w+)|(set|get)\\s+(\\w+))\\s*\\(",
            "beginCaptures": {
                "1": {
                    "name": "storage.type.sub.perl"
                },
                "2": {
                    "name": "entity.name.function.perl"
                },
                "3": {
                    "name": "storage.type.sub.perl"
                },
                "4": {
                    "name": "variable.other.property.perl"
                }
            },
            "end": "\\)\\s*(?::(\\s*\\{[\\s\\|\\w:\\[\\],]+\\}|[\\s\\|\\w:\\[\\]]+))?",
            "endCaptures": {
                "0": {
                    "name": "punctuation.definition.block.ts"
                },
                "1": {
                    "name": "support.type.dataclass.perl"
                }
            },
            "patterns": [
                {
                    "match": "([\\$\\@\\%]\\w+)\\s*(?::(\\s*\\{[\\s\\|\\w:\\[\\],]+\\}|[\\s\\|\\w:\\[\\]]+))?",
                    "captures": {
                        "1": {
                            "name": "variable.other.readwrite.global.perl"
                        },
                        "2": {
                            "name": "support.type.dataclass.perl"
                        }
                    }
                }
            ]
        }
    }
}