Parses a complement
         Complement ::= 'complement' '(' SuperRange ')'
337211
def _parse_complement(self, tokens):
        
        tokens.pop(0)  # Pop 'complement'
        tokens.pop(0)  # Pop '('
        res = self._parse_nested_interval(tokens)
        tokens.pop(0)  # Pop ')'
        res.switch_strand()
        return res
213395
def parse(self, val):
        
        s = str(val).lower()
        if s == "true":
            return True
        elif s == "false":
            return False
        else:
            raise ValueError("cannot interpret '{}' as boolean".format(val))
848637
def parse_pseudo_nth(self, sel, m, has_selector, iselector):
        """"""

        mdict = m.groupdict()
        if mdict.get('pseudo_nth_child'):
            postfix = '_child'
        else:
            postfix = '_type'
        mdict['name'] = util.lower(css_unescape(mdict['name']))
        content = util.lower(mdict.get('nth' + postfix))
        if content == 'even':
            # 2n
            s1 = 2
            s2 = 0
            var = True
        elif content == 'odd':
            # 2n+1
            s1 = 2
            s2 = 1
            var = True
        else:
            nth_parts = RE_NTH.match(content)
            s1 = '-' if nth_parts.group('s1') and nth_parts.group('s1') == '-' else ''
            a = nth_parts.group('a')
            var = a.endswith('n')
            if a.startswith('n'):
                s1 += '1'
            elif var:
                s1 += a[:-1]
            else:
                s1 += a
            s2 = '-' if nth_parts.group('s2') and nth_parts.group('s2') == '-' else ''
            if nth_parts.group('b'):
                s2 += nth_parts.group('b')
            else:
                s2 = '0'
            s1 = int(s1, 10)
            s2 = int(s2, 10)

        pseudo_sel = mdict['name']
        if postfix == '_child':
            if m.group('of'):
                # Parse the rest of `of S`.
                nth_sel = self.parse_selectors(iselector, m.end(0), FLG_PSEUDO | FLG_OPEN)
            else:
                # Use default `*|*` for `of S`.
                nth_sel = CSS_NTH_OF_S_DEFAULT
            if pseudo_sel == ':nth-child':
                sel.nth.append(ct.SelectorNth(s1, var, s2, False, False, nth_sel))
            elif pseudo_sel == ':nth-last-child':
                sel.nth.append(ct.SelectorNth(s1, var, s2, False, True, nth_sel))
        else:
            if pseudo_sel == ':nth-of-type':
                sel.nth.append(ct.SelectorNth(s1, var, s2, True, False, ct.SelectorList()))
            elif pseudo_sel == ':nth-last-of-type':
                sel.nth.append(ct.SelectorNth(s1, var, s2, True, True, ct.SelectorList()))
        has_selector = True
        return has_selector
756412
def try_parse_int(
        s: str,
        default: Optional[Any] = None,
        minimum: Optional[int] = None,
        maximum: Optional[int] = None) -> Optional[Any]:
    
    try:
        n = int(s)
    except ValueError:
        return default
    if (minimum is not None) and (n < minimum):
        return default
    elif (maximum is not None) and (n > maximum):
        return default
    return n
1272619
def parse_hyphen_range(self, value):
        
        values = value.strip().split('-')
        values = list(map(strip, values))
        if len(values) == 1:
            lower = upper = value.strip()
        elif len(values) == 2:
            lower, upper = values
            if lower == '':
                # Parse range such as '-3'
                upper = '-' + upper
                lower = upper
        else:
            if len(values) > 4:
                raise IntervalException(
                    'Unknown interval format given.'
                )
            values_copy = []
            for key, value in enumerate(values):
                if value != '':
                    try:
                        if values[key - 1] == '':
                            value = '-' + value
                    except IndexError:
                        pass
                    values_copy.append(value)
            lower, upper = values_copy

        return [lower, upper], True, True
333387
def complement(self, *args):
        '''
        '''
        universe = self.union()
        to_diff = self.union(*args)
        return universe.difference(to_diff)
688830
def parsecmap(self, fn):
        ''''''
        return self.bind(lambda res: Parser(lambda _, index: Value.success(index, fn(res))))
1095132
def parse_bool(v, default=None, exceptions: bool=True) -> bool:
    
    if isinstance(v, bool):
        return v
    s = str(v).lower()
    if s in TRUE_VALUES:
        return True
    elif s in FALSE_VALUES:
        return False
    else:
        if exceptions:
            raise ValidationError('Failed to parse boolean from "{}"'.format(v))
        return default
100960
def complement(self, other):
        

        s = SimVariableSet()
        s.register_variables = self.register_variables - other.register_variables
        s.register_variable_offsets = self.register_variable_offsets - other.register_variable_offsets
        s.memory_variables = self.memory_variables - other.memory_variables
        s.memory_variable_addresses = self.memory_variable_addresses - other.memory_variable_addresses

        return s
1008151
function parseComparator(comp, loose) {
  ;
  comp = replaceCarets(comp, loose);
  ;
  comp = replaceTildes(comp, loose);
  ;
  comp = replaceXRanges(comp, loose);
  ;
  comp = replaceStars(comp, loose);
  ;
  return comp;
}
1080015
def decode_complementarity(comp, control):

    '''
    
    '''

    try:
        res = regex.match(comp).groups()
    except:
        raise Exception("Unable to parse complementarity condition '{}'".format(comp))
    res = [r.strip() for r in res]
    if res[1] != control:
        msg = "Complementarity condition '{}' incorrect. Expected {} instead of {}.".format(comp, control, res[1])
        raise Exception(msg)
    return [res[0], res[2]]
217634
public RangeSet complement()
    {
        SortedSet<CharRange> nset = new TreeSet<CharRange>();
        int from = 0;
        for (CharRange r : set)
        {
            int to = r.getFrom();
            if (from < to)
            {
                nset.add(new CharRange(from, to));
            }
            from = r.getTo();
        }
        if (from < Integer.MAX_VALUE)
        {
            nset.add(new CharRange(from, Integer.MAX_VALUE));
        }
        return new RangeSet(nset);
    }
406110
def parse_range_params(params)
      params.split(';').inject({'q' => '1'}) do |m, p|
        k, v = p.split('=', 2)
        m[k.strip] = v.strip if v
        m
      end
    end
1104336
def _parse_nested_interval(self, tokens):
        
        if tokens[0].isdigit():
            return self._parse_interval(tokens)
        elif tokens[0] in ['join', 'order']:
            return self._parse_join(tokens)
        elif tokens[0] == 'complement':
            return self._parse_complement(tokens)
        raise ValueError('interval {} does not fit pattern.'.format(tokens))
263888
def _complement(d1,d2):
    '''
        
    '''
    u = _union(d1,d2)
    c = _diff(u,d1)
    return(c)
1232687
def parse_bool(s, default=False):
    
    if s is None:
        return default
    return TRUTH.get(s.lower(), default)
867455
def intranges_contain(int_, ranges):
    """"""
    tuple_ = _encode_range(int_, 0)
    pos = bisect.bisect_left(ranges, tuple_)
    # we could be immediately ahead of a tuple (start, end)
    # with start < int_ <= end
    if pos > 0:
        left, right = _decode_range(ranges[pos-1])
        if left <= int_ < right:
            return True
    # or we could be immediately behind a tuple (int_, end)
    if pos < len(ranges):
        left, _ = _decode_range(ranges[pos])
        if left == int_:
            return True
    return False