microsoft/qdk

Public

mirrored from https://github.com/microsoft/qdkAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
32bcffe86a3647ddd45528ecb551f8feddd749ab

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

source/vscode/syntaxes/qsharp.tmLanguage.json

211lines · modecode

1{
2 "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
3 "name": "qsharp",
4 "fileTypes": ["qs"],
5 "patterns": [
6 {
7 "include": "#comments"
8 },
9 {
10 "include": "#functions"
11 },
12 {
13 "include": "#keywords"
14 },
15 {
16 "include": "#operators"
17 },
18 {
19 "include": "#types"
20 },
21 {
22 "include": "#constants"
23 },
24 {
25 "include": "#strings"
26 },
27 {
28 "include": "#variables"
29 }
30 ],
31 "repository": {
32 "comments": {
33 "patterns": [
34 {
35 "name": "comment.line.double-slash",
36 "match": "\\/\\/.*$"
37 },
38 {
39 "name": "comment.documentation",
40 "match": "\\/\\/\\/.*$"
41 }
42 ]
43 },
44 "functions": {
45 "patterns": [
46 {
47 "comment": "function definition",
48 "name": "meta.function.definition.qsharp",
49 "begin": "\\b(function)\\s+([A-Za-z0-9_]+)(\\()",
50 "beginCaptures": {
51 "1": {
52 "name": "keyword.other.qsharp"
53 },
54 "2": {
55 "name": "entity.name.function.qsharp"
56 },
57 "3": {
58 "name": "punctuation.brackets.round.qsharp"
59 }
60 },
61 "end": "\\)",
62 "endCaptures": {
63 "0": {
64 "name": "punctuation.brackets.round.qsharp"
65 }
66 },
67 "patterns": [
68 {
69 "include": "#comments"
70 },
71 {
72 "include": "#functions"
73 },
74 {
75 "include": "#keywords"
76 },
77 {
78 "include": "#operators"
79 },
80 {
81 "include": "#types"
82 },
83 {
84 "include": "#constants"
85 },
86 {
87 "include": "#strings"
88 },
89 {
90 "include": "#variables"
91 }
92 ]
93 },
94 {
95 "comment": "function calls",
96 "name": "meta.function.call.qsharp",
97 "begin": "\\b(?<!@)([A-Za-z0-9_]+)(\\()",
98 "beginCaptures": {
99 "1": {
100 "name": "entity.name.function.qsharp"
101 },
102 "2": {
103 "name": "punctuation.brackets.round.qsharp"
104 }
105 },
106 "end": "\\)",
107 "endCaptures": {
108 "0": {
109 "name": "punctuation.brackets.round.qsharp"
110 }
111 },
112 "patterns": [
113 {
114 "include": "#comments"
115 },
116 {
117 "include": "#functions"
118 },
119 {
120 "include": "#keywords"
121 },
122 {
123 "include": "#operators"
124 },
125 {
126 "include": "#types"
127 },
128 {
129 "include": "#constants"
130 },
131 {
132 "include": "#strings"
133 },
134 {
135 "include": "#variables"
136 }
137 ]
138 }
139 ]
140 },
141 "keywords": {
142 "patterns": [
143 {
144 "name": "keyword.control.qsharp",
145 "match": "\\b(use|borrow|mutable|let|set|if|elif|else|repeat|until|fixup|for|in|while|return|fail|within|apply)\\b"
146 },
147 {
148 "name": "keyword.other.qsharp",
149 "match": "\\b(namespace|open|import|export|as|internal|newtype|struct|operation|function|new|body|(a|A)djoint|(c|C)ontrolled|self|auto|distribute|invert|intrinsic)\\b"
150 }
151 ]
152 },
153 "operators": {
154 "patterns": [
155 {
156 "name": "keyword.other.operator.qsharp",
157 "match": "\\b(not|and|or)\\b|\\b(w/)|(=)|(!)|(<)|(>)|(\\+)|(-)|(\\*)|(\\/)|(\\^)|(%)|(\\|)|(\\&\\&\\&)|(\\~\\~\\~)|(\\.\\.\\.)|(\\.\\.)|(\\?)"
158 }
159 ]
160 },
161 "types": {
162 "patterns": [
163 {
164 "name": "storage.type.qsharp",
165 "match": "\\b(Int|BigInt|Double|Bool|Qubit|Pauli|Result|Range|String|Unit|Ctl|Adj|is)\\b"
166 }
167 ]
168 },
169 "constants": {
170 "patterns": [
171 {
172 "name": "constant.language.qsharp",
173 "match": "\\b(true|false|Pauli(I|X|Y|Z))\\b"
174 },
175 {
176 "name": "constant.other.result.qsharp",
177 "match": "\\b(One|Zero)\\b"
178 },
179 {
180 "comment": "integers and decimals",
181 "name": "constant.numeric.qsharp",
182 "match": "\\b[\\d_]*\\.?[\\d_]\\b"
183 }
184 ]
185 },
186 "strings": {
187 "patterns": [
188 {
189 "name": "string.quoted.double.qsharp",
190 "begin": "(\\$|)\"",
191 "end": "\"",
192 "patterns": [
193 {
194 "name": "constant.character.escape.qsharp",
195 "match": "\\\\."
196 }
197 ]
198 }
199 ]
200 },
201 "variables": {
202 "patterns": [
203 {
204 "name": "variable.other.qsharp",
205 "match": "\\b(?<!@)[A-Za-z0-9_]+\\b"
206 }
207 ]
208 }
209 },
210 "scopeName": "source.qsharp"
211}
212