/** * OpenQASM 2.0 Token Definitions and Utilities * * This module defines the token types used in OpenQASM 2.0 syntax. OpenQASM 2.0 * has a simpler token set compared to 3.0, focusing on basic quantum operations * and classical registers without advanced control flow or data types. * * Key differences from OpenQASM 3.0: * - Limited to `qreg` and `creg` declarations (no advanced types) * - No control flow tokens (if/else/for/while) * - No subroutine or function definitions * - Simpler expression and operator support * * @module * * @example OpenQASM 2.0 token usage * ```typescript * import { lookup, Token } from './qasm2/token'; * * console.log(lookup('qreg')); // Token.QReg * console.log(lookup('barrier')); // Token.Barrier * console.log(lookup('measure')); // Token.Measure * ``` */ /** * Enumeration of OpenQASM 2.0 token types. * * This simplified token set reflects OpenQASM 2.0's focus on basic quantum * circuit description without the advanced features of version 3.0. */ declare enum Token { Illegal = 0, EndOfFile = 1, Real = 2, NNInteger = 3, Id = 4, OpenQASM = 5, Semicolon = 6, Comma = 7, LParen = 8, LSParen = 9, LCParen = 10, RParen = 11, RSParen = 12, RCParen = 13, Arrow = 14, Equals = 15, Plus = 16, Minus = 17, Times = 18, Divide = 19, Power = 20, Sin = 21, Cos = 22, Tan = 23, Exp = 24, Ln = 25, Sqrt = 26, Pi = 27, QReg = 28, CReg = 29, Barrier = 30, Gate = 31, Measure = 32, Reset = 33, Include = 34, If = 35, String = 36, Opaque = 37 } /** * Returns the token that represents a given string. * @param ident - The string. * @return The corresponding token. */ declare function lookup(ident: string): Token; /** * Returns the string representation of a token. * @param tokens - The token. * @return The string representation of the token. */ declare function inverseLookup(token: Token): string; /** * Determines whether a token denotes a parameter. * @param tokens - The token. * @return Whether the token does NOT denote a parameter. */ declare function notParam(token: Token): boolean; export { Token, notParam, lookup, inverseLookup };