qasm-ts - v2.0.0
    Preparing search index...

    Function lookup

    • Returns the token type that corresponds to a given string.

      This function is used by the lexer to classify identifiers and keywords. If the string is a reserved keyword, it returns the appropriate token type. Otherwise, it returns Token.Id to indicate a user-defined identifier.

      Parameters

      • ident: string

        The string to look up

      Returns Token

      The corresponding token type

      lookup('qubit');     // Returns Token.Qubit
      lookup('measure'); // Returns Token.Measure
      lookup('myVar'); // Returns Token.Id
      lookup('π'); // Returns Token.Pi