+
     i  c                   sF    ^ RI t ^ RIHt ^ RIHt ^ RIHt  ! R R4      tR# )i    NAny)
MacroError)macro_variablesc                   s   a  ] tR t^t o RtV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR	 ltV 3R
 lR lt	V 3R lR lt
V 3R lR ltRtV tR# )Variablea  Something that the user passed into a macro function as parameter.

The value should already be parsed and validated, if const=True, according to the
argument_configs of a given Task.

Examples:
- const string "KEY_A" in `key(KEY_A)`
- non-const string "foo" in `repeat($foo, key(KEY_A))` (`value` is the name here)
- const Macro `key(a)` in `repeat(1, key(a))`
- const int 1 in `repeat(1, key(a))
c                s*   < V ^8  d   QhRS[ RS[RR/# )   valueconstreturnN)r   boolZformat__classdict__   "L/usr/lib/python3.14/site-packages/inputremapper/injection/macros/variable.py__annotate__Variable.__annotate__)   s"     * *c *$ *4 *    c                s    V'       g%   \        V\        4      '       g   \        R V 24      hWn        W n        V'       g   V P                  4        R# R# )z%Variables require a string name, not N)
isinstancestrr   r   r   validate_variable_name)selfr   r   s   &&&r   __init__ZVariable.__init__)   sB    Zs33DUGLMM

'') r   c                    < V ^8  d   QhRS[ /# r   r   r   r
   r   r   r   r   3   s      # r   c                s    V P                   # )z.If the variable is not const, return its name.)r   r      &r   get_nameZVariable.get_name3   s     zzr   c                r   r   r    r
   r   r   r   r   9   s     / /3 /r   c                s~    V P                   '       d   V P                  # \        P                  ! V P                  4      # )zAGet the variables value from the common variable storage process.)r   r   r   Zgetr   r   r   	get_valueZVariable.get_value9   s*    :::::""4::..r   c                s$   < V ^8  d   QhRS[ RR/# )r   r   r   Nr    r
   r   r   r   r   @   s     , ,s ,t ,r   c                s,    V\         V P                  &   R# )z*Set the variables value across all macros.N)r   r   )r   r      &&r   	set_valueZVariable.set_value@   s     ',

#r   c                s   < V ^8  d   QhRR/# )r   r   N r
   r   r   r   r   E   s     Q Q Qr   c                s    \        V P                  \        4      '       d(   \        P                  ! RV P                  4      '       g   \        RV P                   R2R7      hR# )a  Check if this is a legit variable name.

Because they could clash with language features. If the macro can be
parsed at all due to a problematic choice of a variable name.

Allowed examples: "foo", "Foo1234_", "_foo_1234"
Not allowed: "1_foo", "foo=blub", "$foo", "foo,1234", "foo()"
z^[A-Za-z_][A-Za-z_0-9]*$Z"z" is not a legit variable name)ZmsgN)r   r   r   reZmatchr   r   r   r   r   ZVariable.validate_variable_nameE   sN     $**c**"(('3
 3
 1TZZL0N!OPP3
r   c                r   r   r   r
   r   r   r   r   S   s     R R# Rr   c           
     sf    R V P                    RV P                   R\        \        V 4      4       R2# )z<Variable "z" const=z at Z>)r   r   ZhexZidr   r   r   __repr__ZVariable.__repr__S   s-    TZZLDRXqQQr   c                r   r   )r	   r
   r   r   r   r   V   s     G Gt Gr   c                s    \        V\        4      '       g   R # V P                  VP                  8H  ;'       d    V P                  VP                  8H  # )F)r   r   r   r   )r   Zotherr   r   __eq__ZVariable.__eq__V   s:    %**zzU[[(FFTZZ5;;-FFr   )r   r   N)Z__name__Z
__module__Z__qualname__Z__firstlineno__Z__doc__r   r   r   r   r   r!   r"   Z__static_attributes__Z__classdictcell__)r   s   @r   r   r      sV     
* * / /, ,
Q QR RG Gr   r   )r    Ztypingr   Z'inputremapper.configs.validation_errorsr   Z$inputremapper.injection.macros.macror   r   r   r   r   <module>r#      s   * 
  > @>G >Gr   