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/openqasm.tmLanguage.json

115lines · modecode

1{
2 "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
3 "name": "openqasm",
4 "scopeName": "source.openqasm",
5 "fileTypes": ["qasm", "inc"],
6 "patterns": [
7 {
8 "include": "#comments"
9 },
10 {
11 "include": "#keywords"
12 },
13 {
14 "include": "#operators"
15 },
16 {
17 "include": "#types"
18 },
19 {
20 "include": "#constants"
21 },
22 {
23 "include": "#strings"
24 },
25 {
26 "include": "#brackets"
27 },
28 {
29 "include": "#variables"
30 }
31 ],
32 "repository": {
33 "comments": {
34 "patterns": [
35 {
36 "name": "comment.line.double-slash",
37 "match": "//.*$"
38 },
39 {
40 "name": "comment.block",
41 "begin": "/\\*",
42 "end": "\\*/"
43 }
44 ]
45 },
46 "keywords": {
47 "patterns": [
48 {
49 "name": "keyword.control.openqasm",
50 "match": "(?<!\\s*\\.\\s*)\\b(in|for|return|if|else|switch|while)\\b(?!\\s*\\.)"
51 },
52 {
53 "name": "keyword.other.openqasm",
54 "match": "(?<!\\s*\\.\\s*)\\b(OPENQASM|include|qubit|reset|mutable|readonly|#dim|stretch|delay|barrier|box|input|output|int|float|bit|bool|uint|angle|complex|const|defcal|def|gate|array|duration|let|measure|pragma|defcalgrammar|cal|qreg|creg|extern|port|frame|waveform)\\b(?!\\s*\\.)"
55 }
56 ]
57 },
58 "operators": {
59 "patterns": [
60 {
61 "name": "keyword.other.operator.openqasm",
62 "match": "\\b(=)|(!)|(<)|(>)|(\\+)|(-)|(\\*)|(\\*\\*)|(\\/)|(\\^)|(%)|(\\|)|(\\&)|(\\&\\&)|(\\~)|(\\|\\|)|(<<)|(>>)"
63 }
64 ]
65 },
66 "types": {
67 "patterns": [
68 {
69 "name": "storage.type.openqasm",
70 "match": "\\b(angle|bit|bool|complex|duration|float|int|stretch|uint|qreg|creg)(\\[[a-zA-Z_][a-zA-Z0-9_]*\\])?\\b"
71 }
72 ]
73 },
74 "constants": {
75 "patterns": [
76 {
77 "name": "constant.language.openqasm",
78 "match": "\\b(true|false|theta|pi|θ|π|ℇ|τ|euler|tau|λ|lambda|φ|phi|@)\\b"
79 },
80 {
81 "comment": "integers and decimals",
82 "name": "constant.numeric.openqasm",
83 "match": "\\b[\\d_]*\\.?[\\d_](im|dt|ns|us|ms|s|)?\\b"
84 }
85 ]
86 },
87 "strings": {
88 "name": "string.quoted.double.openqasm",
89 "begin": "\"",
90 "end": "\"",
91 "patterns": [
92 {
93 "name": "constant.character.escape.openqasm",
94 "match": "\\\\."
95 }
96 ]
97 },
98 "brackets": {
99 "patterns": [
100 {
101 "name": "punctuation.bracket.openqasm",
102 "match": "[\\[\\]\\(\\)\\{\\}]"
103 }
104 ]
105 },
106 "variables": {
107 "patterns": [
108 {
109 "name": "variable.other.openqasm",
110 "match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)\\b"
111 }
112 ]
113 }
114 }
115}
116