react-openqasm-editor
Version:
A powerful, customizable code editor for OpenQASM (Open Quantum Assembly Language) based on Monaco Editor.
1,567 lines (1,517 loc) • 64 kB
text/typescript
// Generated from lib/antlr/openqasm.g4 by ANTLR 4.9.0-SNAPSHOT
// @ts-nocheck
import { ATN } from "antlr4ts/atn/ATN";
import { ATNDeserializer } from "antlr4ts/atn/ATNDeserializer";
import { FailedPredicateException } from "antlr4ts/FailedPredicateException";
import { NotNull } from "antlr4ts/Decorators";
import { NoViableAltException } from "antlr4ts/NoViableAltException";
import { Override } from "antlr4ts/Decorators";
import { Parser } from "antlr4ts/Parser";
import { ParserRuleContext } from "antlr4ts/ParserRuleContext";
import { ParserATNSimulator } from "antlr4ts/atn/ParserATNSimulator";
import { ParseTreeListener } from "antlr4ts/tree/ParseTreeListener";
import { ParseTreeVisitor } from "antlr4ts/tree/ParseTreeVisitor";
import { RecognitionException } from "antlr4ts/RecognitionException";
import { RuleContext } from "antlr4ts/RuleContext";
//import { RuleVersion } from "antlr4ts/RuleVersion";
import { TerminalNode } from "antlr4ts/tree/TerminalNode";
import { Token } from "antlr4ts/Token";
import { TokenStream } from "antlr4ts/TokenStream";
import { Vocabulary } from "antlr4ts/Vocabulary";
import { VocabularyImpl } from "antlr4ts/VocabularyImpl";
import * as Utils from "antlr4ts/misc/Utils";
import { openqasmListener } from "./openqasmListener";
import { openqasmVisitor } from "./openqasmVisitor";
export class openqasmParser extends Parser {
public static readonly T__0 = 1;
public static readonly T__1 = 2;
public static readonly T__2 = 3;
public static readonly T__3 = 4;
public static readonly T__4 = 5;
public static readonly T__5 = 6;
public static readonly T__6 = 7;
public static readonly T__7 = 8;
public static readonly T__8 = 9;
public static readonly T__9 = 10;
public static readonly T__10 = 11;
public static readonly T__11 = 12;
public static readonly T__12 = 13;
public static readonly T__13 = 14;
public static readonly T__14 = 15;
public static readonly T__15 = 16;
public static readonly T__16 = 17;
public static readonly T__17 = 18;
public static readonly T__18 = 19;
public static readonly T__19 = 20;
public static readonly T__20 = 21;
public static readonly T__21 = 22;
public static readonly T__22 = 23;
public static readonly T__23 = 24;
public static readonly T__24 = 25;
public static readonly T__25 = 26;
public static readonly T__26 = 27;
public static readonly T__27 = 28;
public static readonly T__28 = 29;
public static readonly T__29 = 30;
public static readonly T__30 = 31;
public static readonly T__31 = 32;
public static readonly T__32 = 33;
public static readonly T__33 = 34;
public static readonly STRING_LITERAL = 35;
public static readonly ID = 36;
public static readonly REAL = 37;
public static readonly INT = 38;
public static readonly WS = 39;
public static readonly COMMENT = 40;
public static readonly LINE_COMMENT = 41;
public static readonly RULE_mainprog = 0;
public static readonly RULE_includeStatement = 1;
public static readonly RULE_statement = 2;
public static readonly RULE_version = 3;
public static readonly RULE_decl = 4;
public static readonly RULE_gatedecl = 5;
public static readonly RULE_goplist = 6;
public static readonly RULE_qop = 7;
public static readonly RULE_uop = 8;
public static readonly RULE_anylist = 9;
public static readonly RULE_idlist = 10;
public static readonly RULE_mixedlist = 11;
public static readonly RULE_argument = 12;
public static readonly RULE_explist = 13;
public static readonly RULE_exp = 14;
public static readonly RULE_unaryop = 15;
// tslint:disable:no-trailing-whitespace
public static readonly ruleNames: string[] = [
"mainprog", "includeStatement", "statement", "version", "decl", "gatedecl",
"goplist", "qop", "uop", "anylist", "idlist", "mixedlist", "argument",
"explist", "exp", "unaryop",
];
private static readonly _LITERAL_NAMES: Array<string | undefined> = [
undefined, "'include'", "';'", "'}'", "'opaque'", "'('", "')'", "'if'",
"'=='", "'barrier'", "'OPENQASM'", "'qreg'", "'['", "']'", "'creg'", "'gate'",
"'{'", "'measure'", "'->'", "'reset'", "'U'", "'CX'", "','", "'pi'", "'+'",
"'-'", "'*'", "'/'", "'^'", "'sin'", "'cos'", "'tan'", "'exp'", "'ln'",
"'sqrt'",
];
private static readonly _SYMBOLIC_NAMES: Array<string | undefined> = [
undefined, undefined, undefined, undefined, undefined, undefined, undefined,
undefined, undefined, undefined, undefined, undefined, undefined, undefined,
undefined, undefined, undefined, undefined, undefined, undefined, undefined,
undefined, undefined, undefined, undefined, undefined, undefined, undefined,
undefined, undefined, undefined, undefined, undefined, undefined, undefined,
"STRING_LITERAL", "ID", "REAL", "INT", "WS", "COMMENT", "LINE_COMMENT",
];
public static readonly VOCABULARY: Vocabulary = new VocabularyImpl(openqasmParser._LITERAL_NAMES, openqasmParser._SYMBOLIC_NAMES, []);
// @Override
// @NotNull
public get vocabulary(): Vocabulary {
return openqasmParser.VOCABULARY;
}
// tslint:enable:no-trailing-whitespace
// @Override
public get grammarFileName(): string { return "openqasm.g4"; }
// @Override
public get ruleNames(): string[] { return openqasmParser.ruleNames; }
// @Override
public get serializedATN(): string { return openqasmParser._serializedATN; }
protected createFailedPredicateException(predicate?: string, message?: string): FailedPredicateException {
return new FailedPredicateException(this, predicate, message);
}
constructor(input: TokenStream) {
super(input);
this._interp = new ParserATNSimulator(openqasmParser._ATN, this);
}
// @RuleVersion(0)
public mainprog(): MainprogContext {
let _localctx: MainprogContext = new MainprogContext(this._ctx, this.state);
this.enterRule(_localctx, 0, openqasmParser.RULE_mainprog);
let _la: number;
try {
this.enterOuterAlt(_localctx, 1);
{
this.state = 32;
this.version();
this.state = 33;
this.includeStatement();
this.state = 37;
this._errHandler.sync(this);
_la = this._input.LA(1);
while ((((_la) & ~0x1F) === 0 && ((1 << _la) & ((1 << openqasmParser.T__3) | (1 << openqasmParser.T__6) | (1 << openqasmParser.T__8) | (1 << openqasmParser.T__10) | (1 << openqasmParser.T__13) | (1 << openqasmParser.T__14) | (1 << openqasmParser.T__16) | (1 << openqasmParser.T__18) | (1 << openqasmParser.T__19) | (1 << openqasmParser.T__20))) !== 0) || _la === openqasmParser.ID) {
{
{
this.state = 34;
this.statement();
}
}
this.state = 39;
this._errHandler.sync(this);
_la = this._input.LA(1);
}
}
}
catch (re) {
if (re instanceof RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
} else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
public includeStatement(): IncludeStatementContext {
let _localctx: IncludeStatementContext = new IncludeStatementContext(this._ctx, this.state);
this.enterRule(_localctx, 2, openqasmParser.RULE_includeStatement);
try {
this.enterOuterAlt(_localctx, 1);
{
this.state = 40;
this.match(openqasmParser.T__0);
this.state = 41;
this.match(openqasmParser.STRING_LITERAL);
this.state = 42;
this.match(openqasmParser.T__1);
}
}
catch (re) {
if (re instanceof RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
} else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
public statement(): StatementContext {
let _localctx: StatementContext = new StatementContext(this._ctx, this.state);
this.enterRule(_localctx, 4, openqasmParser.RULE_statement);
try {
this.state = 84;
this._errHandler.sync(this);
switch (this.interpreter.adaptivePredict(this._input, 1, this._ctx)) {
case 1:
this.enterOuterAlt(_localctx, 1);
{
this.state = 44;
this.decl();
}
break;
case 2:
this.enterOuterAlt(_localctx, 2);
{
this.state = 45;
this.gatedecl();
this.state = 46;
this.goplist();
this.state = 47;
this.match(openqasmParser.T__2);
}
break;
case 3:
this.enterOuterAlt(_localctx, 3);
{
this.state = 49;
this.gatedecl();
this.state = 50;
this.match(openqasmParser.T__2);
}
break;
case 4:
this.enterOuterAlt(_localctx, 4);
{
this.state = 52;
this.match(openqasmParser.T__3);
this.state = 53;
this.match(openqasmParser.ID);
this.state = 54;
this.idlist();
this.state = 55;
this.match(openqasmParser.T__1);
}
break;
case 5:
this.enterOuterAlt(_localctx, 5);
{
this.state = 57;
this.match(openqasmParser.T__3);
this.state = 58;
this.match(openqasmParser.ID);
this.state = 59;
this.match(openqasmParser.T__4);
this.state = 60;
this.match(openqasmParser.T__5);
this.state = 61;
this.idlist();
this.state = 62;
this.match(openqasmParser.T__1);
}
break;
case 6:
this.enterOuterAlt(_localctx, 6);
{
this.state = 64;
this.match(openqasmParser.T__3);
this.state = 65;
this.match(openqasmParser.ID);
this.state = 66;
this.match(openqasmParser.T__4);
this.state = 67;
this.idlist();
this.state = 68;
this.match(openqasmParser.T__5);
this.state = 69;
this.idlist();
this.state = 70;
this.match(openqasmParser.T__1);
}
break;
case 7:
this.enterOuterAlt(_localctx, 7);
{
this.state = 72;
this.qop();
}
break;
case 8:
this.enterOuterAlt(_localctx, 8);
{
this.state = 73;
this.match(openqasmParser.T__6);
this.state = 74;
this.match(openqasmParser.T__4);
this.state = 75;
this.match(openqasmParser.ID);
this.state = 76;
this.match(openqasmParser.T__7);
this.state = 77;
this.match(openqasmParser.INT);
this.state = 78;
this.match(openqasmParser.T__5);
this.state = 79;
this.qop();
}
break;
case 9:
this.enterOuterAlt(_localctx, 9);
{
this.state = 80;
this.match(openqasmParser.T__8);
this.state = 81;
this.anylist();
this.state = 82;
this.match(openqasmParser.T__1);
}
break;
}
}
catch (re) {
if (re instanceof RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
} else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
public version(): VersionContext {
let _localctx: VersionContext = new VersionContext(this._ctx, this.state);
this.enterRule(_localctx, 6, openqasmParser.RULE_version);
try {
this.enterOuterAlt(_localctx, 1);
{
this.state = 86;
this.match(openqasmParser.T__9);
this.state = 87;
this.match(openqasmParser.REAL);
this.state = 88;
this.match(openqasmParser.T__1);
}
}
catch (re) {
if (re instanceof RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
} else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
public decl(): DeclContext {
let _localctx: DeclContext = new DeclContext(this._ctx, this.state);
this.enterRule(_localctx, 8, openqasmParser.RULE_decl);
try {
this.state = 102;
this._errHandler.sync(this);
switch (this._input.LA(1)) {
case openqasmParser.T__10:
this.enterOuterAlt(_localctx, 1);
{
this.state = 90;
this.match(openqasmParser.T__10);
this.state = 91;
this.match(openqasmParser.ID);
this.state = 92;
this.match(openqasmParser.T__11);
this.state = 93;
this.match(openqasmParser.INT);
this.state = 94;
this.match(openqasmParser.T__12);
this.state = 95;
this.match(openqasmParser.T__1);
}
break;
case openqasmParser.T__13:
this.enterOuterAlt(_localctx, 2);
{
this.state = 96;
this.match(openqasmParser.T__13);
this.state = 97;
this.match(openqasmParser.ID);
this.state = 98;
this.match(openqasmParser.T__11);
this.state = 99;
this.match(openqasmParser.INT);
this.state = 100;
this.match(openqasmParser.T__12);
this.state = 101;
this.match(openqasmParser.T__1);
}
break;
default:
throw new NoViableAltException(this);
}
}
catch (re) {
if (re instanceof RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
} else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
public gatedecl(): GatedeclContext {
let _localctx: GatedeclContext = new GatedeclContext(this._ctx, this.state);
this.enterRule(_localctx, 10, openqasmParser.RULE_gatedecl);
try {
this.state = 124;
this._errHandler.sync(this);
switch (this.interpreter.adaptivePredict(this._input, 3, this._ctx)) {
case 1:
this.enterOuterAlt(_localctx, 1);
{
this.state = 104;
this.match(openqasmParser.T__14);
this.state = 105;
this.match(openqasmParser.ID);
this.state = 106;
this.idlist();
this.state = 107;
this.match(openqasmParser.T__15);
}
break;
case 2:
this.enterOuterAlt(_localctx, 2);
{
this.state = 109;
this.match(openqasmParser.T__14);
this.state = 110;
this.match(openqasmParser.ID);
this.state = 111;
this.match(openqasmParser.T__4);
this.state = 112;
this.match(openqasmParser.T__5);
this.state = 113;
this.idlist();
this.state = 114;
this.match(openqasmParser.T__15);
}
break;
case 3:
this.enterOuterAlt(_localctx, 3);
{
this.state = 116;
this.match(openqasmParser.T__14);
this.state = 117;
this.match(openqasmParser.ID);
this.state = 118;
this.match(openqasmParser.T__4);
this.state = 119;
this.idlist();
this.state = 120;
this.match(openqasmParser.T__5);
this.state = 121;
this.idlist();
this.state = 122;
this.match(openqasmParser.T__15);
}
break;
}
}
catch (re) {
if (re instanceof RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
} else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
public goplist(): GoplistContext {
let _localctx: GoplistContext = new GoplistContext(this._ctx, this.state);
this.enterRule(_localctx, 12, openqasmParser.RULE_goplist);
let _la: number;
try {
this.enterOuterAlt(_localctx, 1);
{
this.state = 131;
this._errHandler.sync(this);
_la = this._input.LA(1);
do {
{
this.state = 131;
this._errHandler.sync(this);
switch (this._input.LA(1)) {
case openqasmParser.T__19:
case openqasmParser.T__20:
case openqasmParser.ID:
{
this.state = 126;
this.uop();
}
break;
case openqasmParser.T__8:
{
this.state = 127;
this.match(openqasmParser.T__8);
this.state = 128;
this.idlist();
this.state = 129;
this.match(openqasmParser.T__1);
}
break;
default:
throw new NoViableAltException(this);
}
}
this.state = 133;
this._errHandler.sync(this);
_la = this._input.LA(1);
} while (((((_la - 9)) & ~0x1F) === 0 && ((1 << (_la - 9)) & ((1 << (openqasmParser.T__8 - 9)) | (1 << (openqasmParser.T__19 - 9)) | (1 << (openqasmParser.T__20 - 9)) | (1 << (openqasmParser.ID - 9)))) !== 0));
}
}
catch (re) {
if (re instanceof RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
} else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
public qop(): QopContext {
let _localctx: QopContext = new QopContext(this._ctx, this.state);
this.enterRule(_localctx, 14, openqasmParser.RULE_qop);
try {
this.state = 146;
this._errHandler.sync(this);
switch (this._input.LA(1)) {
case openqasmParser.T__19:
case openqasmParser.T__20:
case openqasmParser.ID:
this.enterOuterAlt(_localctx, 1);
{
this.state = 135;
this.uop();
}
break;
case openqasmParser.T__16:
this.enterOuterAlt(_localctx, 2);
{
this.state = 136;
this.match(openqasmParser.T__16);
this.state = 137;
this.argument();
this.state = 138;
this.match(openqasmParser.T__17);
this.state = 139;
this.argument();
this.state = 140;
this.match(openqasmParser.T__1);
}
break;
case openqasmParser.T__18:
this.enterOuterAlt(_localctx, 3);
{
this.state = 142;
this.match(openqasmParser.T__18);
this.state = 143;
this.argument();
this.state = 144;
this.match(openqasmParser.T__1);
}
break;
default:
throw new NoViableAltException(this);
}
}
catch (re) {
if (re instanceof RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
} else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
public uop(): UopContext {
let _localctx: UopContext = new UopContext(this._ctx, this.state);
this.enterRule(_localctx, 16, openqasmParser.RULE_uop);
try {
this.state = 178;
this._errHandler.sync(this);
switch (this.interpreter.adaptivePredict(this._input, 7, this._ctx)) {
case 1:
this.enterOuterAlt(_localctx, 1);
{
this.state = 148;
this.match(openqasmParser.T__19);
this.state = 149;
this.match(openqasmParser.T__4);
this.state = 150;
this.explist();
this.state = 151;
this.match(openqasmParser.T__5);
this.state = 152;
this.argument();
this.state = 153;
this.match(openqasmParser.T__1);
}
break;
case 2:
this.enterOuterAlt(_localctx, 2);
{
this.state = 155;
this.match(openqasmParser.T__20);
this.state = 156;
this.argument();
this.state = 157;
this.match(openqasmParser.T__21);
this.state = 158;
this.argument();
this.state = 159;
this.match(openqasmParser.T__1);
}
break;
case 3:
this.enterOuterAlt(_localctx, 3);
{
this.state = 161;
this.match(openqasmParser.ID);
this.state = 162;
this.anylist();
this.state = 163;
this.match(openqasmParser.T__1);
}
break;
case 4:
this.enterOuterAlt(_localctx, 4);
{
this.state = 165;
this.match(openqasmParser.ID);
this.state = 166;
this.match(openqasmParser.T__4);
this.state = 167;
this.match(openqasmParser.T__5);
this.state = 168;
this.anylist();
this.state = 169;
this.match(openqasmParser.T__1);
}
break;
case 5:
this.enterOuterAlt(_localctx, 5);
{
this.state = 171;
this.match(openqasmParser.ID);
this.state = 172;
this.match(openqasmParser.T__4);
this.state = 173;
this.explist();
this.state = 174;
this.match(openqasmParser.T__5);
this.state = 175;
this.anylist();
this.state = 176;
this.match(openqasmParser.T__1);
}
break;
}
}
catch (re) {
if (re instanceof RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
} else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
public anylist(): AnylistContext {
let _localctx: AnylistContext = new AnylistContext(this._ctx, this.state);
this.enterRule(_localctx, 18, openqasmParser.RULE_anylist);
try {
this.state = 182;
this._errHandler.sync(this);
switch (this.interpreter.adaptivePredict(this._input, 8, this._ctx)) {
case 1:
this.enterOuterAlt(_localctx, 1);
{
this.state = 180;
this.idlist();
}
break;
case 2:
this.enterOuterAlt(_localctx, 2);
{
this.state = 181;
this.mixedlist();
}
break;
}
}
catch (re) {
if (re instanceof RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
} else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
public idlist(): IdlistContext {
let _localctx: IdlistContext = new IdlistContext(this._ctx, this.state);
this.enterRule(_localctx, 20, openqasmParser.RULE_idlist);
try {
let _alt: number;
this.enterOuterAlt(_localctx, 1);
{
this.state = 188;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 9, this._ctx);
while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) {
if (_alt === 1) {
{
{
this.state = 184;
this.match(openqasmParser.ID);
this.state = 185;
this.match(openqasmParser.T__21);
}
}
}
this.state = 190;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 9, this._ctx);
}
this.state = 191;
this.match(openqasmParser.ID);
}
}
catch (re) {
if (re instanceof RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
} else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
public mixedlist(): MixedlistContext {
let _localctx: MixedlistContext = new MixedlistContext(this._ctx, this.state);
this.enterRule(_localctx, 22, openqasmParser.RULE_mixedlist);
try {
let _alt: number;
this.state = 236;
this._errHandler.sync(this);
switch (this.interpreter.adaptivePredict(this._input, 14, this._ctx)) {
case 1:
this.enterOuterAlt(_localctx, 1);
{
this.state = 200;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 10, this._ctx);
while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) {
if (_alt === 1) {
{
{
this.state = 193;
this.match(openqasmParser.ID);
this.state = 194;
this.match(openqasmParser.T__11);
this.state = 195;
this.match(openqasmParser.INT);
this.state = 196;
this.match(openqasmParser.T__12);
this.state = 197;
this.match(openqasmParser.T__21);
}
}
}
this.state = 202;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 10, this._ctx);
}
this.state = 203;
this.match(openqasmParser.ID);
}
break;
case 2:
this.enterOuterAlt(_localctx, 2);
{
this.state = 211;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 11, this._ctx);
while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) {
if (_alt === 1) {
{
{
this.state = 204;
this.match(openqasmParser.ID);
this.state = 205;
this.match(openqasmParser.T__11);
this.state = 206;
this.match(openqasmParser.INT);
this.state = 207;
this.match(openqasmParser.T__12);
this.state = 208;
this.match(openqasmParser.T__21);
}
}
}
this.state = 213;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 11, this._ctx);
}
this.state = 214;
this.match(openqasmParser.ID);
this.state = 215;
this.match(openqasmParser.T__11);
this.state = 216;
this.match(openqasmParser.INT);
this.state = 217;
this.match(openqasmParser.T__12);
}
break;
case 3:
this.enterOuterAlt(_localctx, 3);
{
this.state = 229;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 13, this._ctx);
while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) {
if (_alt === 1) {
{
{
this.state = 222;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 12, this._ctx);
while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) {
if (_alt === 1) {
{
{
this.state = 218;
this.match(openqasmParser.ID);
this.state = 219;
this.match(openqasmParser.T__21);
}
}
}
this.state = 224;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 12, this._ctx);
}
this.state = 225;
this.match(openqasmParser.ID);
this.state = 226;
this.match(openqasmParser.T__21);
}
}
}
this.state = 231;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 13, this._ctx);
}
this.state = 232;
this.match(openqasmParser.ID);
this.state = 233;
this.match(openqasmParser.T__11);
this.state = 234;
this.match(openqasmParser.INT);
this.state = 235;
this.match(openqasmParser.T__12);
}
break;
}
}
catch (re) {
if (re instanceof RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
} else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
public argument(): ArgumentContext {
let _localctx: ArgumentContext = new ArgumentContext(this._ctx, this.state);
this.enterRule(_localctx, 24, openqasmParser.RULE_argument);
try {
this.state = 243;
this._errHandler.sync(this);
switch (this.interpreter.adaptivePredict(this._input, 15, this._ctx)) {
case 1:
this.enterOuterAlt(_localctx, 1);
{
this.state = 238;
this.match(openqasmParser.ID);
}
break;
case 2:
this.enterOuterAlt(_localctx, 2);
{
this.state = 239;
this.match(openqasmParser.ID);
this.state = 240;
this.match(openqasmParser.T__11);
this.state = 241;
this.match(openqasmParser.INT);
this.state = 242;
this.match(openqasmParser.T__12);
}
break;
}
}
catch (re) {
if (re instanceof RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
} else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
public explist(): ExplistContext {
let _localctx: ExplistContext = new ExplistContext(this._ctx, this.state);
this.enterRule(_localctx, 26, openqasmParser.RULE_explist);
try {
let _alt: number;
this.enterOuterAlt(_localctx, 1);
{
this.state = 250;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 16, this._ctx);
while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) {
if (_alt === 1) {
{
{
this.state = 245;
this.exp(0);
this.state = 246;
this.match(openqasmParser.T__21);
}
}
}
this.state = 252;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 16, this._ctx);
}
this.state = 253;
this.exp(0);
}
}
catch (re) {
if (re instanceof RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
} else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
public exp(): ExpContext;
public exp(_p: number): ExpContext;
// @RuleVersion(0)
public exp(_p?: number): ExpContext {
if (_p === undefined) {
_p = 0;
}
let _parentctx: ParserRuleContext = this._ctx;
let _parentState: number = this.state;
let _localctx: ExpContext = new ExpContext(this._ctx, _parentState);
let _prevctx: ExpContext = _localctx;
let _startState: number = 28;
this.enterRecursionRule(_localctx, 28, openqasmParser.RULE_exp, _p);
try {
let _alt: number;
this.enterOuterAlt(_localctx, 1);
{
this.state = 271;
this._errHandler.sync(this);
switch (this._input.LA(1)) {
case openqasmParser.REAL:
{
this.state = 256;
this.match(openqasmParser.REAL);
}
break;
case openqasmParser.INT:
{
this.state = 257;
this.match(openqasmParser.INT);
}
break;
case openqasmParser.T__22:
{
this.state = 258;
this.match(openqasmParser.T__22);
}
break;
case openqasmParser.ID:
{
this.state = 259;
this.match(openqasmParser.ID);
}
break;
case openqasmParser.T__24:
{
this.state = 260;
this.match(openqasmParser.T__24);
this.state = 261;
this.exp(4);
}
break;
case openqasmParser.T__4:
{
this.state = 262;
this.match(openqasmParser.T__4);
this.state = 263;
this.exp(0);
this.state = 264;
this.match(openqasmParser.T__5);
}
break;
case openqasmParser.T__28:
case openqasmParser.T__29:
case openqasmParser.T__30:
case openqasmParser.T__31:
case openqasmParser.T__32:
case openqasmParser.T__33:
{
this.state = 266;
this.unaryop();
this.state = 267;
this.match(openqasmParser.T__4);
this.state = 268;
this.exp(0);
this.state = 269;
this.match(openqasmParser.T__5);
}
break;
default:
throw new NoViableAltException(this);
}
this._ctx._stop = this._input.tryLT(-1);
this.state = 290;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 19, this._ctx);
while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) {
if (_alt === 1) {
if (this._parseListeners != null) {
this.triggerExitRuleEvent();
}
_prevctx = _localctx;
{
this.state = 288;
this._errHandler.sync(this);
switch (this.interpreter.adaptivePredict(this._input, 18, this._ctx)) {
case 1:
{
_localctx = new ExpContext(_parentctx, _parentState);
this.pushNewRecursionContext(_localctx, _startState, openqasmParser.RULE_exp);
this.state = 273;
if (!(this.precpred(this._ctx, 8))) {
throw this.createFailedPredicateException("this.precpred(this._ctx, 8)");
}
this.state = 274;
this.match(openqasmParser.T__23);
this.state = 275;
this.exp(9);
}
break;
case 2:
{
_localctx = new ExpContext(_parentctx, _parentState);
this.pushNewRecursionContext(_localctx, _startState, openqasmParser.RULE_exp);
this.state = 276;
if (!(this.precpred(this._ctx, 7))) {
throw this.createFailedPredicateException("this.precpred(this._ctx, 7)");
}
this.state = 277;
this.match(openqasmParser.T__24);
this.state = 278;
this.exp(8);
}
break;
case 3:
{
_localctx = new ExpContext(_parentctx, _parentState);
this.pushNewRecursionContext(_localctx, _startState, openqasmParser.RULE_exp);
this.state = 279;
if (!(this.precpred(this._ctx, 6))) {
throw this.createFailedPredicateException("this.precpred(this._ctx, 6)");
}
this.state = 280;
this.match(openqasmParser.T__25);
this.state = 281;
this.exp(7);
}
break;
case 4:
{
_localctx = new ExpContext(_parentctx, _parentState);
this.pushNewRecursionContext(_localctx, _startState, openqasmParser.RULE_exp);
this.state = 282;
if (!(this.precpred(this._ctx, 5))) {
throw this.createFailedPredicateException("this.precpred(this._ctx, 5)");
}
this.state = 283;
this.match(openqasmParser.T__26);
this.state = 284;
this.exp(6);
}
break;
case 5:
{
_localctx = new ExpContext(_parentctx, _parentState);
this.pushNewRecursionContext(_localctx, _startState, openqasmParser.RULE_exp);
this.state = 285;
if (!(this.precpred(this._ctx, 3))) {
throw this.createFailedPredicateException("this.precpred(this._ctx, 3)");
}
this.state = 286;
this.match(openqasmParser.T__27);
this.state = 287;
this.exp(4);
}
break;
}
}
}
this.state = 292;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 19, this._ctx);
}
}
}
catch (re) {
if (re instanceof RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
} else {
throw re;
}
}
finally {
this.unrollRecursionContexts(_parentctx);
}
return _localctx;
}
// @RuleVersion(0)
public unaryop(): UnaryopContext {
let _localctx: UnaryopContext = new UnaryopContext(this._ctx, this.state);
this.enterRule(_localctx, 30, openqasmParser.RULE_unaryop);
let _la: number;
try {
this.enterOuterAlt(_localctx, 1);
{
this.state = 293;
_la = this._input.LA(1);
if (!(((((_la - 29)) & ~0x1F) === 0 && ((1 << (_la - 29)) & ((1 << (openqasmParser.T__28 - 29)) | (1 << (openqasmParser.T__29 - 29)) | (1 << (openqasmParser.T__30 - 29)) | (1 << (openqasmParser.T__31 - 29)) | (1 << (openqasmParser.T__32 - 29)) | (1 << (openqasmParser.T__33 - 29)))) !== 0))) {
this._errHandler.recoverInline(this);
} else {
if (this._input.LA(1) === Token.EOF) {
this.matchedEOF = true;
}
this._errHandler.reportMatch(this);
this.consume();
}
}
}
catch (re) {
if (re instanceof RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
} else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
public sempred(_localctx: RuleContext, ruleIndex: number, predIndex: number): boolean {
switch (ruleIndex) {
case 14:
return this.exp_sempred(_localctx as ExpContext, predIndex);
}
return true;
}
private exp_sempred(_localctx: ExpContext, predIndex: number): boolean {
switch (predIndex) {
case 0:
return this.precpred(this._ctx, 8);
case 1:
return this.precpred(this._ctx, 7);
case 2:
return this.precpred(this._ctx, 6);
case 3:
return this.precpred(this._ctx, 5);
case 4:
return this.precpred(this._ctx, 3);
}
return true;
}
public static readonly _serializedATN: string =
"\x03\uC91D\uCABA\u058D\uAFBA\u4F53\u0607\uEA8B\uC241\x03+\u012A\x04\x02" +
"\t\x02\x04\x03\t\x03\x04\x04\t\x04\x04\x05\t\x05\x04\x06\t\x06\x04\x07" +
"\t\x07\x04\b\t\b\x04\t\t\t\x04\n\t\n\x04\v\t\v\x04\f\t\f\x04\r\t\r\x04" +
"\x0E\t\x0E\x04\x0F\t\x0F\x04\x10\t\x10\x04\x11\t\x11\x03\x02\x03\x02\x03" +
"\x02\x07\x02&\n\x02\f\x02\x0E\x02)\v\x02\x03\x03\x03\x03\x03\x03\x03\x03" +
"\x03\x04\x03\x04\x03\x04\x03\x04\x03\x04\x03\x04\x03\x04\x03\x04\x03\x04" +
"\x03\x04\x03\x04\x03\x04\x03\x04\x03\x04\x03\x04\x03\x04\x03\x04\x03\x04" +
"\x03\x04\x03\x04\x03\x04\x03\x04\x03\x04\x03\x04\x03\x04\x03\x04\x03\x04" +
"\x03\x04\x03\x04\x03\x04\x03\x04\x03\x04\x03\x04\x03\x04\x03\x04\x03\x04" +
"\x03\x04\x03\x04\x03\x04\x03\x04\x05\x04W\n\x04\x03\x05\x03\x05\x03\x05" +
"\x03\x05\x03\x06\x03\x06\x03\x06\x03\x06\x03\x06\x03\x06\x03\x06\x03\x06" +
"\x03\x06\x03\x06\x03\x06\x03\x06\x05\x06i\n\x06\x03\x07\x03\x07\x03\x07" +
"\x03\x07\x03\x07\x03\x07\x03\x07\x03\x07\x03\x07\x03\x07\x03\x07\x03\x07" +
"\x03\x07\x03\x07\x03\x07\x03\x07\x03\x07\x03\x07\x03\x07\x03\x07\x05\x07" +
"\x7F\n\x07\x03\b\x03\b\x03\b\x03\b\x03\b\x06\b\x86\n\b\r\b\x0E\b\x87\x03" +
"\t\x03\t\x03\t\x03\t\x03\t\x03\t\x03\t\x03\t\x03\t\x03\t\x03\t\x05\t\x95" +
"\n\t\x03\n\x03\n\x03\n\x03\n\x03\n\x03\n\x03\n\x03\n\x03\n\x03\n\x03\n" +
"\x03\n\x03\n\x03\n\x03\n\x03\n\x03\n\x03\n\x03\n\x03\n\x03\n\x03\n\x03" +
"\n\x03\n\x03\n\x03\n\x03\n\x03\n\x03\n\x03\n\x05\n\xB5\n\n\x03\v\x03\v" +
"\x05\v\xB9\n\v\x03\f\x03\f\x07\f\xBD\n\f\f\f\x0E\f\xC0\v\f\x03\f\x03\f" +
"\x03\r\x03\r\x03\r\x03\r\x03\r\x07\r\xC9\n\r\f\r\x0E\r\xCC\v\r\x03\r\x03" +
"\r\x03\r\x03\r\x03\r\x03\r\x07\r\xD4\n\r\f\r\x0E\r\xD7\v\r\x03\r\x03\r" +
"\x03\r\x03\r\x03\r\x03\r\x07\r\xDF\n\r\f\r\x0E\r\xE2\v\r\x03\r\x03\r\x07" +
"\r\xE6\n\r\f\r\x0E\r\xE9\v\r\x03\r\x03\r\x03\r\x03\r\x05\r\xEF\n\r\x03" +
"\x0E\x03\x0E\x03\x0E\x03\x0E\x03\x0E\x05\x0E\xF6\n\x0E\x03\x0F\x03\x0F" +
"\x03\x0F\x07\x0F\xFB\n\x0F\f\x0F\x0E\x0F\xFE\v\x0F\x03\x0F\x03\x0F\x03" +
"\x10\x03\x10\x03\x10\x03\x10\x03\x10\x03\x10\x03\x10\x03\x10\x03\x10\x03" +
"\x10\x03\x10\x03\x10\x03\x10\x03\x10\x03\x10\x03\x10\x05\x10\u0112\n\x10" +
"\x03\x10\x03\x10\x03\x10\x03\x10\x03\x10\x03\x10\x03\x10\x03\x10\x03\x10" +
"\x03\x10\x03\x10\x03\x10\x03\x10\x03\x10\x03\x10\x07\x10\u0123\n\x10\f" +
"\x10\x0E\x10\u0126\v\x10\x03\x11\x03\x11\x03\x11\x02\x02\x03\x1E\x12\x02" +
"\x02\x04\x02\x06\x02\b\x02\n\x02\f\x02\x0E\x02\x10\x02\x12\x02\x14\x02" +
"\x16\x02\x18\x02\x1A\x02\x1C\x02\x1E\x02 \x02\x02\x03\x03\x02\x1F$\x02" +
"\u0142\x02\"\x03\x02\x02\x02\x04*\x03\x02\x02\x02\x06V\x03\x02\x02\x02" +
"\bX\x03\x02\x02\x02\nh\x03\x02\x02\x02\f~\x03\x02\x02\x02\x0E\x85\x03" +
"\x02\x02\x02\x10\x94\x03\x02\x02\x02\x12\xB4\x03\x02\x02\x02\x14\xB8\x03" +
"\x02\x02\x02\x16\xBE\x03\x02\x02\x02\x18\xEE\x03\x02\x02\x02\x1A\xF5\x03" +
"\x02\x02\x02\x1C\xFC\x03\x02\x02\x02\x1E\u0111\x03\x02\x02\x02 \u0127" +
"\x03\x02\x02\x02\"#\x05\b\x05\x02#\'\x05\x04\x03\x02$&\x05\x06\x04\x02" +
"%$\x03\x02\x02\x02&)\x03\x02\x02\x02\'%\x03\x02\x02\x02\'(\x03\x02\x02" +
"\x02(\x03\x03\x02\x02\x02)\'\x03\x02\x02\x02*+\x07\x03\x02\x02+,\x07%" +
"\x02\x02,-\x07\x04\x02\x02-\x05\x03\x02\x02\x02.W\x05\n\x06\x02/0\x05" +
"\f\x07\x0201\x05\x0E\b\x0212\x07\x05\x02\x022W\x03\x02\x02\x0234\x05\f" +
"\x07\x0245\x07\x05\x02\x025W\x03\x02\x02\x0267\x07\x06\x02\x0278\x07&" +
"\x02\x0289\x05\x16\f\x029:\x07\x04\x02\x02:W\x03\x02\x02\x02;<\x07\x06" +
"\x02\x02<=\x07&\x02\x02=>\x07\x07\x02\x02>?\x07\b\x02\x02?@\x05\x16\f" +
"\x02@A\x07\x04\x02\x02AW\x03\x02\x02\x02BC\x07\x06\x02\x02CD\x07&\x02" +
"\x02DE\x07\x07\x02\x02EF\x05\x16\f\x02FG\x07\b\x02\x02GH\x05\x16\f\x02" +
"HI\x07\x04\x02\x02IW\x03\x02\x02\x02JW\x05\x10\t\x02KL\x07\t\x02\x02L" +
"M\x07\x07\x02\x02MN\x07&\x02\x02NO\x07\n\x02\x02OP\x07(\x02\x02PQ\x07" +
"\b\x02\x02QW\x05\x10\t\x02RS\x07\v\x02\x02ST\x05\x14\v\x02TU\x07\x04\x02" +
"\x02UW\x03\x02\x02\x02V.\x03\x02\x02\x02V/\x03\x02\x02\x02V3\x03\x02\x02" +
"\x02V6\x03\x02\x02\x02V;\x03\x02\x02\x02VB\x03\x02\x02\x02VJ\x03\x02\x02" +
"\x02VK\x03\x02\x02\x02VR\x03\x02\x02\x02W\x07\x03\x02\x02\x02XY\x07\f" +
"\x02\x02YZ\x07\'\x02\x02Z[\x07\x04\x02\x02[\t\x03\x02\x02\x02\\]\x07\r" +
"\x02\x02]^\x07&\x02\x02^_\x07\x0E\x02\x02_`\x07(\x02\x02`a\x07\x0F\x02" +
"\x02ai\x07\x04\x02\x02bc\x07\x10\x02\x02cd\x07&\x02\x02de\x07\x0E\x02" +
"\x02ef\x07(\x02\x02fg\x07\x0F\x02\x02gi\x07\x04\x02\x02h\\\x03\x02\x02" +
"\x02hb\x03\x02\x02\x02i\v\x03\x02\x02\x02jk\x07\x11\x02\x02kl\x07&\x02" +
"\x02lm\x05\x16\f\x02mn\x07\x12\x02\x02n\x7F\x03\x02\x02\x02op\x07\x11" +
"\x02\x02pq\x07&\x02\x02qr\x07\x07\x02\x02rs\x07\b\x02\x02st\x05\x16\f" +
"\x02tu\x07\x12\x02\x02u\x7F\x03\x02\x02\x02vw\x07\x11\x02\x02wx\x07&\x02" +
"\x02xy\x07\x07\x02\x02yz\x05\x16\f\x02z{\x07\b\x02\x02{|\x05\x16\f\x02" +
"|}\x07\x12\x02\x02}\x7F\x03\x02\x02\x02~j\x03\x02\x02\x02~o\x03\x02\x02" +
"\x02~v\x03\x02\x02\x02\x7F\r\x03\x02\x02\x02\x80\x86\x05\x12\n\x02\x81" +
"\x82\x07\v\x02\x02\x82\x83\x05\x16\f\x02\x83\x84\x07\x04\x02\x02\x84\x86" +
"\x03\x02\x02\x02\x85\x80\x03\x02\x02\x02\x85\x81\x03\x02\x02\x02\x86\x87" +
"\x03\x02\x02\x02\x87\x85\x03\x02\x02\x02\x87\x88\x03\x02\x02\x02\x88\x0F" +
"\x03\x02\x02\x02\x89\x95\x05\x12\n\x02\x8A\x8B\x07\x13\x02\x02\x8B\x8C" +
"\x05\x1A\x0E\x02\x8C\x8D\x07\x14\x02\x02\x8D\x8E\x05\x1A\x0E\x02\x8E\x8F" +
"\x07\x04\x02\x02\x8F\x95\x03\x02\x02\x02\x90\x91\x07\x15\x02\x02\x91\x92" +
"\x05\x1A\x0E\x02\x92\x93\x07\x04\x02\x02\x93\x95\x03\x02\x02\x02\x94\x89" +
"\x03\x02\x02\x02\x94\x8A\x03\x02\x02\x02\x94\x90\x03\x02\x02\x02\x95\x11" +
"\x03\x02\x02\x02\x96\x97\x07\x16\x02\x02\x97\x98\x07\x07\x02\x02\x98\x99" +
"\x05\x1C\x0F\x02\x99\x9A\x07\b\x02\x02\x9A\x9B\x05\x1A\x0E\x02\x9B\x9C" +
"\x07\x04\x02\x02\x9C\xB5\x03\x02\x02\x02\x9D\x9E\x07\x17\x02\x02\x9E\x9F" +
"\x05\x1A\x0E\x02\x9F\xA0\x07\x18\x02\x02\xA0\xA1\x05\x1A\x0E\x02\xA1\xA2" +
"\x07\x04\x02\x02\xA2\xB5\x03\x02\x02\x02\xA3\xA4\x07&\x02\x02\xA4\xA5" +
"\x05\x14\v\x02\xA5\xA6\x07\x04\x02\x02\xA6\xB5\x03\x02\x02\x02\xA7\xA8" +
"\x07&\x02\x02\xA8\xA9\x07\x07\x02\x02\xA9\xAA\x07\b\x02\x02\xAA\xAB\x05" +
"\x14\v\x02\xAB\xAC\x07\x04\x02\x02\xAC\xB5\x03\x02\x02\x02\xAD\xAE\x07" +
"&\x02\x02\xAE\xAF\x07\x07\x02\x02\xAF\xB0\x05\x1C\x0F\x02\xB0\xB1\x07" +
"\b\x02\x02\xB1\xB2\x05\x14\v\x02\xB2\xB3\x07\x04\x02\x02\xB3\xB5\x03\x02" +
"\x02\x02\xB4\x96\x03\x02\x02\x02\xB4\x9D\x03\x02\x02\x02\xB4\xA3\x03\x02" +
"\x02\x02\xB4\xA7\x03\x02\x02\x02\xB4\xAD\x03\x02\x02\x02\xB5\x13\x03\x02" +
"\x02\x02\xB6\xB9\x05\x16\f\x02\xB7\xB9\x05\x18\r\x02\xB8\xB6\x03\x02\x02" +
"\x02\xB8\xB7\x03\x02\x02\x02\xB9\x15\x03\x02\x02\x02\xBA\xBB\x07&\x02" +
"\x02\xBB\xBD\x07\x18\x02\x02\xBC\xBA\x03\x02\x02\x02\xBD\xC0\x03\x02\x02" +
"\x02\xBE\xBC\x03\x02\x02\x02\xBE\xBF\x03\x02\x02\x02\xBF\xC1\x03\x02\x02" +
"\x02\xC0\xBE\x03\x02\x02\x02\xC1\xC2\x07&\x02\x02\xC2\x17\x03\x02\x02" +
"\x02\xC3\xC4\x07&\x02\x02\xC4\xC5\x07\x0E\x02\x02\xC5\xC6\x07(\x02\x02" +
"\xC6\xC7\x07\x0F\x02\x02\xC7\xC9\x07\x18\x02\x02\xC8\xC3\x03\x02\x02\x02" +
"\xC9\xCC\x03\x02\x02\x02\xCA\xC8\x03\x02\x02\x02\xCA\xCB\x03\x02\x02\x02" +
"\xCB\xCD\x03\x02\x02\x02\xCC\xCA\x03\x02\x02\x02\xCD\xEF\x07&\x02\x02" +
"\xCE\xCF\x07&\x02\x02\xCF\xD0\x07\x0E\x02\x02\xD0\xD1\x07(\x02\x02\xD1" +
"\xD2\x07\x0F\x02\x02\xD2\xD4\x07\x18\x02\x02\xD3\xCE\x03\x02\x02\x02\xD4" +
"\xD7\x03\x02\x02\x02\xD5\xD3\x03\x02\x02\x02\xD5\xD6\x03\x02\x02\x02\xD6" +
"\xD8\x03\x02\x02\x02\xD7\xD5\x03\x02\x02\x02\xD8\xD9\x07&\x02\x02\xD9" +
"\xDA\x07\x0E\x02\x02\xDA\xDB\x07(\x02\x02\xDB\xEF\x07\x0F\x02\x02\xDC" +
"\xDD\x07&\x02\x02\xDD\xDF\x07\x18\x02\x02\xDE\xDC\x03\x02\x02\x02\xDF" +
"\xE2\x03\x02\x02\x02\xE0\xDE\x03\x02\x02\x02\xE0\xE1\x03\x02\x02\x02\xE1" +
"\xE3\x03\x02\x02\x02\xE2\xE0\x03\x02\x02\x02\xE3\xE4\x07&\x02\x02\xE4" +
"\xE6\x07\x18\x02\x02\xE5\xE0\x03\x02\x02\x02\xE6\xE9\x03\x02\x02\x02\xE7" +
"\xE5\x03\x02\x02\x02\xE7\xE8\x03\x02\x02\x02\xE8\xEA\x03\x02\x02\x02\xE9" +
"\xE7\x03\x02\x02\x02\xEA\xEB\x07&\x02\x02\xEB\xEC\x07\x0E\x02\x02\xEC" +
"\xED\x07(\x02\x02\xED\xEF\x07\x0F\x02\x02\xEE\xCA\x03\x02\x02\x02\xEE" +
"\xD5\x03\x02\x02\x02\xEE\xE7\x03\x02\x02\x02\xEF\x19\x03\x02\x02\x02\xF0" +
"\xF6\x07&\x02\x02\xF1\xF2\x07&\x02\x02\xF2\xF3\x07\x0E\x02\x02\xF3\xF4" +
"\x07(\x02\x02\xF4\xF6\x07\x0F\x02\x02\xF5\xF0\x03\x02\x02\x02\xF5\xF1" +
"\x03\x02\x02\x02\xF6\x1B\x03\x02\x02\x02\xF7\xF8\x05\x1E\x10\x02\xF8\xF9" +
"\x07\x18\x02\x02\xF9\xFB\x03\x02\x02\x02\xFA\xF7\x03\x02\x02\x02\xFB\xFE" +
"\x03\x02\x02\x02\xFC\xFA\x03\x02\x02\x02\xFC\xFD\x03\x02\x02\x02\xFD\xFF" +
"\x03\x02\x02\x02\xFE\xFC\x03\x02\x02\x02\xFF\u0100\x05\x1E\x10\x02\u0100" +
"\x1D\x03\x02\x02\x02\u0101\u0102\b\x10\x01\x02\u0102\u0112\x07\'\x02\x02" +
"\u0103\u0112\x07(\x02\x02\u0104\u0112\x07\x19\x02\x02\u0105\u0112\x07" +
"&\x02\x02\u0106\u0107\x07\x1B\x02\x02\u0107\u0112\x05\x1E\x10\x06\u0108" +
"\u0109\x07\x07\x02\x02\u0109\u010A\x05\x1E\x10\x02\u010A\u010B\x07\b\x02" +
"\x02\u010B\u0112\x03\x02\x02\x02\u010C\u010D\x05 \x11\x02\u010D\u010E" +
"\x07\x07\x02\x02\u010E\u010F\x05\x1E\x10\x02\u010F\u0110\x07\b\x02\x02" +
"\u0110\u0112\x03\x02\x02\x02\u0111\u0101\x03\x02\x02\x02\u0111\u0103\x03" +
"\x02\x02\x02\u0111\u0104\x03\x02\x02\x02\u0111\u0105\x03\x02\x02\x02\u0111" +
"\u0106\x03\x02\x02\x02\u0111\u0108\x03\x02\x02\x02\u0111\u010C\x03\x02" +
"\x02\x02\u0112\u0124\x03\x02\x02\x02\u0113\u0114\f\n\x02\x02\u0114\u0115" +
"\x07\x1A\x02\x02\u0115\u0123\x05\x1E\x10\v\u0116\u0117\f\t\x02\x02\u0117" +
"\u0118\x07\x1B\x02\x02\u0118\u0123\x05\x1E\x10\n\u0119\u011A\f\b\x02\x02" +
"\u011A\u011B\x07\x1C\x02\x02\u011B\u0123\x05\x1E\x10\t\u011C\u011D\f\x07" +
"\x02\x02\u011D\u011E\x07\x1D\x02\x02\u011E\u0123\x05\x1E\x10\b\u011F\u0120" +
"\f\x05\x02\x02\u0120\u0121\x07\x1E\x02\x02\u0121\u0123\x05\x1E\x10\x06" +
"\u0122\u0113\x03\x02\x02\x02\u0122\u0116\x03\x02\x02\x02\u0122\u0119\x03" +
"\x02\x02\x02\u0122\u011C\x03\x02\x02\x02\u0122\u011F\x03\x02\x02\x02\u0123" +
"\u0126\x03\x02\x02\x02\u0124\u0122\x03\x02\x02\x02\u0124\u0125\x03\x02" +
"\x02\x02\u0125\x1F\x03\x02\x02\x02\u0126\u0124\x03\x02\x02\x02\u0127\u0128" +
"\t\x02\x02\x02\u0128!\x03\x02\x02\x02\x16\'Vh~\x85\x87\x94\xB4\xB8\xBE" +
"\xCA\xD5\xE0\xE7\xEE\xF5\xFC\u0111\u0122\u0124";
public static __ATN: ATN;
public static get _ATN(): ATN {
if (!openqasmParser.__ATN) {
openqasmParser.__ATN = new ATNDeserializer().deserialize(Utils.toCharArray(openqasmParser._serializedATN));
}
return openqasmParser.__ATN;
}
}
export class MainprogContext extends ParserRuleContext {
public version(): VersionContext {
return this.getRuleContext(0, VersionContext);
}
public includeStatement(): IncludeStatementContext {
return this.getRuleContext(0, IncludeStatementContext);
}
public statement(): StatementContext[];
public statement(i: number): StatementContext;
public statement(i?: number): StatementContext | StatementContext[] {
if (i === undefined) {
return this.getRuleContexts(StatementContext);
} else {
return this.getRuleContext(i, StatementContext);
}
}
constructor(parent: ParserRuleContext | undefined, invokingState: number) {
super(parent, invokingState);
}
// @Override
public get ruleIndex(): number { return openqasmParser.RULE_mainprog; }
// @Override
public enterRule(listener: openqasmListener): void {
if (listener.enterMainprog) {
listener.enterMainprog(this);
}
}
// @Override
public exitRule(listener: openqasmListener): void {
if (listener.exitMainprog) {
listener.exitMainprog(this);
}
}
// @Override
public accept<Result>(visitor: openqasmVisitor<Result>): Result {
if (visitor.visitMainprog) {
return visitor.visitMainprog(this);
} else {
return visitor.visitChildren(this);
}
}
}
export class IncludeStatementContext extends ParserRuleContext {
public STRING_LITERAL(): TerminalNode { return this.getToken(openqasmParser.STRING_LITERAL, 0); }
constructor(parent: ParserRuleContext | undefined, invokingState: number) {
super(parent, invokingState);
}
// @Override
public get ruleIndex(): number { return openqasmParser.RULE_includeStatement; }
// @Override
public enterRule(listener: openqasmListener): void {
if (listener.enterIncludeStatement) {
listener.enterIncludeStatement(this);
}
}
// @Override
public exitRule(listener: openqasmListener): void {
if (listener.exitIncludeStatement) {
listener.exitIncludeStatement(this);
}
}
// @Override
public accept<Result>(visitor: openqasmVisitor<Result>): Result {
if (visitor.visitIncludeStatement) {
return visitor.visitIncludeStatement(this);
} else {
return visitor.visitChildren(this);
}
}
}
export class StatementContext extends ParserRuleContext {
public decl(): DeclContext | undefined {
return this.tryGetRuleContext(0, DeclContext);
}
public gatedecl(): GatedeclContext | undefined {
return this.tryGetRuleContext(0, GatedeclContext);
}
public goplist(): GoplistContext | undefined {
return this.tryGetRuleContext(0, GoplistContext);
}
public ID(): TerminalNode | undefined { return this.tryGetToken(openqasmParser.ID, 0); }
public idlist(): IdlistContext[];
public idlist(i: number): IdlistContext;
public idlist(i?: number): IdlistContext | IdlistContext[] {
if (i === undefined) {
return this.getRuleContexts(IdlistContext);
} else {
return this.getRuleContext(i, IdlistContext);
}
}
public qop(): QopContext | undefined {
return this.tryGetRuleContext(0, QopContext);
}
public INT(): TerminalNode | undefined { return this.tryGetToken(openqasmParser.INT, 0); }
public anylist(): AnylistContext | undefined {
return this.tryGetRuleContext(0, AnylistContext);
}
constructor(parent: ParserRuleContext | undefined, invokingState: number) {
super(parent, invokingState);
}
// @Override
public get ruleIndex(): number { return openqasmParser.RULE_statement; }
// @Override
public enterRule(listener: openqasmListener): void {
if (