
    z	iK                       S r SSKJr  SSKrSSKJrJrJrJrJ	r	J
r
   " S S5      r " S S\5      r " S	 S
\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\\R,                  5      r " S S\5      r " S S \5      r " S! S"\5      r " S# S$\5      r " S% S&\5      r " S' S(\5      r " S) S*\5      r " S+ S,\5      r " S- S.\5      r  " S/ S0\5      r! " S1 S2\!5      r" " S3 S4\\R,                  5      r# " S5 S6\5      r$ " S7 S8\5      r% " S9 S:\5      r& " S; S<\5      r' " S= S>\R,                  5      r( " S? S@\5      r) " SA SB\5      r* " SC SD\5      r+ " SE SF\5      r, " SG SH\5      r- " SI SJ\5      r. " SK SL\5      r/ " SM SN\5      r0 " SO SP\5      r1 " SQ SR\5      r2 " SS ST\5      r3 " SU SV\5      r4 " SW SX\5      r5 " SY SZ\5      r6 " S[ S\\R,                  5      r7 " S] S^\5      r8 " S_ S`\5      r9 " Sa Sb\5      r: " Sc Sd\5      r; " Se Sf\5      r< " Sg Sh\5      r= " Si Sj\5      r> " Sk Sl\5      r? " Sm Sn\>5      r@ " So Sp\>5      rA " Sq Sr\5      rB " Ss St\5      rC " Su Sv\5      rD " Sw Sx\5      rE " Sy Sz\5      rF " S{ S|\5      rG " S} S~\5      rH " S S\5      rI " S S\5      rJ " S S\5      rK " S S\R,                  5      rL " S S\25      rM " S S\5      rN " S S\5      rO " S S\5      rPg)zQASM3 AST Nodes    )annotationsN)OptionalListUnionIterableTupleSequencec                      \ rS rSrSrSrSrg)ASTNode   z!Base abstract class for AST nodes N__name__
__module____qualname____firstlineno____doc__	__slots____static_attributes__r       J/home/james-whalen/.local/lib/python3.13/site-packages/qiskit/qasm3/ast.pyr   r      s
    +Ir   r   c                      \ rS rSrSrSrSrg)	Statement   z
statement
    : expressionStatement
    | assignmentStatement
    | classicalDeclarationStatement
    | branchingStatement
    | loopStatement
    | endStatement
    | aliasStatement
    | quantumStatement
r   Nr   r   r   r   r   r      s    
 Ir   r   c                  "    \ rS rSrSrSrS rSrg)Pragma-   zX
pragma
    : '#pragma' LBRACE statement* RBRACE  // match any valid openqasm statement
contentc                    Xl         g Nr   )selfr   s     r   __init__Pragma.__init__5   s    r   Nr   r   r   r   r   r   r#   r   r   r   r   r   r   -   s    
 Ir   r   c                  &    \ rS rSrSrSrSS jrSrg)
Annotation9   zAn annotation.	namespacepayloadc                    Xl         X l        g r!   r)   )r"   r*   r+   s      r   r#   Annotation.__init__>   s    "r   N)r*   strr+   r.   r%   r   r   r   r'   r'   9   s    (Ir   r'   c                  "    \ rS rSrSrSrS rSrg)CalibrationGrammarDeclarationC   zR
calibrationGrammarDeclaration
    : 'defcalgrammar' calibrationGrammar SEMICOLON
namec                    Xl         g r!   r2   )r"   r3   s     r   r#   &CalibrationGrammarDeclaration.__init__K       	r   Nr%   r   r   r   r0   r0   C   s    
 Ir   r0   c                  &    \ rS rSrSrSrSS jrSrg)ProgramO   z5
program
    : header (globalStatement | statement)*
header
statementsc                    Xl         X l        g r!   r:   )r"   r;   r<   s      r   r#   Program.__init__W   s    $r   Nr   r%   r   r   r   r8   r8   O   s    
 )I%r   r8   c                  "    \ rS rSrSrSrS rSrg)Header\   z 
header
    : version? include*
versionincludesc                    Xl         X l        g r!   rC   )r"   rD   rE   s      r   r#   Header.__init__d   s     r   )rE   rD   Nr%   r   r   r   rA   rA   \   s    
 (I!r   rA   c                  "    \ rS rSrSrSrS rSrg)Includei   z1
include
    : 'include' StringLiteral SEMICOLON
filenamec                    Xl         g r!   rK   )r"   rL   s     r   r#   Include.__init__q   s     r   Nr%   r   r   r   rI   rI   i   s    
 I!r   rI   c                  "    \ rS rSrSrSrS rSrg)Versionu   z:
version
    : 'OPENQASM'(Integer | RealNumber) SEMICOLON
version_numberc                    Xl         g r!   rR   )r"   rS   s     r   r#   Version.__init__}       ,r   Nr%   r   r   r   rP   rP   u   s    
 $I-r   rP   c                      \ rS rSrSrSrSrg)QuantumInstruction   z~
quantumInstruction
    : quantumGateCall
    | quantumPhase
    | quantumMeasurement
    | quantumReset
    | quantumBarrier
r   Nr   r   r   r   rX   rX      s     Ir   rX   c                      \ rS rSrSrSrSrg)ClassicalType   zYInformation about a classical type.  This is just an abstract base for inheritance tests.r   Nr   r   r   r   r[   r[      s
    cIr   r[   c                  ,    \ rS rSrSrSrSrSrSrSr	Sr
g	)
	FloatType   z5Allowed values for the width of floating-point types.       @         r   N)r   r   r   r   r   HALFSINGLEDOUBLEQUADOCTr   r   r   r   r^   r^      s    ?DFFD
Cr   r^   c                      \ rS rSrSrSrSrg)BoolType   zType information for a Boolean.r   Nr   r   r   r   rk   rk      s
    )Ir   rk   c                  *    \ rS rSrSrSrSSS jjrSrg)IntType   z&Type information for a signed integer.sizeNc                    Xl         g r!   rp   r"   rq   s     r   r#   IntType.__init__   r6   r   r!   rq   zOptional[int]r%   r   r   r   rn   rn      s    0I r   rn   c                  *    \ rS rSrSrSrSSS jjrSrg)UintType   z)Type information for an unsigned integer.rp   Nc                    Xl         g r!   rp   rs   s     r   r#   UintType.__init__   r6   r   r!   ru   r%   r   r   r   rw   rw      s    3I r   rw   c                      \ rS rSrSrSrSrg)BitType   z"Type information for a single bit.r   Nr   r   r   r   r|   r|      s
    ,Ir   r|   c                      \ rS rSrSrSrSrg)DurationType   z Type information for a duration.r   Nr   r   r   r   r   r      s
    *Ir   r   c                  &    \ rS rSrSrSrSS jrSrg)BitArrayType   z6Type information for a sized number of classical bits.rp   c                    Xl         g r!   rp   rs   s     r   r#   BitArrayType.__init__   r6   r   N)rq   intr%   r   r   r   r   r      s    @Ir   r   c                      \ rS rSrSrSrg)
Expression   r   N)r   r   r   r   r   r   r   r   r   r   r      s    Ir   r   c                      \ rS rSrSrS rSrg)StringifyAndPray   objc                    Xl         g r!   r   )r"   r   s     r   r#   StringifyAndPray.__init__   s    r   Nr   r   r   r   r   r#   r   r   r   r   r   r      s    I
r   r   c                  6    \ rS rSrSr   S     SS jjrSrg)Range   startstependNc                (    Xl         X0l        X l        g r!   r   )r"   r   r   r   s       r   r#   Range.__init__   s     
	r   )r   r   r   )NNN)r   Optional[Expression]r   r   r   r   r   r   r   r   r   r      s8    (I '+$(%)	# " #	 r   r   c                      \ rS rSrSrS rSrg)
Identifier   stringc                    Xl         g r!   r   )r"   r   s     r   r#   Identifier.__init__       r   Nr   r   r   r   r   r      s    Ir   r   c                  4   ^  \ rS rSrSrSrSU 4S jjrSrU =r$ )SubscriptedIdentifier   z&An identifier with subscripted access.)	subscriptc                0   > [         TU ]  U5        X l        g r!   )superr#   r   )r"   r   r   	__class__s      r   r#   SubscriptedIdentifier.__init__   s     "r   )r   r.   r   zUnion[Range, Expression]	r   r   r   r   r   r   r#   r   __classcell__r   s   @r   r   r      s    0I# #r   r   c                  ~    \ rS rSrSr\R                  " 5       r\R                  " 5       r\R                  " 5       r	Sr
g)Constant   z,A constant value defined by the QASM 3 spec.r   N)r   r   r   r   r   enumautoPIEULERTAUr   r   r   r   r   r      s&    6	BIIKE
))+Cr   r   c                      \ rS rSrSrS rSrg)IntegerLiteralrd   valuec                    Xl         g r!   r   r"   r   s     r   r#   IntegerLiteral.__init__      
r   Nr   r   r   r   r   r          Ir   r   c                      \ rS rSrSrS rSrg)FloatLiterali  r   c                    Xl         g r!   r   r   s     r   r#   FloatLiteral.__init__
  r   r   Nr   r   r   r   r   r     r   r   r   c                      \ rS rSrSrS rSrg)BooleanLiterali  r   c                    Xl         g r!   r   r   s     r   r#   BooleanLiteral.__init__  r   r   Nr   r   r   r   r   r     r   r   r   c                      \ rS rSrSrS rSrg)BitstringLiterali  r   widthc                    Xl         X l        g r!   r   )r"   r   r   s      r   r#   BitstringLiteral.__init__  s    

r   Nr   r   r   r   r   r     s    "Ir   r   c                  ,    \ rS rSrSrSrSrSrSrSr	Sr
g	)
DurationUniti  z'Valid values for the unit of durations.nsusmssdtr   N)r   r   r   r   r   
NANOSECONDMICROSECONDMILLISECONDSECONDSAMPLEr   r   r   r   r   r     s    1JKKFFr   r   c                  "    \ rS rSrSrSS jrSrg)DurationLiterali'  r   unitc                    Xl         X l        g r!   r   )r"   r   r   s      r   r#   DurationLiteral.__init__*  s    
	r   )r   r   N)r   floatr   r   r   r   r   r   r   r   '  s    !Ir   r   c                  L    \ rS rSrSr " S S\R                  5      rSS jrSr	g)Unaryi/  opoperandc                      \ rS rSrSrSrSrg)Unary.Opi2  !~r   N)r   r   r   r   	LOGIC_NOTBIT_NOTr   r   r   r   Opr   2  s    	r   r   c                    Xl         X l        g r!   r   )r"   r   r   s      r   r#   Unary.__init__6  s    r   N)r   r   r   r   
r   r   r   r   r   r   Enumr   r#   r   r   r   r   r   r   /  s    !ITYY r   r   c                  L    \ rS rSrSr " S S\R                  5      rSS jrSr	g)	Binaryi;  r   leftrightc                  X    \ rS rSrSrSrSrSrSrSr	Sr
S	rS
rSrSrSrSrSrSrSrSrSrg)	Binary.Opi>  &|^z&&z||<z<=>z>=z==z!=z<<z>>+-*/r   N)r   r   r   r   BIT_ANDBIT_ORBIT_XOR	LOGIC_ANDLOGIC_ORLESS
LESS_EQUALGREATERGREATER_EQUALEQUAL	NOT_EQUAL
SHIFT_LEFTSHIFT_RIGHTADDSUBMULDIVr   r   r   r   r   r   >  sW    	
	
r   r   c                (    Xl         X l        X0l        g r!   r   )r"   r   r   r   s       r   r#   Binary.__init__Q  s    	
r   )r   r   r   N)r   r   r   r   r   r   r   r   r   r   r   r   ;  s    'ITYY &r   r   c                  "    \ rS rSrSrSS jrSrg)CastiW  typer   c                    Xl         X l        g r!   r  )r"   r  r   s      r   r#   Cast.__init__Z  s    	r   )r   r  N)r  r[   r   r   r   r   r   r   r  r  W  s    #Ir   r  c                  "    \ rS rSrSrSS jrSrg)Indexi_  targetindexc                    Xl         X l        g r!   r  )r"   r  r  s      r   r#   Index.__init__b  s    
r   )r  r  N)r  r   r  r   r   r   r   r   r  r  _  s    #Ir   r  c                  &    \ rS rSrSrSrSS jrSrg)IndexSetig  zE
A literal index set of values::

    { Expression (, Expression)* }
valuesc                    Xl         g r!   r#  )r"   r$  s     r   r#   IndexSet.__init__p  r   r   N)r$  zList[Expression]r%   r   r   r   r"  r"  g  s     Ir   r"  c                  &    \ rS rSrSrSrSS jrSrg)QuantumMeasurementit  z8
quantumMeasurement
    : 'measure' indexIdentifierList
identifierListc                    Xl         g r!   r)  )r"   r*  s     r   r#   QuantumMeasurement.__init__|  rV   r   N)r*  List[Identifier]r%   r   r   r   r(  r(  t  s    
 $I-r   r(  c                  &    \ rS rSrSrSrSS jrSrg)QuantumMeasurementAssignmenti  z
quantumMeasurementAssignment
    : quantumMeasurement ARROW indexIdentifierList
    | indexIdentifier EQUALS quantumMeasurement  # eg: bits = measure qubits;

identifierquantumMeasurementc                    Xl         X l        g r!   r0  )r"   r1  r2  s      r   r#   %QuantumMeasurementAssignment.__init__  s    $"4r   N)r1  r   r2  r(  r%   r   r   r   r/  r/    s     5I5r   r/  c                  &    \ rS rSrSrSrSS jrSrg)
Designatori  z/
designator
    : LBRACKET expression RBRACKET

expressionc                    Xl         g r!   r7  r"   r8  s     r   r#   Designator.__init__      $r   N)r8  r   r%   r   r   r   r6  r6        
  I%r   r6  c                  *    \ rS rSrSrSrSSS jjrSrg)	ClassicalDeclarationi  zGDeclaration of a classical type, optionally initializing it to a value.r  r1  initializerNc                (    Xl         X l        X0l        g r!   r@  )r"   type_r1  rA  s       r   r#   ClassicalDeclaration.__init__  s    	$&r   )r1  rA  r  r!   )rC  r[   r1  r   r%   r   r   r   r?  r?    s    Q5I' 'r   r?  c                  *    \ rS rSrSrSrSSS jjrSrg)	StretchDeclarationi  zLDeclaration of a stretch variable, optionally with a lower bound
expression.r1  boundNc                    Xl         X l        g r!   rG  )r"   r1  rH  s      r   r#   StretchDeclaration.__init__      $
r   )rH  r1  r!   r1  r   r%   r   r   r   rF  rF    s     (I r   rF  c                  &    \ rS rSrSrSrSS jrSrg)AssignmentStatementi  z*Assignment of an expression to an l-value.lvaluervaluec                    Xl         X l        g r!   rO  )r"   rP  rQ  s      r   r#   AssignmentStatement.__init__  s    r   N)rP  r   rQ  r   r%   r   r   r   rN  rN    s    4$Ir   rN  c                  *    \ rS rSrSrSrSSS jjrSrg)	QuantumDeclarationi  zp
quantumDeclaration
    : 'qreg' Identifier designator? |   # NOT SUPPORTED
     'qubit' designator? Identifier
r1  
designatorNc                    Xl         X l        g r!   rV  )r"   r1  rW  s      r   r#   QuantumDeclaration.__init__  s    $$r   )rW  r1  r!   rL  r%   r   r   r   rU  rU    s     -I% %r   rU  c                  &    \ rS rSrSrSrSS jrSrg)AliasStatementi  zH
aliasStatement
    : 'let' Identifier EQUALS indexIdentifier SEMICOLON
r1  r   c                    Xl         X l        g r!   r\  )r"   r1  r   s      r   r#   AliasStatement.__init__  rK  r   N)r1  r   r   r   r%   r   r   r   r[  r[    s    
 (Ir   r[  c                      \ rS rSrSr\R                  " 5       r\R                  " 5       r\R                  " 5       r	\R                  " 5       r
Srg)QuantumGateModifierNamei  z4The names of the allowed modifiers of quantum gates.r   N)r   r   r   r   r   r   r   CTRLNEGCTRLINVPOWr   r   r   r   r`  r`    s1    >99;DiikG
))+C
))+Cr   r`  c                  *    \ rS rSrSrSrSSS jjrSrg)	QuantumGateModifieri  zVA modifier of a gate. For example, in ``ctrl @ x $0``, the ``ctrl @`` is the modifier.modifierargumentNc                    Xl         X l        g r!   rg  )r"   rh  ri  s      r   r#   QuantumGateModifier.__init__  s      r   )ri  rh  r!   )rh  r`  ri  r   r%   r   r   r   rf  rf    s    `(I! !r   rf  c                  <    \ rS rSrSrSr  S       SS jjrSrg)	QuantumGateCalli  zs
quantumGateCall
    : quantumGateModifier* quantumGateName ( LPAREN expressionList? RPAREN )? indexIdentifierList
quantumGateNameindexIdentifierList
parameters	modifiersc                4    Xl         X l        X0l        X@l        g r!   rn  )r"   ro  rp  rq  rr  s        r   r#   QuantumGateCall.__init__  s      /#6 $"r   )rp  rr  rq  ro  N)r   r   )ro  r   rp  r-  rq  Sequence[Expression]rr  zSequence[QuantumGateModifier]r%   r   r   r   rm  rm    sG    
 VI ,.35
##
# .
# )	
#
 1
# 
#r   rm  c                  >    \ rS rSrSrSr   S       SS jjrSrg)	DefcalCallStatementi  z9A quantum-like call that may have an assignment location.)identrq  qubitsrP  Nc                \    Xl         [        U5      U l        [        U5      U l        X@l        g r!   )rx  tuplerq  ry  rP  )r"   rx  rq  ry  rP  s        r   r#   DefcalCallStatement.__init__  s%     

+Fmr   )rx  rP  rq  ry  )r   r   N)rx  r   rq  ru  ry  ru  rP  Expression | Noner%   r   r   r   rw  rw    sE    C;I
 ,.')$(

 )
 %	

 "
 
r   rw  c                  &    \ rS rSrSrSrSS jrSrg)QuantumBarrieri  z4
quantumBarrier
    : 'barrier' indexIdentifierList
rp  c                    Xl         g r!   r  )r"   rp  s     r   r#   QuantumBarrier.__init__  s    #6 r   N)rp  r-  r%   r   r   r   r  r    s    
 )I7r   r  c                  &    \ rS rSrSrSrSS jrSrg)QuantumReseti  z#A built-in ``reset q0;`` statement.r1  c                    Xl         g r!   r  )r"   r1  s     r   r#   QuantumReset.__init__   r<  r   NrL  r%   r   r   r   r  r    s    -I%r   r  c                  &    \ rS rSrSrSrSS jrSrg)QuantumDelayi$  z-A built-in ``delay[duration] q0;`` statement.durationry  c                    Xl         X l        g r!   r  )r"   r  ry  s      r   r#   QuantumDelay.__init__)  s     r   N)r  r   ry  r-  r%   r   r   r   r  r  $  s    7&Ir   r  c                  &    \ rS rSrSrSrSS jrSrg)ProgramBlocki.  ze
programBlock
    : statement | controlDirective
    | LBRACE(statement | controlDirective) * RBRACE
r<   c                    Xl         g r!   r  )r"   r<   s     r   r#   ProgramBlock.__init__7  r<  r   N)r<   zList[Statement]r%   r   r   r   r  r  .  s      I%r   r  c                  &    \ rS rSrSrSrSS jrSrg)ReturnStatementi;  zP
returnStatement
    : 'return' ( expression | quantumMeasurement )? SEMICOLON;
r7  Nc                    Xl         g r!   r7  r:  s     r   r#   ReturnStatement.__init__C  r<  r   r!   r%   r   r   r   r  r  ;  r=  r   r  c                      \ rS rSrSrSrSrg)QuantumBlockiG  zF
quantumBlock
    : LBRACE ( quantumStatement | quantumLoop )* RBRACE
r   Nr   r   r   r   r  r  G      
 Ir   r  c                      \ rS rSrSrSrSrg)SubroutineBlockiP  zA
subroutineBlock
    : LBRACE statement* returnStatement? RBRACE
r   Nr   r   r   r   r  r  P  r  r   r  c                  6    \ rS rSrSrSr        SS jrSrg)QuantumGateDefinitioniY  zF
quantumGateDefinition
    : 'gate' quantumGateSignature quantumBlock
r3   paramsry  bodyc                4    Xl         X l        X0l        X@l        g r!   r  )r"   r3   r  ry  r  s        r   r#   QuantumGateDefinition.__init__a  s     		r   )r  r3   r  ry  N)r3   r   r  Tuple[Identifier, ...]ry  r  r  r  r%   r   r   r   r  r  Y  s9    
 5I

 '
 '	

 
r   r  c                  2    \ rS rSrSrSr S   SS jjrSrg)	SubroutineDefinitionin  zu
subroutineDefinition
    : 'def' Identifier LPAREN anyTypeArgumentList? RPAREN
    returnSignature? subroutineBlock
r1  	argumentssubroutineBlockc                (    Xl         X0l        X l        g r!   r  )r"   r1  r  r  s       r   r#   SubroutineDefinition.__init__w  s     %".r   )r  r1  r  Nr?   )r1  r   r  r  r%   r   r   r   r  r  n  s/     ?I 	// )/ /r   r  c                      \ rS rSrSrSrSrg)CalibrationArgumenti  zF
calibrationArgumentList
    : classicalArgumentList | expressionList
r   Nr   r   r   r   r  r    r  r   r  c                  6    \ rS rSrSrSr S     SS jjrSrg)	CalibrationDefinitioni  z
calibrationDefinition
    : 'defcal' Identifier
    ( LPAREN calibrationArgumentList? RPAREN )? identifierList
    returnSignature? LBRACE .*? RBRACE  // for now, match anything inside body
    ;
r3   r*  calibrationArgumentListc                (    Xl         X l        X0l        g r!   r  )r"   r3   r*  r  s       r   r#   CalibrationDefinition.__init__  s     	,'>$r   )r  r*  r3   Nr?   )r3   r   r*  r-  r  zSequence[CalibrationArgument]r%   r   r   r   r  r    s<     FI BD	?? )? "?	? ?r   r  c                  *    \ rS rSrSrSrSSS jjrSrg)	BranchingStatementi  ze
branchingStatement
    : 'if' LPAREN booleanExpression RPAREN programBlock ( 'else' programBlock )?
	condition	true_body
false_bodyNc                (    Xl         X l        X0l        g r!   r  )r"   r  r  r  s       r   r#   BranchingStatement.__init__  s    ""$r   )r  r  r  r!   )r  r   r  r  r%   r   r   r   r  r    s    
 9I% %r   r  c                  2    \ rS rSrSrSr      SS jrSrg)ForLoopStatementi  z
AST node for ``for`` loops.

::

    ForLoop: "for" Identifier "in" SetDeclaration ProgramBlock
    SetDeclaration:
        | Identifier
        | "{" Expression ("," Expression)* "}"
        | "[" Range "]"
indexset	parameterr  c                (    Xl         X l        X0l        g r!   r  )r"   r  r  r  s       r   r#   ForLoopStatement.__init__  s     !"	r   )r  r  r  N)r  z"Union[Identifier, IndexSet, Range]r  r   r  r  r%   r   r   r   r  r    s/    
 2I4  	r   r  c                  &    \ rS rSrSrSrSS jrSrg)WhileLoopStatementi  z[
AST node for ``while`` loops.

::

    WhileLoop: "while" "(" Expression ")" ProgramBlock
r  r  c                    Xl         X l        g r!   r  )r"   r  r  s      r   r#   WhileLoopStatement.__init__  s    "	r   )r  r  N)r  r   r  r  r%   r   r   r   r  r    s     &Ir   r  c                  8    \ rS rSrSrSr  S     SS jjrSrg)	BoxStatementi  z'Like ``box[duration] { statements* }``.)r   r  r  Nc                <    Xl         X l        [        U5      U l        g r!   )r  r  r{  r   )r"   r  r  r   s       r   r#   BoxStatement.__init__  s     	  -r   )r   r  r  )Nr   )r  r  r  r}  r   zSequence[Annotation]r%   r   r   r   r  r    s:    1 4I
 '+,.	.. $. *	. .r   r  c                      \ rS rSrSrSrSrg)BreakStatementi  zBAST node for ``break`` statements.  Has no associated information.r   Nr   r   r   r   r  r    s
    LIr   r  c                      \ rS rSrSrSrSrg)ContinueStatementi  zEAST node for ``continue`` statements.  Has no associated information.r   Nr   r   r   r   r  r    s
    OIr   r  c                  \    \ rS rSrSr\R                  " 5       r\R                  " 5       rSr	g)
IOModifieri  zIO Modifier objectr   N)
r   r   r   r   r   r   r   INPUTOUTPUTr   r   r   r   r  r    s    IIKEYY[Fr   r  c                  4   ^  \ rS rSrSrSrSU 4S jjrSrU =r$ )IODeclarationi  z A declaration of an IO variable.)rh  c                0   > [         TU ]  X#5        Xl        g r!   )r   r#   rh  )r"   rh  rC  r1  r   s       r   r#   IODeclaration.__init__  s    + r   )rh  r  rC  r[   r1  r   r   r   s   @r   r  r    s    *I! !r   r  c                      \ rS rSrSrSrSrg)DefaultCasei  zHAn object representing the `default` special label in switch statements.r   Nr   r   r   r   r  r    s
    RIr   r  c                  .    \ rS rSrSrSr    SS jrSrg)SwitchStatementPreviewi  zAST node for the proposed 'switch-case' extension to OpenQASM 3, before the syntax was
stabilized.  This corresponds to the :attr:`.ExperimentalFeatures.SWITCH_CASE_V1` logic.

The stabilized form of the syntax instead uses :class:`.SwitchStatement`.)r  casesc                j    Xl         U VVs/ s H  u  p4[        U5      U4PM     snnU l        g s  snnf r!   )r  r{  r  )r"   r  r  r$  cases        r   r#   SwitchStatementPreview.__init__  s-     @EFuV}d+F
Fs   /)r  r  N)r  r   r  3Iterable[Tuple[Iterable[Expression], ProgramBlock]]r%   r   r   r   r  r    s'    Q
 $IG G)\Gr   r  c                  6    \ rS rSrSrSr S     SS jjrSrg)	SwitchStatementi  zAST node for the stable 'switch' statement of OpenQASM 3.

The only real difference from an AST form is that the default is required to be separate; it
cannot be joined with other cases (even though that's meaningless, the V1 syntax permitted it).
)r  r  defaultNc                v    Xl         U VVs/ s H  u  pE[        U5      U4PM     snnU l        X0l        g s  snnf r!   )r  r{  r  r  )r"   r  r  r  r$  r  s         r   r#   SwitchStatement.__init__&  s5     @EFuV}d+F
 Gs   5)r  r  r  r!   )r  r   r  r  r  zOptional[ProgramBlock]r%   r   r   r   r  r    s:     /I +/	 C (	 r   r  )Qr   
__future__r   r   typingr   r   r   r   r   r	   r   r   r   r'   r0   r8   rA   rI   rP   rX   r[   r   r^   rk   rn   rw   r|   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r"  r(  r/  r6  r?  rF  rN  rU  r[  r`  rf  rm  rw  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r   r   <module>r     so    "  C C   	W 	 	I 	
%g 
%
!W 
!	!g 	!	-g 	-
 
G tyy } m } m = =  z J  #J #z499 Z : Z z 499 j 	J 	Z 8: J 
w 
	- 	-59 5	% 	%'9 ' ) % %
W 
dii !' !#( #*) $	7' 	7%% %% 
%7 
%	%g 	%< l I */9 /(' ?I ?,% %y 4  .9 .$Y 	  !( !* GY Gi r   