source: node_modules/refractor/lang/openqasm.js@ d24f17c

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
Line 
1'use strict'
2
3module.exports = openqasm
4openqasm.displayName = 'openqasm'
5openqasm.aliases = ['qasm']
6function 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.