\globaldefs
yex.keyword.Globaldefs(*args, **kwargs)
#
Bases: yex.control.NumberParameter
Whether definitions should have global effect.
If this is negative, all changes to macro and variable definitions within a group will be lost when the group ends.
If it's positive, they will persist after the group ends.
If it's zero, they will be lost when the group ends unless they're preceded by \global.
This class makes the decision as to whether an assignment
is global; you should ask using its is_global property,
rather than attempting to work it out from value.
Source code in yex/keyword/parameter.py
70 71 72 73 | |
is_global
property
#
Whether an assignment in the document should be global.
See the class definition for the conditions.
lock_global()
#
Makes is_global True until unlock_global() is called.
This is used to implement \global.
Multiple calls to this method will need to be unlocked multiple times in order to return to the usual behaviour.
Source code in yex/keyword/parameter.py
89 90 91 92 93 94 95 96 97 98 99 100 | |
unlock_global(expecting_zero=False)
#
Undoes the effect of lock_global().
If that method hasn't been called, this is a no-op.
If that method has been called multiple times, then this method will have to be called at least as many times to return to the usual behaviour.
Args:
- expecting_zero (bool): if True, and
_overrideis not zero after the unlock, warn.
Source code in yex/keyword/parameter.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | |