Pygments Tools for OpenQASM

This project contains Pygments lexers for OpenQASM 2, OpenQASM 3, and the pulse-calibration dialect OpenPulse. These will all register themselves with Pygments by suitable aliases (qasm2, qasm3 and openpulse, among others).

OpenQASM Lexers

This package contains lexers for both OpenQASM 2 and 3.

class openqasm_pygments.OpenQASM3Lexer(*args, **kwds)

A custom lexer for highlighting OpenQASM 3 code with Pygments.

This registers itself as the Pygments aliases qasm3 and openqasm3, and associates itself with filenames ending in .qasm.

class openqasm_pygments.OpenQASM2Lexer(*args, **kwds)

A custom lexer for highlighting OpenQASM 2 code with Pygments.

This registers itself with the Pygments aliases qasm2 and openqasm2, and associates itself with file names ending in .qasm.

Pulse Grammar Lexers for OpenQASM 3

There is currently a single lexer for pulse calibration.

class openqasm_pygments.OpenPulseLexer(*args, **kwds)

A Pygments lexer for the OpenPulse pulse-calibration dialect used with OpenQASM 3.

This registers itself with the Pygments alias openpulse.