main
Last change
on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Rev | Line | |
---|
[d24f17c] | 1 | 'use strict'
|
---|
| 2 |
|
---|
| 3 | module.exports = openqasm
|
---|
| 4 | openqasm.displayName = 'openqasm'
|
---|
| 5 | openqasm.aliases = ['qasm']
|
---|
| 6 | function openqasm(Prism) {
|
---|
| 7 | // https://qiskit.github.io/openqasm/grammar/index.html
|
---|
| 8 | Prism.languages.openqasm = {
|
---|
| 9 | comment: /\/\*[\s\S]*?\*\/|\/\/.*/,
|
---|
| 10 | string: {
|
---|
| 11 | pattern: /"[^"\r\n\t]*"|'[^'\r\n\t]*'/,
|
---|
| 12 | greedy: true
|
---|
| 13 | },
|
---|
| 14 | keyword:
|
---|
| 15 | /\b(?:CX|OPENQASM|U|barrier|boxas|boxto|break|const|continue|ctrl|def|defcal|defcalgrammar|delay|else|end|for|gate|gphase|if|in|include|inv|kernel|lengthof|let|measure|pow|reset|return|rotary|stretchinf|while)\b|#pragma\b/,
|
---|
| 16 | 'class-name':
|
---|
| 17 | /\b(?:angle|bit|bool|creg|fixed|float|int|length|qreg|qubit|stretch|uint)\b/,
|
---|
| 18 | function: /\b(?:cos|exp|ln|popcount|rotl|rotr|sin|sqrt|tan)\b(?=\s*\()/,
|
---|
| 19 | constant: /\b(?:euler|pi|tau)\b|π|𝜏|ℇ/,
|
---|
| 20 | number: {
|
---|
| 21 | pattern:
|
---|
| 22 | /(^|[^.\w$])(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?(?:dt|ns|us|µs|ms|s)?/i,
|
---|
| 23 | lookbehind: true
|
---|
| 24 | },
|
---|
| 25 | operator: /->|>>=?|<<=?|&&|\|\||\+\+|--|[!=<>&|~^+\-*/%]=?|@/,
|
---|
| 26 | punctuation: /[(){}\[\];,:.]/
|
---|
| 27 | }
|
---|
| 28 | Prism.languages.qasm = Prism.languages.openqasm
|
---|
| 29 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.