#[non_exhaustive]pub enum Tok {
Show 40 variants
Add,
Minus,
Mult,
Div,
Pow,
LBracket,
RBracket,
LBrace,
RBrace,
LParent,
RParent,
Semi,
Comma,
Arrow,
Equal,
Sin,
Cos,
Tan,
Exp,
Ln,
Sqrt,
ConstPi,
U,
CX,
Opaque,
Gate,
Include,
QReg,
CReg,
Measure,
Reset,
Barrier,
If,
QASMHeader,
Version {
repr: String,
},
Id {
repr: String,
},
Int {
repr: String,
},
Real {
repr: String,
},
Str {
repr: String,
},
DocStr {
repr: String,
},
}
Expand description
Represent an OPENQASM language token.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Add
The addition operator +
.
Minus
The substraction operator -
.
Mult
The multiplication operator *
.
Div
The division operator /
.
Pow
The power operator ^
.
LBracket
The left square bracket [
.
RBracket
The right square bracket ]
.
LBrace
The left curly bracket {
.
RBrace
The right curly bracket }
.
LParent
The left parenthesis (
.
RParent
The right parenthesis )
.
Semi
A semicolon ;
.
Comma
A comma ,
.
Arrow
The arrow symbol ->
.
Equal
The equal symbol =
.
Sin
The sinus function id sin
.
Cos
The cosinus function id cos
.
Tan
The tangent function id tan
.
Exp
The exponential function id exp
.
Ln
The natural logarithm id ln
.
Sqrt
The square root function id sqrt
.
ConstPi
The const pi
.
U
The key-word U
.
CX
The key-word CX
.
Opaque
The key-word opaque
.
Gate
The key-word gate
.
Include
The key-word include
.
QReg
The key-word qreg
.
CReg
The key-word creg
.
Measure
The key-word measure
.
Reset
The key-word reset
.
Barrier
The key-word barrier
.
If
The key-word if
.
QASMHeader
The QASM header OPENQASM
.
Version
The version of OPENQASM as X.Y
.
Id
An identifier. Identifiers in OPENQASM must start with underscore or a lower-case letter and may be followed by alphanumeric character, either upper or lower case.
Int
An integer number.
Real
A real number.
Str
A string of unicode characters.
DocStr
Fields
repr: String
The string as it appears in the source code after stripping the
comment marks \\
and including new lines. For instance, consider
the following definition:
// The identity gate, matching the matrix:
// \[
// \mathbb{I} =
// \begin{bmatrix}
// 1 & & \\
// & \ddots & \\
// & & 1
// \end{bmatrix}
// \]
gate id q {}
The DocString
representation looks like:
The identity gate, matching the matrix:
\[
\mathbb{I} =
\begin{bmatrix}
1 & & \\
& \ddots & \\
& & 1
\end{bmatrix}
\]
Notice the space preceding each line.
A string representing the documentation of a gate.